fixed some issues
improvied editing changed toolbox
This commit is contained in:
66
mapview/2D/tools/ToolNewOutline.h
Normal file
66
mapview/2D/tools/ToolNewOutline.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#ifndef TOOLNEWOUTLINE_H
|
||||
#define TOOLNEWOUTLINE_H
|
||||
|
||||
#include "ToolNewElement.h"
|
||||
#include "../../model/MMFloorOutline.h"
|
||||
#include "../../model/MMFloorOutlinePolygon.h"
|
||||
|
||||
class ToolNewOutline : public ToolNewElement<Floorplan::FloorOutlinePolygon, MMFloorOutlinePolygon> {
|
||||
|
||||
private:
|
||||
|
||||
/** currently edited line node (has multiple) */
|
||||
int idx = 0;
|
||||
|
||||
public:
|
||||
|
||||
ToolNewOutline(Tools& tools, MapLayer* layer) : ToolNewElement(tools, layer) {
|
||||
create();
|
||||
}
|
||||
|
||||
const std::string getName() const override {
|
||||
return "new Outline";
|
||||
}
|
||||
|
||||
void becomesActive() override {
|
||||
emit onHelpTextChange("left-click for each edge of the outline. right-click to end");
|
||||
}
|
||||
|
||||
void createEmptyElement() override {
|
||||
|
||||
foEL = new Floorplan::FloorOutlinePolygon();
|
||||
foEL->poly.points.resize(1);
|
||||
foEL->outdoor = false;
|
||||
foEL->method = Floorplan::OutlineMethod::ADD;
|
||||
|
||||
MMFloorOutline* outlines = (MMFloorOutline*)layer;
|
||||
mmEL = outlines->create(foEL);
|
||||
|
||||
}
|
||||
|
||||
/** mouse is currently moved */
|
||||
void moving(const Point2 mapPoint) override {
|
||||
foEL->poly.points[idx] = mapPoint;
|
||||
}
|
||||
|
||||
/** next point */
|
||||
void leftMouse() override {
|
||||
++idx;
|
||||
foEL->poly.points.resize(idx+1);
|
||||
foEL->poly.points.back() = foEL->poly.points[idx-1];
|
||||
emit onHelpTextChange("left-click to add, right-click to end");
|
||||
}
|
||||
|
||||
void rightMouse() override {
|
||||
if (idx >= 3) {
|
||||
finalizeCurrent();
|
||||
} else {
|
||||
deleteCurrent();
|
||||
}
|
||||
disableMe();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // TOOLNEWOUTLINE_H
|
||||
Reference in New Issue
Block a user