From e869bac6d624ddaaf7314440b02fb8d12e09d8c2 Mon Sep 17 00:00:00 2001 From: lm Date: Sun, 3 Jul 2011 23:25:42 +0200 Subject: [PATCH] Minor tweaks on waypoint interaction. Suspected bug in OPMapControl mouse position handling. --- src/ui/map/QGCMapWidget.cc | 6 ++++-- src/ui/map/Waypoint2DIcon.cc | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ui/map/QGCMapWidget.cc b/src/ui/map/QGCMapWidget.cc index 1314fd927..2dae96830 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 181ef9502..ac7dfade7 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) -- 2.22.0