fixed some issues

added new tools for creating APs, Beacons, GTP, POI, Fingerprints
fixed selection issue
changed new-element creation
added missing layer parameters
This commit is contained in:
2017-06-01 16:26:09 +02:00
parent 489a64fd69
commit 7a23001b82
29 changed files with 763 additions and 265 deletions

View File

@@ -52,7 +52,7 @@ public:
* @return true if the focused element has changed. false otherwise
*/
bool focus(MapView2D* v, MapModelElement* el) {
setFocused(v, el);
return setFocused(v, el);
}
private:
@@ -72,40 +72,58 @@ private:
}
void processPress(MapView2D* m, const Point2 p, MapModelElement* elem) {
void processPress(QMouseEvent* e, MapView2D* m, const Point2 p, MapModelElement* elem) {
MV2DElement* me = elem->getMV2D();
if (!me) {return;}
// left mouse button?
if (e->button() == Qt::MouseButton::LeftButton) {
// element has selectedable nodes? try to select one
if (dynamic_cast<HasMoveableNodes*>(me)) {
if (selectNode(m, p, dynamic_cast<HasMoveableNodes*>(me))) {return;}
}
}
// let the element itself process all events
me->mousePressed(m, p);
}
void processMove(MapView2D* m, const Point2 p, MapModelElement* elem) {
void processMove(QMouseEvent* e, MapView2D* m, const Point2 p, MapModelElement* elem) {
(void) e;
MV2DElement* me = elem->getMV2D();
if (!me) {return;}
// elements has selectedable nodes? try to process them
if (dynamic_cast<HasMoveableNodes*>(me)) {
if (moveNode(m, p, dynamic_cast<HasMoveableNodes*>(me))) {return;}
}
// left mouse button? [does not work for move-events?!]
//if (e->button() == Qt::MouseButton::LeftButton) {
// elements has selectedable nodes? try to move the selected one (if any)
if (dynamic_cast<HasMoveableNodes*>(me)) {
if (moveNode(m, p, dynamic_cast<HasMoveableNodes*>(me))) {return;}
}
//}
// otherwise: let the element itself process all events
me->mouseMove(m, p);
}
void processRelease(MapView2D* m, const Point2 p, MapModelElement* elem) {
void processRelease(QMouseEvent* e, MapView2D* m, const Point2 p, MapModelElement* elem) {
(void) e;
MV2DElement* me = elem->getMV2D();
if (!me) {return;}
// element has selectedable nodes? try to process them
if (dynamic_cast<HasMoveableNodes*>(me)) {
if (selectNode(m, p, dynamic_cast<HasMoveableNodes*>(me))) {return;}
}
// // left mouse button?
// if (e->button() == Qt::MouseButton::LeftButton) {
// // element has selectedable nodes? try to select one
// if (dynamic_cast<HasMoveableNodes*>(me)) {
// if (selectNode(m, p, dynamic_cast<HasMoveableNodes*>(me))) {return;}
// }
// }
// otherwise: let the element itself process all events
me->mouseReleased(m, p);
@@ -124,6 +142,7 @@ private:
// find the node nearest to p
auto comp = [&] (const MoveableNode& n1, const MoveableNode& n2) {return n1.pos.getDistance(p) < n2.pos.getDistance(p);};
auto lst = elem->getMoveableNodes();
if (lst.empty()) {return false;} // nothing available!
auto it = std::min_element(lst.begin(), lst.end(), comp);
// is the nearest point below the threshold?
@@ -240,7 +259,7 @@ private:
// focus kept. provide the currently focused element with events
if (focused) {
processPress(m, p2, focused);
processPress(e, m, p2, focused);
}
}
@@ -258,7 +277,7 @@ private:
if (mouseIsDown) {
// provide the focused element with the mouse event?
if (focused) {processMove(m, p2, focused);}
if (focused) {processMove(e, m, p2, focused);}
}
@@ -269,13 +288,14 @@ private:
virtual bool mouseReleaseEvent(MapView2D* m, QMouseEvent* e) override {
const Scaler& s = m->getScaler();
Point2 p2(s.xsm(e->x()), s.ysm(e->y()));
const Point2 p2(s.xsm(e->x()), s.ysm(e->y()));
// provide the focused element with the mouse event?
if (focused) {processRelease(m, p2, focused);}
if (focused) {processRelease(e, m, p2, focused);}
mouseIsDown = false;
// not consumed
return false;
}