SurveyItemEditor.qml 8.92 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
            id:             transectsGrid
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 97 98 99 100 101 102 103 104 105 106 107 108
                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
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
            }
116

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

123 124 125 126
            FactCheckBox {
                text:       qsTr("Split concave polygons")
                fact:       _splitConcave
                visible:    _splitConcave.visible
127
                property Fact _splitConcave: missionItem.splitConcavePolygons
128 129
            }

130 131 132 133
            FactCheckBox {
                text:               qsTr("Hover and capture image")
                fact:               missionItem.hoverAndCapture
                visible:            missionItem.hoverAndCaptureAllowed
134
                enabled:            !missionItem.followTerrain
135 136 137
                Layout.columnSpan:  2
                onClicked: {
                    if (checked) {
DonLakeFlyer's avatar
DonLakeFlyer committed
138
                        missionItem.cameraTriggerInTurnAround.rawValue = false
139 140 141 142 143
                    }
                }
            }

            FactCheckBox {
Don Gagne's avatar
Don Gagne committed
144
                text:               qsTr("Refly at 90 deg offset")
145 146
                fact:               missionItem.refly90Degrees
                enabled:            !missionItem.followTerrain
147 148
                Layout.columnSpan:  2
            }
Don Gagne's avatar
Don Gagne committed
149

150
            FactCheckBox {
Don Gagne's avatar
Don Gagne committed
151
                text:               qsTr("Images in turnarounds")
152 153
                fact:               missionItem.cameraTriggerInTurnAround
                enabled:            missionItem.hoverAndCaptureAllowed ? !missionItem.hoverAndCapture.rawValue : true
DonLakeFlyer's avatar
DonLakeFlyer committed
154
                Layout.columnSpan:  2
155 156
            }

157 158 159
            FactCheckBox {
                text:               qsTr("Fly alternate transects")
                fact:               missionItem.flyAlternateTransects
160
                visible:            _vehicle.fixedWing || _vehicle.vtol
161 162 163
                Layout.columnSpan:  2
            }

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

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

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

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

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

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

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

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

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

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

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