worked on windows
This commit is contained in:
@@ -424,9 +424,8 @@ namespace Floorplan {
|
||||
float startsAtHeight;
|
||||
float width;
|
||||
float height;
|
||||
bool leftRight = false;
|
||||
bool inOut = false;
|
||||
FloorObstacleWallWindow(const WindowType type, const Material material, const float atLinePos, const float startsAtHeight, const float width, const float height, const bool lr = false, const bool io = false) : FloorObstacle(material), type(type), atLinePos(atLinePos), startsAtHeight(startsAtHeight), width(width), height(height), leftRight(lr), inOut(io) {;}
|
||||
FloorObstacleWallWindow(const WindowType type, const Material material, const float atLinePos, const float startsAtHeight, const float width, const float height, const bool io = false) : FloorObstacle(material), type(type), atLinePos(atLinePos), startsAtHeight(startsAtHeight), width(width), height(height), inOut(io) {;}
|
||||
Point2 getStart(const FloorObstacleWall* wall) const {
|
||||
const Point2 dir = wall->to - wall->from;
|
||||
const Point2 cen = wall->from + dir * atLinePos;
|
||||
|
||||
@@ -415,7 +415,7 @@ namespace Floorplan {
|
||||
FloorObstacleWallDoor* door = new FloorObstacleWallDoor(
|
||||
parseDoorType(n->Attribute("type")),
|
||||
parseMaterial(n->Attribute("material")),
|
||||
n->FloatAttribute("at"),
|
||||
n->FloatAttribute("x01"),
|
||||
n->FloatAttribute("width"),
|
||||
n->FloatAttribute("height"),
|
||||
n->BoolAttribute("lr"),
|
||||
@@ -425,6 +425,22 @@ namespace Floorplan {
|
||||
}
|
||||
}
|
||||
|
||||
// windows
|
||||
FOREACH_NODE(n, el) {
|
||||
if (std::string("window") == n->Name()) {
|
||||
FloorObstacleWallWindow* win = new FloorObstacleWallWindow(
|
||||
parseWindowType(n->Attribute("type")),
|
||||
parseMaterial(n->Attribute("material")),
|
||||
n->FloatAttribute("x01"),
|
||||
n->FloatAttribute("y"),
|
||||
n->FloatAttribute("width"),
|
||||
n->FloatAttribute("height"),
|
||||
n->BoolAttribute("io")
|
||||
);
|
||||
wall->windows.push_back(win);
|
||||
}
|
||||
}
|
||||
|
||||
return wall;
|
||||
|
||||
}
|
||||
@@ -534,6 +550,10 @@ namespace Floorplan {
|
||||
try { return (DoorType) std::stoi(type); } catch (...) { return DoorType::UNKNOWN; }
|
||||
}
|
||||
|
||||
static WindowType parseWindowType(const std::string type) {
|
||||
try { return (WindowType) std::stoi(type); } catch (...) { return WindowType::UNKNOWN; }
|
||||
}
|
||||
|
||||
static Material parseMaterial(const std::string material) {
|
||||
try {
|
||||
return (Material) std::stoi(material);
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace Floorplan {
|
||||
private:
|
||||
|
||||
static std::string toString(const ObstacleType t) { return std::to_string((int)t); }
|
||||
static std::string toString(const WindowType t) { return std::to_string((int)t); }
|
||||
static std::string toString(const DoorType t) { return std::to_string((int)t); }
|
||||
static std::string toString(const Material m) { return std::to_string((int)m); }
|
||||
static std::string toString(const OutlineMethod m) { return std::to_string((int)m); }
|
||||
@@ -349,7 +350,7 @@ namespace Floorplan {
|
||||
|
||||
oDoor->SetAttribute("type", toString(door->type).c_str());
|
||||
oDoor->SetAttribute("material", toString(door->material).c_str());
|
||||
oDoor->SetAttribute("at", door->atLinePos);
|
||||
oDoor->SetAttribute("x01", door->atLinePos);
|
||||
oDoor->SetAttribute("width", door->width);
|
||||
oDoor->SetAttribute("height", door->height);
|
||||
oDoor->SetAttribute("io", door->inOut);
|
||||
@@ -357,6 +358,22 @@ namespace Floorplan {
|
||||
|
||||
}
|
||||
|
||||
// windows?
|
||||
for (const FloorObstacleWallWindow* win : wall->windows) {
|
||||
|
||||
XMLElem* oDoor = doc.NewElement("window");
|
||||
oWall->InsertEndChild(oDoor);
|
||||
|
||||
oDoor->SetAttribute("type", toString(win->type).c_str());
|
||||
oDoor->SetAttribute("material", toString(win->material).c_str());
|
||||
oDoor->SetAttribute("x01", win->atLinePos);
|
||||
oDoor->SetAttribute("y", win->startsAtHeight);
|
||||
oDoor->SetAttribute("width", win->width);
|
||||
oDoor->SetAttribute("height", win->height);
|
||||
oDoor->SetAttribute("io", win->inOut);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** write a line obstacle (old walls, handrail, ..) */
|
||||
|
||||
Reference in New Issue
Block a user