fixed some issues
improvied editing changed toolbox
This commit is contained in:
77
mapview/2D/tools/ToolNewStair.h
Normal file
77
mapview/2D/tools/ToolNewStair.h
Normal file
@@ -0,0 +1,77 @@
|
||||
#ifndef TOOLNEWSTAIR_H
|
||||
#define TOOLNEWSTAIR_H
|
||||
|
||||
#include "ToolNewElement.h"
|
||||
#include "../../model/MMFloorStairs.h"
|
||||
|
||||
class ToolNewStair : public ToolNewElement<Floorplan::StairFreeform, MMFloorStair> {
|
||||
|
||||
private:
|
||||
|
||||
/** currently edited line node (has multiple) */
|
||||
int idx = 0;
|
||||
|
||||
public:
|
||||
|
||||
ToolNewStair(Tools& tools, MapLayer* layer) : ToolNewElement(tools, layer) {
|
||||
create();
|
||||
}
|
||||
|
||||
const std::string getName() const override {
|
||||
return "new Stair";
|
||||
}
|
||||
|
||||
void becomesActive() override {
|
||||
emit onHelpTextChange("click for the stair's starting point");
|
||||
}
|
||||
|
||||
void createEmptyElement() override {
|
||||
|
||||
foEL = new Floorplan::StairFreeform();
|
||||
foEL->parts.resize(1);
|
||||
MMFloorStairs* stairs = (MMFloorStairs*)layer;
|
||||
mmEL = stairs->create(foEL);
|
||||
|
||||
}
|
||||
|
||||
/** mouse is currently moved */
|
||||
void moving(const Point2 mapPoint) override {
|
||||
|
||||
if (idx == 0) {
|
||||
|
||||
Floorplan::StairPart& part = foEL->parts[0];
|
||||
part.connectWithPrev = false;
|
||||
part.width = 1.5;
|
||||
part.start = Point3(mapPoint.x, mapPoint.y, 0);
|
||||
part.end = part.start;
|
||||
|
||||
} else if (idx == 1) {
|
||||
Floorplan::StairPart& part = foEL->parts[0];
|
||||
part.end = Point3(mapPoint.x, mapPoint.y, 0);
|
||||
|
||||
} else {
|
||||
Floorplan::StairPart& p1 = foEL->parts[idx-2];
|
||||
Floorplan::StairPart& p2 = foEL->parts[idx-1];
|
||||
p2.width = 1.5;
|
||||
p2.start = p1.end;
|
||||
p2.end = Point3(mapPoint.x, mapPoint.y, 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** next point */
|
||||
void leftMouse() override {
|
||||
++idx;
|
||||
foEL->parts.resize(idx);
|
||||
emit onHelpTextChange("right-click: set end + start new part, left-click set end + finish");
|
||||
}
|
||||
|
||||
void rightMouse() override {
|
||||
finalizeCurrent();
|
||||
disableMe();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // TOOLNEWSTAIR_H
|
||||
Reference in New Issue
Block a user