SurveyItemEditor.qml 25.3 KB
Newer Older
Don Gagne's avatar
Don Gagne committed
1 2 3 4
import QtQuick          2.2
import QtQuick.Controls 1.2
import QtQuick.Dialogs  1.2
import QtQuick.Layouts  1.2
5

6
import QGroundControl               1.0
7 8 9 10 11 12 13 14 15
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

// Editor for Survery mission items
Rectangle {
    id:         _root
16
    height:     visible ? (editorColumn.height + (_margin * 2)) : 0
17 18 19 20
    width:      availableWidth
    color:      qgcPal.windowShadeDark
    radius:     _radius

Ricardo de Almeida Gonzaga's avatar
Ricardo de Almeida Gonzaga committed
21
    // The following properties must be available up the hierarchy chain
22 23 24
    //property real   availableWidth    ///< Width for control
    //property var    missionItem       ///< Mission Item for editor

25
    property real   _margin:        ScreenTools.defaultFontPixelWidth * 0.25
Don Gagne's avatar
Don Gagne committed
26
    property int    _cameraIndex:   1
27
    property real   _fieldWidth:    ScreenTools.defaultFontPixelWidth * 10.5
Don Gagne's avatar
Don Gagne committed
28 29 30 31 32

    readonly property int _gridTypeManual:          0
    readonly property int _gridTypeCustomCamera:    1
    readonly property int _gridTypeCamera:          2

33
    ListModel {
Don Gagne's avatar
Don Gagne committed
34 35 36
        id: cameraModelList

        Component.onCompleted: {
37 38 39 40 41
            cameraModelList.setProperty(_gridTypeCustomCamera, "sensorWidth",   missionItem.cameraSensorWidth.rawValue)
            cameraModelList.setProperty(_gridTypeCustomCamera, "sensorHeight",  missionItem.cameraSensorHeight.rawValue)
            cameraModelList.setProperty(_gridTypeCustomCamera, "imageWidth",    missionItem.cameraResolutionWidth.rawValue)
            cameraModelList.setProperty(_gridTypeCustomCamera, "imageHeight",   missionItem.cameraResolutionHeight.rawValue)
            cameraModelList.setProperty(_gridTypeCustomCamera, "focalLength",   missionItem.cameraFocalLength.rawValue)
Don Gagne's avatar
Don Gagne committed
42 43 44 45 46 47 48 49
        }

        ListElement {
            text:           qsTr("Manual Grid (no camera specs)")
        }
        ListElement {
            text:           qsTr("Custom Camera Grid")
        }
50 51 52 53 54 55 56 57
        ListElement {
            text:           qsTr("Typhoon H CGO3+")
            sensorWidth:    6.264
            sensorHeight:   4.698
            imageWidth:     4000
            imageHeight:    3000
            focalLength:    14
        }
Don Gagne's avatar
Don Gagne committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
        ListElement {
            text:           qsTr("Sony ILCE-QX1") //http://www.sony.co.uk/electronics/interchangeable-lens-cameras/ilce-qx1-body-kit/specifications
            sensorWidth:    23.2                  //http://www.sony.com/electronics/camera-lenses/sel16f28/specifications
            sensorHeight:   15.4
            imageWidth:     5456
            imageHeight:    3632
            focalLength:    16
        }
        ListElement {
            text:           qsTr("Canon S100 PowerShot")
            sensorWidth:    7.6
            sensorHeight:   5.7
            imageWidth:     4000
            imageHeight:    3000
            focalLength:    5.2
        }
        ListElement {
            text:           qsTr("Canon SX260 HS PowerShot")
            sensorWidth:    6.17
            sensorHeight:   4.55
            imageWidth:     4000
            imageHeight:    3000
            focalLength:    4.5
        }
        ListElement {
            text:           qsTr("Canon EOS-M 22mm")
            sensorWidth:    22.3
            sensorHeight:   14.9
            imageWidth:     5184
            imageHeight:    3456
            focalLength:    22
        }
        ListElement {
            text:           qsTr("Sony a6000 16mm") //http://www.sony.co.uk/electronics/interchangeable-lens-cameras/ilce-6000-body-kit#product_details_default
            sensorWidth:    23.5
            sensorHeight:   15.6
            imageWidth:     6000
            imageHeight:    4000
            focalLength:    16
        }
    }
Don Gagne's avatar
Don Gagne committed
99 100

    function recalcFromCameraValues() {
101 102 103 104 105
        var focalLength     = missionItem.cameraFocalLength.rawValue
        var sensorWidth     = missionItem.cameraSensorWidth.rawValue
        var sensorHeight    = missionItem.cameraSensorHeight.rawValue
        var imageWidth      = missionItem.cameraResolutionWidth.rawValue
        var imageHeight     = missionItem.cameraResolutionHeight.rawValue
Don Gagne's avatar
Don Gagne committed
106

107 108 109 110
        var altitude        = missionItem.gridAltitude.rawValue
        var groundResolution= missionItem.groundResolution.rawValue
        var frontalOverlap  = missionItem.frontalOverlap.rawValue
        var sideOverlap     = missionItem.sideOverlap.rawValue
Don Gagne's avatar
Don Gagne committed
111 112

        if (focalLength <= 0 || sensorWidth <= 0 || sensorHeight <= 0 || imageWidth <= 0 || imageHeight <= 0 || groundResolution <= 0) {
Don Gagne's avatar
Don Gagne committed
113 114 115
            return
        }

Don Gagne's avatar
Don Gagne committed
116 117
        var imageSizeSideGround     //size in side (non flying) direction of the image on the ground
        var imageSizeFrontGround    //size in front (flying) direction of the image on the ground
Don Gagne's avatar
Don Gagne committed
118 119
        var gridSpacing
        var cameraTriggerDistance
120

Don Gagne's avatar
Don Gagne committed
121
        if (missionItem.fixedValueIsAltitude) {
122
            groundResolution = (altitude * sensorWidth * 100) / (imageWidth * focalLength)
Don Gagne's avatar
Don Gagne committed
123 124 125
        } else {
            altitude = (imageWidth * groundResolution * focalLength) / (sensorWidth * 100)
        }
126

Don Gagne's avatar
Don Gagne committed
127
        if (cameraOrientationLandscape.checked) {
128
            imageSizeSideGround  = (imageWidth  * groundResolution) / 100
Don Gagne's avatar
Don Gagne committed
129
            imageSizeFrontGround = (imageHeight * groundResolution) / 100
Don Gagne's avatar
Don Gagne committed
130
        } else {
131 132
            imageSizeSideGround  = (imageHeight * groundResolution) / 100
            imageSizeFrontGround = (imageWidth  * groundResolution) / 100
Don Gagne's avatar
Don Gagne committed
133 134
        }

135 136 137
        gridSpacing = imageSizeSideGround * ( (100-sideOverlap) / 100 )
        cameraTriggerDistance = imageSizeFrontGround * ( (100-frontalOverlap) / 100 )

Don Gagne's avatar
Don Gagne committed
138 139 140 141 142
        if (missionItem.fixedValueIsAltitude) {
            missionItem.groundResolution.rawValue = groundResolution
        } else {
            missionItem.gridAltitude.rawValue = altitude
        }
Don Gagne's avatar
Don Gagne committed
143 144 145 146
        missionItem.gridSpacing.rawValue = gridSpacing
        missionItem.cameraTriggerDistance.rawValue = cameraTriggerDistance
    }

Don Gagne's avatar
Don Gagne committed
147
    /*
148
    function recalcFromMissionValues() {
Don Gagne's avatar
Don Gagne committed
149 150 151 152 153
        var focalLength = missionItem.cameraFocalLength.rawValue
        var sensorWidth = missionItem.cameraSensorWidth.rawValue
        var sensorHeight = missionItem.cameraSensorHeight.rawValue
        var imageWidth = missionItem.cameraResolutionWidth.rawValue
        var imageHeight = missionItem.cameraResolutionHeight.rawValue
154 155 156 157 158 159

        var altitude = missionItem.gridAltitude.rawValue
        var gridSpacing = missionItem.gridSpacing.rawValue
        var cameraTriggerDistance = missionItem.cameraTriggerDistance.rawValue

        if (focalLength <= 0.0 || sensorWidth <= 0.0 || sensorHeight <= 0.0 || imageWidth < 0 || imageHeight < 0 || altitude < 0.0 || gridSpacing < 0.0 || cameraTriggerDistance < 0.0) {
Don Gagne's avatar
Don Gagne committed
160 161 162
            missionItem.groundResolution.rawValue = 0
            missionItem.sideOverlap = 0
            missionItem.frontalOverlap = 0
163 164 165
            return
        }

Don Gagne's avatar
Don Gagne committed
166 167 168
        var groundResolution
        var imageSizeSideGround     //size in side (non flying) direction of the image on the ground
        var imageSizeFrontGround    //size in front (flying) direction of the image on the ground
169

Don Gagne's avatar
Don Gagne committed
170
        groundResolution = (altitude * sensorWidth * 100) / (imageWidth * focalLength)
171 172 173 174 175 176 177 178 179 180 181 182

        if (cameraOrientationLandscape.checked) {
            imageSizeSideGround = (imageWidth * gsd) / 100
            imageSizeFrontGround = (imageHeight * gsd) / 100
        } else {
            imageSizeSideGround = (imageHeight * gsd) / 100
            imageSizeFrontGround = (imageWidth * gsd) / 100
        }

        var sideOverlap = (imageSizeSideGround == 0 ? 0 : 100 - (gridSpacing*100 / imageSizeSideGround))
        var frontOverlap = (imageSizeFrontGround == 0 ? 0 : 100 - (cameraTriggerDistance*100 / imageSizeFrontGround))

Don Gagne's avatar
Don Gagne committed
183 184 185
        missionItem.groundResolution.rawValue = groundResolution
        missionItem.sideOverlap.rawValue = sideOverlap
        missionItem.frontalOverlap.rawValue = frontOverlap
186
    }
Don Gagne's avatar
Don Gagne committed
187
    */
188

189
    function polygonCaptureStarted() {
Don Gagne's avatar
Don Gagne committed
190
        missionItem.clearPolygon()
191
    }
Don Gagne's avatar
Don Gagne committed
192

193 194 195
    function polygonCaptureFinished(coordinates) {
        for (var i=0; i<coordinates.length; i++) {
            missionItem.addPolygonCoordinate(coordinates[i])
Don Gagne's avatar
Don Gagne committed
196
        }
197
    }
Don Gagne's avatar
Don Gagne committed
198

199 200
    function polygonAdjustVertex(vertexIndex, vertexCoordinate) {
        missionItem.adjustPolygonCoordinate(vertexIndex, vertexCoordinate)
Don Gagne's avatar
Don Gagne committed
201 202
    }

203 204 205
    function polygonAdjustStarted() { }
    function polygonAdjustFinished() { }

Don Gagne's avatar
Don Gagne committed
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
    property bool _noCameraValueRecalc: false   ///< Prevents uneeded recalcs

    Connections {
        target: missionItem

        onCameraValueChanged: {
            if (gridTypeCombo.currentIndex >= _gridTypeCustomCamera && !_noCameraValueRecalc) {
                recalcFromCameraValues()
            }
        }
    }

    Connections {
        target: missionItem.gridAltitude

        onValueChanged: {
            if (gridTypeCombo.currentIndex >= _gridTypeCustomCamera && missionItem.fixedValueIsAltitude && !_noCameraValueRecalc) {
                recalcFromCameraValues()
            }
        }
    }

228 229
    QGCPalette { id: qgcPal; colorGroupEnabled: true }

Don Gagne's avatar
Don Gagne committed
230
    ExclusiveGroup {
Don Gagne's avatar
Don Gagne committed
231 232 233 234 235 236
        id: cameraOrientationGroup

        onCurrentChanged: {
            if (gridTypeCombo.currentIndex >= _gridTypeCustomCamera) {
                recalcFromCameraValues()
            }
237
        }
Don Gagne's avatar
Don Gagne committed
238 239
    }

Don Gagne's avatar
Don Gagne committed
240 241
    ExclusiveGroup { id: fixedValueGroup }

242 243 244 245 246
    Column {
        id:                 editorColumn
        anchors.margins:    _margin
        anchors.top:        parent.top
        anchors.left:       parent.left
247
        anchors.right:      parent.right
248 249
        spacing:            _margin

Don Gagne's avatar
Don Gagne committed
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
        QGCComboBox {
            id:             gridTypeCombo
            anchors.left:   parent.left
            anchors.right:  parent.right
            model:          cameraModelList
            currentIndex:   -1

            Component.onCompleted: {
                if (missionItem.manualGrid) {
                    gridTypeCombo.currentIndex = _gridTypeManual
                } else {
                    var index = gridTypeCombo.find(missionItem.camera)
                    if (index == -1) {
                        console.log("Couldn't find camera", missionItem.camera)
                        gridTypeCombo.currentIndex = _gridTypeManual
                    } else {
                        gridTypeCombo.currentIndex = index
                    }
268
                }
Don Gagne's avatar
Don Gagne committed
269
            }
270

Don Gagne's avatar
Don Gagne committed
271 272 273 274 275 276 277
            onActivated: {
                if (index == _gridTypeManual) {
                    missionItem.manualGrid = true
                } else {
                    missionItem.manualGrid = false
                    missionItem.camera = gridTypeCombo.textAt(index)
                    _noCameraValueRecalc = true
278 279 280
                    missionItem.cameraSensorWidth.rawValue      = cameraModelList.get(index).sensorWidth
                    missionItem.cameraSensorHeight.rawValue     = cameraModelList.get(index).sensorHeight
                    missionItem.cameraResolutionWidth.rawValue  = cameraModelList.get(index).imageWidth
Don Gagne's avatar
Don Gagne committed
281
                    missionItem.cameraResolutionHeight.rawValue = cameraModelList.get(index).imageHeight
282
                    missionItem.cameraFocalLength.rawValue      = cameraModelList.get(index).focalLength
Don Gagne's avatar
Don Gagne committed
283 284
                    _noCameraValueRecalc = false
                    recalcFromCameraValues()
285 286 287 288
                }
            }
        }

289 290 291 292 293 294 295 296 297 298
        QGCLabel { text: qsTr("Camera"); color: qgcPal.buttonHighlight; visible: gridTypeCombo.currentIndex !== _gridTypeManual}

        Rectangle {
            anchors.left:   parent.left
            anchors.right:  parent.right
            height:         1
            color:          qgcPal.text
            visible:        gridTypeCombo.currentIndex !== _gridTypeManual
        }

Don Gagne's avatar
Don Gagne committed
299 300
        // Camera based grid ui
        Column {
Don Gagne's avatar
Don Gagne committed
301
            anchors.left:   parent.left
Don Gagne's avatar
Don Gagne committed
302 303 304
            anchors.right:  parent.right
            spacing:        _margin
            visible:        gridTypeCombo.currentIndex != _gridTypeManual
Don Gagne's avatar
Don Gagne committed
305

Don Gagne's avatar
Don Gagne committed
306 307
            Row {
                spacing: _margin
308
                anchors.horizontalCenter: parent.horizontalCenter
309

Don Gagne's avatar
Don Gagne committed
310 311 312 313 314 315 316
                QGCRadioButton {
                    id:             cameraOrientationLandscape
                    width:          _editFieldWidth
                    text:           "Landscape"
                    checked:        true
                    exclusiveGroup: cameraOrientationGroup
                }
317

Don Gagne's avatar
Don Gagne committed
318 319 320 321 322
                QGCRadioButton {
                    id:             cameraOrientationPortrait
                    text:           "Portrait"
                    exclusiveGroup: cameraOrientationGroup
                }
323 324
            }

Don Gagne's avatar
Don Gagne committed
325
            Column {
326
                id:             custCameraCol
Don Gagne's avatar
Don Gagne committed
327 328 329
                anchors.left:   parent.left
                anchors.right:  parent.right
                spacing:        _margin
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
                visible:        gridTypeCombo.currentIndex === _gridTypeCustomCamera

                RowLayout {
                    anchors.left:   parent.left
                    anchors.right:  parent.right
                    spacing:        _margin
                    Item { Layout.fillWidth: true }
                    QGCLabel {
                        Layout.preferredWidth:  _root._fieldWidth
                        text:                   qsTr("Width")
                    }
                    QGCLabel {
                        Layout.preferredWidth:  _root._fieldWidth
                        text:                   qsTr("Height")
                    }
                }
Don Gagne's avatar
Don Gagne committed
346

347 348 349 350 351
                RowLayout {
                    anchors.left:   parent.left
                    anchors.right:  parent.right
                    spacing:        _margin
                    QGCLabel { text: qsTr("Sensor:"); Layout.fillWidth: true }
Don Gagne's avatar
Don Gagne committed
352
                    FactTextField {
353
                        Layout.preferredWidth:  _root._fieldWidth
Don Gagne's avatar
Don Gagne committed
354 355 356
                        fact:                   missionItem.cameraSensorWidth
                    }
                    FactTextField {
357
                        Layout.preferredWidth:  _root._fieldWidth
Don Gagne's avatar
Don Gagne committed
358 359
                        fact:                   missionItem.cameraSensorHeight
                    }
360
                }
Don Gagne's avatar
Don Gagne committed
361

362 363 364 365 366
                RowLayout {
                    anchors.left:   parent.left
                    anchors.right:  parent.right
                    spacing:        _margin
                    QGCLabel { text: qsTr("Image:"); Layout.fillWidth: true }
Don Gagne's avatar
Don Gagne committed
367
                    FactTextField {
368
                        Layout.preferredWidth:  _root._fieldWidth
Don Gagne's avatar
Don Gagne committed
369 370 371
                        fact:                   missionItem.cameraResolutionWidth
                    }
                    FactTextField {
372
                        Layout.preferredWidth:  _root._fieldWidth
Don Gagne's avatar
Don Gagne committed
373 374 375 376
                        fact:                   missionItem.cameraResolutionHeight
                    }
                }

377 378 379 380 381 382 383 384 385 386 387 388
                RowLayout {
                    anchors.left:   parent.left
                    anchors.right:  parent.right
                    spacing:        _margin
                    QGCLabel {
                        text:                   missionItem.cameraFocalLength.name + ":"
                        Layout.fillWidth:       true
                    }
                    FactTextField {
                        Layout.preferredWidth:  _root._fieldWidth
                        fact:                   missionItem.cameraFocalLength
                    }
Don Gagne's avatar
Don Gagne committed
389 390
                }

391
            } // Column - custom camera
Don Gagne's avatar
Don Gagne committed
392

393 394 395
            RowLayout {
                anchors.left:   parent.left
                anchors.right:  parent.right
Don Gagne's avatar
Don Gagne committed
396
                spacing:        _margin
397 398 399 400
                Item { Layout.fillWidth: true }
                QGCLabel {
                    Layout.preferredWidth:  _root._fieldWidth
                    text:                   qsTr("Frontal")
Don Gagne's avatar
Don Gagne committed
401 402
                }
                QGCLabel {
403 404
                    Layout.preferredWidth:  _root._fieldWidth
                    text:                   qsTr("Side")
Don Gagne's avatar
Don Gagne committed
405
                }
406
            }
Don Gagne's avatar
Don Gagne committed
407

408 409 410 411 412
            RowLayout {
                anchors.left:   parent.left
                anchors.right:  parent.right
                spacing:        _margin
                QGCLabel { text: qsTr("Overlap:"); Layout.fillWidth: true }
Don Gagne's avatar
Don Gagne committed
413
                FactTextField {
414 415
                    Layout.preferredWidth:  _root._fieldWidth
                    fact:                   missionItem.frontalOverlap
Don Gagne's avatar
Don Gagne committed
416 417
                }
                FactTextField {
418 419
                    Layout.preferredWidth:  _root._fieldWidth
                    fact:                   missionItem.sideOverlap
Don Gagne's avatar
Don Gagne committed
420
                }
Don Gagne's avatar
Don Gagne committed
421 422
            }

423
            QGCLabel { text: qsTr("Grid"); color: qgcPal.buttonHighlight;}
Don Gagne's avatar
Don Gagne committed
424 425 426 427 428 429

            Rectangle {
                anchors.left:   parent.left
                anchors.right:  parent.right
                height:         1
                color:          qgcPal.text
Don Gagne's avatar
Don Gagne committed
430 431
            }

432
            RowLayout {
Don Gagne's avatar
Don Gagne committed
433 434
                anchors.left:   parent.left
                anchors.right:  parent.right
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461
                spacing:        _margin
                QGCLabel {
                    text:                   missionItem.gridAngle.name + ":"
                    Layout.fillWidth:       true
                    anchors.verticalCenter: parent.verticalCenter
                }
                FactTextField {
                    fact:                   missionItem.gridAngle
                    anchors.verticalCenter: parent.verticalCenter
                    Layout.preferredWidth:  _root._fieldWidth
                }
            }

            RowLayout {
                anchors.left:   parent.left
                anchors.right:  parent.right
                spacing:        _margin
                QGCLabel {
                    text:                   missionItem.turnaroundDist.name + ":"
                    Layout.fillWidth:       true
                    anchors.verticalCenter: parent.verticalCenter
                }
                FactTextField {
                    fact:                   missionItem.turnaroundDist
                    anchors.verticalCenter: parent.verticalCenter
                    Layout.preferredWidth:  _root._fieldWidth
                }
Don Gagne's avatar
Don Gagne committed
462 463
            }

Don Gagne's avatar
Don Gagne committed
464 465 466 467 468 469
            QGCLabel {
                anchors.left:   parent.left
                anchors.right:  parent.right
                wrapMode:       Text.WordWrap
                font.pointSize: ScreenTools.smallFontPointSize
                text:           qsTr("Which value would you like to keep constant as you adjust other settings:")
Don Gagne's avatar
Don Gagne committed
470 471
            }

Don Gagne's avatar
Don Gagne committed
472 473 474 475 476 477
            RowLayout {
                anchors.left:   parent.left
                anchors.right:  parent.right
                spacing:        _margin

                QGCRadioButton {
478 479 480 481 482 483 484
                    id:                     fixedAltitudeRadio
                    text:                   qsTr("Altitude:")
                    checked:                missionItem.fixedValueIsAltitude
                    exclusiveGroup:         fixedValueGroup
                    onClicked:              missionItem.fixedValueIsAltitude = true
                    Layout.fillWidth:       true
                    anchors.verticalCenter: parent.verticalCenter
Don Gagne's avatar
Don Gagne committed
485
                }
486

Don Gagne's avatar
Don Gagne committed
487
                FactTextField {
488 489 490 491
                    fact:                   missionItem.gridAltitude
                    enabled:                fixedAltitudeRadio.checked
                    Layout.preferredWidth:  _root._fieldWidth
                    anchors.verticalCenter: parent.verticalCenter
492
                }
Don Gagne's avatar
Don Gagne committed
493
            }
Don Gagne's avatar
Don Gagne committed
494

Don Gagne's avatar
Don Gagne committed
495 496 497 498 499 500
            RowLayout {
                anchors.left:   parent.left
                anchors.right:  parent.right
                spacing:        _margin

                QGCRadioButton {
501 502 503 504 505 506 507
                    id:                     fixedGroundResolutionRadio
                    text:                   qsTr("Ground res:")
                    checked:                !missionItem.fixedValueIsAltitude
                    exclusiveGroup:         fixedValueGroup
                    onClicked:              missionItem.fixedValueIsAltitude = false
                    Layout.fillWidth:       true
                    anchors.verticalCenter: parent.verticalCenter
508 509
                }

Don Gagne's avatar
Don Gagne committed
510
                FactTextField {
511 512 513 514
                    fact:                   missionItem.groundResolution
                    enabled:                fixedGroundResolutionRadio.checked
                    Layout.preferredWidth:  _root._fieldWidth
                    anchors.verticalCenter: parent.verticalCenter
Don Gagne's avatar
Don Gagne committed
515 516 517 518 519
                }
            }
        }

        // Manual grid ui
520
        Column {
Don Gagne's avatar
Don Gagne committed
521 522 523 524
            anchors.left:   parent.left
            anchors.right:  parent.right
            spacing:        _margin
            visible:        gridTypeCombo.currentIndex == _gridTypeManual
525

526
            QGCLabel { text: qsTr("Grid"); color: qgcPal.buttonHighlight;}
527

Don Gagne's avatar
Don Gagne committed
528 529 530 531 532
            Rectangle {
                anchors.left:   parent.left
                anchors.right:  parent.right
                height:         1
                color:          qgcPal.text
Don Gagne's avatar
Don Gagne committed
533 534
            }

Don Gagne's avatar
Don Gagne committed
535 536 537
            FactTextFieldGrid {
                anchors.left:   parent.left
                anchors.right:  parent.right
538
                columnSpacing:  _margin * 10
Don Gagne's avatar
Don Gagne committed
539 540 541
                rowSpacing:     _margin
                factList:       [ missionItem.gridAngle, missionItem.gridSpacing, missionItem.gridAltitude, missionItem.turnaroundDist ]
            }
Don Gagne's avatar
Don Gagne committed
542

Don Gagne's avatar
Don Gagne committed
543 544 545 546 547 548
            QGCCheckBox {
                anchors.left:   parent.left
                text:           qsTr("Relative altitude")
                checked:        missionItem.gridAltitudeRelative
                onClicked:      missionItem.gridAltitudeRelative = checked
            }
549

550
            QGCLabel { text: qsTr("Camera"); color: qgcPal.buttonHighlight;}
551

Don Gagne's avatar
Don Gagne committed
552 553 554 555 556
            Rectangle {
                anchors.left:   parent.left
                anchors.right:  parent.right
                height:         1
                color:          qgcPal.text
Don Gagne's avatar
Don Gagne committed
557 558
            }

Don Gagne's avatar
Don Gagne committed
559 560 561 562 563 564 565 566 567 568 569 570
            RowLayout {
                anchors.left:   parent.left
                anchors.right:  parent.right
                spacing:        _margin

                QGCCheckBox {
                    id:                 cameraTrigger
                    anchors.baseline:   cameraTriggerDistanceField.baseline
                    text:               qsTr("Trigger Distance:")
                    checked:            missionItem.cameraTrigger
                    onClicked:          missionItem.cameraTrigger = checked
                }
Don Gagne's avatar
Don Gagne committed
571

Don Gagne's avatar
Don Gagne committed
572 573 574 575 576 577
                FactTextField {
                    id:                 cameraTriggerDistanceField
                    Layout.fillWidth:   true
                    fact:               missionItem.cameraTriggerDistance
                    enabled:            missionItem.cameraTrigger
                }
Don Gagne's avatar
Don Gagne committed
578 579 580
            }
        }

581
        QGCLabel { text: qsTr("Polygon"); color: qgcPal.buttonHighlight;}
Don Gagne's avatar
Don Gagne committed
582

583 584 585 586 587 588 589 590 591
        Rectangle {
            anchors.left:   parent.left
            anchors.right:  parent.right
            height:         1
            color:          qgcPal.text
        }

        Row {
            spacing: ScreenTools.defaultFontPixelWidth
592
            anchors.horizontalCenter: parent.horizontalCenter
593 594

            QGCButton {
595
                width:      _root.width * 0.45
596 597 598 599 600 601 602 603
                text:       editorMap.polygonDraw.drawingPolygon ? qsTr("Finish Draw") : qsTr("Draw")
                visible:    !editorMap.polygonDraw.adjustingPolygon
                enabled:    ((editorMap.polygonDraw.drawingPolygon && editorMap.polygonDraw.polygonReady) || !editorMap.polygonDraw.drawingPolygon)

                onClicked: {
                    if (editorMap.polygonDraw.drawingPolygon) {
                        editorMap.polygonDraw.finishCapturePolygon()
                    } else {
604
                        editorMap.polygonDraw.startCapturePolygon(_root)
605
                    }
606 607 608
                }
            }

609
            QGCButton {
610
                width:      _root.width * 0.4
611 612
                text:       editorMap.polygonDraw.adjustingPolygon ? qsTr("Finish Adjust") : qsTr("Adjust")
                visible:    missionItem.polygonPath.length > 0 && !editorMap.polygonDraw.drawingPolygon
613

614 615 616 617
                onClicked: {
                    if (editorMap.polygonDraw.adjustingPolygon) {
                        editorMap.polygonDraw.finishAdjustPolygon()
                    } else {
618
                        editorMap.polygonDraw.startAdjustPolygon(_root, missionItem.polygonPath)
619
                    }
620 621 622
                }
            }
        }
623

624
        QGCLabel { text: qsTr("Statistics"); color: qgcPal.buttonHighlight;}
625 626 627 628 629 630 631 632 633

        Rectangle {
            anchors.left:   parent.left
            anchors.right:  parent.right
            height:         1
            color:          qgcPal.text
        }

        Grid {
634 635
            columns:        2
            columnSpacing:  ScreenTools.defaultFontPixelWidth
636 637 638 639

            QGCLabel { text: qsTr("Survey area:") }
            QGCLabel { text: QGroundControl.squareMetersToAppSettingsAreaUnits(missionItem.coveredArea).toFixed(2) + " " + QGroundControl.appSettingsAreaUnitsString }

640
            QGCLabel { text: qsTr("Photo count:") }
641
            QGCLabel { text: missionItem.cameraShots }
642

643 644 645 646 647 648 649 650 651 652
            QGCLabel { text: qsTr("Photo interval:") }
            QGCLabel {
                text: {
                    var timeVal = missionItem.timeBetweenShots
                    if(!isFinite(timeVal) || missionItem.cameraShots === 0) {
                        return qsTr("N/A")
                    }
                    return timeVal.toFixed(1) + " " + qsTr("secs")
                }
            }
653
        }
654 655
    }
}