QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
StructureScanEditor.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Dialogs
4import QtQuick.Layouts
5
6import QGroundControl
7import QGroundControl.Controls
8import QGroundControl.FactControls
9import QGroundControl.FlightMap
10
11// Editor for Survery mission items
12Rectangle {
13 id: _root
14 height: visible ? (editorColumn.height + (_margin * 2)) : 0
15 width: availableWidth
16 color: qgcPal.windowShadeDark
17 radius: _radius
18
19 required property var missionItem
20 required property real availableWidth
21
22 property real _margin: ScreenTools.defaultFontPixelWidth / 2
23 property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10.5
24 property var _vehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle
25 property real _cameraMinTriggerInterval: missionItem.cameraCalc.minTriggerInterval.rawValue
26
27 function polygonCaptureStarted() {
28 missionItem.clearPolygon()
29 }
30
31 function polygonCaptureFinished(coordinates) {
32 for (var i=0; i<coordinates.length; i++) {
33 missionItem.addPolygonCoordinate(coordinates[i])
34 }
35 }
36
37 function polygonAdjustVertex(vertexIndex, vertexCoordinate) {
38 missionItem.adjustPolygonCoordinate(vertexIndex, vertexCoordinate)
39 }
40
41 function polygonAdjustStarted() { }
42 function polygonAdjustFinished() { }
43
44 function _topLayerAltText() {
45 return QGroundControl.unitsConversion.metersToAppSettingsVerticalDistanceUnitsString(missionItem.topFlightAlt)
46 }
47
48 function _bottomLayerAltText() {
49 return QGroundControl.unitsConversion.metersToAppSettingsVerticalDistanceUnitsString(missionItem.bottomFlightAlt)
50 }
51
52 QGCPalette { id: qgcPal; colorGroupEnabled: true }
53
54 ColumnLayout {
55 id: editorColumn
56 anchors.margins: _margin
57 anchors.top: parent.top
58 anchors.left: parent.left
59 anchors.right: parent.right
60
61 QGCLabel {
62 id: wizardLabel
63 Layout.fillWidth: true
64 wrapMode: Text.WordWrap
65 horizontalAlignment: Text.AlignHCenter
66 text: qsTr("Use the Polygon Tools to create the polygon which outlines the structure.")
67 visible: !missionItem.structurePolygon.isValid || missionItem.wizardMode
68 }
69
70 ColumnLayout {
71 Layout.fillWidth: true
72 spacing: _margin
73 visible: !wizardLabel.visible
74
75 QGCTabBar {
76 id: tabBar
77 Layout.fillWidth: true
78
79 Component.onCompleted: currentIndex = 0
80
81 QGCTabButton { text: qsTr("Grid") }
82 QGCTabButton { text: qsTr("Camera") }
83 }
84
85 ColumnLayout {
86 Layout.fillWidth: true
87 spacing: _margin
88 visible: tabBar.currentIndex == 0
89
90 QGCLabel {
91 Layout.fillWidth: true
92 text: qsTr("Note: Polygon respresents structure surface not vehicle flight path.")
93 wrapMode: Text.WordWrap
94 font.pointSize: ScreenTools.smallFontPointSize
95 }
96
97 QGCLabel {
98 Layout.fillWidth: true
99 text: qsTr("WARNING: Photo interval is below minimum interval (%1 secs) supported by camera.").arg(_cameraMinTriggerInterval.toFixed(1))
100 wrapMode: Text.WordWrap
101 color: qgcPal.warningText
102 visible: missionItem.cameraShots > 0 && _cameraMinTriggerInterval !== 0 && _cameraMinTriggerInterval > missionItem.timeBetweenShots
103 }
104
105 CameraCalcGrid {
106 Layout.fillWidth: true
107 cameraCalc: missionItem.cameraCalc
108 vehicleFlightIsFrontal: false
109 distanceToSurfaceLabel: qsTr("Scan Distance")
110 frontalDistanceLabel: qsTr("Layer Height")
111 sideDistanceLabel: qsTr("Trigger Distance")
112 }
113
114 SectionHeader {
115 id: scanHeader
116 Layout.fillWidth: true
117 text: qsTr("Scan")
118 }
119
120 ColumnLayout {
121 Layout.fillWidth: true
122 spacing: _margin
123 visible: scanHeader.checked
124
125 GridLayout {
126 Layout.fillWidth: true
127 columnSpacing: _margin
128 rowSpacing: _margin
129 columns: 2
130
131 FactComboBox {
132 fact: missionItem.startFromTop
133 indexModel: true
134 model: [ qsTr("Start Scan From Bottom"), qsTr("Start Scan From Top") ]
135 Layout.columnSpan: 2
136 Layout.fillWidth: true
137 }
138
139 QGCLabel {
140 text: qsTr("Structure Height")
141 }
142 FactTextField {
143 fact: missionItem.structureHeight
144 Layout.fillWidth: true
145 }
146
147 QGCLabel { text: qsTr("Scan Bottom Alt") }
148 AltitudeFactTextField {
149 fact: missionItem.scanBottomAlt
150 altitudeFrame: QGroundControl.AltitudeFrameRelative
151 Layout.fillWidth: true
152 }
153
154 QGCLabel { text: qsTr("Entrance/Exit Alt") }
155 AltitudeFactTextField {
156 fact: missionItem.entranceAlt
157 altitudeFrame: QGroundControl.AltitudeFrameRelative
158 Layout.fillWidth: true
159 }
160
161 QGCLabel {
162 text: qsTr("Gimbal Pitch")
163 visible: missionItem.cameraCalc.isManualCamera
164 }
165 FactTextField {
166 fact: missionItem.gimbalPitch
167 Layout.fillWidth: true
168 visible: missionItem.cameraCalc.isManualCamera
169 }
170 }
171
172 Item {
173 height: ScreenTools.defaultFontPixelHeight / 2
174 width: 1
175 }
176
177 QGCButton {
178 text: qsTr("Rotate entry point")
179 onClicked: missionItem.rotateEntryPoint()
180 }
181 } // Column - Scan
182
183 SectionHeader {
184 id: statsHeader
185 Layout.fillWidth: true
186 text: qsTr("Statistics")
187 }
188
189 Grid {
190 columns: 2
191 columnSpacing: ScreenTools.defaultFontPixelWidth
192 visible: statsHeader.checked
193
194 QGCLabel { text: qsTr("Layers") }
195 QGCLabel { text: missionItem.layers.valueString }
196
197 QGCLabel { text: qsTr("Layer Height") }
198 QGCLabel { text: missionItem.cameraCalc.adjustedFootprintFrontal.valueString + " " + QGroundControl.unitsConversion.appSettingsHorizontalDistanceUnitsString }
199
200 QGCLabel { text: qsTr("Top Layer Alt") }
201 QGCLabel { id: topLayerAltLabel; text: _topLayerAltText() }
202
203 QGCLabel { text: qsTr("Bottom Layer Alt") }
204 QGCLabel { id: bottomLayerAltLabel; text: _bottomLayerAltText() }
205
206 QGCLabel { text: qsTr("Photo Count") }
207 QGCLabel { text: missionItem.cameraShots }
208
209 QGCLabel { text: qsTr("Photo Interval") }
210 QGCLabel { text: missionItem.timeBetweenShots.toFixed(1) + " " + qsTr("secs") }
211
212 QGCLabel { text: qsTr("Trigger Distance") }
213 QGCLabel { text: missionItem.cameraCalc.adjustedFootprintSide.valueString + " " + QGroundControl.unitsConversion.appSettingsHorizontalDistanceUnitsString }
214 }
215 } // Grid Column
216
217 ColumnLayout {
218 Layout.fillWidth: true
219 spacing: _margin
220 visible: tabBar.currentIndex == 1
221
222 CameraCalcCamera {
223 Layout.fillWidth: true
224 cameraCalc: missionItem.cameraCalc
225 }
226 }
227 }
228 }
229
230 Connections {
231 target: QGroundControl.unitsConversion
232
233 function onUnitsChanged() {
234 topLayerAltLabel.text = Qt.binding(_topLayerAltText)
235 bottomLayerAltLabel.text = Qt.binding(_bottomLayerAltText)
236 }
237 }
238}