mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +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/minus.png</file>
|
||||||
<file>images/plus.png</file>
|
<file>images/plus.png</file>
|
||||||
<file>images/waypoint_marker3.png</file>
|
<file>images/waypoint_marker3.png</file>
|
||||||
<file>images/center_wp.png</file>
|
|
||||||
<file>images/home_wp.png</file>
|
<file>images/home_wp.png</file>
|
||||||
|
<file>images/move_to_wp.png</file>
|
||||||
|
<file>images/center_wp.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -380,6 +380,32 @@ border-radius: 2px;
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButtonHomeWaypoint">
|
<widget class="QToolButton" name="toolButtonHomeWaypoint">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -189,6 +189,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
|||||||
m_widget->toolButtonNormalMapMode->setChecked(true);
|
m_widget->toolButtonNormalMapMode->setChecked(true);
|
||||||
m_widget->toolButtonHomeWaypoint->setEnabled(false);
|
m_widget->toolButtonHomeWaypoint->setEnabled(false);
|
||||||
m_widget->toolButtonCenterWaypoint->setEnabled(false);
|
m_widget->toolButtonCenterWaypoint->setEnabled(false);
|
||||||
|
m_widget->toolButtonMoveToWP->setEnabled(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MagicWaypoint_MapMode:
|
case MagicWaypoint_MapMode:
|
||||||
@ -196,6 +197,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
|||||||
m_widget->toolButtonMagicWaypointMapMode->setChecked(true);
|
m_widget->toolButtonMagicWaypointMapMode->setChecked(true);
|
||||||
m_widget->toolButtonHomeWaypoint->setEnabled(true);
|
m_widget->toolButtonHomeWaypoint->setEnabled(true);
|
||||||
m_widget->toolButtonCenterWaypoint->setEnabled(true);
|
m_widget->toolButtonCenterWaypoint->setEnabled(true);
|
||||||
|
m_widget->toolButtonMoveToWP->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -204,6 +206,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
|||||||
m_widget->toolButtonNormalMapMode->setChecked(true);
|
m_widget->toolButtonNormalMapMode->setChecked(true);
|
||||||
m_widget->toolButtonHomeWaypoint->setEnabled(false);
|
m_widget->toolButtonHomeWaypoint->setEnabled(false);
|
||||||
m_widget->toolButtonCenterWaypoint->setEnabled(false);
|
m_widget->toolButtonCenterWaypoint->setEnabled(false);
|
||||||
|
m_widget->toolButtonMoveToWP->setEnabled(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,7 +449,6 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
return; // not a mouse click event
|
return; // not a mouse click event
|
||||||
|
|
||||||
// current mouse position
|
// current mouse position
|
||||||
// QPoint p = m_map->mapFromGlobal(QCursor::pos());
|
|
||||||
QPoint p = m_map->mapFromGlobal(event->globalPos());
|
QPoint p = m_map->mapFromGlobal(event->globalPos());
|
||||||
context_menu_lat_lon = m_map->GetFromLocalToLatLng(p);
|
context_menu_lat_lon = m_map->GetFromLocalToLatLng(p);
|
||||||
// context_menu_lat_lon = m_map->currentMousePosition();
|
// context_menu_lat_lon = m_map->currentMousePosition();
|
||||||
@ -472,7 +474,7 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
|
|
||||||
QMenu menu(this);
|
QMenu menu(this);
|
||||||
|
|
||||||
menu.addAction(closeAct);
|
menu.addAction(closeAct1);
|
||||||
|
|
||||||
menu.addSeparator();
|
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
|
menu.exec(event->globalPos()); // popup the menu
|
||||||
|
|
||||||
@ -832,6 +836,9 @@ void OPMapGadgetWidget::WPValuesChanged(WayPointItem *waypoint)
|
|||||||
magic_waypoint.coord = waypoint->Coord();
|
magic_waypoint.coord = waypoint->Coord();
|
||||||
magic_waypoint.altitude = waypoint->Altitude();
|
magic_waypoint.altitude = waypoint->Altitude();
|
||||||
magic_waypoint.description = waypoint->Description();
|
magic_waypoint.description = waypoint->Description();
|
||||||
|
|
||||||
|
// move the UAV to the magic waypoint position
|
||||||
|
// moveToMagicWaypointPosition();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1069,6 +1076,11 @@ void OPMapGadgetWidget::on_toolButtonCenterWaypoint_clicked()
|
|||||||
centerMagicWaypoint();
|
centerMagicWaypoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPMapGadgetWidget::on_toolButtonMoveToWP_clicked()
|
||||||
|
{
|
||||||
|
moveToMagicWaypointPosition();
|
||||||
|
}
|
||||||
|
|
||||||
// *************************************************************************************
|
// *************************************************************************************
|
||||||
// public functions
|
// public functions
|
||||||
|
|
||||||
@ -1244,6 +1256,7 @@ void OPMapGadgetWidget::setMapMode(opMapModeType mode)
|
|||||||
|
|
||||||
m_widget->toolButtonHomeWaypoint->setEnabled(false);
|
m_widget->toolButtonHomeWaypoint->setEnabled(false);
|
||||||
m_widget->toolButtonCenterWaypoint->setEnabled(false);
|
m_widget->toolButtonCenterWaypoint->setEnabled(false);
|
||||||
|
m_widget->toolButtonMoveToWP->setEnabled(false);
|
||||||
|
|
||||||
// delete the magic waypoint from the map
|
// delete the magic waypoint from the map
|
||||||
if (magic_waypoint.map_wp_item)
|
if (magic_waypoint.map_wp_item)
|
||||||
@ -1281,6 +1294,7 @@ void OPMapGadgetWidget::setMapMode(opMapModeType mode)
|
|||||||
|
|
||||||
m_widget->toolButtonHomeWaypoint->setEnabled(true);
|
m_widget->toolButtonHomeWaypoint->setEnabled(true);
|
||||||
m_widget->toolButtonCenterWaypoint->setEnabled(true);
|
m_widget->toolButtonCenterWaypoint->setEnabled(true);
|
||||||
|
m_widget->toolButtonMoveToWP->setEnabled(true);
|
||||||
|
|
||||||
// delete the normal waypoints from the map
|
// delete the normal waypoints from the map
|
||||||
m_waypoint_list_mutex.lock();
|
m_waypoint_list_mutex.lock();
|
||||||
@ -1317,9 +1331,11 @@ void OPMapGadgetWidget::createActions()
|
|||||||
// ***********************
|
// ***********************
|
||||||
// create menu actions
|
// create menu actions
|
||||||
|
|
||||||
closeAct = new QAction(tr("&Close menu"), this);
|
closeAct1 = new QAction(tr("Close menu"), this);
|
||||||
// closeAct->setShortcuts(QKeySequence::New);
|
closeAct1->setStatusTip(tr("Close the context menu"));
|
||||||
closeAct->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 = new QAction(tr("&Reload map"), this);
|
||||||
reloadAct->setShortcut(tr("F5"));
|
reloadAct->setShortcut(tr("F5"));
|
||||||
@ -1979,6 +1995,25 @@ void OPMapGadgetWidget::centerMagicWaypoint()
|
|||||||
magic_waypoint.map_wp_item->SetCoord(magic_waypoint.coord);
|
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
|
// temporary until an object is created for managing the save/restore
|
||||||
|
|
||||||
|
@ -157,6 +157,7 @@ private slots:
|
|||||||
void on_toolButtonNormalMapMode_clicked();
|
void on_toolButtonNormalMapMode_clicked();
|
||||||
void on_toolButtonHomeWaypoint_clicked();
|
void on_toolButtonHomeWaypoint_clicked();
|
||||||
void on_toolButtonCenterWaypoint_clicked();
|
void on_toolButtonCenterWaypoint_clicked();
|
||||||
|
void on_toolButtonMoveToWP_clicked();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief signals received from the map object
|
* @brief signals received from the map object
|
||||||
@ -267,7 +268,8 @@ private:
|
|||||||
|
|
||||||
void createActions();
|
void createActions();
|
||||||
|
|
||||||
QAction *closeAct;
|
QAction *closeAct1;
|
||||||
|
QAction *closeAct2;
|
||||||
QAction *reloadAct;
|
QAction *reloadAct;
|
||||||
QAction *copyMouseLatLonToClipAct;
|
QAction *copyMouseLatLonToClipAct;
|
||||||
QAction *copyMouseLatToClipAct;
|
QAction *copyMouseLatToClipAct;
|
||||||
@ -314,6 +316,8 @@ private:
|
|||||||
void homeMagicWaypoint();
|
void homeMagicWaypoint();
|
||||||
void centerMagicWaypoint();
|
void centerMagicWaypoint();
|
||||||
|
|
||||||
|
void moveToMagicWaypointPosition();
|
||||||
|
|
||||||
void loadComboBoxLines(QComboBox *comboBox, QString filename);
|
void loadComboBoxLines(QComboBox *comboBox, QString filename);
|
||||||
void saveComboBoxLines(QComboBox *comboBox, QString filename);
|
void saveComboBoxLines(QComboBox *comboBox, QString filename);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user