fixed some issues
improvied editing changed toolbox
This commit is contained in:
61
mapview/2D/tools/ToolNewDoor.h
Normal file
61
mapview/2D/tools/ToolNewDoor.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#ifndef TOOLNEWDOOR_H
|
||||
#define TOOLNEWDOOR_H
|
||||
|
||||
#include "ToolNewElement.h"
|
||||
|
||||
class ToolNewDoor : public ToolNewElement<Floorplan::FloorObstacleDoor, MMFloorObstacleDoor> {
|
||||
|
||||
private:
|
||||
|
||||
/** currently edited line node (has 2) */
|
||||
int idx = 0;
|
||||
|
||||
public:
|
||||
|
||||
ToolNewDoor(Tools& tools, MapLayer* layer) : ToolNewElement(tools, layer) {
|
||||
create();
|
||||
}
|
||||
|
||||
const std::string getName() const override {
|
||||
return "new Door";
|
||||
}
|
||||
|
||||
void createEmptyElement() override {
|
||||
|
||||
foEL = new Floorplan::FloorObstacleDoor(Floorplan::DoorType::SWING, Floorplan::Material::WOOD, Point2(0, 0), Point2(0, 0));
|
||||
MMFloorObstacles* obs = (MMFloorObstacles*)layer;
|
||||
mmEL = obs->createDoor(foEL);
|
||||
|
||||
}
|
||||
|
||||
/** mouse is currently moved */
|
||||
void moving(const Point2 mapPoint) override {
|
||||
|
||||
if (idx == 0) { foEL->from = mapPoint; foEL->to = mapPoint; }
|
||||
if (idx == 1) { foEL->to = mapPoint; }
|
||||
|
||||
}
|
||||
|
||||
/** next point */
|
||||
void leftMouse() override {
|
||||
|
||||
if (++idx == 2) {
|
||||
finalizeCurrent();
|
||||
if (addAnother) {
|
||||
idx = 0;
|
||||
create();
|
||||
} else {
|
||||
disableMe();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void rightMouse() override {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // TOOLNEWDOOR_H
|
||||
Reference in New Issue
Block a user