4import QGroundControl.Controls
12 border.color: qgcPal.text
13 border.width: usedByMultipleVehicleList ? 1 : 0
14 opacity: vehicle && usedByMultipleVehicleList && !vehicle.armed ? 0.5 : 1
16 property real size: _defaultSize
17 property var vehicle: null
18 property bool usedByMultipleVehicleList: false
20 property real _defaultSize: usedByMultipleVehicleList ? ScreenTools.defaultFontPixelHeight * 3 : ScreenTools.defaultFontPixelHeight * 10
21 property real _sizeRatio: (usedByMultipleVehicleList || ScreenTools.isTinyScreen) ? (size / _defaultSize) * 0.5 : size / _defaultSize
22 property int _fontSize: ScreenTools.defaultFontPointSize * _sizeRatio < 8 ? 8 : ScreenTools.defaultFontPointSize * _sizeRatio
23 property real _heading: vehicle ? vehicle.heading.rawValue : 0
24 property real _headingToHome: vehicle ? vehicle.headingToHome.rawValue : 0
25 property real _groundSpeed: vehicle ? vehicle.groundSpeed.rawValue : 0
26 property real _headingToNextWP: vehicle ? vehicle.headingToNextWP.rawValue : 0
27 property real _courseOverGround: vehicle ? vehicle.gps.courseOverGround.rawValue : 0
28 property var _flyViewSettings: QGroundControl.settingsManager.flyViewSettings
29 property bool _showAdditionalIndicators: _flyViewSettings.showAdditionalIndicatorsCompass.value && !usedByMultipleVehicleList
30 property bool _lockNoseUpCompass: _flyViewSettings.lockNoseUpCompass.value && !usedByMultipleVehicleList
33 if (_groundSpeed < 0.5) {
36 return vehicle && _showAdditionalIndicators
40 function showHeadingHome() {
41 return vehicle && _showAdditionalIndicators && !isNaN(_headingToHome)
44 function showHeadingToNextWP() {
45 return vehicle && _showAdditionalIndicators && !isNaN(_headingToNextWP)
48 function translateCenterToAngleX(radius, angle) {
49 return radius * Math.sin(angle * (Math.PI / 180))
52 function translateCenterToAngleY(radius, angle) {
53 return -radius * Math.cos(angle * (Math.PI / 180))
56 QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
63 origin.x: rotationParent.width / 2
64 origin.y: rotationParent.height / 2
65 angle: _lockNoseUpCompass ? -_heading : 0
70 visible: !usedByMultipleVehicleList
73 CompassHeadingIndicator {
76 simplified: usedByMultipleVehicleList
81 source: "/qmlimages/cOGPointer.svg"
83 fillMode: Image.PreserveAspectFit
85 sourceSize.height: parent.height
89 origin.x: cogPointer.width / 2
90 origin.y: cogPointer.height / 2
91 angle: _courseOverGround
97 source: "/qmlimages/compassDottedLine.svg"
99 fillMode: Image.PreserveAspectFit
101 sourceSize.height: parent.height
102 visible: showHeadingToNextWP()
104 transform: Rotation {
105 origin.x: nextWPPointer.width / 2
106 origin.y: nextWPPointer.height / 2
107 angle: _headingToNextWP
111 // Launch location indicator
113 width: Math.max(label.contentWidth, label.contentHeight)
115 color: qgcPal.mapIndicator
117 anchors.centerIn: parent
118 visible: showHeadingHome()
125 anchors.centerIn: parent
128 transform: Translate {
129 property double _angle: _headingToHome
131 x: translateCenterToAngleX(parent.width / 2, _angle)
132 y: translateCenterToAngleY(parent.height / 2, _angle)
138 anchors.horizontalCenter: parent.horizontalCenter
140 text: vehicle && !usedByMultipleVehicleList ? _heading.toFixed(0) + "°" : ""
141 horizontalAlignment: Text.AlignHCenter