started working on walling, dooring and windowing

refactoring
This commit is contained in:
k-a-z-u
2018-07-25 16:21:47 +02:00
parent f7e4323d58
commit 0d22d91470
9 changed files with 368 additions and 48 deletions

View File

@@ -388,6 +388,7 @@ namespace Floorplan {
// if (std::string("window") == n->Name()) {obstacles.push_back(parseFloorObstacleWindow(n));}
// if (std::string("pillar") == n->Name()) {obstacles.push_back(parseFloorObstaclePillar(n));}
//if (std::string("obstacle") == n->Name()) {obstacles.push_back(parseFloorObstacleLine(n));} // OLD
if (std::string("wall") == n->Name()) {obstacles.push_back(parseFloorObstacleWall(n));}
if (std::string("line") == n->Name()) {obstacles.push_back(parseFloorObstacleLine(n));}
if (std::string("circle") == n->Name()) {obstacles.push_back(parseFloorObstacleCircle(n));}
if (std::string("door") == n->Name()) {obstacles.push_back(parseFloorObstacleDoor(n));}
@@ -396,6 +397,38 @@ namespace Floorplan {
return obstacles;
}
/** parse one wall */
static FloorObstacleWall* parseFloorObstacleWall(const XMLElem* el) {
FloorObstacleWall* wall = new FloorObstacleWall(
parseObstacleType(el->Attribute("type")),
parseMaterial(el->Attribute("material")),
el->FloatAttribute("x1"), el->FloatAttribute("y1"),
el->FloatAttribute("x2"), el->FloatAttribute("y2"),
(el->FloatAttribute("thickness") > 0) ? (el->FloatAttribute("thickness")) : (0.15), // default wall thickness in m
el->FloatAttribute("height")
);
// doors
FOREACH_NODE(n, el) {
if (std::string("door") == n->Name()) {
FloorObstacleWallDoor* door = new FloorObstacleWallDoor(
parseDoorType(n->Attribute("type")),
parseMaterial(n->Attribute("material")),
n->FloatAttribute("at"),
n->FloatAttribute("width"),
n->FloatAttribute("height"),
n->BoolAttribute("lr"),
n->BoolAttribute("io")
);
wall->doors.push_back(door);
}
}
return wall;
}
/** parse one line */
static FloorObstacleLine* parseFloorObstacleLine(const XMLElem* el) {
return new FloorObstacleLine(