FWLandingPatternEditor.qml 6.37 KB
Newer Older
1 2 3 4 5 6 7 8 9
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

10 11
import QtQuick          2.3
import QtQuick.Controls 1.2
12
import QtQuick.Dialogs  1.2
13
import QtQuick.Layouts  1.2
14 15 16 17 18 19 20 21 22 23 24

import QGroundControl               1.0
import QGroundControl.ScreenTools   1.0
import QGroundControl.Vehicle       1.0
import QGroundControl.Controls      1.0
import QGroundControl.FactControls  1.0
import QGroundControl.Palette       1.0

// Editor for Fixed Wing Landing Pattern complex mission item
Rectangle {
    id:         _root
25
    height:     visible ? ((editorColumn.visible ? editorColumn.height : editorColumnNeedLandingPoint.height) + (_margin * 2)) : 0
26 27 28 29 30 31 32 33
    width:      availableWidth
    color:      qgcPal.windowShadeDark
    radius:     _radius

    // The following properties must be available up the hierarchy chain
    //property real   availableWidth    ///< Width for control
    //property var    missionItem       ///< Mission Item for editor

34
    property real _margin: ScreenTools.defaultFontPixelWidth / 2
35
    property real _spacer: ScreenTools.defaultFontPixelWidth / 2
36 37

    Column {
38 39 40 41
        id:                 editorColumn
        anchors.margins:    _margin
        anchors.left:       parent.left
        anchors.right:      parent.right
42
        spacing:            _margin
43
        visible:            missionItem.landingCoordSet
44

45 46 47
        SectionHeader {
            text: qsTr("Loiter point")
        }
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

        Item { width: 1; height: _spacer }

        FactTextFieldGrid {
            anchors.left:   parent.left
            anchors.right:  parent.right
            factList:       [ missionItem.loiterAltitude, missionItem.loiterRadius ]
        }

        Item { width: 1; height: _spacer }

        QGCCheckBox {
            id:             loiterAltRelative
            anchors.right:  parent.right
            text:           qsTr("Altitude relative to home")
            checked:        missionItem.loiterAltitudeRelative
            onClicked:      missionItem.loiterAltitudeRelative = checked
        }

        Item { width: 1; height: _spacer }

        QGCCheckBox {
            anchors.left:   loiterAltRelative.left
            text:           qsTr("Loiter clockwise")
            checked:        missionItem.loiterClockwise
            onClicked:      missionItem.loiterClockwise = checked
        }

76
        SectionHeader { text: qsTr("Landing point") }
77 78

        Item { width: 1; height: _spacer }
79

80 81 82 83 84
        GridLayout {
            anchors.left:    parent.left
            anchors.right:   parent.right
            columns:         2

DonLakeFlyer's avatar
DonLakeFlyer committed
85 86 87 88 89 90 91 92 93 94 95 96 97 98
                QGCLabel { text: missionItem.landingHeading.name }

                FactTextField {
                    Layout.fillWidth:   true
                    fact:               missionItem.landingHeading
                }

                QGCLabel { text: missionItem.landingAltitude.name }

                FactTextField {
                    Layout.fillWidth:   true
                    fact:               missionItem.landingAltitude
                }

99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
            QGCRadioButton {
                id:                     useLandingDistance
                text:                   missionItem.landingDistance.name
                checked:                !useFallRate.checked
                onClicked: {
                    useFallRate.checked = false
                    missionItem.fallRate.value = parseFloat(missionItem.loiterAltitude.value)*100/parseFloat (missionItem.landingDistance.value)
                }
                Layout.fillWidth:       true
            }

            FactTextField {
                fact:                   missionItem.landingDistance
                enabled:                useLandingDistance.checked
                Layout.fillWidth:       true
            }

            QGCRadioButton {
                id:                     useFallRate
                text:                   missionItem.fallRate.name
                checked:                !useLandingDistance.checked
                onClicked: {
                    useLandingDistance.checked = false
                    missionItem.landingDistance.value = parseFloat(missionItem.loiterAltitude.value)*100/parseFloat (missionItem.fallRate.value)
                }
                Layout.fillWidth:       true
            }

            FactTextField {
                fact:                   missionItem.fallRate
                enabled:                useFallRate.checked
                Layout.fillWidth:       true
            }

            Connections {
                target: missionItem.landingDistance

                onValueChanged: {
                    missionItem.fallRate.value = parseFloat(missionItem.loiterAltitude.value)*100/parseFloat (missionItem.landingDistance.value)
                }
            }

            Connections {
                target: missionItem.fallRate

                onValueChanged: {
                    missionItem.landingDistance.value = parseFloat(missionItem.loiterAltitude.value)*100/parseFloat (missionItem.fallRate.value)
                }
            }
148 149
        }

150 151 152 153 154 155 156
        Item { width: 1; height: _spacer }

        QGCCheckBox {
            anchors.right:  parent.right
            text:           qsTr("Altitude relative to home")
            checked:        missionItem.landingAltitudeRelative
            onClicked:      missionItem.landingAltitudeRelative = checked
157
        }
158
    }
159 160 161 162 163 164 165

    Column {
        id:                 editorColumnNeedLandingPoint
        anchors.margins:    _margin
        anchors.left:       parent.left
        anchors.right:      parent.right
        visible:            !missionItem.landingCoordSet
Don Gagne's avatar
Don Gagne committed
166
        spacing:            ScreenTools.defaultFontPixelHeight
167

Don Gagne's avatar
Don Gagne committed
168 169 170 171 172 173 174
        QGCLabel {
            anchors.left:   parent.left
            anchors.right:  parent.right
            wrapMode:       Text.WordWrap
            font.pointSize: ScreenTools.smallFontPointSize
            text:           qsTr("WIP (NOT FOR REAL FLIGHT!)")
        }
175

Don Gagne's avatar
Don Gagne committed
176 177 178 179 180 181
        QGCLabel {
            anchors.left:   parent.left
            anchors.right:  parent.right
            wrapMode:       Text.WordWrap
            text:           qsTr("Click in map to set landing point.")
        }
182
    }
183
}