mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Enable waypoints on the map again
This commit is contained in:
parent
252f61bb8e
commit
f3e3a2f16b
@ -325,6 +325,21 @@ OPMapGadgetWidget::~OPMapGadgetWidget()
|
||||
m_map->SetShowUAV(false); // " "
|
||||
}
|
||||
|
||||
|
||||
m_waypoint_list_mutex.lock();
|
||||
foreach (t_waypoint *wp, m_waypoint_list)
|
||||
{
|
||||
if (!wp) continue;
|
||||
|
||||
|
||||
// todo:
|
||||
|
||||
|
||||
delete wp->map_wp_item;
|
||||
}
|
||||
m_waypoint_list_mutex.unlock();
|
||||
m_waypoint_list.clear();
|
||||
|
||||
if (m_map)
|
||||
{
|
||||
delete m_map;
|
||||
@ -442,6 +457,11 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
/*
|
||||
menu.addAction(findPlaceAct);
|
||||
|
||||
menu.addSeparator();
|
||||
*/
|
||||
QMenu safeArea("Safety Area definitions");
|
||||
// menu.addAction(showSafeAreaAct);
|
||||
QMenu safeAreaSubMenu(tr("Safe Area Radius") + " (" + QString::number(m_map->Home->SafeArea()) + "m)", this);
|
||||
@ -514,11 +534,12 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
// *********
|
||||
|
||||
qDebug() << "Testing mode";
|
||||
switch (m_map_mode)
|
||||
{
|
||||
case Normal_MapMode:
|
||||
qDebug() << "Normal mode";
|
||||
// only show the waypoint stuff if not in 'magic waypoint' mode
|
||||
/*
|
||||
menu.addSeparator()->setText(tr("Waypoints"));
|
||||
|
||||
menu.addAction(wayPointEditorAct);
|
||||
@ -539,7 +560,6 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
if (m_waypoint_list.count() > 0)
|
||||
menu.addAction(clearWayPointsAct); // we have waypoints
|
||||
m_waypoint_list_mutex.unlock();
|
||||
*/
|
||||
|
||||
break;
|
||||
|
||||
@ -1476,16 +1496,12 @@ void OPMapGadgetWidget::createActions()
|
||||
followUAVheadingAct->setChecked(false);
|
||||
connect(followUAVheadingAct, SIGNAL(toggled(bool)), this, SLOT(onFollowUAVheadingAct_toggled(bool)));
|
||||
|
||||
/*
|
||||
TODO: Waypoint support is disabled for v1.0
|
||||
*/
|
||||
|
||||
/*
|
||||
/* Waypoint stuff */
|
||||
wayPointEditorAct = new QAction(tr("&Waypoint editor"), this);
|
||||
wayPointEditorAct->setShortcut(tr("Ctrl+W"));
|
||||
wayPointEditorAct->setStatusTip(tr("Open the waypoint editor"));
|
||||
wayPointEditorAct->setEnabled(false); // temporary
|
||||
connect(wayPointEditorAct, SIGNAL(triggered()), this, SLOT(onOpenWayPointEditorAct_triggered()));
|
||||
//connect(wayPointEditorAct, SIGNAL(triggered()), this, SLOT(onOpenWayPointEditorAct_triggered()));
|
||||
|
||||
addWayPointAct = new QAction(tr("&Add waypoint"), this);
|
||||
addWayPointAct->setShortcut(tr("Ctrl+A"));
|
||||
@ -1512,7 +1528,6 @@ void OPMapGadgetWidget::createActions()
|
||||
clearWayPointsAct->setShortcut(tr("Ctrl+C"));
|
||||
clearWayPointsAct->setStatusTip(tr("Clear waypoints"));
|
||||
connect(clearWayPointsAct, SIGNAL(triggered()), this, SLOT(onClearWayPointsAct_triggered()));
|
||||
*/
|
||||
|
||||
homeMagicWaypointAct = new QAction(tr("Home magic waypoint"), this);
|
||||
homeMagicWaypointAct->setStatusTip(tr("Move the magic waypoint to the home position"));
|
||||
@ -1877,10 +1892,6 @@ void OPMapGadgetWidget::onUAVTrailDistanceActGroup_triggered(QAction *action)
|
||||
m_map->UAV->SetTrailDistance(trail_distance);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: unused for v1.0
|
||||
**/
|
||||
/*
|
||||
void OPMapGadgetWidget::onAddWayPointAct_triggered()
|
||||
{
|
||||
if (!m_widget || !m_map)
|
||||
@ -1894,7 +1905,7 @@ void OPMapGadgetWidget::onAddWayPointAct_triggered()
|
||||
// create a waypoint on the map at the last known mouse position
|
||||
t_waypoint *wp = new t_waypoint;
|
||||
wp->map_wp_item = NULL;
|
||||
wp->coord = context_menu_lat_lon;
|
||||
wp->coord = m_context_menu_lat_lon;
|
||||
wp->altitude = 0;
|
||||
wp->description = "";
|
||||
wp->locked = false;
|
||||
@ -1920,7 +1931,6 @@ void OPMapGadgetWidget::onAddWayPointAct_triggered()
|
||||
|
||||
m_waypoint_list_mutex.unlock();
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Called when the user asks to edit a waypoint from the map
|
||||
@ -1928,7 +1938,6 @@ void OPMapGadgetWidget::onAddWayPointAct_triggered()
|
||||
* TODO: should open an interface to edit waypoint properties, or
|
||||
* propagate the signal to a specific WP plugin (tbd).
|
||||
**/
|
||||
/*
|
||||
void OPMapGadgetWidget::onEditWayPointAct_triggered()
|
||||
{
|
||||
if (!m_widget || !m_map)
|
||||
@ -1944,12 +1953,7 @@ void OPMapGadgetWidget::onEditWayPointAct_triggered()
|
||||
|
||||
m_mouse_waypoint = NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* TODO: unused for v1.0
|
||||
*/
|
||||
/*
|
||||
void OPMapGadgetWidget::onLockWayPointAct_triggered()
|
||||
{
|
||||
if (!m_widget || !m_map || !m_mouse_waypoint)
|
||||
@ -1969,12 +1973,7 @@ void OPMapGadgetWidget::onLockWayPointAct_triggered()
|
||||
|
||||
m_mouse_waypoint = NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* TODO: unused for v1.0
|
||||
*/
|
||||
/*
|
||||
void OPMapGadgetWidget::onDeleteWayPointAct_triggered()
|
||||
{
|
||||
if (!m_widget || !m_map)
|
||||
@ -2008,31 +2007,29 @@ void OPMapGadgetWidget::onDeleteWayPointAct_triggered()
|
||||
|
||||
break;
|
||||
}
|
||||
//
|
||||
// foreach (t_waypoint *wp, m_waypoint_list)
|
||||
// {
|
||||
// if (!wp) continue;
|
||||
// if (!wp->map_wp_item || wp->map_wp_item != m_mouse_waypoint) continue;
|
||||
//
|
||||
// // delete the waypoint from the map
|
||||
// m_map->WPDelete(wp->map_wp_item);
|
||||
//
|
||||
// // delete the waypoint from our local waypoint list
|
||||
// m_waypoint_list.removeOne(wp);
|
||||
//
|
||||
// delete wp;
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
|
||||
foreach (t_waypoint *wp, m_waypoint_list)
|
||||
{
|
||||
if (!wp) continue;
|
||||
if (!wp->map_wp_item || wp->map_wp_item != m_mouse_waypoint) continue;
|
||||
|
||||
// delete the waypoint from the map
|
||||
m_map->WPDelete(wp->map_wp_item);
|
||||
|
||||
// delete the waypoint from our local waypoint list
|
||||
m_waypoint_list.removeOne(wp);
|
||||
|
||||
delete wp;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
m_mouse_waypoint = NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* TODO: No Waypoint support in v1.0
|
||||
*/
|
||||
/*
|
||||
void OPMapGadgetWidget::onClearWayPointsAct_triggered()
|
||||
{
|
||||
if (!m_widget || !m_map)
|
||||
@ -2056,7 +2053,6 @@ void OPMapGadgetWidget::onClearWayPointsAct_triggered()
|
||||
|
||||
m_waypoint_list.clear();
|
||||
}
|
||||
*/
|
||||
|
||||
void OPMapGadgetWidget::onHomeMagicWaypointAct_triggered()
|
||||
{
|
||||
|
@ -57,7 +57,7 @@
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OPMap_Widget;
|
||||
class OPMap_Widget;
|
||||
}
|
||||
|
||||
using namespace mapcontrol;
|
||||
@ -142,21 +142,21 @@ private slots:
|
||||
*
|
||||
* Some are currently disabled for the v1.0 plugin version.
|
||||
*/
|
||||
// void comboBoxFindPlace_returnPressed();
|
||||
// void on_toolButtonFindPlace_clicked();
|
||||
// void comboBoxFindPlace_returnPressed();
|
||||
// void on_toolButtonFindPlace_clicked();
|
||||
void on_toolButtonZoomM_clicked();
|
||||
void on_toolButtonZoomP_clicked();
|
||||
void on_toolButtonMapHome_clicked();
|
||||
void on_toolButtonMapUAV_clicked();
|
||||
void on_toolButtonMapUAVheading_clicked();
|
||||
void on_horizontalSliderZoom_sliderMoved(int position);
|
||||
// void on_toolButtonAddWaypoint_clicked();
|
||||
// void on_treeViewWaypoints_clicked(QModelIndex index);
|
||||
// void on_toolButtonHome_clicked();
|
||||
// void on_toolButtonNextWaypoint_clicked();
|
||||
// void on_toolButtonPrevWaypoint_clicked();
|
||||
// void on_toolButtonHoldPosition_clicked();
|
||||
// void on_toolButtonGo_clicked();
|
||||
// void on_toolButtonAddWaypoint_clicked();
|
||||
// void on_treeViewWaypoints_clicked(QModelIndex index);
|
||||
// void on_toolButtonHome_clicked();
|
||||
// void on_toolButtonNextWaypoint_clicked();
|
||||
// void on_toolButtonPrevWaypoint_clicked();
|
||||
// void on_toolButtonHoldPosition_clicked();
|
||||
// void on_toolButtonGo_clicked();
|
||||
void on_toolButtonMagicWaypointMapMode_clicked();
|
||||
void on_toolButtonNormalMapMode_clicked();
|
||||
void on_toolButtonHomeWaypoint_clicked();
|
||||
@ -191,7 +191,7 @@ private slots:
|
||||
void onCopyMouseLatLonToClipAct_triggered();
|
||||
void onCopyMouseLatToClipAct_triggered();
|
||||
void onCopyMouseLonToClipAct_triggered();
|
||||
// void onFindPlaceAct_triggered();
|
||||
// void onFindPlaceAct_triggered();
|
||||
void onShowCompassAct_toggled(bool show);
|
||||
void onShowDiagnostics_toggled(bool show);
|
||||
void onShowUAVAct_toggled(bool show);
|
||||
@ -206,14 +206,12 @@ private slots:
|
||||
void onGoUAVAct_triggered();
|
||||
void onFollowUAVpositionAct_toggled(bool checked);
|
||||
void onFollowUAVheadingAct_toggled(bool checked);
|
||||
/*
|
||||
void onOpenWayPointEditorAct_triggered();
|
||||
//void onOpenWayPointEditorAct_triggered();
|
||||
void onAddWayPointAct_triggered();
|
||||
void onEditWayPointAct_triggered();
|
||||
void onLockWayPointAct_triggered();
|
||||
void onDeleteWayPointAct_triggered();
|
||||
void onClearWayPointsAct_triggered();
|
||||
*/
|
||||
void onMapModeActGroup_triggered(QAction *action);
|
||||
void onZoomActGroup_triggered(QAction *action);
|
||||
void onHomeMagicWaypointAct_triggered();
|
||||
@ -300,14 +298,12 @@ private:
|
||||
QAction *goUAVAct;
|
||||
QAction *followUAVpositionAct;
|
||||
QAction *followUAVheadingAct;
|
||||
/*
|
||||
QAction *wayPointEditorAct;
|
||||
QAction *addWayPointAct;
|
||||
QAction *editWayPointAct;
|
||||
QAction *lockWayPointAct;
|
||||
QAction *deleteWayPointAct;
|
||||
QAction *clearWayPointsAct;
|
||||
*/
|
||||
QAction *homeMagicWaypointAct;
|
||||
|
||||
QAction *showSafeAreaAct;
|
||||
|
Loading…
x
Reference in New Issue
Block a user