mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-01 18:29:16 +01:00
LP-572 Add buttons to the right: Save, clear trail, PathPlan editor, Home set
This commit is contained in:
parent
40f669b232
commit
1fd91caa29
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>514</width>
|
<width>671</width>
|
||||||
<height>412</height>
|
<height>488</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -29,7 +29,16 @@
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@ -242,7 +251,16 @@ border-radius: 2px;
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@ -531,7 +549,7 @@ border-radius: 2px;
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="opmap.qrc">
|
<iconset resource="opmap.qrc">
|
||||||
<normaloff>:/opmap/images/uav.png</normaloff>:/opmap/images/button_uav.png</iconset>
|
<normaloff>:/opmap/images/button_uav.png</normaloff>:/opmap/images/button_uav.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
@ -569,7 +587,7 @@ border-radius: 2px;
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="opmap.qrc">
|
<iconset resource="opmap.qrc">
|
||||||
<normaloff>:/opmap/images/uav_heading.png</normaloff>:/opmap/images/button_uav_heading.png</iconset>
|
<normaloff>:/opmap/images/button_uav_heading.png</normaloff>:/opmap/images/button_uav_heading.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
@ -775,7 +793,16 @@ border-radius: 3px;
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@ -876,7 +903,16 @@ border-radius: 3px;
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
@ -1020,6 +1056,152 @@ border-radius: 3px;
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_7">
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonHomeSet">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Set HomeLocation to be used by the
|
||||||
|
autopilot or just pick the first GPS fix.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Home Set</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="opmap.qrc">
|
||||||
|
<normaloff>:/opmap/images/button_home_not_set.png</normaloff>
|
||||||
|
<normalon>:/opmap/images/button_home_set.png</normalon>:/opmap/images/button_home_not_set.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>28</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoRepeat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonIconOnly</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonClearUAVTrail">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Clear UAV trail</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Clear UAV trail</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="opmap.qrc">
|
||||||
|
<normaloff>:/opmap/images/button_clear_uavtrail.png</normaloff>:/opmap/images/button_clear_uavtrail.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>28</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoRepeat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonIconOnly</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_9">
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonPlanEditor">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Edit PathPlan</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Edit plan</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="opmap.qrc">
|
||||||
|
<normaloff>:/opmap/images/button_edit_plan.png</normaloff>:/opmap/images/button_edit_plan.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>28</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoRepeat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonIconOnly</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_10">
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -1036,6 +1218,54 @@ border-radius: 3px;
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_11">
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonSaveSettings">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Save current map settings</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Save settings</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="opmap.qrc">
|
||||||
|
<normaloff>:/opmap/images/button_save.png</normaloff>:/opmap/images/button_save.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>28</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoRepeat">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonIconOnly</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -32,6 +32,7 @@ OPMapGadget::OPMapGadget(QString classId, OPMapGadgetWidget *widget, QWidget *pa
|
|||||||
m_widget(widget), m_config(NULL)
|
m_widget(widget), m_config(NULL)
|
||||||
{
|
{
|
||||||
connect(m_widget, SIGNAL(defaultLocationAndZoomChanged(double, double, double)), this, SLOT(saveDefaultLocation(double, double, double)));
|
connect(m_widget, SIGNAL(defaultLocationAndZoomChanged(double, double, double)), this, SLOT(saveDefaultLocation(double, double, double)));
|
||||||
|
connect(m_widget, SIGNAL(defaultSafeAreaChanged(int, bool)), this, SLOT(saveDefaultSafeArea(int, bool)));
|
||||||
connect(m_widget, SIGNAL(overlayOpacityChanged(qreal)), this, SLOT(saveOpacity(qreal)));
|
connect(m_widget, SIGNAL(overlayOpacityChanged(qreal)), this, SLOT(saveOpacity(qreal)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,6 +49,14 @@ void OPMapGadget::saveDefaultLocation(double lng, double lat, double zoom)
|
|||||||
m_config->save();
|
m_config->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void OPMapGadget::saveDefaultSafeArea(int safe_area_radius, bool showSafeArea)
|
||||||
|
{
|
||||||
|
if (m_config) {
|
||||||
|
m_config->setSafeAreaRadius(safe_area_radius);
|
||||||
|
m_config->setShowSafeArea(showSafeArea);
|
||||||
|
m_config->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OPMapGadget::saveOpacity(qreal value)
|
void OPMapGadget::saveOpacity(qreal value)
|
||||||
{
|
{
|
||||||
|
@ -56,6 +56,7 @@ private:
|
|||||||
private slots:
|
private slots:
|
||||||
void saveOpacity(qreal value);
|
void saveOpacity(qreal value);
|
||||||
void saveDefaultLocation(double lng, double lat, double zoom);
|
void saveDefaultLocation(double lng, double lat, double zoom);
|
||||||
|
void saveDefaultSafeArea(int safe_area_radius, bool showSafeArea);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -216,6 +216,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
|||||||
connect(m_map, SIGNAL(OnWayPointDoubleClicked(WayPointItem *)), this, SLOT(wpDoubleClickEvent(WayPointItem *)));
|
connect(m_map, SIGNAL(OnWayPointDoubleClicked(WayPointItem *)), this, SLOT(wpDoubleClickEvent(WayPointItem *)));
|
||||||
m_map->SetCurrentPosition(m_home_position.coord); // set the map position
|
m_map->SetCurrentPosition(m_home_position.coord); // set the map position
|
||||||
m_map->Home->SetCoord(m_home_position.coord); // set the HOME position
|
m_map->Home->SetCoord(m_home_position.coord); // set the HOME position
|
||||||
|
m_map->Home->RefreshPos();
|
||||||
m_map->Nav->SetCoord(m_home_position.coord); // set the NAV position
|
m_map->Nav->SetCoord(m_home_position.coord); // set the NAV position
|
||||||
m_map->UAV->SetUAVPos(m_home_position.coord, 0.0); // set the UAV position
|
m_map->UAV->SetUAVPos(m_home_position.coord, 0.0); // set the UAV position
|
||||||
m_map->UAV->update();
|
m_map->UAV->update();
|
||||||
@ -885,6 +886,65 @@ void OPMapGadgetWidget::on_horizontalSliderZoom_sliderMoved(int position)
|
|||||||
setZoom(position);
|
setZoom(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPMapGadgetWidget::on_toolButtonHomeSet_clicked()
|
||||||
|
{
|
||||||
|
if (!m_widget || !m_map) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
double LLA[3];
|
||||||
|
|
||||||
|
bool checked = m_widget->toolButtonHomeSet->isChecked();
|
||||||
|
|
||||||
|
if (!m_telemetry_connected) {
|
||||||
|
m_widget->toolButtonHomeSet->setChecked(false);
|
||||||
|
checked = false;
|
||||||
|
// Default map center from default settings
|
||||||
|
LLA[0] = m_home_position.coord.Lat();
|
||||||
|
LLA[1] = m_home_position.coord.Lng();
|
||||||
|
LLA[2] = m_home_position.altitude;
|
||||||
|
} else {
|
||||||
|
bool set;
|
||||||
|
if (obum->getHomeLocation(set, LLA) < 0) {
|
||||||
|
return; // error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
obum->setHomeLocation(LLA, checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OPMapGadgetWidget::on_toolButtonClearUAVTrail_clicked()
|
||||||
|
{
|
||||||
|
if (!m_widget || !m_map) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_map->UAV->DeleteTrail();
|
||||||
|
if (m_map->GPS) {
|
||||||
|
m_map->GPS->DeleteTrail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OPMapGadgetWidget::on_toolButtonPlanEditor_clicked()
|
||||||
|
{
|
||||||
|
if (!m_widget || !m_map) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// open dialog
|
||||||
|
table->show();
|
||||||
|
// bring dialog to the front in case it was already open and hidden away
|
||||||
|
table->raise();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OPMapGadgetWidget::on_toolButtonSaveSettings_clicked()
|
||||||
|
{
|
||||||
|
if (!m_widget || !m_map) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit defaultLocationAndZoomChanged(m_map->CurrentPosition().Lng(), m_map->CurrentPosition().Lat(), m_map->ZoomTotal());
|
||||||
|
emit defaultSafeAreaChanged(m_map->Home->SafeArea(), m_map->Home->ShowSafeArea());
|
||||||
|
}
|
||||||
|
|
||||||
void OPMapGadgetWidget::on_toolButtonNormalMapMode_clicked()
|
void OPMapGadgetWidget::on_toolButtonNormalMapMode_clicked()
|
||||||
{
|
{
|
||||||
@ -944,6 +1004,7 @@ void OPMapGadgetWidget::homePositionUpdated(UAVObject *hp)
|
|||||||
} else {
|
} else {
|
||||||
HomePic = "home2_not_set.svg";
|
HomePic = "home2_not_set.svg";
|
||||||
}
|
}
|
||||||
|
m_widget->toolButtonHomeSet->setChecked(set);
|
||||||
|
|
||||||
SetHomePic(HomePic);
|
SetHomePic(HomePic);
|
||||||
setHome(internals::PointLatLng(LLA[0], LLA[1]), LLA[2]);
|
setHome(internals::PointLatLng(LLA[0], LLA[1]), LLA[2]);
|
||||||
@ -1021,6 +1082,7 @@ void OPMapGadgetWidget::setHome(internals::PointLatLng pos_lat_lon, double altit
|
|||||||
|
|
||||||
m_map->Home->SetCoord(m_home_position.coord);
|
m_map->Home->SetCoord(m_home_position.coord);
|
||||||
m_map->Home->SetAltitude(altitude);
|
m_map->Home->SetAltitude(altitude);
|
||||||
|
m_map->Home->SetToggleRefresh(true);
|
||||||
m_map->Home->RefreshPos();
|
m_map->Home->RefreshPos();
|
||||||
|
|
||||||
// move the magic waypoint to keep it within the safe area boundry
|
// move the magic waypoint to keep it within the safe area boundry
|
||||||
|
@ -123,6 +123,7 @@ public:
|
|||||||
bool applyHomeLocationOnMap();
|
bool applyHomeLocationOnMap();
|
||||||
signals:
|
signals:
|
||||||
void defaultLocationAndZoomChanged(double lng, double lat, double zoom);
|
void defaultLocationAndZoomChanged(double lng, double lat, double zoom);
|
||||||
|
void defaultSafeAreaChanged(int safe_area_radius, bool showSafeArea);
|
||||||
void overlayOpacityChanged(qreal);
|
void overlayOpacityChanged(qreal);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -159,6 +160,10 @@ private slots:
|
|||||||
void on_toolButtonNormalMapMode_clicked();
|
void on_toolButtonNormalMapMode_clicked();
|
||||||
void on_toolButtonHomeWaypoint_clicked();
|
void on_toolButtonHomeWaypoint_clicked();
|
||||||
void on_toolButtonMoveToWP_clicked();
|
void on_toolButtonMoveToWP_clicked();
|
||||||
|
void on_toolButtonHomeSet_clicked();
|
||||||
|
void on_toolButtonClearUAVTrail_clicked();
|
||||||
|
void on_toolButtonPlanEditor_clicked();
|
||||||
|
void on_toolButtonSaveSettings_clicked();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief signals received from the map object
|
* @brief signals received from the map object
|
||||||
|
Loading…
x
Reference in New Issue
Block a user