1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-03 11:24:10 +01:00

Fix waypoint visualization in OPMap to work for multiple maps

This commit is contained in:
James Cotton 2012-06-15 15:51:12 -05:00
parent 5b2f4d6d91
commit be360d3c21
3 changed files with 3 additions and 4 deletions

View File

@ -2541,12 +2541,14 @@ void OPMapGadgetWidget::doVisualizationChanged(QList<PathCompiler::waypoint> way
WayPointItem * wayPointItem = m_map->WPCreate(position, 0, QString(index)); WayPointItem * wayPointItem = m_map->WPCreate(position, 0, QString(index));
Q_ASSERT(wayPointItem); Q_ASSERT(wayPointItem);
if(wayPointItem) { if(wayPointItem) {
wayPointItem->SetNumber(index);
wayPointItem->setFlag(QGraphicsItem::ItemIsMovable, true); wayPointItem->setFlag(QGraphicsItem::ItemIsMovable, true);
wayPointItem->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker1.png")); wayPointItem->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker1.png"));
index++; index++;
} }
connect(wayPointItem, SIGNAL(WPDropped(WayPointItem*)), this, SLOT(WPDropped(WayPointItem*))); connect(wayPointItem, SIGNAL(WPDropped(WayPointItem*)), this, SLOT(WPDropped(WayPointItem*)));
} }
} }
/** /**

View File

@ -213,7 +213,6 @@ void PathCompiler::doDelWaypoint(int index)
int numWaypoints = objManager->getNumInstances(waypoint->getObjID()); int numWaypoints = objManager->getNumInstances(waypoint->getObjID());
for (int i = index; i < numWaypoints - 1; i++) { for (int i = index; i < numWaypoints - 1; i++) {
qDebug() << "Copying from" << i+1 << "to" << i;
Waypoint *waypointDest = Waypoint::GetInstance(objManager, i); Waypoint *waypointDest = Waypoint::GetInstance(objManager, i);
Q_ASSERT(waypointDest); Q_ASSERT(waypointDest);
@ -232,7 +231,6 @@ void PathCompiler::doDelWaypoint(int index)
// Set the second to last waypoint to stop (and last for safety) // Set the second to last waypoint to stop (and last for safety)
// the functional equivalent to deleting // the functional equivalent to deleting
for (int i = numWaypoints - 2; i < numWaypoints; i++) { for (int i = numWaypoints - 2; i < numWaypoints; i++) {
qDebug() << "Stopping" << i;
waypoint = Waypoint::GetInstance(objManager, i); waypoint = Waypoint::GetInstance(objManager, i);
Q_ASSERT(waypoint); Q_ASSERT(waypoint);
if (waypoint) { if (waypoint) {
@ -274,8 +272,6 @@ void PathCompiler::doDelAllWaypoints()
*/ */
void PathCompiler::doUpdateFromUAV(UAVObject *obj) void PathCompiler::doUpdateFromUAV(UAVObject *obj)
{ {
static QList<waypoint> previousWaypoints;
UAVObjectManager *objManager = getObjectManager(); UAVObjectManager *objManager = getObjectManager();
if (!objManager) if (!objManager)
return; return;

View File

@ -88,6 +88,7 @@ private:
//! Convert a UAVO waypoint to the local structure //! Convert a UAVO waypoint to the local structure
Waypoint::DataFields InternalToUavo(waypoint); Waypoint::DataFields InternalToUavo(waypoint);
QList <waypoint> previousWaypoints;
signals: signals:
/** /**
* Indicates something changed the waypoints and the map should * Indicates something changed the waypoints and the map should