mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Added MoveToMagicWaypointPosition function and GUI button.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1928 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
676166f045
commit
cad8644a47
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.2 KiB |
BIN
ground/src/plugins/opmap/images/move_to_wp.png
Normal file
BIN
ground/src/plugins/opmap/images/move_to_wp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 765 B |
@ -22,7 +22,8 @@
|
||||
<file>images/minus.png</file>
|
||||
<file>images/plus.png</file>
|
||||
<file>images/waypoint_marker3.png</file>
|
||||
<file>images/center_wp.png</file>
|
||||
<file>images/home_wp.png</file>
|
||||
<file>images/move_to_wp.png</file>
|
||||
<file>images/center_wp.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -380,6 +380,32 @@ border-radius: 2px;
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonMoveToWP">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Click to move the UAV to the magic waypoint position</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Move to WP</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<normaloff>:/opmap/images/move_to_wp.png</normaloff>:/opmap/images/move_to_wp.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonHomeWaypoint">
|
||||
<property name="sizePolicy">
|
||||
|
@ -189,6 +189,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
m_widget->toolButtonNormalMapMode->setChecked(true);
|
||||
m_widget->toolButtonHomeWaypoint->setEnabled(false);
|
||||
m_widget->toolButtonCenterWaypoint->setEnabled(false);
|
||||
m_widget->toolButtonMoveToWP->setEnabled(false);
|
||||
break;
|
||||
|
||||
case MagicWaypoint_MapMode:
|
||||
@ -196,6 +197,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
m_widget->toolButtonMagicWaypointMapMode->setChecked(true);
|
||||
m_widget->toolButtonHomeWaypoint->setEnabled(true);
|
||||
m_widget->toolButtonCenterWaypoint->setEnabled(true);
|
||||
m_widget->toolButtonMoveToWP->setEnabled(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -204,6 +206,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
m_widget->toolButtonNormalMapMode->setChecked(true);
|
||||
m_widget->toolButtonHomeWaypoint->setEnabled(false);
|
||||
m_widget->toolButtonCenterWaypoint->setEnabled(false);
|
||||
m_widget->toolButtonMoveToWP->setEnabled(false);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -446,7 +449,6 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
return; // not a mouse click event
|
||||
|
||||
// current mouse position
|
||||
// QPoint p = m_map->mapFromGlobal(QCursor::pos());
|
||||
QPoint p = m_map->mapFromGlobal(event->globalPos());
|
||||
context_menu_lat_lon = m_map->GetFromLocalToLatLng(p);
|
||||
// context_menu_lat_lon = m_map->currentMousePosition();
|
||||
@ -472,7 +474,7 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
QMenu menu(this);
|
||||
|
||||
menu.addAction(closeAct);
|
||||
menu.addAction(closeAct1);
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
@ -610,7 +612,9 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
// *********
|
||||
|
||||
// menu.addSeparator();
|
||||
menu.addSeparator();
|
||||
|
||||
menu.addAction(closeAct2);
|
||||
|
||||
menu.exec(event->globalPos()); // popup the menu
|
||||
|
||||
@ -832,6 +836,9 @@ void OPMapGadgetWidget::WPValuesChanged(WayPointItem *waypoint)
|
||||
magic_waypoint.coord = waypoint->Coord();
|
||||
magic_waypoint.altitude = waypoint->Altitude();
|
||||
magic_waypoint.description = waypoint->Description();
|
||||
|
||||
// move the UAV to the magic waypoint position
|
||||
// moveToMagicWaypointPosition();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1069,6 +1076,11 @@ void OPMapGadgetWidget::on_toolButtonCenterWaypoint_clicked()
|
||||
centerMagicWaypoint();
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::on_toolButtonMoveToWP_clicked()
|
||||
{
|
||||
moveToMagicWaypointPosition();
|
||||
}
|
||||
|
||||
// *************************************************************************************
|
||||
// public functions
|
||||
|
||||
@ -1244,6 +1256,7 @@ void OPMapGadgetWidget::setMapMode(opMapModeType mode)
|
||||
|
||||
m_widget->toolButtonHomeWaypoint->setEnabled(false);
|
||||
m_widget->toolButtonCenterWaypoint->setEnabled(false);
|
||||
m_widget->toolButtonMoveToWP->setEnabled(false);
|
||||
|
||||
// delete the magic waypoint from the map
|
||||
if (magic_waypoint.map_wp_item)
|
||||
@ -1281,6 +1294,7 @@ void OPMapGadgetWidget::setMapMode(opMapModeType mode)
|
||||
|
||||
m_widget->toolButtonHomeWaypoint->setEnabled(true);
|
||||
m_widget->toolButtonCenterWaypoint->setEnabled(true);
|
||||
m_widget->toolButtonMoveToWP->setEnabled(true);
|
||||
|
||||
// delete the normal waypoints from the map
|
||||
m_waypoint_list_mutex.lock();
|
||||
@ -1317,9 +1331,11 @@ void OPMapGadgetWidget::createActions()
|
||||
// ***********************
|
||||
// create menu actions
|
||||
|
||||
closeAct = new QAction(tr("&Close menu"), this);
|
||||
// closeAct->setShortcuts(QKeySequence::New);
|
||||
closeAct->setStatusTip(tr("Close the context menu"));
|
||||
closeAct1 = new QAction(tr("Close menu"), this);
|
||||
closeAct1->setStatusTip(tr("Close the context menu"));
|
||||
|
||||
closeAct2 = new QAction(tr("Close menu"), this);
|
||||
closeAct2->setStatusTip(tr("Close the context menu"));
|
||||
|
||||
reloadAct = new QAction(tr("&Reload map"), this);
|
||||
reloadAct->setShortcut(tr("F5"));
|
||||
@ -1979,6 +1995,25 @@ void OPMapGadgetWidget::centerMagicWaypoint()
|
||||
magic_waypoint.map_wp_item->SetCoord(magic_waypoint.coord);
|
||||
}
|
||||
|
||||
// *************************************************************************************
|
||||
// move the UAV to the magic waypoint position
|
||||
|
||||
void OPMapGadgetWidget::moveToMagicWaypointPosition()
|
||||
{
|
||||
if (!m_widget || !m_map)
|
||||
return;
|
||||
|
||||
if (m_map_mode != MagicWaypoint_MapMode)
|
||||
return;
|
||||
|
||||
// internals::PointLatLng coord = magic_waypoint.coord;
|
||||
// double altitude = magic_waypoint.altitude;
|
||||
|
||||
|
||||
// ToDo:
|
||||
|
||||
}
|
||||
|
||||
// *************************************************************************************
|
||||
// temporary until an object is created for managing the save/restore
|
||||
|
||||
|
@ -157,6 +157,7 @@ private slots:
|
||||
void on_toolButtonNormalMapMode_clicked();
|
||||
void on_toolButtonHomeWaypoint_clicked();
|
||||
void on_toolButtonCenterWaypoint_clicked();
|
||||
void on_toolButtonMoveToWP_clicked();
|
||||
|
||||
/**
|
||||
* @brief signals received from the map object
|
||||
@ -267,7 +268,8 @@ private:
|
||||
|
||||
void createActions();
|
||||
|
||||
QAction *closeAct;
|
||||
QAction *closeAct1;
|
||||
QAction *closeAct2;
|
||||
QAction *reloadAct;
|
||||
QAction *copyMouseLatLonToClipAct;
|
||||
QAction *copyMouseLatToClipAct;
|
||||
@ -314,6 +316,8 @@ private:
|
||||
void homeMagicWaypoint();
|
||||
void centerMagicWaypoint();
|
||||
|
||||
void moveToMagicWaypointPosition();
|
||||
|
||||
void loadComboBoxLines(QComboBox *comboBox, QString filename);
|
||||
void saveComboBoxLines(QComboBox *comboBox, QString filename);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user