added support for pillars

minor fixes
new 3D models
This commit is contained in:
2018-05-22 11:50:56 +02:00
parent 1bc95d9c55
commit 37b3011e5d
14 changed files with 352 additions and 77 deletions

View File

@@ -32,8 +32,6 @@ public:
return MapElementHelper::getLineDistanceXY(fo->from, fo->to, p);
}
/** repaint me */
void paint(Painter& p) override {
@@ -58,7 +56,6 @@ public:
// reset the old pen
p.setPen(pen);
// available endpoints
if (hasFocus()) {
@@ -76,38 +73,8 @@ public:
p.drawCircle_px(fo->to, 3);
}
}
// void paintDoor(Painter& p) {
// QPen pen;
// pen.setColor(QColor(0.5,0.5,0.5));
// pen.setStyle(Qt::PenStyle::DotLine);
// p.setPenBrush(pen, Qt::NoBrush);
// // opening indicator
// const float open = M_PI / 4;
// const float len = (fo->to - fo->from).length();
// const float angle1 = std::atan2(fo->to.y-fo->from.y, fo->to.x-fo->from.x);
// const float angle2 = angle1 + open;
// const Point2 pOpen = Point2( std::cos(angle2) * len, std::sin(angle2) * len ) + fo->from;
// p.drawLine(fo->from, fo->to);
// p.drawLine(fo->from, pOpen);
// p.drawArc(fo->from, len, angle1, open);
// //p.drawLine(fo->to, pOpen);
// // obstacle length
// p.setPenBrush(Qt::black, Qt::NoBrush);
// p.drawLength(fo->from, fo->to, fo->from.getDistance(fo->to));
// }
void onFocus() override {
;
}
@@ -135,7 +102,6 @@ public:
emit v->onElementChange(this);
}
};
#endif // MV2DELEMENTFLOOROBSTACLELINE_H

View File

@@ -77,12 +77,13 @@ public:
pen.setCapStyle(Qt::FlatCap);
if (focus) {pen.setColor(Qt::black);}
if (mat == Material::CONCRETE) {;}
if (mat == Material::GLASS) {pen.setStyle(Qt::PenStyle::DotLine);}
if (mat == Material::METAL) {pen.setColor(QColor(50, 50, 50));}
if (type == ObstacleType::HANDRAIL) {pen.setStyle(Qt::PenStyle::DashLine);}
if (type == ObstacleType::UNKNOWN) {pen.setColor(Qt::red);}
if (type == ObstacleType::PILLAR) {pen.setColor(Qt::red);}
if (mat == Material::CONCRETE) {;}
if (mat == Material::GLASS) {pen.setStyle(Qt::PenStyle::DotLine);}
if (mat == Material::METALLIZED_GLAS) {pen.setStyle(Qt::PenStyle::DotLine);}
if (mat == Material::METAL) {pen.setColor(QColor(50, 50, 50));}
if (type == ObstacleType::HANDRAIL) {pen.setStyle(Qt::PenStyle::DashLine);}
if (type == ObstacleType::UNKNOWN) {pen.setColor(Qt::red);}
if (type == ObstacleType::PILLAR) {pen.setColor(Qt::red);}
return pen;
}

View File

@@ -0,0 +1,47 @@
#ifndef TOOLNEWPILLAR_H
#define TOOLNEWPILLAR_H
#include "ToolNewElement.h"
#include "../../model/MMFloorObstacles.h"
#include "../../model/MMFloorObstacleCircle.h"
class ToolNewPillar : public ToolNewElement<Floorplan::FloorObstacleCircle, MMFloorObstacleCircle> {
public:
ToolNewPillar(Tools& tools, MapLayer* layer) : ToolNewElement(tools, layer) {
;
}
void becomesActive() override {
emit onHelpTextChange("left-click where to place a new pillar. right-click to end.");
}
void becomesInactive() override {
;
}
const std::string getName() const override {
return "new Pillar";
}
void moving(const Point2 mapPoint) override {
(void) mapPoint;
}
void leftMouse(const Point2 mapPoint) override {
const Floorplan::Material mat = Floorplan::Material::CONCRETE; // default material
foEL = new Floorplan::FloorObstacleCircle(mat, mapPoint.x, mapPoint.y, 0.2);//"", Point3(mapPoint.x, mapPoint.y, 0.0), Point3(0,0,0));
MMFloorObstacles* obs = (MMFloorObstacles*)layer;
mmEL = obs->createCircle(foEL);
}
void rightMouse(const Point2 mapPoint) override {
(void) mapPoint;
finalizeCurrent();
disableMe();
}
};
#endif // TOOLNEWPILLAR_H