diff --git a/src/ui/map/QGCMapWidget.cc b/src/ui/map/QGCMapWidget.cc index 1314fd9273716d82d87ec9d8a568d9439cb076ab..2dae968309dccd3b97d598d667f32d2d480f1fa1 100644 --- a/src/ui/map/QGCMapWidget.cc +++ b/src/ui/map/QGCMapWidget.cc @@ -362,13 +362,13 @@ void QGCMapWidget::setUpdateRateLimit(float seconds) void QGCMapWidget::handleMapWaypointEdit(mapcontrol::WayPointItem* waypoint) { - qDebug() << "UPDATING WP FROM MAP"; // Block circle updates Waypoint* wp = iconsToWaypoints.value(waypoint, NULL); // Protect from vicious double update cycle - if (firingWaypointChange == wp || !wp) return; + if (firingWaypointChange == wp) return; // Not in cycle, block now from entering it firingWaypointChange = wp; + qDebug() << "UPDATING WP FROM MAP"; // Update WP values internals::PointLatLng pos = waypoint->Coord(); @@ -376,6 +376,8 @@ void QGCMapWidget::handleMapWaypointEdit(mapcontrol::WayPointItem* waypoint) wp->setLongitude(pos.Lng()); wp->setAltitude(waypoint->Altitude()); + qDebug() << "WP: LAT:" << pos.Lat() << "LON:" << pos.Lng(); + emit waypointChanged(wp); firingWaypointChange = NULL; } diff --git a/src/ui/map/Waypoint2DIcon.cc b/src/ui/map/Waypoint2DIcon.cc index 181ef95026d51a1ccfe81cfd7646c00f3a3f36a2..ac7dfade7c05f639dea0696ab7e004cbb5a80985 100644 --- a/src/ui/map/Waypoint2DIcon.cc +++ b/src/ui/map/Waypoint2DIcon.cc @@ -35,7 +35,7 @@ Waypoint2DIcon::Waypoint2DIcon(mapcontrol::MapGraphicItem* map, mapcontrol::OPMa // drawIcon(mypen); this->setFlag(QGraphicsItem::ItemIgnoresTransformations,true); picture = QPixmap(radius+1, radius+1); - drawIcon(); + updateWaypoint(); } Waypoint2DIcon::~Waypoint2DIcon() @@ -63,6 +63,9 @@ void Waypoint2DIcon::updateWaypoint() SetHeading(waypoint->getYaw()); SetCoord(internals::PointLatLng(waypoint->getLatitude(), waypoint->getLongitude())); + + qDebug() << "UPDATING WP:" << waypoint->getId() << "LAT:" << waypoint->getLatitude() << "LON:" << waypoint->getLongitude(); + SetDescription(waypoint->getDescription()); SetAltitude(waypoint->getAltitude()); // FIXME Add SetNumber (currently needs a separate call)