Opened windows

This commit is contained in:
2019-06-19 16:43:29 +02:00
parent 4142ffb950
commit 91e598a828

View File

@@ -525,6 +525,8 @@ public:
void plot() { void plot() {
splot.getObjects().reOrderByZIndex();
this->mapOutlineConcrete.getStroke().setColor(settings.outlineColor); this->mapOutlineConcrete.getStroke().setColor(settings.outlineColor);
this->mapOutlineDrywall.getStroke().setColor(settings.outlineColor); this->mapOutlineDrywall.getStroke().setColor(settings.outlineColor);
this->mapOutlineGlass.getStroke().setColor(settings.outlineColor); this->mapOutlineGlass.getStroke().setColor(settings.outlineColor);
@@ -627,9 +629,8 @@ public:
// plot obstacles? // plot obstacles?
if (settings.obstacles) { if (settings.obstacles) {
for (Floorplan::FloorObstacle* obs : floor->obstacles) { for (Floorplan::FloorObstacle* obs : floor->obstacles) {
//Floorplan::FloorObstacleLine* line = dynamic_cast<Floorplan::FloorObstacleLine*>(obs); Floorplan::FloorObstacleWall* wall = dynamic_cast<Floorplan::FloorObstacleWall*>(obs);
Floorplan::FloorObstacleWall* line = dynamic_cast<Floorplan::FloorObstacleWall*>(obs); if (wall) {
if (line) {
if (floor->atHeight < settings.minZ) {continue;} if (floor->atHeight < settings.minZ) {continue;}
if (floor->atHeight > settings.maxZ) {continue;} if (floor->atHeight > settings.maxZ) {continue;}
@@ -652,20 +653,48 @@ public:
const float v = 140 + vo; const float v = 140 + vo;
// drawing outlines as polygon is a hack for correct depth-order in gnuplot
K::GnuplotColor color = (settings.outlineColorCustom) ? (settings.outlineColor) : (K::GnuplotColor::fromRGB(v,v,v)); // New wall type with integrated doors
std::vector<Point2> pts;
pts.push_back(wall->from);
for (const Floorplan::FloorObstacleWallDoor* door : wall->doors) {
pts.push_back(door->getStart(wall));
pts.push_back(door->getEnd(wall));
}
for (const Floorplan::FloorObstacleWallWindow* win : wall->windows) {
pts.push_back(win->getStart(wall));
pts.push_back(win->getEnd(wall));
}
pts.push_back(wall->to);
auto comp = [&](const Point2 p1, const Point2 p2) {
return wall->from.getDistance(p1) < wall->from.getDistance(p2);
};
std::sort(pts.begin(), pts.end(), comp);
for (size_t i = 0; i < pts.size(); i += 2) {
Point2 start = pts[i];
Point2 end = pts[i + 1];
// draw line
// drawing obstacles as polygon is a hack for correct depth-order in gnuplot
K::GnuplotColor color = (settings.outlineColorCustom) ? (settings.outlineColor) : (K::GnuplotColor::fromRGB(v, v, v));
K::GnuplotFill filler = K::GnuplotFill(K::GnuplotFillStyle::EMPTY_BORDER, color); K::GnuplotFill filler = K::GnuplotFill(K::GnuplotFillStyle::EMPTY_BORDER, color);
K::GnuplotStroke stroke(K::GnuplotDashtype::NONE, 6, color); K::GnuplotStroke stroke(K::GnuplotDashtype::NONE, 6, color);
//K::GnuplotObjectPolygon* gpol = new K::GnuplotObjectPolygon(K::GnuplotFill::NONE(), stroke); //K::GnuplotObjectPolygon* gpol = new K::GnuplotObjectPolygon(K::GnuplotFill::NONE(), stroke);
K::GnuplotObjectPolygon* gpol = new K::GnuplotObjectPolygon(filler, stroke); K::GnuplotObjectPolygon* gpol = new K::GnuplotObjectPolygon(filler, stroke);
//K::GnuplotObjectPolygon* gpol = new K::GnuplotObjectPolygon(K::GnuplotFill::NONE(), K::GnuplotStroke::NONE()); //K::GnuplotObjectPolygon* gpol = new K::GnuplotObjectPolygon(K::GnuplotFill::NONE(), K::GnuplotStroke::NONE());
gpol->add(K::GnuplotCoordinate3(line->from.x, line->from.y, floor->atHeight, K::GnuplotCoordinateSystem::FIRST)); gpol->add(K::GnuplotCoordinate3(start.x, start.y, floor->atHeight, K::GnuplotCoordinateSystem::FIRST));
gpol->add(K::GnuplotCoordinate3(line->to.x, line->to.y, floor->atHeight, K::GnuplotCoordinateSystem::FIRST)); gpol->add(K::GnuplotCoordinate3(end.x, end.y, floor->atHeight, K::GnuplotCoordinateSystem::FIRST));
gpol->close(); gpol->close();
gpol->setZIndex(floor->atHeight); // above the ground polygon gpol->setZIndex(floor->atHeight); // above the ground polygon
//gpol->setFront(true); //gpol->setFront(true);
splot.getObjects().add(gpol); splot.getObjects().add(gpol);
}
} }
} }