This commit is contained in:
toni
2017-03-10 14:41:04 +01:00
66 changed files with 1551 additions and 312 deletions

View File

@@ -15,6 +15,8 @@
#include "params/LayerParamWidget.h"
#include "params/ToolBoxWidget.h"
#include "params/ActionWidget.h"
#include "params/LayerTree.h"
#include "params/MetaEditWidget.h"
#include "tree/MapTreeModel.h"
@@ -27,12 +29,20 @@
MainController::MainController() {
// Floorplan::Meta* meta = new Floorplan::Meta();
// meta->setVal("a", "b");
// meta->setVal("c", "d");
// MetaEditWidget* mew = new MetaEditWidget(meta);
// mew->resize(300,300);
// mew->show();
mw = new MainWindow();
mw->resize(1000, 700);
MapView2D* mapView2D = mw->getMapView2D();
MapView3D* mapView3D = mw->getMapView3D();
QTreeView* layerTree = mw->getTree();
LayerTree* layerTree = mw->getTree();
// model setup
@@ -43,11 +53,11 @@ MainController::MainController() {
mapTreeModel = new MapTreeModel(mapModel);
layerTree->setModel(mapTreeModel);
ToolMoveMap* moveMap = new ToolMoveMap();
ToolRuler* ruler = new ToolRuler();
ToolMapZoom* mapZoom = new ToolMapZoom();
ToolMapGrid* mapGrid = new ToolMapGrid();
ToolSelector* mapSelector = new ToolSelector();
moveMap = new ToolMoveMap();
ruler = new ToolRuler();
mapZoom = new ToolMapZoom();
mapGrid = new ToolMapGrid();
mapSelector = new ToolSelector();
mapView2D->getTools().addBackground(mapGrid);
mapView2D->getTools().addBackground(moveMap);
@@ -58,7 +68,8 @@ MainController::MainController() {
//connect(layerTree, SIGNAL(activated(QModelIndex)), this, SLOT(layerSelected(QModelIndex)));
connect(layerTree->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(layerSelected(QModelIndex)));
//connect(layerTree->getTree()->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(layerSelected(QModelIndex)));
connect(layerTree, SIGNAL(layerSelected(QModelIndex)), this, SLOT(layerSelected(QModelIndex)));
connect(mapSelector, SIGNAL(onMapElementSelected(MapModelElement*)), this, SLOT(mapElementSelected(MapModelElement*)));
connect(mw->getMapView2D(), SIGNAL(onElementChange(MV2DElement*)), this, SLOT(curMapElementChanged()));
@@ -66,6 +77,7 @@ MainController::MainController() {
// model events
connect(mapModel, SIGNAL(aboutToReset()), this, SLOT(onMapModelAboutToReset()));
connect(mapModel, SIGNAL(reset()), this, SLOT(onMapModelReset()));
mapModel->addListener(this);
// load/save
connect(mw->getActionWidget(), SIGNAL(onLoad()), this, SLOT(onLoad()));
@@ -81,20 +93,18 @@ MainController::MainController() {
connect(mw, &MainWindow::onGridShowEdges, [&] (const bool show) {mw->getMapView3D()->getGridRenderer()->setShowEdges(show);} );
//mapModel->load("../IndoorMap/maps/SHL21.xml");
mapModel->load("../IndoorMap/maps/SHL26.xml");
//mapModel->load("../IndoorMap/maps/test.xml");
//mapModel->load("../IndoorMap/maps/APs.xml");
//mapModel->load("/home/toni/Documents/programme/localization/IPIN2016/competition/src/competition/map/CAR/CAR10.xml");
mapModel->load("/home/toni/Documents/programme/localization/IPIN2016/competition/src/competition/map/UAH/UAH12_rawObstacles.xml");
//mapModel->load("/home/toni/Documents/programme/localization/IPIN2016/competition/src/competition/map/SHL/SHL25.xml");
//mapModel->load("/home/toni/Documents/programme/localization/IPIN2016/competition/src/competition/map/UJI-UB/UJI-UB5.xml");
//mapModel->load("/home/toni/Documents/programme/localization/IPIN2016/competition/src/competition/map/UJI-TI/UJI-TI4.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/UJI-TI/UJI-TI4.xml");
//mapModel->load("/home/toni/Documents/programme/localization/IPIN2016/competition/src/competition/map/UJI-UB/UJI-UB5.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/IPIN2016/IPIN2016/competition/maps/test.xml");
//mapModel->startEmpty();
}
@@ -130,6 +140,10 @@ void MainController::onMapModelAboutToReset() {
mw->getMapView2D()->update();
}
void MainController::onMapModelNeedsRepaint() {
mw->getMapView2D()->update();
}
void MainController::onMapModelReset() {
mw->getTree()->expandAll();
}