mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
PFD qml: Load Terrain and World views dynamicaly
Moved them to separate qml files loaded by reqest using Loader. This allows to keep PFD working even if one of views can't be loaded and avoids the cost of loading expensive views like camera.
This commit is contained in:
parent
4e28a529db
commit
68652ef643
@ -1,6 +1,5 @@
|
||||
import Qt 4.7
|
||||
import "."
|
||||
import org.OpenPilot 1.0
|
||||
|
||||
Rectangle {
|
||||
color: "#666666"
|
||||
@ -22,46 +21,10 @@ Rectangle {
|
||||
anchors.centerIn: parent
|
||||
clip: true
|
||||
|
||||
OsgEarth {
|
||||
id: earthView
|
||||
|
||||
Loader {
|
||||
id: worldLoader
|
||||
anchors.fill: parent
|
||||
sceneFile: qmlWidget.earthFile
|
||||
visible: qmlWidget.terrainEnabled
|
||||
|
||||
fieldOfView: 90
|
||||
|
||||
yaw: AttitudeActual.Yaw
|
||||
pitch: AttitudeActual.Pitch
|
||||
roll: AttitudeActual.Roll
|
||||
|
||||
latitude: qmlWidget.actualPositionUsed ?
|
||||
GPSPosition.Latitude/10000000.0 : qmlWidget.latitude
|
||||
longitude: qmlWidget.actualPositionUsed ?
|
||||
GPSPosition.Longitude/10000000.0 : qmlWidget.longitude
|
||||
altitude: qmlWidget.actualPositionUsed ?
|
||||
GPSPosition.Altitude : qmlWidget.altitude
|
||||
}
|
||||
|
||||
Image {
|
||||
id: world
|
||||
source: "image://svg/pfd.svg!world"
|
||||
sourceSize: background.sourceSize
|
||||
smooth: true
|
||||
visible: !qmlWidget.terrainEnabled
|
||||
|
||||
transform: [
|
||||
Translate {
|
||||
id: pitchTranslate
|
||||
x: (world.parent.width - world.width)/2
|
||||
y: (world.parent.height - world.height)/2 + AttitudeActual.Pitch*world.parent.height/94
|
||||
},
|
||||
Rotation {
|
||||
angle: -AttitudeActual.Roll
|
||||
origin.x : world.parent.width/2
|
||||
origin.y : world.parent.height/2
|
||||
}
|
||||
]
|
||||
source: qmlWidget.terrainEnabled ? "PfdTerrainView.qml" : "PfdWorldView.qml"
|
||||
}
|
||||
|
||||
Image {
|
||||
|
@ -0,0 +1,20 @@
|
||||
import Qt 4.7
|
||||
import org.OpenPilot 1.0
|
||||
|
||||
OsgEarth {
|
||||
id: earthView
|
||||
|
||||
sceneFile: qmlWidget.earthFile
|
||||
fieldOfView: 90
|
||||
|
||||
yaw: AttitudeActual.Yaw
|
||||
pitch: AttitudeActual.Pitch
|
||||
roll: AttitudeActual.Roll
|
||||
|
||||
latitude: qmlWidget.actualPositionUsed ?
|
||||
GPSPosition.Latitude/10000000.0 : qmlWidget.latitude
|
||||
longitude: qmlWidget.actualPositionUsed ?
|
||||
GPSPosition.Longitude/10000000.0 : qmlWidget.longitude
|
||||
altitude: qmlWidget.actualPositionUsed ?
|
||||
GPSPosition.Altitude : qmlWidget.altitude
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
import Qt 4.7
|
||||
|
||||
Item {
|
||||
//worldView should fill the source size of svg document
|
||||
id: worldView
|
||||
|
||||
Image {
|
||||
id: world
|
||||
source: "image://svg/pfd.svg!world"
|
||||
|
||||
sourceSize.width: worldView.width
|
||||
sourceSize.height: worldView.height
|
||||
|
||||
smooth: true
|
||||
|
||||
transform: [
|
||||
Translate {
|
||||
id: pitchTranslate
|
||||
x: (world.parent.width - world.width)/2
|
||||
y: (world.parent.height - world.height)/2 + AttitudeActual.Pitch*world.parent.height/94
|
||||
},
|
||||
Rotation {
|
||||
angle: -AttitudeActual.Roll
|
||||
origin.x : world.parent.width/2
|
||||
origin.y : world.parent.height/2
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user