4import QGroundControl.Controls
5import QGroundControl.FlyView
6import QGroundControl.FlightMap
9 implicitWidth: _totalRadius * 2
10 implicitHeight: implicitWidth
12 property real compassRadius: ScreenTools.defaultFontPixelHeight * 6 / 2
13 property real attitudeAngleDegrees: 0
15 property real attitudeSize: ScreenTools.defaultFontPixelHeight * 0.75
16 property real attitudeSpacing: ScreenTools.defaultFontPixelHeight / 4
18 property real _totalRadius: compassRadius + attitudeSpacing + attitudeSize
19 property real _attitudeRadius: (width / 2) - (attitudeSize / 2)
20 property real _maxAngleDegrees: 30
21 property real _maxRadians: _maxAngleDegrees * Math.PI / 180
22 property real _zeroAttitudeRadians: Math.PI * 1.5
23 property real _clampedAngleDegrees: Math.min(Math.max(attitudeAngleDegrees, -_maxAngleDegrees), _maxAngleDegrees)
24 property real _attitudeAnglePercent: _clampedAngleDegrees / _maxAngleDegrees
26 property var qgcPal: QGroundControl.globalPalette
28 on_AttitudeAnglePercentChanged: angleIndicator.requestPaint()
35 var centerX = width / 2
36 var centerY = height / 2
37 var ctx = getContext("2d")
39 ctx.strokeStyle = qgcPal.window
40 ctx.lineWidth = attitudeSize
42 ctx.arc(centerX, centerY, _attitudeRadius, _zeroAttitudeRadians - _maxRadians, _zeroAttitudeRadians + _maxRadians)
47 // Roll value indicator
51 visible: Math.abs(attitudeAngleDegrees) > 1
53 property real startRollRadiansRaw: _zeroAttitudeRadians
54 property real endRollRadiansRaw: _zeroAttitudeRadians + (_attitudeAnglePercent * _maxRadians)
55 property real startRollRadiansOrdered: Math.min(startRollRadiansRaw, endRollRadiansRaw)
56 property real endRollRadiansOrdered: Math.max(startRollRadiansRaw, endRollRadiansRaw)
59 var centerX = width / 2
60 var centerY = height / 2
61 var ctx = getContext("2d")
63 ctx.strokeStyle = qgcPal.primaryButton
64 ctx.lineWidth = attitudeSize
66 ctx.arc(centerX, centerY, _attitudeRadius, startRollRadiansOrdered, endRollRadiansOrdered)
71 // Roll 0 value tick mark
76 var centerX = width / 2
77 var centerY = height / 2
78 var ctx = getContext("2d")
80 ctx.strokeStyle = qgcPal.text
83 ctx.moveTo(centerX, 0)
84 ctx.lineTo(centerX, attitudeSize)