fixed issues and elevators
This commit is contained in:
@@ -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]"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user