added first version of LINT to the editor

fixed issue with incorrect stairs
This commit is contained in:
2017-03-20 14:45:11 +01:00
parent 7ac8e7bac2
commit e774a66f34
9 changed files with 78 additions and 6 deletions

View File

@@ -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

View File

@@ -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());
}
}

View File

@@ -4,6 +4,8 @@
#include <QGraphicsScene>
#include <QStatusBar>
#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);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

25
misc/LINTView.cpp Normal file
View File

@@ -0,0 +1,25 @@
#include "LINTView.h"
#include <QStringListModel>
#include <Indoor/floorplan/v2/FloorplanLINT.h>
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);
}

24
misc/LINTView.h Normal file
View File

@@ -0,0 +1,24 @@
#ifndef LINTVIEW_H
#define LINTVIEW_H
#include <QListView>
class QStringListModel;
#include <Indoor/floorplan/v2/Floorplan.h>
class LINTView : public QListView {
private:
QStringListModel* mdl;
public:
LINTView();
public:
void update(Floorplan::IndoorMap* map);
};
#endif // LINTVIEW_H