added lint for doors
small obj-pool fix
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "Floorplan.h"
|
#include "Floorplan.h"
|
||||||
#include "../../geo/BBox2.h"
|
#include "../../geo/BBox2.h"
|
||||||
|
#include "../../wifi/estimate/ray3/ModelFactory.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -84,7 +85,7 @@ namespace Floorplan {
|
|||||||
|
|
||||||
// check obstacles
|
// check obstacles
|
||||||
for (const FloorObstacle* obs : floor->obstacles) {
|
for (const FloorObstacle* obs : floor->obstacles) {
|
||||||
checkObstacle(res, floor, obs);
|
checkObstacle(res, map, floor, obs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check fingerprints
|
// check fingerprints
|
||||||
@@ -127,7 +128,7 @@ namespace Floorplan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** check walls, doors, ... */
|
/** check walls, doors, ... */
|
||||||
static void checkObstacle(Issues& res, const Floor* floor, const FloorObstacle* fo) {
|
static void checkObstacle(Issues& res, const IndoorMap* map, const Floor* floor, const FloorObstacle* fo) {
|
||||||
|
|
||||||
// line? -> check
|
// line? -> check
|
||||||
const FloorObstacleLine* line = dynamic_cast<const FloorObstacleLine*>(fo);
|
const FloorObstacleLine* line = dynamic_cast<const FloorObstacleLine*>(fo);
|
||||||
@@ -145,6 +146,14 @@ namespace Floorplan {
|
|||||||
if (len_m < 0.40) {
|
if (len_m < 0.40) {
|
||||||
res.push_back(Issue(Type::ERR, floor, "' door is too narrow: " + std::to_string(len_m) + " meter from " + door->from.asString() + " to " + door->to.asString()));
|
res.push_back(Issue(Type::ERR, floor, "' door is too narrow: " + std::to_string(len_m) + " meter from " + door->from.asString() + " to " + door->to.asString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Ray3D::ModelFactory fac(map);
|
||||||
|
fac.getDoorAbove(floor, door);
|
||||||
|
} catch (Exception e) {
|
||||||
|
res.push_back(Issue(Type::ERR, floor, std::string(e.what()) + "[from" + door->from.asString() + " to " + door->to.asString() + "]"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// pillar? -> check
|
// pillar? -> check
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ namespace Ray3D {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
public:
|
||||||
|
|
||||||
/** convert a floor (floor/ceiling) into triangles */
|
/** convert a floor (floor/ceiling) into triangles */
|
||||||
std::vector<Obstacle3D> getFloor(const Floorplan::Floor* f) {
|
std::vector<Obstacle3D> getFloor(const Floorplan::Floor* f) {
|
||||||
@@ -426,10 +426,18 @@ namespace Ray3D {
|
|||||||
return (line->from == door->from || line->to == door->from || line->from == door->to || line->to == door->to);
|
return (line->from == door->from || line->to == door->from || line->from == door->to || line->to == door->to);
|
||||||
};
|
};
|
||||||
auto it = std::find_if(f->obstacles.begin(), f->obstacles.end(), comp);
|
auto it = std::find_if(f->obstacles.begin(), f->obstacles.end(), comp);
|
||||||
|
|
||||||
|
// there is absolutely nothing attached directly to the door...
|
||||||
|
if (it == f->obstacles.end()) {
|
||||||
|
throw Exception("did not find a matching element to place above the door");
|
||||||
|
}
|
||||||
|
|
||||||
|
// try to convert the element directly connected to the door into a line-obstacle
|
||||||
const Floorplan::FloorObstacleLine* line = dynamic_cast<const Floorplan::FloorObstacleLine*> (*it);
|
const Floorplan::FloorObstacleLine* line = dynamic_cast<const Floorplan::FloorObstacleLine*> (*it);
|
||||||
|
|
||||||
|
// there seems to be no wall (but something else?!) attached to the door. fishy..
|
||||||
if (!line) {
|
if (!line) {
|
||||||
throw Exception("did not find a matching element to place above the door");
|
throw Exception("did not find a matching wall to place above the door");
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the obstacle to place above the door
|
// get the obstacle to place above the door
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ namespace Ray3D {
|
|||||||
scanFolder(folder);
|
scanFolder(folder);
|
||||||
} catch (...) {;}
|
} catch (...) {;}
|
||||||
}
|
}
|
||||||
|
initDone = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user