SurveyItemEditor.qml 8.98 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 70 71 72 73 74
        CameraCalc {
            cameraCalc:             missionItem.cameraCalc
            vehicleFlightIsFrontal: true
            distanceToSurfaceLabel: qsTr("Altitude")
            frontalDistanceLabel:   qsTr("Trigger Distance")
            sideDistanceLabel:      qsTr("Spacing")
Don Gagne's avatar
Don Gagne committed
75 76
        }

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

DonLakeFlyer's avatar
DonLakeFlyer committed
82
        GridLayout {
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
                onUpdated:              angleSlider.value = missionItem.gridAngle.value
            }
Don Gagne's avatar
Don Gagne committed
96

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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