fixed issues and elevators
This commit is contained in:
@@ -508,6 +508,9 @@ namespace Floorplan {
|
||||
/** the elevator's rotation (in radians) */
|
||||
float rotation;
|
||||
|
||||
/** the elevator's height (from its starting position) */
|
||||
float height_m;
|
||||
|
||||
/** get the 4 corner points for the elevator */
|
||||
Polygon2 getPoints() const {
|
||||
const Point2 p1 = Point2(+width/2, +depth/2).rotated(rotation) + center;
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Floorplan {
|
||||
|
||||
// check elevators
|
||||
for (const Elevator* e : floor->elevators) {
|
||||
checkElevator(res, floor, e);
|
||||
checkElevator(res, map, floor, e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -222,14 +222,31 @@ namespace Floorplan {
|
||||
|
||||
}
|
||||
|
||||
static void checkElevator(Issues& res, const Floor* floor, const Elevator* e) {
|
||||
static void checkElevator(Issues& res, const IndoorMap* map, const Floor* floor, const Elevator* e) {
|
||||
|
||||
if (e->depth < 0.5) {
|
||||
res.push_back(Issue(Type::ERROR, floor, "elevator's depth @" + e->center.asString() + " is too small: " + std::to_string(e->depth) + "m"));
|
||||
res.push_back(Issue(Type::ERROR, floor, "elevator's @" + e->center.asString() + ": depth is too small: " + std::to_string(e->depth) + "m"));
|
||||
}
|
||||
|
||||
if (e->width < 0.5) {
|
||||
res.push_back(Issue(Type::ERROR, floor, "elevator's width @" + e->center.asString() + " is too small: " + std::to_string(e->width) + "m"));
|
||||
res.push_back(Issue(Type::ERROR, floor, "elevator's @" + e->center.asString() + ": width is too small: " + std::to_string(e->width) + "m"));
|
||||
}
|
||||
|
||||
if (e->height_m < 0.1) {
|
||||
res.push_back(Issue(Type::ERROR, floor, "elevator's @" + e->center.asString() + ": height is too small: " + std::to_string(e->height_m) + "m"));
|
||||
}
|
||||
|
||||
// list of all heights where there is a floor;
|
||||
std::vector<int> floorAtHeight_cm;
|
||||
for (const Floor* f : map->floors) {
|
||||
const int floorZ_cm = std::round(f->atHeight * 100);
|
||||
floorAtHeight_cm.push_back(floorZ_cm); // integer height in cm
|
||||
}
|
||||
|
||||
// disconnected end? (must be long to ANY other floor within the map)
|
||||
const int elevEndZ_cm = std::round( (floor->getStartingZ() + e->height_m) * 100 );
|
||||
if(std::find(floorAtHeight_cm.begin(), floorAtHeight_cm.end(), elevEndZ_cm) == floorAtHeight_cm.end()) {
|
||||
res.push_back(Issue(Type::ERROR, floor, "elevator @" + e->center.asString() + " is not connected to the ending floor's ground! [open elevator end]"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -168,6 +168,7 @@ namespace Floorplan {
|
||||
elev->center = Point2(el->FloatAttribute("cx"), el->FloatAttribute("cy"));
|
||||
elev->depth = el->FloatAttribute("depth");
|
||||
elev->width = el->FloatAttribute("width");
|
||||
elev->height_m = el->FloatAttribute("height");
|
||||
elev->rotation = el->FloatAttribute("rotation");
|
||||
return elev;
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ namespace Floorplan {
|
||||
elem->SetAttribute("cy", elevator->center.y);
|
||||
elem->SetAttribute("width", elevator->width);
|
||||
elem->SetAttribute("depth", elevator->depth);
|
||||
elem->SetAttribute("height", elevator->height_m);
|
||||
elem->SetAttribute("rotation", elevator->rotation);
|
||||
elevators->InsertEndChild(elem);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user