Commit b14e1a46 authored by dogmaphobic's avatar dogmaphobic

Done with first pass of the Flight View re-work.

parent a9a17e88
......@@ -77,11 +77,14 @@
<file alias="FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<file alias="FlightDisplayWidget.qml">src/FlightDisplay/FlightDisplayWidget.qml</file>
<file alias="MissionEditor.qml">src/MissionEditor/MissionEditor.qml</file>
<file alias="MissionEditorHelp.qml">src/MissionEditor/MissionEditorHelp.qml</file>
<!-- FlightDisplay module -->
<file alias="QGroundControl/FlightDisplay/qmldir">src/FlightDisplay/qmldir</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewDelayLoad.qml">src/FlightDisplay/FlightDisplayViewDelayLoad.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewMap.qml">src/FlightDisplay/FlightDisplayViewMap.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewVideo.qml">src/FlightDisplay/FlightDisplayViewVideo.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewWidgets.qml">src/FlightDisplay/FlightDisplayViewWidgets.qml</file>
<!-- FlightMap module -->
<file alias="QGroundControl/FlightMap/qmldir">src/FlightMap/qmldir</file>
......
......@@ -41,16 +41,6 @@ import QGroundControl.Controllers 1.0
Item {
id: root
property alias latitude: flightMap.latitude
property alias longitude: flightMap.longitude
// Top margin for all widgets. Used to prevent overlap with the toolbar
property real topMargin: 0
// Used by parent to hide widgets when it displays something above in the z order.
// Prevents z order drawing problems.
property bool hideWidgets: false
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
property var _activeVehicle: multiVehicleManager.activeVehicle
......@@ -64,139 +54,117 @@ Item {
readonly property real _defaultAirSpeed: 0
readonly property real _defaultClimbRate: 0
readonly property string _mapName: "FlightDisplayView"
readonly property string _showMapBackgroundKey: "/showMapBackground"
readonly property string _mapName: "FlightDisplayView"
readonly property string _showMapBackgroundKey: "/showMapBackground"
readonly property var _flightMap: flightMap
property bool _mainIsMap: !_controller.hasVideo
property real _roll: _activeVehicle ? (isNaN(_activeVehicle.roll) ? _defaultRoll : _activeVehicle.roll) : _defaultRoll
property real _pitch: _activeVehicle ? (isNaN(_activeVehicle.pitch) ? _defaultPitch : _activeVehicle.pitch) : _defaultPitch
property real _roll: _activeVehicle ? (isNaN(_activeVehicle.roll) ? _defaultRoll : _activeVehicle.roll) : _defaultRoll
property real _pitch: _activeVehicle ? (isNaN(_activeVehicle.pitch) ? _defaultPitch : _activeVehicle.pitch) : _defaultPitch
property real _heading: _activeVehicle ? (isNaN(_activeVehicle.heading) ? _defaultHeading : _activeVehicle.heading) : _defaultHeading
property var _vehicleCoordinate: _activeVehicle ? (_activeVehicle.coordinateValid ? _activeVehicle.coordinate : _defaultVehicleCoordinate) : _defaultVehicleCoordinate
property real _altitudeWGS84: _activeVehicle ? _activeVehicle.altitudeWGS84 : _defaultAltitudeWGS84
property real _groundSpeed: _activeVehicle ? _activeVehicle.groundSpeed : _defaultGroundSpeed
property real _airSpeed: _activeVehicle ? _activeVehicle.airSpeed : _defaultAirSpeed
property real _climbRate: _activeVehicle ? _activeVehicle.climbRate : _defaultClimbRate
property real _groundSpeed: _activeVehicle ? _activeVehicle.groundSpeed : _defaultGroundSpeed
property real _airSpeed: _activeVehicle ? _activeVehicle.airSpeed : _defaultAirSpeed
property real _climbRate: _activeVehicle ? _activeVehicle.climbRate : _defaultClimbRate
property bool _showMap: getBool(QGroundControl.flightMapSettings.loadMapSetting(flightMap.mapName, _showMapBackgroundKey, "1"))
property var _flightMap: null
property var _flightVideo: null
property var _savedZoomLevel: 0
FlightDisplayViewController { id: _controller }
MissionController {
id: _missionController
Component.onCompleted: start(false /* editMode */)
}
ExclusiveGroup {
id: _dropButtonsExclusiveGroup
function reloadContents() {
if(_flightVideo) {
_flightVideo.visible = false
}
if(_mainIsMap) {
mainLoader.source = "FlightDisplayViewMap.qml"
pipLoader.source = "FlightDisplayViewVideo.qml"
} else {
mainLoader.source = "FlightDisplayViewVideo.qml"
pipLoader.source = "FlightDisplayViewMap.qml"
}
}
// Validate _showMap setting
Component.onCompleted: {
delayLoader.source = "FlightDisplayViewDelayLoad.qml"
// We have to be careful to not reference root properties in a function which is in a subcomponent
// until the root component has completed loading. Otherwise you get undefined references.
flightMap.rootLoadCompleted = true
flightMap.updateMapPosition(true /* force */)
_setShowMap(_showMap)
}
function getBool(value) {
return value === '0' ? false : true;
reloadContents();
widgetsLoader.source = "FlightDisplayViewWidgets.qml"
}
function setBool(value) {
return value ? "1" : "0";
}
function _setShowMap(showMap) {
_showMap = _controller.hasVideo ? showMap : true
QGroundControl.flightMapSettings.saveMapSetting(flightMap.mapName, _showMapBackgroundKey, setBool(_showMap))
}
FlightMap {
id: flightMap
anchors.fill: parent
mapName: _mapName
visible: _showMap
latitude: root._defaultCoordinate.latitude
longitude: root._defaultCoordinate.longitude
property var rootVehicleCoordinate: _vehicleCoordinate
property bool rootLoadCompleted: false
property bool _followVehicle: true
onRootVehicleCoordinateChanged: updateMapPosition(false /* force */)
function updateMapPosition(force) {
if ((_followVehicle || force) && rootLoadCompleted) {
flightMap.latitude = root._vehicleCoordinate.latitude
flightMap.longitude = root._vehicleCoordinate.longitude
//-- Main Window
Loader {
id: mainLoader
anchors.fill: parent
onLoaded: {
if(_mainIsMap) {
_flightMap = item
if(_savedZoomLevel != 0)
_flightMap.zoomLevel = _savedZoomLevel
else
_savedZoomLevel = _flightMap.zoomLevel
_flightMap.updateMapPosition(true /* force */)
} else {
_flightVideo = item
_flightVideo.visible = true
}
}
}
// Home position
MissionItemIndicator {
label: "H"
coordinate: (_activeVehicle && _activeVehicle.homePositionAvailable) ? _activeVehicle.homePosition : QtPositioning.coordinate(0, 0)
visible: _activeVehicle ? _activeVehicle.homePositionAvailable : false
z: QGroundControl.zOrderMapItems
}
// Add trajectory points to the map
MapItemView {
model: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.trajectoryPoints : 0
delegate:
MapPolyline {
line.width: 3
line.color: "orange"
z: QGroundControl.zOrderMapItems - 1
path: [
{ latitude: object.coordinate1.latitude, longitude: object.coordinate1.longitude },
{ latitude: object.coordinate2.latitude, longitude: object.coordinate2.longitude },
]
}
//-- PIP Window
Rectangle {
id: pip
visible: _controller.hasVideo
anchors.margins: ScreenTools.defaultFontPixelHeight
anchors.left: parent.left
anchors.bottom: parent.bottom
height: ScreenTools.defaultFontPixelSize * (9)
width: ScreenTools.defaultFontPixelSize * (9) * (16/9)
color: "#000010"
border.width: 4
radius: 4
border.color: {
if(_mainIsMap && _flightMap != null)
return _flightMap.isSatelliteMap ? Qt.rgba(1,1,1,0.75) : Qt.rgba(0,0,0,0.75)
else
return Qt.rgba(0,0,0,0.75)
}
// Add the vehicles to the map
MapItemView {
model: multiVehicleManager.vehicles
delegate:
VehicleMapItem {
vehicle: object
coordinate: object.coordinate
isSatellite: flightMap.isSatelliteMap
z: QGroundControl.zOrderMapItems
Loader {
id: pipLoader
anchors.fill: parent
anchors.margins: 2
onLoaded: {
if(_mainIsMap) {
_flightVideo = item
_flightVideo.visible = true
} else {
_flightMap = item
_savedZoomLevel = _flightMap.zoomLevel
_flightMap.zoomLevel = _savedZoomLevel - 3
}
pip.visible = _controller.hasVideo
}
}
// Add the mission items to the map
MissionItemView {
model: _missionController.missionItems
}
// Add lines between waypoints
MissionLineView {
model: _missionController.waypointLines
}
// Used to make pinch zoom work
MouseArea {
anchors.fill: parent
onClicked: {
_mainIsMap = !_mainIsMap
pip.visible = false
reloadContents();
}
}
} // Flight Map
}
//-- Widgets
Loader {
id: delayLoader
anchors.fill: parent
id: widgetsLoader
anchors.fill: parent
}
}
Module QGroundControl.FlightDisplay
FlightDisplayView 1.0 FlightDisplayView.qml
FlightDisplayViewDelayLoad 1.0 FlightDisplayViewDelayLoad.qml
......@@ -49,7 +49,7 @@ Map {
property bool interactive: true
property string mapName: 'defaultMap'
property string mapType: QGroundControl.flightMapSettings.mapTypeForMapName(mapName)
property alias mapWidgets: controlWidgets
// property alias mapWidgets: controlWidgets
property bool isSatelliteMap: mapType == "Satellite Map" || mapType == "Hybrid Map"
property real lon: (longitude >= -180 && longitude <= 180) ? longitude : 0
......@@ -80,6 +80,7 @@ Map {
}
}
/*********************************************
/// Map control widgets
Column {
id: controlWidgets
......@@ -151,6 +152,7 @@ Map {
}
} // Row - +/- buttons
} // Column - Map control widgets
*********************************************/
/*
The slider and scale display are commented out for now to try to save real estate - DonLakeFlyer
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 72 72" enable-background="new 0 0 72 72" xml:space="preserve">
<circle fill="none" stroke="#FFFFFF" stroke-width="2" stroke-miterlimit="10" cx="29.573" cy="30.04" r="22.416"/>
<line fill="none" stroke="#FFFFFF" stroke-width="3" stroke-miterlimit="10" x1="64.8" y1="64.83" x2="45.801" y2="45.765"/>
<line fill="none" x1="16.973" y1="30.04" x2="42.173" y2="30.04"/>
<line fill="none" stroke="#FFFFFF" stroke-width="5" stroke-miterlimit="10" x1="16.973" y1="30.134" x2="42.173" y2="29.946"/>
viewBox="-269 361 72 72" style="enable-background:new -269 361 72 72;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;stroke:#FFFFFF;stroke-width:2;stroke-miterlimit:10;}
.st1{fill:none;stroke:#FFFFFF;stroke-width:3;stroke-miterlimit:10;}
.st2{fill:none;}
.st3{fill:none;stroke:#FFFFFF;stroke-width:5;stroke-miterlimit:10;}
</style>
<circle class="st0" cx="-236.2" cy="393.9" r="11.2"/>
<line class="st1" x1="-218.6" y1="411.3" x2="-228.1" y2="401.8"/>
<line class="st2" x1="-242.5" y1="393.9" x2="-229.9" y2="393.9"/>
<line class="st3" x1="-242.5" y1="394" x2="-229.9" y2="393.9"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 72 72" enable-background="new 0 0 72 72" xml:space="preserve">
<circle fill="none" stroke="#FFFFFF" stroke-width="2" stroke-miterlimit="10" cx="29.573" cy="30.04" r="22.416"/>
<line fill="none" stroke="#FFFFFF" stroke-width="3" stroke-miterlimit="10" x1="64.8" y1="64.83" x2="45.801" y2="45.765"/>
<path fill="#FFFFFF" d="M27.36,42.653V32.187H16.973v-4.374H27.36V17.426h4.426v10.387h10.387v4.374H31.786v10.466H27.36z"/>
viewBox="-269 361 72 72" style="enable-background:new -269 361 72 72;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;stroke:#FFFFFF;stroke-width:2;stroke-miterlimit:10;}
.st1{fill:none;stroke:#FFFFFF;stroke-width:3;stroke-miterlimit:10;}
.st2{fill:#FFFFFF;}
</style>
<circle class="st0" cx="-236.2" cy="393.9" r="11.2"/>
<line class="st1" x1="-218.6" y1="411.3" x2="-228.1" y2="401.8"/>
<path class="st2" d="M-237.3,400.2V395h-5.2v-2.2h5.2v-5.2h2.2v5.2h5.2v2.2h-5.2v5.2H-237.3z"/>
</svg>
......@@ -33,8 +33,9 @@ import QGroundControl.Vehicle 1.0
/// Marker for displaying a vehicle location on the map
MapQuickItem {
property var vehicle ///< Vehicle object
property bool isSatellite: false ///< true: satellite map is showing
property var vehicle ///< Vehicle object
property bool isSatellite: false ///< true: satellite map is showing
property real size: ScreenTools.defaultFontPixelHeight * 5
anchorPoint.x: vehicleIcon.width / 2
anchorPoint.y: vehicleIcon.height / 2
......@@ -44,7 +45,7 @@ MapQuickItem {
id: vehicleIcon
source: isSatellite ? "/qmlimages/airplaneOpaque.svg" : "/qmlimages/airplaneOutline.svg"
mipmap: true
width: ScreenTools.defaultFontPixelHeight * 5
width: size
fillMode: Image.PreserveAspectFit
transform: Rotation {
......
......@@ -36,21 +36,26 @@ Item {
id: root
height: size
property alias heading: compass.heading
property alias active: attitude.active
property alias rollAngle: attitude.rollAngle
property alias pitchAngle: attitude.pitchAngle
property real size: ScreenTools.defaultFontPixelSize * (10)
property alias heading: compass.heading
property alias rollAngle: attitude.rollAngle
property alias pitchAngle: attitude.pitchAngle
property real size: ScreenTools.defaultFontPixelSize * (10)
property bool isSatellite: false
property bool active: false
property bool _isVisible: true
//-- Instrument Pannel
Rectangle {
id: instrumentPannel
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: root.size
width: instruments.width + 8
radius: root.size / 2
color: Qt.rgba(0,0,0,0.5)
visible: _isVisible
color: isSatellite ? Qt.rgba(1,1,1,0.5) : Qt.rgba(0,0,0,0.5)
Row {
id: instruments
height: parent.height
......@@ -59,14 +64,49 @@ Item {
QGCAttitudeWidget {
id: attitude
size: parent.height * 0.9
active: root.active
anchors.verticalCenter: parent.verticalCenter
}
QGCCompassWidget {
id: compass
size: parent.height * 0.9
active: root.active
anchors.verticalCenter: parent.verticalCenter
}
}
MouseArea {
anchors.fill: parent
onClicked: {
_isVisible = !_isVisible
}
}
}
//-- Show Instruments
Rectangle {
id: openButton
anchors.right: parent.right
anchors.bottom: parent.bottom
height: 24
width: 24
radius: 4
visible: !_isVisible
color: isSatellite ? Qt.rgba(1,1,1,0.5) : Qt.rgba(0,0,0,0.5)
Image {
width: parent.width * 0.75
height: parent.height * 0.75
source: "/qmlimages/buttonLeft.svg"
mipmap: true
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
}
MouseArea {
anchors.fill: parent
onClicked: {
_isVisible = !_isVisible
}
}
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment