mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Connect OPMapGadget to the PathCompiler so any changes in UAVOs are reflected
on the map
This commit is contained in:
parent
e348a1a582
commit
6b662f9b9e
@ -40,7 +40,7 @@
|
||||
|
||||
#include "homelocation.h"
|
||||
#include "positionactual.h"
|
||||
|
||||
#include <pathcompiler.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "utils/stylehelper.h"
|
||||
@ -145,6 +145,10 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
m_magic_waypoint.time_seconds = 0;
|
||||
m_magic_waypoint.hold_time_seconds = 0;
|
||||
|
||||
// Connect to the path compiler to get updates from the waypoints
|
||||
pathCompiler = new PathCompiler(this);
|
||||
connect(pathCompiler,SIGNAL(visualizationChanged(QList<PathCompiler::waypoint>)),
|
||||
this, SLOT(doVisualizationChanged(QList<PathCompiler::waypoint>)));
|
||||
// **************
|
||||
// create the widget that holds the user controls and the map
|
||||
|
||||
@ -2416,3 +2420,21 @@ void OPMapGadgetWidget::SetUavPic(QString UAVPic)
|
||||
{
|
||||
m_map->SetUavPic(UAVPic);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from path compiler whenever the path to visualize has changed
|
||||
*/
|
||||
void OPMapGadgetWidget::doVisualizationChanged(QList<PathCompiler::waypoint> waypoints)
|
||||
{
|
||||
m_map->WPDeleteAll();
|
||||
foreach (PathCompiler::waypoint waypoint, waypoints) {
|
||||
internals::PointLatLng position(waypoint.latitude, waypoint.longitude);
|
||||
|
||||
WayPointItem * wayPointItem = m_map->WPCreate(position, 0, "Waypoint");
|
||||
Q_ASSERT(wayPointItem);
|
||||
if(wayPointItem) {
|
||||
wayPointItem->setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
wayPointItem->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker1.png"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "uavobject.h"
|
||||
#include "objectpersistence.h"
|
||||
|
||||
#include <pathcompiler.h>
|
||||
// ******************************************************
|
||||
|
||||
namespace Ui
|
||||
@ -182,6 +183,7 @@ private slots:
|
||||
void WPValuesChanged(WayPointItem* waypoint);
|
||||
void WPInserted(int const& number, WayPointItem* waypoint);
|
||||
void WPDeleted(int const& number);
|
||||
void doVisualizationChanged(QList<PathCompiler::waypoint>);
|
||||
|
||||
/**
|
||||
* @brief mouse right click context menu signals
|
||||
@ -267,7 +269,9 @@ private:
|
||||
|
||||
mapcontrol::WayPointItem *m_mouse_waypoint;
|
||||
|
||||
PathCompiler *pathCompiler;
|
||||
QList<t_waypoint *> m_waypoint_list;
|
||||
|
||||
QMutex m_waypoint_list_mutex;
|
||||
|
||||
QMutex m_map_mutex;
|
||||
|
Loading…
Reference in New Issue
Block a user