SurveyItemEditor.qml 8.85 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 131 132
            FactCheckBox {
                text:       qsTr("Split concave polygons")
                fact:       _splitConcave
                visible:    _splitConcave.visible
133
                property Fact _splitConcave: missionItem.splitConcavePolygons
134 135
            }

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

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

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

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

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

175 176 177
                Connections {
                    target: missionItem.cameraCalc
                    onDistanceToSurfaceRelativeChanged: relAlt.checked = missionItem.cameraCalc.distanceToSurfaceRelative
178 179
                }
            }
180
        }
181

182 183 184 185
        SectionHeader {
            id:         terrainHeader
            text:       qsTr("Terrain")
            checked:    missionItem.followTerrain
186
        }
187

188 189 190 191 192
        ColumnLayout {
            anchors.left:   parent.left
            anchors.right:  parent.right
            spacing:        _margin
            visible:        terrainHeader.checked
193

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

201
            GridLayout {
202 203 204 205 206
                Layout.fillWidth:   true
                columnSpacing:      _margin
                rowSpacing:         _margin
                columns:            2
                visible:            followsTerrainCheckBox.checked
207

208 209 210 211 212
                QGCLabel { text: qsTr("Tolerance") }
                FactTextField {
                    fact:               missionItem.terrainAdjustTolerance
                    Layout.fillWidth:   true
                }
213

214 215 216 217 218
                QGCLabel { text: qsTr("Max Climb Rate") }
                FactTextField {
                    fact:               missionItem.terrainAdjustMaxClimbRate
                    Layout.fillWidth:   true
                }
219

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

228 229 230
        SectionHeader {
            id:     statsHeader
            text:   qsTr("Statistics")
231
        }
232

233 234 235
        TransectStyleComplexItemStats { }
    } // Column
} // Rectangle