SurveyItemEditor.qml 7.42 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

100 101 102
            QGCLabel {
                text: qsTr("Entry")
            }
DonLakeFlyer's avatar
DonLakeFlyer committed
103 104 105 106 107 108
            FactComboBox {
                fact:                   missionItem.gridEntryLocation
                indexModel:             false
                Layout.fillWidth:       true
            }

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

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

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

136 137
            QGCCheckBox {
                id:                 relAlt
DonLakeFlyer's avatar
DonLakeFlyer committed
138 139
                anchors.left:       parent.left
                text:               qsTr("Relative altitude")
140 141
                checked:            missionItem.cameraCalc.distanceToSurfaceRelative
                enabled:            missionItem.cameraCalc.isManualCamera && !missionItem.followTerrain
DonLakeFlyer's avatar
DonLakeFlyer committed
142
                Layout.columnSpan:  2
143
                onClicked:          missionItem.cameraCalc.distanceToSurfaceRelative = checked
Don Gagne's avatar
Don Gagne committed
144

145 146 147
                Connections {
                    target: missionItem.cameraCalc
                    onDistanceToSurfaceRelativeChanged: relAlt.checked = missionItem.cameraCalc.distanceToSurfaceRelative
148 149
                }
            }
150
        }
151

152 153 154 155
        SectionHeader {
            id:         terrainHeader
            text:       qsTr("Terrain")
            checked:    missionItem.followTerrain
156
        }
157

158 159 160 161 162
        ColumnLayout {
            anchors.left:   parent.left
            anchors.right:  parent.right
            spacing:        _margin
            visible:        terrainHeader.checked
163

164 165 166 167 168 169
            QGCCheckBox {
                id:         followsTerrainCheckBox
                text:       qsTr("Vehicle follows terrain")
                checked:    missionItem.followTerrain
                onClicked:  missionItem.followTerrain = checked
            }
170

171 172 173 174 175 176 177
            GridLayout {
                anchors.left:   parent.left
                anchors.right:  parent.right
                columnSpacing:  _margin
                rowSpacing:     _margin
                columns:        2
                visible:        followsTerrainCheckBox.checked
178

179 180 181 182 183
                QGCLabel { text: qsTr("Tolerance") }
                FactTextField {
                    fact:               missionItem.terrainAdjustTolerance
                    Layout.fillWidth:   true
                }
184

185 186 187 188 189
                QGCLabel { text: qsTr("Max Climb Rate") }
                FactTextField {
                    fact:               missionItem.terrainAdjustMaxClimbRate
                    Layout.fillWidth:   true
                }
190

191 192 193 194 195
                QGCLabel { text: qsTr("Max Descent Rate") }
                FactTextField {
                    fact:               missionItem.terrainAdjustMaxDescentRate
                    Layout.fillWidth:   true
                }
196
            }
197 198
        }

199 200 201
        SectionHeader {
            id:     statsHeader
            text:   qsTr("Statistics")
202
        }
203

204 205 206
        TransectStyleComplexItemStats { }
    } // Column
} // Rectangle