SurveyItemEditor.qml 9.16 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
import QGroundControl.ScreenTools   1.0
import QGroundControl.Vehicle       1.0
import QGroundControl.Controls      1.0
12
import QGroundControl.FactSystem    1.0
13 14
import QGroundControl.FactControls  1.0
import QGroundControl.Palette       1.0
15
import QGroundControl.FlightMap     1.0
16 17 18

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

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

28 29 30 31
    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
32

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

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

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

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

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

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

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

69
        CameraCalc {
70 71 72 73 74 75
            cameraCalc:                     missionItem.cameraCalc
            vehicleFlightIsFrontal:         true
            distanceToSurfaceLabel:         qsTr("Altitude")
            distanceToSurfaceAltitudeMode:  missionItem.followTerrain ? QGroundControl.AltitudeModeAboveTerrain : QGroundControl.AltitudeModeRelative
            frontalDistanceLabel:           qsTr("Trigger Dist")
            sideDistanceLabel:              qsTr("Spacing")
Don Gagne's avatar
Don Gagne committed
76 77
        }

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

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

91
            QGCLabel { text: qsTr("Angle") }
DonLakeFlyer's avatar
DonLakeFlyer committed
92
            FactTextField {
93
                fact:                   missionItem.gridAngle
DonLakeFlyer's avatar
DonLakeFlyer committed
94
                Layout.fillWidth:       true
95 96
                onUpdated:              angleSlider.value = missionItem.gridAngle.value
            }
Don Gagne's avatar
Don Gagne committed
97

98 99 100 101 102 103 104 105 106 107 108 109
            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
110 111 112 113
            }

            QGCLabel { text: qsTr("Turnaround dist") }
            FactTextField {
Don Gagne's avatar
Don Gagne committed
114 115
                fact:               missionItem.turnAroundDistance
                Layout.fillWidth:   true
Don Gagne's avatar
Don Gagne committed
116
            }
Don Gagne's avatar
Don Gagne committed
117 118 119 120 121 122 123
        }

        ColumnLayout {
            anchors.left:   parent.left
            anchors.right:  parent.right
            spacing:        _margin
            visible:        transectsHeader.checked
124

DonLakeFlyer's avatar
DonLakeFlyer committed
125 126 127
            QGCButton {
                text:               qsTr("Rotate Entry Point")
                onClicked:          missionItem.rotateEntryPoint();
DonLakeFlyer's avatar
DonLakeFlyer committed
128 129
            }

130 131
            /*
              Temporarily removed due to bug https://github.com/mavlink/qgroundcontrol/issues/7005
132 133 134 135
            FactCheckBox {
                text:       qsTr("Split concave polygons")
                fact:       _splitConcave
                visible:    _splitConcave.visible
136
                property Fact _splitConcave: missionItem.splitConcavePolygons
137
            }
138
            */
139

140 141 142 143
            FactCheckBox {
                text:               qsTr("Hover and capture image")
                fact:               missionItem.hoverAndCapture
                visible:            missionItem.hoverAndCaptureAllowed
144
                enabled:            !missionItem.followTerrain
145 146
                onClicked: {
                    if (checked) {
DonLakeFlyer's avatar
DonLakeFlyer committed
147
                        missionItem.cameraTriggerInTurnAround.rawValue = false
148 149 150 151 152
                    }
                }
            }

            FactCheckBox {
Don Gagne's avatar
Don Gagne committed
153
                text:               qsTr("Refly at 90 deg offset")
154 155
                fact:               missionItem.refly90Degrees
                enabled:            !missionItem.followTerrain
156
            }
Don Gagne's avatar
Don Gagne committed
157

158
            FactCheckBox {
Don Gagne's avatar
Don Gagne committed
159
                text:               qsTr("Images in turnarounds")
160 161
                fact:               missionItem.cameraTriggerInTurnAround
                enabled:            missionItem.hoverAndCaptureAllowed ? !missionItem.hoverAndCapture.rawValue : true
162 163
            }

164 165 166
            FactCheckBox {
                text:               qsTr("Fly alternate transects")
                fact:               missionItem.flyAlternateTransects
167
                visible:            _vehicle.fixedWing || _vehicle.vtol
168 169
            }

170 171
            QGCCheckBox {
                id:                 relAlt
172
                Layout.alignment:   Qt.AlignLeft
DonLakeFlyer's avatar
DonLakeFlyer committed
173
                text:               qsTr("Relative altitude")
174 175
                checked:            missionItem.cameraCalc.distanceToSurfaceRelative
                enabled:            missionItem.cameraCalc.isManualCamera && !missionItem.followTerrain
176
                visible:            QGroundControl.corePlugin.options.showMissionAbsoluteAltitude || (!missionItem.cameraCalc.distanceToSurfaceRelative && !missionItem.followTerrain)
177
                onClicked:          missionItem.cameraCalc.distanceToSurfaceRelative = checked
Don Gagne's avatar
Don Gagne committed
178

179 180 181
                Connections {
                    target: missionItem.cameraCalc
                    onDistanceToSurfaceRelativeChanged: relAlt.checked = missionItem.cameraCalc.distanceToSurfaceRelative
182 183
                }
            }
184
        }
185

186 187 188 189
        SectionHeader {
            id:         terrainHeader
            text:       qsTr("Terrain")
            checked:    missionItem.followTerrain
190
        }
191

192 193 194 195 196
        ColumnLayout {
            anchors.left:   parent.left
            anchors.right:  parent.right
            spacing:        _margin
            visible:        terrainHeader.checked
197

198 199 200 201 202 203
            QGCCheckBox {
                id:         followsTerrainCheckBox
                text:       qsTr("Vehicle follows terrain")
                checked:    missionItem.followTerrain
                onClicked:  missionItem.followTerrain = checked
            }
204

205
            GridLayout {
206 207 208 209 210
                Layout.fillWidth:   true
                columnSpacing:      _margin
                rowSpacing:         _margin
                columns:            2
                visible:            followsTerrainCheckBox.checked
211

212 213 214 215 216
                QGCLabel { text: qsTr("Tolerance") }
                FactTextField {
                    fact:               missionItem.terrainAdjustTolerance
                    Layout.fillWidth:   true
                }
217

218 219 220 221 222
                QGCLabel { text: qsTr("Max Climb Rate") }
                FactTextField {
                    fact:               missionItem.terrainAdjustMaxClimbRate
                    Layout.fillWidth:   true
                }
223

224 225 226 227 228
                QGCLabel { text: qsTr("Max Descent Rate") }
                FactTextField {
                    fact:               missionItem.terrainAdjustMaxDescentRate
                    Layout.fillWidth:   true
                }
229
            }
230 231
        }

232 233 234
        SectionHeader {
            id:     statsHeader
            text:   qsTr("Statistics")
235
        }
236

237 238 239
        TransectStyleComplexItemStats { }
    } // Column
} // Rectangle