worked on elevators and lint
This commit is contained in:
@@ -164,7 +164,8 @@ HEADERS += MainWindow.h \
|
|||||||
mapview/2D/tools/ToolNewAccessPoint.h \
|
mapview/2D/tools/ToolNewAccessPoint.h \
|
||||||
mapview/2D/tools/ToolNewBeacon.h \
|
mapview/2D/tools/ToolNewBeacon.h \
|
||||||
mapview/2D/tools/ToolNewGroundTruth.h \
|
mapview/2D/tools/ToolNewGroundTruth.h \
|
||||||
mapview/2D/tools/ToolNewPOI.h
|
mapview/2D/tools/ToolNewPOI.h \
|
||||||
|
mapview/3D/MV3DElementElevator.h
|
||||||
|
|
||||||
|
|
||||||
FORMS += MainWindow.ui
|
FORMS += MainWindow.ui
|
||||||
|
|||||||
@@ -97,8 +97,13 @@ MainController::MainController() {
|
|||||||
|
|
||||||
//mapModel->load("../IndoorMap/maps/SHL36_noel.xml");
|
//mapModel->load("../IndoorMap/maps/SHL36_noel.xml");
|
||||||
//mapModel->load("../IndoorMap/maps/SHL38_no_elev.xml");
|
//mapModel->load("../IndoorMap/maps/SHL38_no_elev.xml");
|
||||||
//mapModel->load("/apps/android/workspace/testmap.xml");
|
//mapModel->load("/apps/testmap.xml");
|
||||||
mapModel->load("/mnt/data/workspaces/testmap.xml");
|
//mapModel->load("/apps/map24b.xml");
|
||||||
|
|
||||||
|
mapModel->load("/apps/SHL41.xml");
|
||||||
|
|
||||||
|
//mapModel->load("/apps/paper/diss/data/maps/map_elevator2.xml");
|
||||||
|
//mapModel->load("/apps/paper/diss/data/maps/map_issue6.xml");
|
||||||
|
|
||||||
//mapModel->resize(0.983, 0.983, 1, -0.2, -0.3, 0);
|
//mapModel->resize(0.983, 0.983, 1, -0.2, -0.3, 0);
|
||||||
|
|
||||||
@@ -113,7 +118,7 @@ MainController::MainController() {
|
|||||||
//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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,14 @@ class MV2DElementElevator : public MV2DElement, public HasMoveableNodes {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Floorplan::IndoorMap* map;
|
||||||
|
Floorplan::Floor* floor;
|
||||||
Floorplan::Elevator* elevator;
|
Floorplan::Elevator* elevator;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** ctor with the AP to render/edit */
|
/** ctor with the AP to render/edit */
|
||||||
MV2DElementElevator(Floorplan::Elevator* elevator) : elevator(elevator) {;}
|
MV2DElementElevator(Floorplan::IndoorMap* map, Floorplan::Floor* floor, Floorplan::Elevator* elevator) : map(map), floor(floor), elevator(elevator) {;}
|
||||||
|
|
||||||
|
|
||||||
BBox2 getBoundingBox() const override {
|
BBox2 getBoundingBox() const override {
|
||||||
@@ -47,6 +49,10 @@ public:
|
|||||||
|
|
||||||
// outline
|
// outline
|
||||||
QPen pen; pen.setWidth(2); pen.setColor(QColor(0,0,0));
|
QPen pen; pen.setWidth(2); pen.setColor(QColor(0,0,0));
|
||||||
|
|
||||||
|
if (!elevatorEndConnected(map, floor, elevator)) {pen.setColor(QColor(255,0,0));}
|
||||||
|
if (elevator->height_m == 0) {pen.setColor(QColor(255,0,0));}
|
||||||
|
|
||||||
p.setPenBrush(pen, Qt::NoBrush);
|
p.setPenBrush(pen, Qt::NoBrush);
|
||||||
//p.drawLine(poly.points[0], poly.points[1]);
|
//p.drawLine(poly.points[0], poly.points[1]);
|
||||||
p.drawLine(poly.points[1], poly.points[2]);
|
p.drawLine(poly.points[1], poly.points[2]);
|
||||||
@@ -67,6 +73,18 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** is the given elevator's end connected to ANY of the floorplan's floors? */
|
||||||
|
static inline bool elevatorEndConnected(const Floorplan::IndoorMap* map, const Floorplan::Floor* floor, const Floorplan::Elevator* e) {
|
||||||
|
const int elevatorEnd_cm = std::round( (floor->atHeight + e->height_m) * 100 );
|
||||||
|
std::vector<int> floorsAtHeight_cm;
|
||||||
|
for (const Floorplan::Floor* f : map->floors) {
|
||||||
|
const int height_cm = std::round(f->atHeight*100);
|
||||||
|
floorsAtHeight_cm.push_back(height_cm);
|
||||||
|
}
|
||||||
|
const bool connected = std::find(floorsAtHeight_cm.begin(), floorsAtHeight_cm.end(), elevatorEnd_cm) != floorsAtHeight_cm.end();
|
||||||
|
return connected;
|
||||||
|
}
|
||||||
|
|
||||||
virtual std::vector<MoveableNode> getMoveableNodes() const override {
|
virtual std::vector<MoveableNode> getMoveableNodes() const override {
|
||||||
return { MoveableNode(0, elevator->center) };
|
return { MoveableNode(0, elevator->center) };
|
||||||
}
|
}
|
||||||
|
|||||||
49
mapview/3D/MV3DElementElevator.h
Normal file
49
mapview/3D/MV3DElementElevator.h
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#ifndef MV3DELEMENTELEVATOR_H
|
||||||
|
#define MV3DELEMENTELEVATOR_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||||
|
#include <Indoor/math/Math.h>
|
||||||
|
|
||||||
|
#include "misc/Cube.h"
|
||||||
|
#include "MV3DElement.h"
|
||||||
|
//#include "misc/Plane.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class MV3DElementElevator : public MV3DElement {
|
||||||
|
|
||||||
|
Floorplan::Floor* f;
|
||||||
|
Floorplan::Elevator* e;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/** ctor */
|
||||||
|
MV3DElementElevator(Floorplan::Floor* f, Floorplan::Elevator* e) : f(f), e(e) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** repaint me */
|
||||||
|
void paintGL() override {
|
||||||
|
|
||||||
|
const Point3 pos(e->center.x, e->center.y, f->getStartingZ() + e->height_m/2);
|
||||||
|
const Point3 size(e->width/2, e->depth/2, e->height_m/2.0001); // z-fighting
|
||||||
|
const Point3 rot(0,0,e->rotation * 180 / M_PI);
|
||||||
|
|
||||||
|
// fill color
|
||||||
|
glColor3f(0.2, 0.2, 0.2);
|
||||||
|
|
||||||
|
// build
|
||||||
|
Cube cube(pos, size, rot);
|
||||||
|
cube.paintGL();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isTransparent() const override {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MV3DELEMENTELEVATOR_H
|
||||||
@@ -21,7 +21,7 @@ class GridModel {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int gridSize_cm = 20; // TODO
|
const int gridSize_cm = 40; // TODO
|
||||||
|
|
||||||
Grid<MyNode> grid;
|
Grid<MyNode> grid;
|
||||||
Floorplan::IndoorMap* im;
|
Floorplan::IndoorMap* im;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public:
|
|||||||
new MMFloorFingerprints(this, floor);
|
new MMFloorFingerprints(this, floor);
|
||||||
new MMFloorPOIs(this, floor);
|
new MMFloorPOIs(this, floor);
|
||||||
new MMFloorStairs(this, map, floor);
|
new MMFloorStairs(this, map, floor);
|
||||||
new MMFloorElevators(this, floor);
|
new MMFloorElevators(this, map, floor);
|
||||||
new MMFloorGroundTruthPoints(this, floor);
|
new MMFloorGroundTruthPoints(this, floor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include "IHasParams.h"
|
#include "IHasParams.h"
|
||||||
|
|
||||||
#include "../2D/MV2DElementElevator.h"
|
#include "../2D/MV2DElementElevator.h"
|
||||||
//#include "../3D/MV3DElementElevator.h" TODO
|
#include "../3D/MV3DElementElevator.h"
|
||||||
|
|
||||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||||
|
|
||||||
@@ -16,24 +16,25 @@ private:
|
|||||||
Floorplan::Floor* floor;
|
Floorplan::Floor* floor;
|
||||||
Floorplan::Elevator* elevator;
|
Floorplan::Elevator* elevator;
|
||||||
MV2DElementElevator mv2d;
|
MV2DElementElevator mv2d;
|
||||||
//MV3DElementElevator mv3d; TODO
|
MV3DElementElevator mv3d;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MMFloorElevator(MapLayer* parent, Floorplan::Floor* floor, Floorplan::Elevator* elevator) :
|
MMFloorElevator(MapLayer* parent, Floorplan::IndoorMap* map, Floorplan::Floor* floor, Floorplan::Elevator* elevator) :
|
||||||
MapModelElement(parent), floor(floor), elevator(elevator), mv2d(elevator) {
|
MapModelElement(parent), floor(floor), elevator(elevator), mv2d(map, floor, elevator), mv3d(floor, elevator) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int getNumParams() const override {
|
virtual int getNumParams() const override {
|
||||||
return 3;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Param getParamDesc(const int idx) const override {
|
virtual Param getParamDesc(const int idx) const override {
|
||||||
switch(idx) {
|
switch(idx) {
|
||||||
case 0: return Param("width", ParamType::FLOAT);
|
case 0: return Param("width", ParamType::FLOAT);
|
||||||
case 1: return Param("depth", ParamType::FLOAT);
|
case 1: return Param("depth", ParamType::FLOAT);
|
||||||
case 2: return Param("rotation", ParamType::FLOAT);
|
case 2: return Param("height", ParamType::FLOAT);
|
||||||
|
case 3: return Param("rotation", ParamType::FLOAT);
|
||||||
}
|
}
|
||||||
throw 1;
|
throw 1;
|
||||||
}
|
}
|
||||||
@@ -42,7 +43,8 @@ public:
|
|||||||
switch(idx) {
|
switch(idx) {
|
||||||
case 0: return elevator->width;
|
case 0: return elevator->width;
|
||||||
case 1: return elevator->depth;
|
case 1: return elevator->depth;
|
||||||
case 2: return (elevator->rotation * 180.0f / (float)M_PI);
|
case 2: return elevator->height_m;
|
||||||
|
case 3: return (elevator->rotation * 180.0f / (float)M_PI);
|
||||||
}
|
}
|
||||||
throw 1;
|
throw 1;
|
||||||
}
|
}
|
||||||
@@ -51,12 +53,13 @@ public:
|
|||||||
switch(idx) {
|
switch(idx) {
|
||||||
case 0: elevator->width = val.toFloat(); break;
|
case 0: elevator->width = val.toFloat(); break;
|
||||||
case 1: elevator->depth = val.toFloat(); break;
|
case 1: elevator->depth = val.toFloat(); break;
|
||||||
case 2: elevator->rotation = val.toFloat() / 180.0f * (float)M_PI; break;
|
case 2: elevator->height_m = val.toFloat(); break;
|
||||||
|
case 3: elevator->rotation = val.toFloat() / 180.0f * (float)M_PI; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||||
MV3DElement* getMV3D() const override {return nullptr;} // TODO
|
MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;}
|
||||||
|
|
||||||
void deleteMe() const override {
|
void deleteMe() const override {
|
||||||
parent->removeElement(this);
|
parent->removeElement(this);
|
||||||
|
|||||||
@@ -14,16 +14,17 @@ class MMFloorElevators : public MapLayer {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Floorplan::IndoorMap* map;
|
||||||
Floorplan::Floor* floor;
|
Floorplan::Floor* floor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** ctor with the underlying model */
|
/** ctor with the underlying model */
|
||||||
MMFloorElevators(MapLayer* parent, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR_ELEVATORS), floor(floor) {
|
MMFloorElevators(MapLayer* parent, Floorplan::IndoorMap* map, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR_ELEVATORS), map(map), floor(floor) {
|
||||||
|
|
||||||
// add all elevators
|
// add all elevators
|
||||||
for (Floorplan::Elevator* elevator : floor->elevators) {
|
for (Floorplan::Elevator* elevator : floor->elevators) {
|
||||||
addElement(new MMFloorElevator(this, floor, elevator));
|
addElement(new MMFloorElevator(this, map, floor, elevator));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -37,7 +38,7 @@ public:
|
|||||||
floor->elevators.push_back(elevator);
|
floor->elevators.push_back(elevator);
|
||||||
|
|
||||||
// add to myself as element
|
// add to myself as element
|
||||||
MMFloorElevator* mm = new MMFloorElevator(this, floor, elevator);
|
MMFloorElevator* mm = new MMFloorElevator(this, map, floor, elevator);
|
||||||
addElement(mm);
|
addElement(mm);
|
||||||
return mm;
|
return mm;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user