Commit d22409fd authored by Mariano Lizarraga's avatar Mariano Lizarraga

Fixed bug in collecting global waypoints from the autopilot

parent a2c07fa1
...@@ -407,6 +407,7 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina ...@@ -407,6 +407,7 @@ void MapWidget::captureMapClick(const QMouseEvent* event, const QPointF coordina
void MapWidget::createWaypointGraphAtMap(const QPointF coordinate) void MapWidget::createWaypointGraphAtMap(const QPointF coordinate)
{ {
if (!wpExists(coordinate)){
// Create waypoint name // Create waypoint name
QString str; QString str;
...@@ -425,6 +426,8 @@ void MapWidget::createWaypointGraphAtMap(const QPointF coordinate) ...@@ -425,6 +426,8 @@ void MapWidget::createWaypointGraphAtMap(const QPointF coordinate)
{ {
tempCirclePoint = new Waypoint2DIcon(coordinate.x(), coordinate.y(), 20, str, qmapcontrol::Point::Middle); tempCirclePoint = new Waypoint2DIcon(coordinate.x(), coordinate.y(), 20, str, qmapcontrol::Point::Middle);
} }
mc->layer("Waypoints")->addGeometry(tempCirclePoint); mc->layer("Waypoints")->addGeometry(tempCirclePoint);
Point* tempPoint = new Point(coordinate.x(), coordinate.y(),str); Point* tempPoint = new Point(coordinate.x(), coordinate.y(),str);
...@@ -436,11 +439,22 @@ void MapWidget::createWaypointGraphAtMap(const QPointF coordinate) ...@@ -436,11 +439,22 @@ void MapWidget::createWaypointGraphAtMap(const QPointF coordinate)
// Refresh the screen // Refresh the screen
mc->updateRequestNew(); mc->updateRequestNew();
}
//// // emit signal mouse was clicked //// // emit signal mouse was clicked
// emit captureMapCoordinateClick(coordinate); // emit captureMapCoordinateClick(coordinate);
} }
int MapWidget::wpExists(const QPointF coordinate){
for (int i = 0; i < wps.size(); i++){
if (wps.at(i)->latitude() == coordinate.y() &&
wps.at(i)->longitude()== coordinate.x()){
return 1;
}
}
return 0;
}
void MapWidget::captureGeometryClick(Geometry* geom, QPoint point) void MapWidget::captureGeometryClick(Geometry* geom, QPoint point)
{ {
......
...@@ -144,7 +144,7 @@ private: ...@@ -144,7 +144,7 @@ private:
QHash <QString, qmapcontrol::Point*> wpIndex; QHash <QString, qmapcontrol::Point*> wpIndex;
qmapcontrol::LineString* path; qmapcontrol::LineString* path;
QPen* pointPen; QPen* pointPen;
int wpExists(const QPointF coordinate);
bool waypointIsDrag; bool waypointIsDrag;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment