fixed some issues

improvied editing
changed toolbox
This commit is contained in:
2017-03-20 19:25:23 +01:00
parent 92e279aefc
commit b7ee7d992a
18 changed files with 583 additions and 262 deletions

View File

@@ -0,0 +1,63 @@
#ifndef TOOLNEWWALL_H
#define TOOLNEWWALL_H
#include "ToolNewElement.h"
#include "../../model/MMFloorObstacles.h"
#include "../../model/MMFloorObstacleLine.h"
class ToolNewWall : public ToolNewElement<Floorplan::FloorObstacleLine, MMFloorObstacleLine> {
private:
/** currently edited line node (has 2) */
int idx = 0;
public:
ToolNewWall(Tools& tools, MapLayer* layer) : ToolNewElement(tools, layer) {
create();
}
const std::string getName() const override {
return "new Wall";
}
void createEmptyElement() override {
foEL = new Floorplan::FloorObstacleLine(Floorplan::ObstacleType::WALL, Floorplan::Material::DRYWALL, Point2(0, 0), Point2(0, 0));
MMFloorObstacles* obs = (MMFloorObstacles*)layer;
mmEL = obs->createLine(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 // TOOLNEWWALL_H