SurveyItemEditor.qml 8.61 KB
Newer Older
1 2
import QtQuick          2.3
import QtQuick.Controls 1.2
3
import QtQuick.Controls.Styles 1.4
Don Gagne's avatar
Don Gagne committed
4
import QtQuick.Dialogs  1.2
5
import QtQuick.Extras   1.4
6
import QtQuick.Layouts  1.2
7

8
import QGroundControl               1.0
9 10 11 12 13
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
14
import QGroundControl.FlightMap     1.0
15 16 17

Rectangle {
    id:         _root
18
    height:     visible ? (editorColumn.height + (_margin * 2)) : 0
19 20 21 22
    width:      availableWidth
    color:      qgcPal.windowShadeDark
    radius:     _radius

Ricardo de Almeida Gonzaga's avatar
Ricardo de Almeida Gonzaga committed
23
    // The following properties must be available up the hierarchy chain
24 25 26
    //property real   availableWidth    ///< Width for control
    //property var    missionItem       ///< Mission Item for editor

27 28 29 30
    property real   _margin:                    ScreenTools.defaultFontPixelWidth / 2
    property real   _fieldWidth:                ScreenTools.defaultFontPixelWidth * 10.5
    property var    _vehicle:                   QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle
    property real   _cameraMinTriggerInterval:  missionItem.cameraCalc.minTriggerInterval.rawValue
Don Gagne's avatar
Don Gagne committed
31

32
    function polygonCaptureStarted() {
Don Gagne's avatar
Don Gagne committed
33
        missionItem.clearPolygon()
34
    }
Don Gagne's avatar
Don Gagne committed
35

36 37 38
    function polygonCaptureFinished(coordinates) {
        for (var i=0; i<coordinates.length; i++) {
            missionItem.addPolygonCoordinate(coordinates[i])
Don Gagne's avatar
Don Gagne committed
39
        }
40
    }
Don Gagne's avatar
Don Gagne committed
41

42 43
    function polygonAdjustVertex(vertexIndex, vertexCoordinate) {
        missionItem.adjustPolygonCoordinate(vertexIndex, vertexCoordinate)
Don Gagne's avatar
Don Gagne committed
44 45
    }

46 47 48
    function polygonAdjustStarted() { }
    function polygonAdjustFinished() { }

49 50 51 52 53 54 55
    QGCPalette { id: qgcPal; colorGroupEnabled: true }

    Column {
        id:                 editorColumn
        anchors.margins:    _margin
        anchors.top:        parent.top
        anchors.left:       parent.left
56
        anchors.right:      parent.right
57 58
        spacing:            _margin

59 60 61
        QGCLabel {
            anchors.left:   parent.left
            anchors.right:  parent.right
62
            text:           qsTr("WARNING: Photo interval is below minimum interval (%1 secs) supported by camera.").arg(_cameraMinTriggerInterval.toFixed(1))
63 64
            wrapMode:       Text.WordWrap
            color:          qgcPal.warningText
65
            visible:        missionItem.cameraShots > 0 && _cameraMinTriggerInterval !== 0 && _cameraMinTriggerInterval > missionItem.timeBetweenShots
66 67
        }

68 69 70 71 72 73
        CameraCalc {
            cameraCalc:             missionItem.cameraCalc
            vehicleFlightIsFrontal: true
            distanceToSurfaceLabel: qsTr("Altitude")
            frontalDistanceLabel:   qsTr("Trigger Distance")
            sideDistanceLabel:      qsTr("Spacing")
Don Gagne's avatar
Don Gagne committed
74 75
        }

76
        SectionHeader {
Don Gagne's avatar
Don Gagne committed
77
            id:     transectsHeader
78
            text:   qsTr("Transects")
79 80
        }

DonLakeFlyer's avatar
DonLakeFlyer committed
81
        GridLayout {
Don Gagne's avatar
Don Gagne committed
82
            id:             transectsGrid
Don Gagne's avatar
Don Gagne committed
83 84
            anchors.left:   parent.left
            anchors.right:  parent.right
DonLakeFlyer's avatar
DonLakeFlyer committed
85 86 87
            columnSpacing:  _margin
            rowSpacing:     _margin
            columns:        2
Don Gagne's avatar
Don Gagne committed
88
            visible:        transectsHeader.checked
89

90
            QGCLabel { text: qsTr("Angle") }
DonLakeFlyer's avatar
DonLakeFlyer committed
91
            FactTextField {
92
                fact:                   missionItem.gridAngle
DonLakeFlyer's avatar
DonLakeFlyer committed
93
                Layout.fillWidth:       true
94 95 96 97 98 99 100 101 102 103 104 105 106 107
                onUpdated:              angleSlider.value = missionItem.gridAngle.value
            }
            QGCSlider {
                id:                     angleSlider
                minimumValue:           0
                maximumValue:           359
                stepSize:               1
                tickmarksEnabled:       false
                Layout.fillWidth:       true
                Layout.columnSpan:      2
                Layout.preferredHeight: ScreenTools.defaultFontPixelHeight * 1.5
                onValueChanged:         missionItem.gridAngle.value = value
                Component.onCompleted:  value = missionItem.gridAngle.value
                updateValueWhileDragging: true
DonLakeFlyer's avatar
DonLakeFlyer committed
108 109 110 111
            }

            QGCLabel { text: qsTr("Turnaround dist") }
            FactTextField {
Don Gagne's avatar
Don Gagne committed
112 113
                fact:               missionItem.turnAroundDistance
                Layout.fillWidth:   true
Don Gagne's avatar
Don Gagne committed
114
            }
115

DonLakeFlyer's avatar
DonLakeFlyer committed
116 117 118 119
            QGCButton {
                Layout.columnSpan:  2
                text:               qsTr("Rotate Entry Point")
                onClicked:          missionItem.rotateEntryPoint();
DonLakeFlyer's avatar
DonLakeFlyer committed
120 121
            }

122 123 124 125
            FactCheckBox {
                text:               qsTr("Hover and capture image")
                fact:               missionItem.hoverAndCapture
                visible:            missionItem.hoverAndCaptureAllowed
126
                enabled:            !missionItem.followTerrain
127 128 129
                Layout.columnSpan:  2
                onClicked: {
                    if (checked) {
DonLakeFlyer's avatar
DonLakeFlyer committed
130
                        missionItem.cameraTriggerInTurnAround.rawValue = false
131 132 133 134 135
                    }
                }
            }

            FactCheckBox {
Don Gagne's avatar
Don Gagne committed
136
                text:               qsTr("Refly at 90 deg offset")
137 138
                fact:               missionItem.refly90Degrees
                enabled:            !missionItem.followTerrain
139 140
                Layout.columnSpan:  2
            }
Don Gagne's avatar
Don Gagne committed
141

142
            FactCheckBox {
Don Gagne's avatar
Don Gagne committed
143
                text:               qsTr("Images in turnarounds")
144 145
                fact:               missionItem.cameraTriggerInTurnAround
                enabled:            missionItem.hoverAndCaptureAllowed ? !missionItem.hoverAndCapture.rawValue : true
DonLakeFlyer's avatar
DonLakeFlyer committed
146
                Layout.columnSpan:  2
147 148
            }

149 150 151
            FactCheckBox {
                text:               qsTr("Fly alternate transects")
                fact:               missionItem.flyAlternateTransects
152
                visible:            _vehicle.fixedWing || _vehicle.vtol
153 154 155
                Layout.columnSpan:  2
            }

156 157
            QGCCheckBox {
                id:                 relAlt
158
                Layout.alignment:   Qt.AlignLeft
DonLakeFlyer's avatar
DonLakeFlyer committed
159
                text:               qsTr("Relative altitude")
160 161
                checked:            missionItem.cameraCalc.distanceToSurfaceRelative
                enabled:            missionItem.cameraCalc.isManualCamera && !missionItem.followTerrain
162
                visible:            QGroundControl.corePlugin.options.showMissionAbsoluteAltitude || (!missionItem.cameraCalc.distanceToSurfaceRelative && !missionItem.followTerrain)
DonLakeFlyer's avatar
DonLakeFlyer committed
163
                Layout.columnSpan:  2
164
                onClicked:          missionItem.cameraCalc.distanceToSurfaceRelative = checked
Don Gagne's avatar
Don Gagne committed
165

166 167 168
                Connections {
                    target: missionItem.cameraCalc
                    onDistanceToSurfaceRelativeChanged: relAlt.checked = missionItem.cameraCalc.distanceToSurfaceRelative
169 170
                }
            }
171
        }
172

173 174 175 176
        SectionHeader {
            id:         terrainHeader
            text:       qsTr("Terrain")
            checked:    missionItem.followTerrain
177
        }
178

179 180 181 182 183
        ColumnLayout {
            anchors.left:   parent.left
            anchors.right:  parent.right
            spacing:        _margin
            visible:        terrainHeader.checked
184

185 186 187 188 189 190
            QGCCheckBox {
                id:         followsTerrainCheckBox
                text:       qsTr("Vehicle follows terrain")
                checked:    missionItem.followTerrain
                onClicked:  missionItem.followTerrain = checked
            }
191

192
            GridLayout {
193 194 195 196 197
                Layout.fillWidth:   true
                columnSpacing:      _margin
                rowSpacing:         _margin
                columns:            2
                visible:            followsTerrainCheckBox.checked
198

199 200 201 202 203
                QGCLabel { text: qsTr("Tolerance") }
                FactTextField {
                    fact:               missionItem.terrainAdjustTolerance
                    Layout.fillWidth:   true
                }
204

205 206 207 208 209
                QGCLabel { text: qsTr("Max Climb Rate") }
                FactTextField {
                    fact:               missionItem.terrainAdjustMaxClimbRate
                    Layout.fillWidth:   true
                }
210

211 212 213 214 215
                QGCLabel { text: qsTr("Max Descent Rate") }
                FactTextField {
                    fact:               missionItem.terrainAdjustMaxDescentRate
                    Layout.fillWidth:   true
                }
216
            }
217 218
        }

219 220 221
        SectionHeader {
            id:     statsHeader
            text:   qsTr("Statistics")
222
        }
223

224 225 226
        TransectStyleComplexItemStats { }
    } // Column
} // Rectangle