mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
PFD terrain view: switch between GPS and predefined positions.
This commit is contained in:
parent
ec3919d2b7
commit
9d884ca12c
@ -1,7 +1,6 @@
|
||||
import Qt 4.7
|
||||
import "."
|
||||
import org.OpenPilot 1.0
|
||||
//import "/home/dima/work/RC/OsgEarthQml-build-desktop-Qt_4_8_1_in_PATH__System__Debug"
|
||||
|
||||
Rectangle {
|
||||
color: "#666666"
|
||||
@ -23,6 +22,27 @@ Rectangle {
|
||||
anchors.centerIn: parent
|
||||
clip: true
|
||||
|
||||
OsgEarth {
|
||||
id: earthView
|
||||
|
||||
anchors.fill: parent
|
||||
sceneFile: qmlWidget.earthFile
|
||||
visible: qmlWidget.terrainEnabled
|
||||
|
||||
fieldOfView: 90
|
||||
|
||||
yaw: AttitudeActual.Yaw
|
||||
pitch: AttitudeActual.Pitch
|
||||
roll: AttitudeActual.Roll
|
||||
|
||||
latitude: qmlWidget.actualPositionUsed ?
|
||||
GPSPosition.Latitude/10000000.0 : qmlWidget.latitude
|
||||
longitude: qmlWidget.actualPositionUsed ?
|
||||
GPSPosition.Longitude/10000000.0 : qmlWidget.longitude
|
||||
altitude: qmlWidget.actualPositionUsed ?
|
||||
GPSPosition.Altitude : qmlWidget.altitude
|
||||
}
|
||||
|
||||
Image {
|
||||
id: world
|
||||
source: "image://svg/pfd.svg!world"
|
||||
@ -44,26 +64,6 @@ Rectangle {
|
||||
]
|
||||
}
|
||||
|
||||
OsgEarth {
|
||||
id: earthView
|
||||
|
||||
anchors.fill: parent
|
||||
sceneFile: qmlWidget.earthFile
|
||||
visible: qmlWidget.terrainEnabled
|
||||
|
||||
fieldOfView: 90
|
||||
|
||||
yaw: AttitudeActual.Yaw
|
||||
pitch: AttitudeActual.Pitch
|
||||
roll: AttitudeActual.Roll
|
||||
|
||||
|
||||
latitude: -27.935474
|
||||
longitude: 153.187147
|
||||
altitude: 3000
|
||||
//altitude: PositionActual.Down
|
||||
}
|
||||
|
||||
Image {
|
||||
id: rollscale
|
||||
source: "image://svg/pfd.svg!rollscale"
|
||||
|
@ -1698,9 +1698,14 @@
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<actualPositionUsed>false</actualPositionUsed>
|
||||
<altitude>2000</altitude>
|
||||
<cacheOnly>false</cacheOnly>
|
||||
<earthFile>%%DATAPATH%%pfd/pfd/default/readymap.earth</earthFile>
|
||||
<latitude>46.671478</latitude>
|
||||
<longitude>10.158932</longitude>
|
||||
<qmlFile>%%DATAPATH%%pfd/pfd/default/Pfd.qml</qmlFile>
|
||||
<terrainEnabled>false</terrainEnabled>
|
||||
<qmlFile>%%DATAPATH%%pfd/default/Pfd.qml</qmlFile>
|
||||
<earthFile>%%DATAPATH%%pfd/default/srtm.earth</earthFile>
|
||||
</data>
|
||||
</NoTerrain>
|
||||
<Terrain>
|
||||
@ -1709,9 +1714,14 @@
|
||||
<version>0.0.0</version>
|
||||
</configInfo>
|
||||
<data>
|
||||
<actualPositionUsed>false</actualPositionUsed>
|
||||
<altitude>2000</altitude>
|
||||
<cacheOnly>false</cacheOnly>
|
||||
<earthFile>%%DATAPATH%%pfd/pfd/default/readymap.earth</earthFile>
|
||||
<latitude>46.671478</latitude>
|
||||
<longitude>10.158932</longitude>
|
||||
<qmlFile>%%DATAPATH%%pfd/pfd/default/Pfd.qml</qmlFile>
|
||||
<terrainEnabled>true</terrainEnabled>
|
||||
<qmlFile>%%DATAPATH%%pfd/default/Pfd.qml</qmlFile>
|
||||
<earthFile>%%DATAPATH%%pfd/default/srtm.earth</earthFile>
|
||||
</data>
|
||||
</Terrain>
|
||||
</PfdQmlGadget>
|
||||
|
@ -41,4 +41,17 @@ void PfdQmlGadget::loadConfiguration(IUAVGadgetConfiguration* config)
|
||||
m_widget->setQmlFile(m->qmlFile());
|
||||
m_widget->setEarthFile(m->earthFile());
|
||||
m_widget->setTerrainEnabled(m->terrainEnabled());
|
||||
m_widget->setActualPositionUsed(m->actualPositionUsed());
|
||||
m_widget->setLatitude(m->latitude());
|
||||
m_widget->setLongitude(m->longitude());
|
||||
m_widget->setAltitude(m->altitude());
|
||||
|
||||
//setting OSGEARTH_CACHE_ONLY seems to work the most reliably
|
||||
//between osgEarth versions I tried
|
||||
if (m->cacheOnly()) {
|
||||
qputenv("OSGEARTH_CACHE_ONLY", "true");
|
||||
} else {
|
||||
//how portable it is?
|
||||
unsetenv("OSGEARTH_CACHE_ONLY");
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,12 @@ PfdQmlGadgetConfiguration::PfdQmlGadgetConfiguration(QString classId, QSettings
|
||||
IUAVGadgetConfiguration(classId, parent),
|
||||
m_qmlFile("Unknown"),
|
||||
m_earthFile("Unknown"),
|
||||
m_terrainEnabled(true)
|
||||
m_terrainEnabled(true),
|
||||
m_actualPositionUsed(false),
|
||||
m_latitude(0),
|
||||
m_longitude(0),
|
||||
m_altitude(0),
|
||||
m_cacheOnly(false)
|
||||
{
|
||||
//if a saved configuration exists load it
|
||||
if(qSettings != 0) {
|
||||
@ -36,6 +41,11 @@ PfdQmlGadgetConfiguration::PfdQmlGadgetConfiguration(QString classId, QSettings
|
||||
m_earthFile=Utils::PathUtils().InsertDataPath(m_earthFile);
|
||||
|
||||
m_terrainEnabled = qSettings->value("terrainEnabled").toBool();
|
||||
m_actualPositionUsed = qSettings->value("actualPositionUsed").toBool();
|
||||
m_latitude = qSettings->value("latitude").toDouble();
|
||||
m_longitude = qSettings->value("longitude").toDouble();
|
||||
m_altitude = qSettings->value("altitude").toDouble();
|
||||
m_cacheOnly = qSettings->value("cacheOnly").toBool();
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,6 +59,11 @@ IUAVGadgetConfiguration *PfdQmlGadgetConfiguration::clone()
|
||||
m->m_qmlFile = m_qmlFile;
|
||||
m->m_earthFile = m_earthFile;
|
||||
m->m_terrainEnabled = m_terrainEnabled;
|
||||
m->m_actualPositionUsed = m_actualPositionUsed;
|
||||
m->m_latitude = m_latitude;
|
||||
m->m_longitude = m_longitude;
|
||||
m->m_altitude = m_altitude;
|
||||
m->m_cacheOnly = m_cacheOnly;
|
||||
|
||||
return m;
|
||||
}
|
||||
@ -64,4 +79,9 @@ void PfdQmlGadgetConfiguration::saveConfig(QSettings* qSettings) const {
|
||||
qSettings->setValue("earthFile", earthFile);
|
||||
|
||||
qSettings->setValue("terrainEnabled", m_terrainEnabled);
|
||||
qSettings->setValue("actualPositionUsed", m_actualPositionUsed);
|
||||
qSettings->setValue("latitude", m_latitude);
|
||||
qSettings->setValue("longitude", m_longitude);
|
||||
qSettings->setValue("altitude", m_altitude);
|
||||
qSettings->setValue("cacheOnly", m_cacheOnly);
|
||||
}
|
||||
|
@ -30,11 +30,20 @@ public:
|
||||
void setQmlFile(const QString &fileName) { m_qmlFile=fileName; }
|
||||
void setEarthFile(const QString &fileName) { m_earthFile=fileName; }
|
||||
void setTerrainEnabled(bool flag) { m_terrainEnabled = flag; }
|
||||
void setActualPositionUsed(bool flag) { m_actualPositionUsed = flag; }
|
||||
void setLatitude(double value) { m_latitude = value; }
|
||||
void setLongitude(double value) { m_longitude = value; }
|
||||
void setAltitude(double value) { m_altitude = value; }
|
||||
void setCacheOnly(bool flag) { m_cacheOnly = flag; }
|
||||
|
||||
//get dial configuration functions
|
||||
QString qmlFile() const { return m_qmlFile; }
|
||||
QString earthFile() const { return m_earthFile; }
|
||||
bool terrainEnabled() const { return m_terrainEnabled; }
|
||||
bool actualPositionUsed() const { return m_actualPositionUsed; }
|
||||
double latitude() const { return m_latitude; }
|
||||
double longitude() const { return m_longitude; }
|
||||
double altitude() const { return m_altitude; }
|
||||
bool cacheOnly() const { return m_cacheOnly; }
|
||||
|
||||
void saveConfig(QSettings* settings) const;
|
||||
IUAVGadgetConfiguration *clone();
|
||||
@ -43,6 +52,11 @@ private:
|
||||
QString m_qmlFile; // The name of the dial's SVG source file
|
||||
QString m_earthFile; // The name of osgearth terrain file
|
||||
bool m_terrainEnabled;
|
||||
bool m_actualPositionUsed;
|
||||
double m_latitude;
|
||||
double m_longitude;
|
||||
double m_altitude;
|
||||
bool m_cacheOnly;
|
||||
};
|
||||
|
||||
#endif // PfdQmlGADGETCONFIGURATION_H
|
||||
|
@ -35,10 +35,9 @@ PfdQmlGadgetOptionsPage::PfdQmlGadgetOptionsPage(PfdQmlGadgetConfiguration *conf
|
||||
//creates options page widget (uses the UI file)
|
||||
QWidget *PfdQmlGadgetOptionsPage::createPage(QWidget *parent)
|
||||
{
|
||||
|
||||
options_page = new Ui::PfdQmlGadgetOptionsPage();
|
||||
//main widget
|
||||
QWidget *optionsPageWidget = new QWidget;
|
||||
QWidget *optionsPageWidget = new QWidget(parent);
|
||||
//main layout
|
||||
options_page->setupUi(optionsPageWidget);
|
||||
|
||||
@ -56,6 +55,13 @@ QWidget *PfdQmlGadgetOptionsPage::createPage(QWidget *parent)
|
||||
|
||||
options_page->showTerrain->setChecked(m_config->terrainEnabled());
|
||||
|
||||
options_page->useActualLocation->setChecked(m_config->actualPositionUsed());
|
||||
options_page->usePredefinedLocation->setChecked(!m_config->actualPositionUsed());
|
||||
options_page->latitude->setText(QString::number(m_config->latitude()));
|
||||
options_page->longitude->setText(QString::number(m_config->longitude()));
|
||||
options_page->altitude->setText(QString::number(m_config->altitude()));
|
||||
options_page->useOnlyCache->setChecked(m_config->cacheOnly());
|
||||
|
||||
return optionsPageWidget;
|
||||
}
|
||||
|
||||
@ -70,6 +76,12 @@ void PfdQmlGadgetOptionsPage::apply()
|
||||
m_config->setQmlFile(options_page->qmlSourceFile->path());
|
||||
m_config->setEarthFile(options_page->earthFile->path());
|
||||
m_config->setTerrainEnabled(options_page->showTerrain->isChecked());
|
||||
|
||||
m_config->setActualPositionUsed(options_page->useActualLocation->isChecked());
|
||||
m_config->setLatitude(options_page->latitude->text().toDouble());
|
||||
m_config->setLongitude(options_page->longitude->text().toDouble());
|
||||
m_config->setAltitude(options_page->altitude->text().toDouble());
|
||||
m_config->setCacheOnly(options_page->useOnlyCache->isChecked());
|
||||
}
|
||||
|
||||
void PfdQmlGadgetOptionsPage::finish()
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>441</width>
|
||||
<height>339</height>
|
||||
<width>457</width>
|
||||
<height>436</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -19,107 +19,217 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>QML file: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Utils::PathChooser" name="qmlSourceFile" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>457</width>
|
||||
<height>436</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>QML file: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Utils::PathChooser" name="qmlSourceFile" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="showTerrain">
|
||||
<property name="title">
|
||||
<string>Show Terrain:</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" colspan="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>OsgEarth file:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Utils::PathChooser" name="earthFile" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QRadioButton" name="useActualLocation">
|
||||
<property name="text">
|
||||
<string>Use actual location</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QRadioButton" name="usePredefinedLocation">
|
||||
<property name="text">
|
||||
<string>Use pre-defined location:</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="3">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Latitude:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="latitude"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Longitude:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="longitude"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Altitude:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="altitude"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="useOnlyCache">
|
||||
<property name="text">
|
||||
<string>Use only cache data</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>74</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QPushButton" name="preSeedTerrain">
|
||||
<property name="text">
|
||||
<string>Pre seed terrain cache</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>121</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showTerrain">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show terrain</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>OsgEarth file:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Utils::PathChooser" name="earthFile" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@ -131,5 +241,54 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>usePredefinedLocation</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>latitude</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>150</x>
|
||||
<y>138</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>142</x>
|
||||
<y>172</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>usePredefinedLocation</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>longitude</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>164</x>
|
||||
<y>141</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>164</x>
|
||||
<y>202</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>usePredefinedLocation</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>altitude</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>190</x>
|
||||
<y>141</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>190</x>
|
||||
<y>237</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
@ -33,7 +33,11 @@
|
||||
|
||||
PfdQmlGadgetWidget::PfdQmlGadgetWidget(QWidget *parent) :
|
||||
QDeclarativeView(parent),
|
||||
m_terrainEnabled(false)
|
||||
m_terrainEnabled(false),
|
||||
m_actualPositionUsed(false),
|
||||
m_latitude(46.671478),
|
||||
m_longitude(10.158932),
|
||||
m_altitude(2000)
|
||||
{
|
||||
setMinimumSize(64,64);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
@ -105,3 +109,38 @@ void PfdQmlGadgetWidget::setTerrainEnabled(bool arg)
|
||||
emit terrainEnabledChanged(arg);
|
||||
}
|
||||
}
|
||||
|
||||
//Switch between PositionActual UAVObject position
|
||||
//and pre-defined latitude/longitude/altitude properties
|
||||
void PfdQmlGadgetWidget::setActualPositionUsed(bool arg)
|
||||
{
|
||||
if (m_actualPositionUsed != arg) {
|
||||
m_actualPositionUsed = arg;
|
||||
emit actualPositionUsedChanged(arg);
|
||||
}
|
||||
}
|
||||
|
||||
void PfdQmlGadgetWidget::setLatitude(double arg)
|
||||
{
|
||||
//not sure qFuzzyCompare is accurate enough for geo coordinates
|
||||
if (m_latitude != arg) {
|
||||
m_latitude = arg;
|
||||
emit latitudeChanged(arg);
|
||||
}
|
||||
}
|
||||
|
||||
void PfdQmlGadgetWidget::setLongitude(double arg)
|
||||
{
|
||||
if (m_longitude != arg) {
|
||||
m_longitude = arg;
|
||||
emit longitudeChanged(arg);
|
||||
}
|
||||
}
|
||||
|
||||
void PfdQmlGadgetWidget::setAltitude(double arg)
|
||||
{
|
||||
if (!qFuzzyCompare(m_altitude,arg)) {
|
||||
m_altitude = arg;
|
||||
emit altitudeChanged(arg);
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,13 @@ class PfdQmlGadgetWidget : public QDeclarativeView
|
||||
Q_PROPERTY(QString earthFile READ earthFile WRITE setEarthFile NOTIFY earthFileChanged)
|
||||
Q_PROPERTY(bool terrainEnabled READ terrainEnabled WRITE setTerrainEnabled NOTIFY terrainEnabledChanged)
|
||||
|
||||
Q_PROPERTY(bool actualPositionUsed READ actualPositionUsed WRITE setActualPositionUsed NOTIFY actualPositionUsedChanged)
|
||||
|
||||
//pre-defined fallback position
|
||||
Q_PROPERTY(double latitude READ latitude WRITE setLatitude NOTIFY latitudeChanged)
|
||||
Q_PROPERTY(double longitude READ longitude WRITE setLongitude NOTIFY longitudeChanged)
|
||||
Q_PROPERTY(double altitude READ altitude WRITE setAltitude NOTIFY altitudeChanged)
|
||||
|
||||
public:
|
||||
PfdQmlGadgetWidget(QWidget *parent = 0);
|
||||
~PfdQmlGadgetWidget();
|
||||
@ -34,18 +41,39 @@ public:
|
||||
QString earthFile() const { return m_earthFile; }
|
||||
bool terrainEnabled() const { return m_terrainEnabled; }
|
||||
|
||||
bool actualPositionUsed() const { return m_actualPositionUsed; }
|
||||
double latitude() const { return m_latitude; }
|
||||
double longitude() const { return m_longitude; }
|
||||
double altitude() const { return m_altitude; }
|
||||
|
||||
public slots:
|
||||
void setEarthFile(QString arg);
|
||||
void setTerrainEnabled(bool arg);
|
||||
|
||||
void setLatitude(double arg);
|
||||
void setLongitude(double arg);
|
||||
void setAltitude(double arg);
|
||||
|
||||
void setActualPositionUsed(bool arg);
|
||||
|
||||
signals:
|
||||
void earthFileChanged(QString arg);
|
||||
void terrainEnabledChanged(bool arg);
|
||||
|
||||
void actualPositionUsedChanged(bool arg);
|
||||
void latitudeChanged(double arg);
|
||||
void longitudeChanged(double arg);
|
||||
void altitudeChanged(double arg);
|
||||
|
||||
private:
|
||||
QString m_qmlFileName;
|
||||
QString m_earthFile;
|
||||
bool m_terrainEnabled;
|
||||
|
||||
bool m_actualPositionUsed;
|
||||
double m_latitude;
|
||||
double m_longitude;
|
||||
double m_altitude;
|
||||
};
|
||||
|
||||
#endif /* PFDQMLGADGETWIDGET_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user