resolved some errors caused by a bad merge and new datatypes from indoor

This commit is contained in:
toni
2017-03-10 15:25:32 +01:00
parent 3d9d2a7529
commit 87d57ef134
4 changed files with 80 additions and 65 deletions

View File

@@ -22,12 +22,12 @@ INCLUDEPATH += \
SOURCES += \ SOURCES += \
lib/gpc/gpc.cpp \ lib/gpc/gpc.cpp \
main.cpp \ main.cpp \
MainWindow.cpp \ MainWindow.cpp \
MainController.cpp \ MainController.cpp \
mapview/2D/tools/ToolSelector.cpp \ mapview/2D/tools/ToolSelector.cpp \
mapview/2D/tools/Tool.cpp \ mapview/2D/tools/Tool.cpp \
mapview/MapView2D.cpp \ mapview/MapView2D.cpp \
params/ElementParamWidget.cpp \ params/ElementParamWidget.cpp \
params/LayerParamWidget.cpp \ params/LayerParamWidget.cpp \
@@ -35,7 +35,7 @@ SOURCES += \
params/ToolBox.cpp \ params/ToolBox.cpp \
mapview/model/MapModel.cpp \ mapview/model/MapModel.cpp \
tree/MapTreeModel.cpp \ tree/MapTreeModel.cpp \
mapview/3D/MapView3D.cpp \ mapview/3D/MapView3D.cpp \
params/StairBuilder.cpp \ params/StairBuilder.cpp \
mapview/2D/tools/Tools.cpp \ mapview/2D/tools/Tools.cpp \
params/LayerTree.cpp \ params/LayerTree.cpp \
@@ -62,24 +62,24 @@ HEADERS += MainWindow.h \
mapview/model/IHasName.h \ mapview/model/IHasName.h \
mapview/model/IHasObstacleType.h \ mapview/model/IHasObstacleType.h \
mapview/model/IHasPosition3D.h \ mapview/model/IHasPosition3D.h \
mapview/2D/MV2DElementFloorObstacleLine.h \ mapview/2D/MV2DElementFloorObstacleLine.h \
mapview/2D/MV2DElement.h \ mapview/2D/MV2DElement.h \
mapview/2D/MV2DElementFloorOutlinePolygon.h \ mapview/2D/MV2DElementFloorOutlinePolygon.h \
mapview/2D/MV2DElementBeacon.h \ mapview/2D/MV2DElementBeacon.h \
mapview/2D/MV2DElementAccessPoint.h \ mapview/2D/MV2DElementAccessPoint.h \
mapview/2D/MV2DElementFloorObstacleCircle.h \ mapview/2D/MV2DElementFloorObstacleCircle.h \
mapview/2D/MV2DElementFloorObstacleDoor.h \ mapview/2D/MV2DElementFloorObstacleDoor.h \
mapview/2D/MapViewElementHelper.h \ mapview/2D/MapViewElementHelper.h \
mapview/2D/MV2DElementFloorUnderlay.h \ mapview/2D/MV2DElementFloorUnderlay.h \
mapview/2D/MV2DElementPOI.h \ mapview/2D/MV2DElementPOI.h \
mapview/2D/MV2DElementStair.h \ mapview/2D/MV2DElementStair.h \
mapview/2D/tools/ToolMoveMap.h \ mapview/2D/tools/ToolMoveMap.h \
mapview/2D/tools/Tools.h \ mapview/2D/tools/Tools.h \
mapview/2D/tools/ToolRuler.h \ mapview/2D/tools/ToolRuler.h \
mapview/2D/tools/ToolMapZoom.h \ mapview/2D/tools/ToolMapZoom.h \
mapview/2D/tools/ToolSelector.h \ mapview/2D/tools/ToolSelector.h \
mapview/2D/tools/ToolMapGrid.h \ mapview/2D/tools/ToolMapGrid.h \
mapview/2D/tools/Tool.h \ mapview/2D/tools/Tool.h \
mapview/model/MMFloorObstacleCircle.h \ mapview/model/MMFloorObstacleCircle.h \
mapview/model/MMFloorObstacleLine.h \ mapview/model/MMFloorObstacleLine.h \
mapview/model/MMFloorOutlinePolygon.h \ mapview/model/MMFloorOutlinePolygon.h \
@@ -109,7 +109,7 @@ HEADERS += MainWindow.h \
mapview/3D/misc/Polygon.h \ mapview/3D/misc/Polygon.h \
mapview/grid/MapView3DGrid.h \ mapview/grid/MapView3DGrid.h \
mapview/grid/MapModelGrid.h \ mapview/grid/MapModelGrid.h \
mapview/3DGrid/GridModel.h \ mapview/3DGrid/GridModel.h \
mapview/3DGrid/GridRenderer.h \ mapview/3DGrid/GridRenderer.h \
mapview/3DGrid/MyNode.h \ mapview/3DGrid/MyNode.h \
mapview/3D/MV3DElementStair.h \ mapview/3D/MV3DElementStair.h \
@@ -126,8 +126,8 @@ HEADERS += MainWindow.h \
mapview/3D/misc/Plane.h \ mapview/3D/misc/Plane.h \
mapview/elements/HasMoveableNodes.h \ mapview/elements/HasMoveableNodes.h \
mapview/2D/MapView2D.h \ mapview/2D/MapView2D.h \
mapview/2D/Painter.h \ mapview/2D/Painter.h \
mapview/2D/Scaler.h \ mapview/2D/Scaler.h \
mapview/2D/MV2DElementElevator.h \ mapview/2D/MV2DElementElevator.h \
mapview/model/MMFloorElevators.h \ mapview/model/MMFloorElevators.h \
mapview/model/MMFloorElevator.h \ mapview/model/MMFloorElevator.h \
@@ -140,7 +140,7 @@ HEADERS += MainWindow.h \
params/MetaEditModel.h \ params/MetaEditModel.h \
mapview/model/MapLayerListener.h \ mapview/model/MapLayerListener.h \
mapview/model/MapModelListener.h \ mapview/model/MapModelListener.h \
mapview/model/MMFloorOutlinePolygonCombined.h\ mapview/model/MMFloorOutlinePolygonCombined.h \
mapview/model/MMFloorGroundTruthPoints.h \ mapview/model/MMFloorGroundTruthPoints.h \
mapview/model/MMFloorGroundTruthPoint.h \ mapview/model/MMFloorGroundTruthPoint.h \
mapview/2D/MV2DElementGroundTruthPoint.h mapview/2D/MV2DElementGroundTruthPoint.h

