FlightDisplayView.qml 5.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
/*=====================================================================

QGroundControl Open Source Ground Control Station

(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>

This file is part of the QGROUNDCONTROL project

    QGROUNDCONTROL is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QGROUNDCONTROL is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.

======================================================================*/

import QtQuick                  2.4
import QtQuick.Controls         1.3
import QtQuick.Controls.Styles  1.2
import QtQuick.Dialogs          1.2

import QGroundControl.FlightMap     1.0
import QGroundControl.ScreenTools   1.0
import QGroundControl.Controls      1.0
import QGroundControl.Palette       1.0


/// Flight Display View
Item {
    id: root

    property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }

    property var _activeVehicle: multiVehicleManager.activeVehicle

    readonly property real _defaultLatitude:        37.803784
    readonly property real _defaultLongitude:       -122.462276
    readonly property real _defaultRoll:            0
    readonly property real _defaultPitch:           0
    readonly property real _defaultHeading:         0
    readonly property real _defaultAltitudeWGS84:   0
    readonly property real _defaultGroundSpeed:     0
    readonly property real _defaultAirSpeed:        0
    readonly property real _defaultClimbRate:       0

    property real _roll:            _activeVehicle ? (isNaN(_activeVehicle.roll) ? _defaultRoll : _activeVehicle.roll) : _defaultRoll
    property real _pitch:           _activeVehicle ? (isNaN(_activeVehicle.pitch) ? _defaultPitch : _activeVehicle.pitch) : _defaultPitch
55 56
    property real _heading:         _activeVehicle ? (isNaN(_activeVehicle.heading) ? _defaultHeading : _activeVehicle.heading) : _defaultHeading

57 58
    property real _latitude:        _activeVehicle ? ((_activeVehicle.latitude  === 0) ? _defaultLatitude : _activeVehicle.latitude) : _defaultLatitude
    property real _longitude:       _activeVehicle ? ((_activeVehicle.longitude === 0) ? _defaultLongitude : _activeVehicle.longitude) : _defaultLongitude
59

60 61 62 63 64 65 66 67 68 69 70 71 72 73
    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

    function getBool(value) {
        return value === '0' ? false : true;
    }

    function setBool(value) {
        return value ? "1" : "0";
    }

    FlightMap {
74 75 76 77 78 79 80 81
        id:                 flightMap
        anchors.fill:       parent
        mapName:            "FlightDisplayView"
        latitude:           parent._latitude
        longitude:          parent._longitude
        z:                  10
        showVehicles:       true
        showMissionItems:   true
82 83 84 85 86 87
    }

    QGCCompassWidget {
        x:          ScreenTools.defaultFontPixelSize * (7.1)
        y:          ScreenTools.defaultFontPixelSize * (0.42)
        size:       ScreenTools.defaultFontPixelSize * (13.3)
88
        heading:    parent._heading
89 90 91 92 93 94 95 96 97
        active:     multiVehicleManager.activeVehicleAvailable
        z:          flightMap.z + 2
    }

    QGCAttitudeWidget {
        anchors.rightMargin:    ScreenTools.defaultFontPixelSize * (7.1)
        anchors.right:          parent.right
        y:                      ScreenTools.defaultFontPixelSize * (0.42)
        size:                   ScreenTools.defaultFontPixelSize * (13.3)
98 99
        rollAngle:              parent._roll
        pitchAngle:             parent._pitch
100 101 102 103 104 105 106 107
        active:                 multiVehicleManager.activeVehicleAvailable
        z:                      flightMap.z + 2
    }

    QGCAltitudeWidget {
        anchors.right:  parent.right
        height:         parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
        width:          ScreenTools.defaultFontPixelSize * (5)
108
        altitude:       parent._altitudeWGS84
109 110 111 112 113 114 115
        z:              30
    }

    QGCSpeedWidget {
        anchors.left:   parent.left
        width:          ScreenTools.defaultFontPixelSize * (5)
        height:         parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
116
        speed:          parent._groundSpeed
117 118 119 120 121 122
        z:              40
    }

    QGCCurrentSpeed {
        anchors.left:       parent.left
        width:              ScreenTools.defaultFontPixelSize * (6.25)
123 124
        airspeed:           parent._airSpeed
        groundspeed:        parent._groundSpeed
125 126 127 128 129 130 131
        active:             multiVehicleManager.activeVehicleAvailable
        z:                  50
    }

    QGCCurrentAltitude {
        anchors.right:      parent.right
        width:              ScreenTools.defaultFontPixelSize * (6.25)
132 133
        altitude:           parent._altitudeWGS84
        vertZ:              parent._climbRate
134 135 136 137
        active:             multiVehicleManager.activeVehicleAvailable
        z:                  60
    }
}