1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

Add a long comment describing pathcompiler and store the index for each

waypoint in their description.
This commit is contained in:
James Cotton 2012-06-02 13:28:10 -05:00
parent 7492c8fec8
commit f7e0fc1065
2 changed files with 15 additions and 1 deletions

View File

@ -2427,14 +2427,16 @@ void OPMapGadgetWidget::SetUavPic(QString UAVPic)
void OPMapGadgetWidget::doVisualizationChanged(QList<PathCompiler::waypoint> waypoints)
{
m_map->WPDeleteAll();
int index = 0;
foreach (PathCompiler::waypoint waypoint, waypoints) {
internals::PointLatLng position(waypoint.latitude, waypoint.longitude);
WayPointItem * wayPointItem = m_map->WPCreate(position, 0, "Waypoint");
WayPointItem * wayPointItem = m_map->WPCreate(position, 0, QString(index));
Q_ASSERT(wayPointItem);
if(wayPointItem) {
wayPointItem->setFlag(QGraphicsItem::ItemIsMovable, false);
wayPointItem->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker1.png"));
index++;
}
}
}

View File

@ -40,6 +40,18 @@
* UAVObject representation on the flight controller. It also can support multiple
* ways of converting a path from what the user clicked to the underlying representation
* to achieve the desired end flight trajectory
*
* So the chain of data for the map lib is:
* FC <-> PathCompiler <-> OPMapGadget <-> OPMapLib
*
* The goal is that PathCompiler be as state free as is possible. Eventually for more
* complicated path compilation this will probably not be achievable. That means it
* should not cache a copy of waypoints locally if that can be avoided (i.e. it should
* refer directly to what is stored on the FC).
*
* For the visualization to have the ability to manipulate the path though it needs to
* be able to map unambiguously from the graphical items to the internal waypoints. It
* must cache a lookup from the graphical item to the index from this tool.
*/
class PathCompiler : public QObject
{