Commit 719931c5 authored by Pierre TILAK's avatar Pierre TILAK

Add setting to enable COG/HOME Compass

parent b5aefa7c
...@@ -17,10 +17,11 @@ ...@@ -17,10 +17,11 @@
import QtQuick 2.3 import QtQuick 2.3
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import QGroundControl.Controls 1.0 import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.Controls 1.0
import QGroundControl.Vehicle 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Vehicle 1.0
import QGroundControl.Palette 1.0
Item { Item {
id: root id: root
...@@ -37,6 +38,9 @@ Item { ...@@ -37,6 +38,9 @@ Item {
property real _headingToHome: vehicle ? vehicle.headingToHome.rawValue : 0 property real _headingToHome: vehicle ? vehicle.headingToHome.rawValue : 0
property real _courseOverGround:activeVehicle ? activeVehicle.gps.courseOverGround.rawValue : 0 property real _courseOverGround:activeVehicle ? activeVehicle.gps.courseOverGround.rawValue : 0
readonly property bool _showHomeHeadingCompass: QGroundControl.settingsManager.flyViewSettings.showHomeHeadingCompass.value
readonly property bool _showCOGAngleCompass: QGroundControl.settingsManager.flyViewSettings.showCOGAngleCompass.value
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
...@@ -67,11 +71,12 @@ Item { ...@@ -67,11 +71,12 @@ Item {
Image { Image {
id: homePointer id: homePointer
width: size * 0.1 width: size * 0.1
source: "/qmlimages/Home.svg" source: _showHomeHeadingCompass ? "/qmlimages/Home.svg" : ""
mipmap: true mipmap: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
anchors.centerIn: parent anchors.centerIn: parent
sourceSize.width: width sourceSize.width: width
visible: _showHomeHeadingCompass
transform: Translate { transform: Translate {
x: size/2.3 * Math.sin((-_heading + _headingToHome)*(3.14/180)) x: size/2.3 * Math.sin((-_heading + _headingToHome)*(3.14/180))
...@@ -95,17 +100,21 @@ Item { ...@@ -95,17 +100,21 @@ Item {
} }
Image { Image {
function f(){
console.log(_heading -_courseOverGround)
}
property double test: f()
id: cOGPointer id: cOGPointer
source: "/qmlimages/attitudePointer.svg" source: _showCOGAngleCompass ? "/qmlimages/attitudePointer.svg" : ""
mipmap: true mipmap: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
anchors.fill: parent anchors.fill: parent
sourceSize.height: parent.height sourceSize.height: parent.height
onVisibleChanged: {
if (visible)
console.log("is being displayed")
else
console.log("is being hidden")
}
transform: Rotation { transform: Rotation {
origin.x: cOGPointer.width / 2 origin.x: cOGPointer.width / 2
origin.y: cOGPointer.height / 2 origin.y: cOGPointer.height / 2
......
...@@ -24,5 +24,17 @@ ...@@ -24,5 +24,17 @@
"shortDescription": "Use Vertical Instrument Panel instead of the default one", "shortDescription": "Use Vertical Instrument Panel instead of the default one",
"type": "bool", "type": "bool",
"defaultValue": false "defaultValue": false
},
{
"name": "showHomeHeadingCompass",
"shortDescription": "Show/Hide Home heading on the Compass",
"type": "bool",
"defaultValue": false
},
{
"name": "showCOGAngleCompass",
"shortDescription": "Show/Hide Course Over Ground angle on the Compass",
"type": "bool",
"defaultValue": false
} }
] ]
...@@ -21,3 +21,5 @@ DECLARE_SETTINGSFACT(FlyViewSettings, guidedMinimumAltitude) ...@@ -21,3 +21,5 @@ DECLARE_SETTINGSFACT(FlyViewSettings, guidedMinimumAltitude)
DECLARE_SETTINGSFACT(FlyViewSettings, guidedMaximumAltitude) DECLARE_SETTINGSFACT(FlyViewSettings, guidedMaximumAltitude)
DECLARE_SETTINGSFACT(FlyViewSettings, showLogReplayStatusBar) DECLARE_SETTINGSFACT(FlyViewSettings, showLogReplayStatusBar)
DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel) DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel)
DECLARE_SETTINGSFACT(FlyViewSettings, showHomeHeadingCompass)
DECLARE_SETTINGSFACT(FlyViewSettings, showCOGAngleCompass)
...@@ -23,4 +23,6 @@ public: ...@@ -23,4 +23,6 @@ public:
DEFINE_SETTINGFACT(guidedMaximumAltitude) DEFINE_SETTINGFACT(guidedMaximumAltitude)
DEFINE_SETTINGFACT(showLogReplayStatusBar) DEFINE_SETTINGFACT(showLogReplayStatusBar)
DEFINE_SETTINGFACT(alternateInstrumentPanel) DEFINE_SETTINGFACT(alternateInstrumentPanel)
DEFINE_SETTINGFACT(showHomeHeadingCompass)
DEFINE_SETTINGFACT(showCOGAngleCompass)
}; };
...@@ -475,6 +475,21 @@ Rectangle { ...@@ -475,6 +475,21 @@ Rectangle {
property Fact _alternateInstrumentPanel: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel property Fact _alternateInstrumentPanel: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel
} }
FactCheckBox {
text: qsTr("Show/Hide Home heading on the Compass")
visible: _showHomeHeadingCompass.visible
fact: _showHomeHeadingCompass
property Fact _showHomeHeadingCompass: QGroundControl.settingsManager.flyViewSettings.showHomeHeadingCompass
}
FactCheckBox {
text: qsTr("Show/Hide Course Over Ground angle on the Compass")
visible: _showCOGAngleCompass.visible
fact: _showCOGAngleCompass
property Fact _showCOGAngleCompass: QGroundControl.settingsManager.flyViewSettings.showCOGAngleCompass
}
GridLayout { GridLayout {
columns: 2 columns: 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment