2013-11-14 00:48:00 +01:00
|
|
|
import QtQuick 2.0
|
2012-07-23 09:19:24 +02:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: sceneItem
|
2012-09-09 08:58:54 +02:00
|
|
|
property variant sceneSize
|
2012-07-23 09:19:24 +02:00
|
|
|
|
2012-09-09 08:58:54 +02:00
|
|
|
SvgElementImage {
|
2013-10-20 06:49:59 +02:00
|
|
|
id: altitude_window
|
|
|
|
elementName: "altitude-window"
|
2012-09-09 08:58:54 +02:00
|
|
|
sceneSize: sceneItem.sceneSize
|
2012-07-23 09:19:24 +02:00
|
|
|
clip: true
|
|
|
|
|
2013-10-20 06:49:59 +02:00
|
|
|
property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "altitude-window")
|
2012-07-23 09:19:24 +02:00
|
|
|
|
2012-09-16 02:03:28 +02:00
|
|
|
x: Math.floor(scaledBounds.x * sceneItem.width)
|
|
|
|
y: Math.floor(scaledBounds.y * sceneItem.height)
|
2012-07-23 09:19:24 +02:00
|
|
|
|
2012-09-09 08:58:54 +02:00
|
|
|
SvgElementImage {
|
2012-07-23 09:19:24 +02:00
|
|
|
id: altitude_scale
|
|
|
|
|
2012-09-09 08:58:54 +02:00
|
|
|
elementName: "altitude-scale"
|
|
|
|
sceneSize: sceneItem.sceneSize
|
2012-07-23 09:19:24 +02:00
|
|
|
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
// The altitude scale represents 30 meters,
|
|
|
|
// move it in 0..5m range
|
2013-06-22 18:44:03 +02:00
|
|
|
anchors.verticalCenterOffset: -height/30 * (PositionState.Down-Math.floor(PositionState.Down/5*qmlWidget.altitudeFactor)*5)
|
2012-07-23 09:19:24 +02:00
|
|
|
anchors.left: parent.left
|
|
|
|
|
2013-06-22 18:44:03 +02:00
|
|
|
property int topNumber: 15-Math.floor(PositionState.Down/5*qmlWidget.altitudeFactor)*5
|
2012-07-23 09:19:24 +02:00
|
|
|
|
|
|
|
// Altitude numbers
|
|
|
|
Column {
|
|
|
|
Repeater {
|
|
|
|
model: 7
|
|
|
|
Item {
|
|
|
|
height: altitude_scale.height / 6
|
2013-10-20 06:49:59 +02:00
|
|
|
width: altitude_window.width
|
2012-07-23 09:19:24 +02:00
|
|
|
|
|
|
|
Text {
|
|
|
|
text: altitude_scale.topNumber - index*5
|
|
|
|
color: "white"
|
|
|
|
font.pixelSize: parent.height / 4
|
|
|
|
font.family: "Arial"
|
|
|
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.top
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-11-09 02:13:23 +01:00
|
|
|
|
2013-11-09 02:20:38 +01:00
|
|
|
SvgElementImage {
|
|
|
|
id: altitude_vector
|
|
|
|
elementName: "altitude-vector"
|
|
|
|
sceneSize: sceneItem.sceneSize
|
|
|
|
|
|
|
|
height: -NedAccel.Down * altitude_scale.height/30
|
|
|
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.bottom: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
2013-11-09 02:13:23 +01:00
|
|
|
SvgElementImage {
|
|
|
|
id: altitude_waypoint
|
|
|
|
elementName: "altitude-waypoint"
|
|
|
|
sceneSize: sceneItem.sceneSize
|
|
|
|
visible: PathDesired.End_Down !== 0.0
|
|
|
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
|
|
anchors.verticalCenterOffset: -altitude_scale.height/30 * (PositionState.Down - PathDesired.End_Down)
|
|
|
|
}
|
2012-07-23 09:19:24 +02:00
|
|
|
}
|
|
|
|
|
2012-09-09 08:58:54 +02:00
|
|
|
SvgElementImage {
|
2013-10-20 06:49:59 +02:00
|
|
|
id: altitude_box
|
2012-07-23 09:19:24 +02:00
|
|
|
clip: true
|
|
|
|
|
2013-10-20 06:49:59 +02:00
|
|
|
elementName: "altitude-box"
|
2012-09-09 08:58:54 +02:00
|
|
|
sceneSize: sceneItem.sceneSize
|
2012-07-23 09:19:24 +02:00
|
|
|
|
2013-10-20 06:49:59 +02:00
|
|
|
property variant scaledBounds: svgRenderer.scaledElementBounds("pfd.svg", "altitude-box")
|
2012-07-23 09:19:24 +02:00
|
|
|
|
|
|
|
x: scaledBounds.x * sceneItem.width
|
|
|
|
y: scaledBounds.y * sceneItem.height
|
|
|
|
width: scaledBounds.width * sceneItem.width
|
|
|
|
height: scaledBounds.height * sceneItem.height
|
|
|
|
|
|
|
|
Text {
|
|
|
|
id: altitude_text
|
2013-06-22 18:44:03 +02:00
|
|
|
text: Math.floor(-PositionState.Down * qmlWidget.altitudeFactor).toFixed()
|
2012-07-23 09:19:24 +02:00
|
|
|
color: "white"
|
|
|
|
font {
|
|
|
|
family: "Arial"
|
2013-10-20 06:49:59 +02:00
|
|
|
pixelSize: parent.height * 0.4
|
2012-07-23 09:19:24 +02:00
|
|
|
}
|
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
|
|
|
}
|
2013-06-18 00:52:27 +02:00
|
|
|
|
2013-10-20 06:49:59 +02:00
|
|
|
Text {
|
|
|
|
id: altitude_unit_text
|
|
|
|
text: qmlWidget.altitudeUnit
|
|
|
|
color: "white"
|
|
|
|
font {
|
|
|
|
family: "Arial"
|
|
|
|
pixelSize: sceneSize.height * 0.025
|
2013-06-18 00:52:27 +02:00
|
|
|
}
|
2013-10-20 06:49:59 +02:00
|
|
|
anchors.top: altitude_window.bottom
|
|
|
|
anchors.right: altitude_window.right
|
|
|
|
anchors.margins: font.pixelSize * 0.3
|
2013-06-18 00:52:27 +02:00
|
|
|
}
|
2012-07-23 09:19:24 +02:00
|
|
|
}
|