worked on elevators and lint
This commit is contained in:
@@ -13,12 +13,14 @@ class MV2DElementElevator : public MV2DElement, public HasMoveableNodes {
|
||||
|
||||
private:
|
||||
|
||||
Floorplan::IndoorMap* map;
|
||||
Floorplan::Floor* floor;
|
||||
Floorplan::Elevator* elevator;
|
||||
|
||||
public:
|
||||
|
||||
/** 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 {
|
||||
@@ -47,6 +49,10 @@ public:
|
||||
|
||||
// outline
|
||||
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.drawLine(poly.points[0], poly.points[1]);
|
||||
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 {
|
||||
return { MoveableNode(0, elevator->center) };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user