SurveyItemEditor.qml 7.88 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 30
    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
31

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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