View File

@@ -93,76 +93,91 @@ MainController::MainController() {
connect(mw, &MainWindow::onGridShowEdges, [&] (const bool show) {mw->getMapView3D()->getGridRenderer()->setShowEdges(show);} ); connect(mw, &MainWindow::onGridShowEdges, [&] (const bool show) {mw->getMapView3D()->getGridRenderer()->setShowEdges(show);} );
mapModel->load("../IndoorMap/maps/SHL26.xml"); //mapModel->load("../IndoorMap/maps/SHL26.xml");
//mapModel->load("../IndoorMap/maps/test.xml"); //mapModel->load("../IndoorMap/maps/test.xml");
//mapModel->load("../IndoorMap/maps/APs.xml"); //mapModel->load("../IndoorMap/maps/APs.xml");
//mapModel->load("/mnt/data/workspaces/IPIN2016/IPIN2016/competition/maps/CAR/CAR9.xml"); //mapModel->load("/mnt/data/workspaces/IPIN2016/IPIN2016/competition/maps/CAR/CAR9.xml");
mapModel->load("/mnt/data/workspaces/IPIN2016/IPIN2016/competition/maps/UAH/UAH9.xml"); //mapModel->load("/mnt/data/workspaces/IPIN2016/IPIN2016/competition/maps/UAH/UAH9.xml");
//mapModel->load("/mnt/data/workspaces/IPIN2016/IPIN2016/competition/maps/UJI-TI/UJI-TI4.xml"); //mapModel->load("/mnt/data/workspaces/IPIN2016/IPIN2016/competition/maps/UJI-TI/UJI-TI4.xml");
//mapModel->load("/mnt/data/workspaces/IPIN2016/IPIN2016/competition/maps/UJI-UB/UJI-UB4.xml"); //mapModel->load("/mnt/data/workspaces/IPIN2016/IPIN2016/competition/maps/UJI-UB/UJI-UB4.xml");
//mapModel->load("/mnt/data/workspaces/Indoor/tests/data/WalkHeadingMap.xml"); //mapModel->load("/mnt/data/workspaces/Indoor/tests/data/WalkHeadingMap.xml");
//mapModel->load("/mnt/data/workspaces/IPIN2016/IPIN2016/competition/maps/test.xml"); //mapModel->load("/mnt/data/workspaces/IPIN2016/IPIN2016/competition/maps/test.xml");
//mapModel->startEmpty(); mapModel->startEmpty();
} }
void MainController::onLayerChanged(MapLayer* layer) {
(void) layer;
mw->getMapView2D()->update();
mw->getMapView3D()->update();
}
void MainController::onLayerElementAdded(MapLayer* layer, MapModelElement* elem) {
(void) layer;
mapSelector->focus(mw->getMapView2D(), elem);
}
void MainController::onLayerElementRemoved(MapLayer* layer, const MapModelElement* elem) {
(void) layer;
(void) elem;
}
void MainController::onLayerVisibilityChanged(MapLayer *layer, const bool visible) {
(void) layer;
(void) visible;
}
void MainController::onShow3DFloorplan() { void MainController::onShow3DFloorplan() {
mw->getMapView3D()->showFloorplan(); mw->getMapView3D()->showFloorplan();
} }
void MainController::onShow3DGrid() { void MainController::onShow3DGrid() {
mw->getMapView3D()->showGrid(); mw->getMapView3D()->showGrid();
} }
void MainController::layerSelected(QModelIndex idx) { void MainController::layerSelected(QModelIndex idx) {
mw->getMapView2D()->layerChange(); mw->getMapView2D()->layerChange();
MapLayer* ml = static_cast<MapLayer*>(idx.internalPointer()); MapLayer* ml = static_cast<MapLayer*>(idx.internalPointer());
mapModel->setSelectedLayer(ml); mapModel->setSelectedLayer(ml);
mw->getMapView2D()->layerChange(); mw->getMapView2D()->layerChange();
mw->getMapView3D()->layerChange(); mw->getMapView3D()->layerChange();
mw->getLayerParamWidget()->setElement(ml); mw->getLayerParamWidget()->setElement(ml);
mw->getToolBoxWidget()->setSelectedLayer(ml); mw->getToolBoxWidget()->setSelectedLayer(ml);
} }
void MainController::curMapElementChanged() { void MainController::curMapElementChanged() {
mw->getElementParamWidget()->refresh(); mw->getElementParamWidget()->refresh();
} }
void MainController::mapElementSelected(MapModelElement* el) { void MainController::mapElementSelected(MapModelElement* el) {
mw->getElementParamWidget()->setElement(el); mw->getElementParamWidget()->setElement(el);
} }
void MainController::onMapModelAboutToReset() { void MainController::onMapModelAboutToReset() {
mw->getLayerParamWidget()->setElement(nullptr); mw->getLayerParamWidget()->setElement(nullptr);
mw->getToolBoxWidget()->setSelectedLayer(nullptr); mw->getToolBoxWidget()->setSelectedLayer(nullptr);
mw->getMapView2D()->update(); mw->getMapView2D()->update();
} }
void MainController::onMapModelNeedsRepaint() { void MainController::onMapModelNeedsRepaint() {
mw->getMapView2D()->update(); mw->getMapView2D()->update();
} }
void MainController::onMapModelReset() { void MainController::onMapModelReset() {
mw->getTree()->expandAll(); mw->getTree()->expandAll();
} }
void MainController::onLoad() { void MainController::onLoad() {
QString file = QFileDialog::getOpenFileName(mw, "open a map");
QString file = QFileDialog::getOpenFileName(mw, "open a map"); if (file != "") {
if (file != "") { mapModel->load(file.toStdString());
mapModel->load(file.toStdString()); }
}
} }
void MainController::onSave() { void MainController::onSave() {
QString file = QFileDialog::getSaveFileName(mw, "save the map");
QString file = QFileDialog::getSaveFileName(mw, "save the map"); if (file != "") {
if (file != "") { mapModel->save(file.toStdString());
mapModel->save(file.toStdString()); }
}
} }

View File

@@ -30,8 +30,8 @@ public:
} }
/** get the element's minimal distance (nearest whatsoever) to the given point */ /** get the element's minimal distance (nearest whatsoever) to the given point */
float getMinDistanceXY(const Point2 p) const override { ClickDist getMinDistanceXY(const Point2 p) const override {
return p.getDistance(gtp->pos); return ClickDist(p.getDistance(gtp->pos), ClickDistType::DIRECT);
} }
/** repaint me */ /** repaint me */

View File

@@ -20,7 +20,7 @@ public:
// the POIs // the POIs
for (Floorplan::GroundTruthPoint* gtp : floor->gtpoints) { for (Floorplan::GroundTruthPoint* gtp : floor->gtpoints) {
elements.push_back(new MMFloorGroundTruthPoint(this, floor, gtp)); addElement(new MMFloorGroundTruthPoint(this, floor, gtp));
} }
} }
@@ -35,7 +35,7 @@ public:
floor->gtpoints.push_back(gtp); floor->gtpoints.push_back(gtp);
// add to myself as element // add to myself as element
elements.push_back(new MMFloorGroundTruthPoint(this, floor, gtp)); addElement(new MMFloorGroundTruthPoint(this, floor, gtp));
} }