SurveyItemEditor.qml 7.79 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
    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
Don Gagne's avatar
Don Gagne committed
30

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

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

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

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

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

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

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

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

75
        SectionHeader {
76 77
            id:     corridorHeader
            text:   qsTr("Transects")
78 79
        }

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

88
            QGCLabel { text: qsTr("Angle") }
DonLakeFlyer's avatar
DonLakeFlyer committed
89
            FactTextField {
90
                fact:                   missionItem.gridAngle
DonLakeFlyer's avatar
DonLakeFlyer committed
91 92 93 94 95
                Layout.fillWidth:       true
            }

            QGCLabel { text: qsTr("Turnaround dist") }
            FactTextField {
96
                fact:                   missionItem.turnAroundDistance
DonLakeFlyer's avatar
DonLakeFlyer committed
97
                Layout.fillWidth:       true
Don Gagne's avatar
Don Gagne committed
98
            }
99

DonLakeFlyer's avatar
DonLakeFlyer committed
100 101 102 103
            QGCButton {
                Layout.columnSpan:  2
                text:               qsTr("Rotate Entry Point")
                onClicked:          missionItem.rotateEntryPoint();
DonLakeFlyer's avatar
DonLakeFlyer committed
104 105
            }

106 107 108 109
            FactCheckBox {
                text:               qsTr("Hover and capture image")
                fact:               missionItem.hoverAndCapture
                visible:            missionItem.hoverAndCaptureAllowed
110
                enabled:            !missionItem.followTerrain
111 112 113 114 115 116 117 118 119
                Layout.columnSpan:  2
                onClicked: {
                    if (checked) {
                        missionItem.cameraTriggerInTurnaround.rawValue = false
                    }
                }
            }

            FactCheckBox {
120 121 122
                text:               qsTr("Refly at 90 degree offset")
                fact:               missionItem.refly90Degrees
                enabled:            !missionItem.followTerrain
123 124
                Layout.columnSpan:  2
            }
Don Gagne's avatar
Don Gagne committed
125

126 127 128 129
            FactCheckBox {
                text:               qsTr("Take images in turnarounds")
                fact:               missionItem.cameraTriggerInTurnAround
                enabled:            missionItem.hoverAndCaptureAllowed ? !missionItem.hoverAndCapture.rawValue : true
DonLakeFlyer's avatar
DonLakeFlyer committed
130
                Layout.columnSpan:  2
131 132
            }

133 134 135
            FactCheckBox {
                text:               qsTr("Fly alternate transects")
                fact:               missionItem.flyAlternateTransects
136
                visible:            _vehicle.fixedWing || _vehicle.vtol
137 138 139
                Layout.columnSpan:  2
            }

140 141
            QGCCheckBox {
                id:                 relAlt
142
                Layout.alignment:   Qt.AlignLeft
DonLakeFlyer's avatar
DonLakeFlyer committed
143
                text:               qsTr("Relative altitude")
144 145
                checked:            missionItem.cameraCalc.distanceToSurfaceRelative
                enabled:            missionItem.cameraCalc.isManualCamera && !missionItem.followTerrain
146
                visible:            QGroundControl.corePlugin.options.showMissionAbsoluteAltitude || (!missionItem.cameraCalc.distanceToSurfaceRelative && !missionItem.followTerrain)
DonLakeFlyer's avatar
DonLakeFlyer committed
147
                Layout.columnSpan:  2
148
                onClicked:          missionItem.cameraCalc.distanceToSurfaceRelative = checked
Don Gagne's avatar
Don Gagne committed
149

150 151 152
                Connections {
                    target: missionItem.cameraCalc
                    onDistanceToSurfaceRelativeChanged: relAlt.checked = missionItem.cameraCalc.distanceToSurfaceRelative
153 154
                }
            }
155
        }
156

157 158 159 160
        SectionHeader {
            id:         terrainHeader
            text:       qsTr("Terrain")
            checked:    missionItem.followTerrain
161
        }
162

163 164 165 166 167
        ColumnLayout {
            anchors.left:   parent.left
            anchors.right:  parent.right
            spacing:        _margin
            visible:        terrainHeader.checked
168

169 170 171 172 173 174
            QGCCheckBox {
                id:         followsTerrainCheckBox
                text:       qsTr("Vehicle follows terrain")
                checked:    missionItem.followTerrain
                onClicked:  missionItem.followTerrain = checked
            }
175

176
            GridLayout {
177 178 179 180 181
                Layout.fillWidth:   true
                columnSpacing:      _margin
                rowSpacing:         _margin
                columns:            2
                visible:            followsTerrainCheckBox.checked
182

183 184 185 186 187
                QGCLabel { text: qsTr("Tolerance") }
                FactTextField {
                    fact:               missionItem.terrainAdjustTolerance
                    Layout.fillWidth:   true
                }
188

189 190 191 192 193
                QGCLabel { text: qsTr("Max Climb Rate") }
                FactTextField {
                    fact:               missionItem.terrainAdjustMaxClimbRate
                    Layout.fillWidth:   true
                }
194

195 196 197 198 199
                QGCLabel { text: qsTr("Max Descent Rate") }
                FactTextField {
                    fact:               missionItem.terrainAdjustMaxDescentRate
                    Layout.fillWidth:   true
                }
200
            }
201 202
        }

203 204 205
        SectionHeader {
            id:     statsHeader
            text:   qsTr("Statistics")
206
        }
207

208 209 210
        TransectStyleComplexItemStats { }
    } // Column
} // Rectangle