diff --git a/IndoorMap.pro b/IndoorMap.pro index dcae3b4..47929a3 100644 --- a/IndoorMap.pro +++ b/IndoorMap.pro @@ -28,7 +28,6 @@ SOURCES += \ MainController.cpp \ mapview/2D/tools/ToolSelector.cpp \ mapview/2D/tools/Tool.cpp \ - mapview/MapView2D.cpp \ params/ElementParamWidget.cpp \ params/LayerParamWidget.cpp \ params/ActionWidget.cpp \ @@ -41,7 +40,9 @@ SOURCES += \ params/LayerTree.cpp \ mapview/2D/tools/ToolMeasure.cpp \ params/MetaEditWidget.cpp \ - params/MetaEditModel.cpp + params/MetaEditModel.cpp \ + mapview/2D/MapView2D.cpp \ + misc/LINTView.cpp HEADERS += MainWindow.h \ @@ -147,7 +148,8 @@ HEADERS += MainWindow.h \ mapview/3D/MV3DElementFingerprintLocation.h \ mapview/model/MMFloorGroundTruthPoints.h \ mapview/model/MMFloorGroundTruthPoint.h \ - mapview/2D/MV2DElementGroundTruthPoint.h + mapview/2D/MV2DElementGroundTruthPoint.h \ + misc/LINTView.h FORMS += MainWindow.ui diff --git a/MainController.cpp b/MainController.cpp index f33052c..b06e0b1 100644 --- a/MainController.cpp +++ b/MainController.cpp @@ -4,6 +4,7 @@ #include "mapview/model/MapModel.h" #include "mapview/model/MapModelElement.h" +#include "misc/LINTView.h" #include "mapview/2D/tools/ToolSelector.h" #include "mapview/2D/tools/ToolMoveMap.h" @@ -94,7 +95,7 @@ MainController::MainController() { connect(mw, &MainWindow::onGridShowEdges, [&] (const bool show) {mw->getMapView3D()->getGridRenderer()->setShowEdges(show);} ); - mapModel->load("../IndoorMap/maps/SHL33a.xml"); + mapModel->load("../IndoorMap/maps/SHL35.xml"); //mapModel->resize(0.983, 0.983, 1, -0.2, -0.3, 0); @@ -116,11 +117,13 @@ void MainController::onLayerChanged(MapLayer* layer) { (void) layer; mw->getMapView2D()->update(); mw->getMapView3D()->update(); + mw->getLINT()->update(mapModel->getMap()); } void MainController::onLayerElementAdded(MapLayer* layer, MapModelElement* elem) { (void) layer; mapSelector->focus(mw->getMapView2D(), elem); + mw->getLINT()->update(mapModel->getMap()); } void MainController::onLayerElementRemoved(MapLayer* layer, const MapModelElement* elem) { @@ -149,13 +152,16 @@ void MainController::layerSelected(QModelIndex idx) { mw->getMapView3D()->layerChange(); mw->getLayerParamWidget()->setElement(ml); mw->getToolBoxWidget()->setSelectedLayer(ml); + mw->getLINT()->update(mapModel->getMap()); } void MainController::curMapElementChanged() { mw->getElementParamWidget()->refresh(); + mw->getLINT()->update(mapModel->getMap()); } void MainController::mapElementSelected(MapModelElement* el) { mw->getElementParamWidget()->setElement(el); + mw->getLINT()->update(mapModel->getMap()); } void MainController::onMapModelAboutToReset() { @@ -166,16 +172,19 @@ void MainController::onMapModelAboutToReset() { void MainController::onMapModelNeedsRepaint() { mw->getMapView2D()->update(); + mw->getLINT()->update(mapModel->getMap()); } void MainController::onMapModelReset() { mw->getTree()->expandAll(); + mw->getLINT()->update(mapModel->getMap()); } void MainController::onLoad() { QString file = QFileDialog::getOpenFileName(mw, "open a map"); if (file != "") { mapModel->load(file.toStdString()); + mw->getLINT()->update(mapModel->getMap()); } } diff --git a/MainWindow.cpp b/MainWindow.cpp index 6a6ce45..5b2a8f1 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -4,6 +4,8 @@ #include #include +#include "misc/LINTView.h" + #include "mapview/2D/MapView2D.h" #include "mapview/model/MMFloorObstacleLine.h" @@ -49,6 +51,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi mapView2D = new MapView2D(); mapView3D = new MapView3D(); + lintView = new LINTView(); elementParamWidget = new ElementParamWidget(); layerParamWidget = new LayerParamWidget(); @@ -90,6 +93,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi setCentralWidget(splitter); splitter->addWidget(mapView2D); splitter->addWidget(mapView3D); + splitter->addWidget(lintView); // // 2D View // QDockWidget* mapView2DDoc = new QDockWidget("2D", this); mapView2DDoc->setWidget(mapView2D); diff --git a/MainWindow.h b/MainWindow.h index 6800b19..f69e8c5 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -13,6 +13,7 @@ class LayerParamWidget; class ActionWidget; class ToolBoxWidget; class LayerTree; +class LINTView; namespace Ui { class MainWindow; @@ -28,6 +29,7 @@ public: MapView2D* getMapView2D() {return mapView2D;} MapView3D* getMapView3D() {return mapView3D;} + LINTView* getLINT() {return lintView;} ElementParamWidget* getElementParamWidget() {return elementParamWidget;} LayerParamWidget* getLayerParamWidget() {return layerParamWidget;} @@ -47,6 +49,7 @@ signals: private: Ui::MainWindow *ui; LayerTree* layerTree; + LINTView* lintView; MapView2D* mapView2D; MapView3D* mapView3D; ElementParamWidget* elementParamWidget; diff --git a/mapview/2D/MV2DElementStair.h b/mapview/2D/MV2DElementStair.h index 2dc2962..c2febb0 100644 --- a/mapview/2D/MV2DElementStair.h +++ b/mapview/2D/MV2DElementStair.h @@ -113,17 +113,21 @@ public: pen.setColor(QColor(255,0,0)); p.setPen(pen); - // LINT + // LINT disconnected start if (i == 0) { if (quad.p1.z != floor->getStartingZ()) { p.drawLine(quad.p1, quad.p2); } - } else if (i == (int) parts.size() - 1) { + } + + // LINT disconnected end + if (i == (int) parts.size() - 1) { if (quad.p3.z != floor->getEndingZ()) { p.drawLine(quad.p3, quad.p4); } } + // LINT disconnected within if (i > 0) { if (quads[i-1].p4.z != quads[i-0].p1.z) { p.drawLine(quad.p1, quad.p2); diff --git a/mapview/MapView2D.cpp b/mapview/2D/MapView2D.cpp similarity index 100% rename from mapview/MapView2D.cpp rename to mapview/2D/MapView2D.cpp diff --git a/mapview/model/MapModel.h b/mapview/model/MapModel.h index fc0e3c4..e056eb1 100644 --- a/mapview/model/MapModel.h +++ b/mapview/model/MapModel.h @@ -73,6 +73,7 @@ public: // load the indoor-map using the given XML-file im = Floorplan::Reader::readFromFile(file); + Floorplan::LINT::assertOK(im); root = new MMRoot(nullptr, im); root->addListener(this); diff --git a/misc/LINTView.cpp b/misc/LINTView.cpp new file mode 100644 index 0000000..0af598f --- /dev/null +++ b/misc/LINTView.cpp @@ -0,0 +1,25 @@ +#include "LINTView.h" + +#include +#include + +LINTView::LINTView() { + + mdl = new QStringListModel(); + setModel(mdl); + +} + +void LINTView::update(Floorplan::IndoorMap* map) { + + QStringList lst; + + Floorplan::LINT::Issues issues = Floorplan::LINT::check(map); + for (const Floorplan::LINT::Issue& i : issues) { + QString str(i.asString().c_str()); + lst.append(str); + } + + mdl->setStringList(lst); + +} diff --git a/misc/LINTView.h b/misc/LINTView.h new file mode 100644 index 0000000..ec2e733 --- /dev/null +++ b/misc/LINTView.h @@ -0,0 +1,24 @@ +#ifndef LINTVIEW_H +#define LINTVIEW_H + +#include +class QStringListModel; +#include + +class LINTView : public QListView { + +private: + + QStringListModel* mdl; + +public: + + LINTView(); + +public: + + void update(Floorplan::IndoorMap* map); + +}; + +#endif // LINTVIEW_H