a lot of work on th map-creator

This commit is contained in:
2016-07-04 15:11:10 +02:00
parent 6243165084
commit 2935f468fc
61 changed files with 2612 additions and 3342 deletions

View File

@@ -4,7 +4,13 @@
#include <Indoor/floorplan/v2/Floorplan.h>
#include <Indoor/grid/Grid.h>
#include <Indoor/grid/factory/v2/GridFactory.h>
#include <Indoor/grid/factory/v2/Importance.h>
#include <QProgressDialog>
#include <QApplication>
#include <QVBoxLayout>
#include <QLabel>
#include <QProgressBar>
#include "MyNode.h"
@@ -15,7 +21,7 @@ class GridModel {
private:
int gridSize_cm = 40;
int gridSize_cm = 31;
Grid<MyNode> grid;
Floorplan::IndoorMap* im;
@@ -27,10 +33,60 @@ public:
Grid<MyNode>* getGrid() {return &grid;}
class Listener : public GridFactoryListener {
private:
QDialog dlg;
QLabel* lbl1;
QLabel* lbl2;
QProgressBar* bar1;
QProgressBar* bar2;
public:
Listener() {
QVBoxLayout* lay = new QVBoxLayout(&dlg);
lbl1 = new QLabel(); lay->addWidget(lbl1);
bar1 = new QProgressBar(); lay->addWidget(bar1);
lbl2 = new QLabel(); lay->addWidget(lbl2);
bar2 = new QProgressBar(); lay->addWidget(bar2);
dlg.resize(350, 120);
dlg.show();
}
~Listener() {
dlg.close();
}
void onGridBuildUpdateMajor(const std::string& what) override {
lbl1->setText(what.c_str());
QApplication::processEvents();
}
void onGridBuildUpdateMajor(const int cnt, const int cur) override {
bar1->setValue(cur*100/cnt);
QApplication::processEvents();
}
void onGridBuildUpdateMinor(const std::string& what) override {
lbl2->setText(what.c_str());
QApplication::processEvents();
}
void onGridBuildUpdateMinor(const int cnt, const int cur) override {
bar2->setValue(cur*100/cnt);
QApplication::processEvents();
}
};
void rebuild(Floorplan::IndoorMap* im) {
Listener l;
GridFactory<MyNode> fac(grid);
fac.build(im);
int i = 0;(void) i;
fac.build(im, true, &l);
Importance::addImportance(grid, 0);
//Importance::addImportance(grid, 400);
}
};