a lot of work on th map-creator
This commit is contained in:
@@ -42,10 +42,18 @@ public:
|
||||
if (selPoint == 1) {p.drawCircle(fo->to);}
|
||||
}
|
||||
|
||||
// line
|
||||
|
||||
p.setPenBrush(MapElementHelper::getPen(fo->material, fo->type, hasFocus()), Qt::NoBrush);
|
||||
p.drawLine(fo->from, fo->to);
|
||||
|
||||
// // door?
|
||||
// if (fo->type == Floorplan::ObstacleType::DOOR) {
|
||||
// paintDoor(p);
|
||||
// } else {
|
||||
// p.setPenBrush(MapElementHelper::getPen(fo->material, fo->type, hasFocus()), Qt::NoBrush);
|
||||
// p.drawLine(fo->from, fo->to);
|
||||
// }
|
||||
|
||||
// available endpoints
|
||||
if (hasFocus()) {
|
||||
p.setPenBrush(Qt::black, Qt::NoBrush);
|
||||
@@ -55,6 +63,29 @@ public:
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
virtual void onFocus() override {
|
||||
;
|
||||
}
|
||||
@@ -74,7 +105,7 @@ public:
|
||||
virtual void mouseMove(MapView2D* v, const Point2 _p) override {
|
||||
(void) v;
|
||||
if (selPoint == -1) {return;}
|
||||
const Point2 p = Scaler::snap(_p, CFG::MOVE_SNAP_SIZE_M);
|
||||
const Point2 p = v->getScaler().snap(_p);
|
||||
if (selPoint == 0) {fo->from.x = p.x; fo->from.y = p.y;}
|
||||
if (selPoint == 1) {fo->to.x = p.x; fo->to.y = p.y;}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user