2 * Copyright (C) 2016 The LibrePilot Project
3 * Contact: http://www.librepilot.org
5 * This file is part of LibrePilot GCS.
7 * LibrePilot GCS is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * LibrePilot GCS is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with LibrePilot GCS. If not, see <http://www.gnu.org/licenses/>.
22 import "../js/uav.js" as UAV
26 property real horizontCenter : horizontCenterItem.horizontCenter
29 // using rectange instead of svg rendered to pixmap
30 // as it's much more memory efficient
34 property variant scaledBounds: svgRenderer.scaledElementBounds("pfd/pfd.svg", "horizon")
35 width: Math.round(sceneItem.width * scaledBounds.width / 2) * 2
36 height: Math.round(sceneItem.height * scaledBounds.height / 2) * 3
38 property double pitch1DegScaledHeight: ((svgRenderer.scaledElementBounds("pfd/pfd.svg", "pitch-90").y -
39 svgRenderer.scaledElementBounds("pfd/pfd.svg", "pitch90").y) * 1.03) / 180.0
41 property double pitch1DegHeight: sceneItem.height*pitch1DegScaledHeight
44 GradientStop { position: 0.4000; color: "#013163" }
45 GradientStop { position: 0.4999; color: "#0164CC" }
46 GradientStop { position: 0.5001; color: "#653300" }
47 GradientStop { position: 0.6000; color: "#3C1E00" }
53 x: Math.round((world.parent.width - world.width) / 2)
54 // y is centered around world_center element
55 y: Math.round(horizontCenter - world.height / 2 + UAV.attitudePitch() * world.pitch1DegHeight)
58 angle: -UAV.attitudeRoll()
59 origin.x : world.parent.width / 2
60 origin.y : horizontCenter
66 elementName: "center-line"
68 // worldView is loaded with Loader, so background element is visible
69 sceneSize: background.sceneSize
70 anchors.centerIn: parent
79 sceneSize: background.sceneSize
80 anchors.centerIn: parent
88 property variant scaledBounds: svgRenderer.scaledElementBounds("pfd/pfd.svg", "pitch-window")
90 x: Math.floor(scaledBounds.x * sceneItem.width)
91 y: Math.floor(scaledBounds.y * sceneItem.height)
92 width: Math.floor(scaledBounds.width * sceneItem.width)
93 height: Math.floor(scaledBounds.height * sceneItem.height)
95 rotation: -UAV.attitudeRoll()
96 transformOrigin: Item.Center
103 elementName: "pitch-scale"
104 // worldView is loaded with Loader, so background element is visible
105 sceneSize: background.sceneSize
106 anchors.centerIn: parent
107 // see comment for world transform
108 anchors.verticalCenterOffset: UAV.attitudePitch() * world.pitch1DegHeight
109 border: 64 //sometimes numbers are excluded from bounding rect