added "new map" button
fixed minor model/logic issues
This commit is contained in:
@@ -181,8 +181,10 @@ private:
|
||||
// set the currently focused object (if any)
|
||||
focused = el;
|
||||
|
||||
// focus the new one (if any)
|
||||
if (focused) {focused->getMV2D()->focus();}
|
||||
// focus the new one (if any, and focus supported)
|
||||
if (focused && focused->getMV2D()) {
|
||||
focused->getMV2D()->focus();
|
||||
}
|
||||
|
||||
// update the help-text
|
||||
showHelp();
|
||||
|
||||
@@ -185,12 +185,21 @@ void MapView3D::showFloorplan() {
|
||||
}
|
||||
|
||||
void MapView3D::showGrid() {
|
||||
|
||||
// delete the previous grid (if any)
|
||||
if (gridModel) {delete gridModel; gridModel = nullptr;}
|
||||
|
||||
// build a new model
|
||||
GridModel* gm = new GridModel();
|
||||
Floorplan::IndoorMap* im = getModel()->getMap();
|
||||
gm->rebuild(im);
|
||||
|
||||
// remember
|
||||
this->gridModel = gm;
|
||||
|
||||
// update UI
|
||||
update();
|
||||
|
||||
}
|
||||
|
||||
void MapView3D::draw() {
|
||||
|
||||
@@ -21,7 +21,8 @@ class GridModel {
|
||||
|
||||
private:
|
||||
|
||||
int gridSize_cm = 20;
|
||||
int gridSize_cm = 30; // TODO
|
||||
|
||||
Grid<MyNode> grid;
|
||||
Floorplan::IndoorMap* im;
|
||||
|
||||
|
||||
@@ -53,10 +53,17 @@ public:
|
||||
|
||||
/** create a new, empty root node */
|
||||
void startEmpty() {
|
||||
|
||||
emit aboutToReset();
|
||||
cleanup();
|
||||
|
||||
im = new Floorplan::IndoorMap();
|
||||
root = new MMRoot(nullptr, im);
|
||||
root->addListener(this);
|
||||
//root->addSublayer(new MMFloors(root, im));
|
||||
|
||||
emit reset();
|
||||
|
||||
}
|
||||
|
||||
void cleanup() {
|
||||
|
||||
Reference in New Issue
Block a user