adjusted some models due to indoor changes

This commit is contained in:
k-a-z-u
2017-07-27 18:41:48 +02:00
parent b0c152c5dc
commit 6f06984c4e
5 changed files with 25 additions and 10 deletions

View File

@@ -7,11 +7,24 @@
#include "MapViewElementHelper.h"
#include <Indoor/floorplan/v2/Floorplan.h>
/** is the given stair's end connected to ANY of the floorplan's floors? */
static inline bool stairEndConnected(const Floorplan::IndoorMap* map, const Floorplan::Floor* floor, const Floorplan::Stair* stair) {
const int stairEnd_cm = std::round( (floor->atHeight + stair->getParts().back().end.z) * 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(), stairEnd_cm) != floorsAtHeight_cm.end();
return connected;
}
class MV2DElementStair : public MV2DElement, public HasMoveableNodes {
private:
bool sel = false;
Floorplan::IndoorMap* map;
Floorplan::Floor* floor;
Floorplan::Stair* stair;
//int selPart = -1;
@@ -19,8 +32,8 @@ private:
public:
/** ctor with the AP to render/edit */
MV2DElementStair(Floorplan::Floor* floor, Floorplan::Stair* stair) : floor(floor), stair(stair) {;}
/** ctor with the stair to render/edit */
MV2DElementStair(Floorplan::IndoorMap* map, Floorplan::Floor* floor, Floorplan::Stair* stair) : map(map), floor(floor), stair(stair) {;}
/** get the element's 3D bounding box */
@@ -116,7 +129,8 @@ public:
// LINT disconnected end
if (i == (int) parts.size() - 1) {
if (quad.p3.z != floor->getEndingZ()) {
//if (quad.p3.z != floor->getEndingZ()) {
if (!stairEndConnected(map, floor, stair)) {
p.drawLine(quad.p3, quad.p4);
}
}

View File

@@ -21,7 +21,7 @@ class GridModel {
private:
int gridSize_cm = 30; // TODO
int gridSize_cm = 20; // TODO
Grid<MyNode> grid;
Floorplan::IndoorMap* im;

View File

@@ -44,7 +44,7 @@ public:
new MMFloorBeacons(this, floor);
new MMFloorFingerprints(this, floor);
new MMFloorPOIs(this, floor);
new MMFloorStairs(this, floor);
new MMFloorStairs(this, map, floor);
new MMFloorElevators(this, floor);
new MMFloorGroundTruthPoints(this, floor);

View File

@@ -28,8 +28,8 @@ private:
public:
/** ctor with the underlying model */
MMFloorStair(MapLayer* parent, Floorplan::Floor* floor, Floorplan::StairFreeform* stair) :
MapModelElement(parent), floor(floor), stair(stair), mv2d(floor, stair), mv3d(floor, stair) {
MMFloorStair(MapLayer* parent, Floorplan::IndoorMap* map, Floorplan::Floor* floor, Floorplan::StairFreeform* stair) :
MapModelElement(parent), floor(floor), stair(stair), mv2d(map, floor, stair), mv3d(floor, stair) {
;

View File

@@ -13,17 +13,18 @@ class MMFloorStairs : public MapLayer {
private:
Floorplan::IndoorMap* map;
Floorplan::Floor* floor;
public:
/** ctor with the underlying model */
MMFloorStairs(MapLayer* parent, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR_STAIRS), floor(floor) {
MMFloorStairs(MapLayer* parent, Floorplan::IndoorMap* map, Floorplan::Floor* floor) : MapLayer(parent, MapLayerType::FLOOR_STAIRS), map(map), floor(floor) {
// add all floors
for (Floorplan::Stair* stair : floor->stairs) {
if (dynamic_cast<Floorplan::StairFreeform*>(stair)) {
addElement( new MMFloorStair(this, floor, (Floorplan::StairFreeform*)stair) );
addElement( new MMFloorStair(this, map, floor, (Floorplan::StairFreeform*)stair) );
}
}
@@ -35,7 +36,7 @@ public:
floor->stairs.push_back(stair);
// add to myself as element
MMFloorStair* mm = new MMFloorStair(this, floor, stair);
MMFloorStair* mm = new MMFloorStair(this, map, floor, stair);
addElement(mm);
return mm;