added new tools for creating APs, Beacons, GTP, POI, Fingerprints fixed selection issue changed new-element creation added missing layer parameters
92 lines
1.8 KiB
C++
92 lines
1.8 KiB
C++
#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");
|
|
}
|
|
|
|
|
|
|
|
/** mouse is currently moved */
|
|
void moving(const Point2 mapPoint) override {
|
|
if (idx > 0) {
|
|
setPoint(idx, mapPoint);
|
|
}
|
|
}
|
|
|
|
/** next point */
|
|
void leftMouse(const Point2 mapPoint) override {
|
|
|
|
(void) mapPoint;
|
|
|
|
// 1st click
|
|
if (idx == 0) {
|
|
createEmptyElement();
|
|
foEL->poly.points.resize(foEL->poly.points.size() + 1);
|
|
} else {
|
|
;
|
|
}
|
|
|
|
foEL->poly.points.resize(foEL->poly.points.size() + 1);
|
|
setPoint(idx, mapPoint); // current element (finished)
|
|
++idx;
|
|
setPoint(idx, mapPoint); // new element (start at the current)
|
|
|
|
emit onHelpTextChange("left-click to add, right-click to end");
|
|
|
|
}
|
|
|
|
void rightMouse(const Point2 mapPoint) override {
|
|
|
|
(void) mapPoint;
|
|
|
|
if (idx >= 3) {
|
|
finalizeCurrent();
|
|
} else {
|
|
deleteCurrent();
|
|
}
|
|
disableMe();
|
|
}
|
|
|
|
private:
|
|
|
|
void setPoint(const int idx, const Point2 mapPoint) {
|
|
foEL->poly.points[idx] = mapPoint;
|
|
}
|
|
|
|
void createEmptyElement() {
|
|
|
|
foEL = new Floorplan::FloorOutlinePolygon();
|
|
foEL->outdoor = false;
|
|
foEL->method = Floorplan::OutlineMethod::ADD;
|
|
|
|
MMFloorOutline* outlines = (MMFloorOutline*)layer;
|
|
mmEL = outlines->create(foEL);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
#endif // TOOLNEWOUTLINE_H
|