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

Don Gagne's avatar
Don Gagne committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
    property real   _margin:        ScreenTools.defaultFontPixelWidth / 2
    property int    _cameraIndex:   1

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

    Component.onCompleted: {
        console.log("gridAltitude", missionItem.gridAltitude.value)
        console.log("gridAltitudeRelative", missionItem.gridAltitudeRelative)
        console.log("gridAngle", missionItem.gridAngle.value)
        console.log("gridSpacing", missionItem.gridSpacing.value)
        console.log("turnaroundDist", missionItem.turnaroundDist.value)
        console.log("cameraTrigger", missionItem.cameraTrigger)
        console.log("cameraTriggerDistance", missionItem.cameraTriggerDistance.value)
        console.log("groundResolution", missionItem.groundResolution.value)
        console.log("frontalOverlap", missionItem.frontalOverlap.value)
        console.log("sideOverlap", missionItem.sideOverlap.value)
        console.log("cameraSensorWidth", missionItem.cameraSensorWidth.value)
        console.log("cameraSensorHeight", missionItem.cameraSensorHeight.value)
        console.log("cameraResolutionWidth", missionItem.cameraResolutionWidth.value)
        console.log("cameraResolutionHeight", missionItem.cameraResolutionHeight.value)
        console.log("cameraFocalLength", missionItem.cameraFocalLength.value)
        console.log("fixedValueIsAltitude", missionItem.fixedValueIsAltitude)
        console.log("cameraOrientationLandscape", missionItem.cameraOrientationLandscape)
        console.log("manualGrid", missionItem.manualGrid)
        console.log("camera", missionItem.camera)
    }
53 54

    ListModel {
Don Gagne's avatar
Don Gagne committed
55 56 57 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 99 100 101 102 103 104 105 106 107 108 109 110 111
        id: cameraModelList

        Component.onCompleted: {
            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)
        }

        ListElement {
            text:           qsTr("Manual Grid (no camera specs)")
        }
        ListElement {
            text:           qsTr("Custom Camera Grid")
        }
        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
112 113

    function recalcFromCameraValues() {
Don Gagne's avatar
Don Gagne committed
114 115 116 117 118 119 120 121 122 123 124 125
        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

        var altitude = missionItem.gridAltitude.rawValue
        var groundResolution = missionItem.groundResolution.rawValue
        var frontalOverlap = missionItem.frontalOverlap.rawValue
        var sideOverlap = missionItem.sideOverlap.rawValue

        if (focalLength <= 0 || sensorWidth <= 0 || sensorHeight <= 0 || imageWidth <= 0 || imageHeight <= 0 || groundResolution <= 0) {
Don Gagne's avatar
Don Gagne committed
126 127 128
            return
        }

Don Gagne's avatar
Don Gagne committed
129 130
        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
131 132
        var gridSpacing
        var cameraTriggerDistance
133

Don Gagne's avatar
Don Gagne committed
134 135 136 137 138
        if (missionItem.fixedValueIsAltitude) {
            groundResolution = (altitude * sensorWidth * 100) /  (imageWidth * focalLength)
        } else {
            altitude = (imageWidth * groundResolution * focalLength) / (sensorWidth * 100)
        }
139

Don Gagne's avatar
Don Gagne committed
140
        if (cameraOrientationLandscape.checked) {
Don Gagne's avatar
Don Gagne committed
141 142
            imageSizeSideGround = (imageWidth * groundResolution) / 100
            imageSizeFrontGround = (imageHeight * groundResolution) / 100
Don Gagne's avatar
Don Gagne committed
143
        } else {
Don Gagne's avatar
Don Gagne committed
144 145
            imageSizeSideGround = (imageHeight * groundResolution) / 100
            imageSizeFrontGround = (imageWidth * groundResolution) / 100
Don Gagne's avatar
Don Gagne committed
146 147
        }

148 149 150
        gridSpacing = imageSizeSideGround * ( (100-sideOverlap) / 100 )
        cameraTriggerDistance = imageSizeFrontGround * ( (100-frontalOverlap) / 100 )

Don Gagne's avatar
Don Gagne committed
151 152 153 154 155
        if (missionItem.fixedValueIsAltitude) {
            missionItem.groundResolution.rawValue = groundResolution
        } else {
            missionItem.gridAltitude.rawValue = altitude
        }
Don Gagne's avatar
Don Gagne committed
156 157 158 159
        missionItem.gridSpacing.rawValue = gridSpacing
        missionItem.cameraTriggerDistance.rawValue = cameraTriggerDistance
    }

Don Gagne's avatar
Don Gagne committed
160
    /*
161
    function recalcFromMissionValues() {
Don Gagne's avatar
Don Gagne committed
162 163 164 165 166
        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
167 168 169 170 171 172

        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
173 174 175
            missionItem.groundResolution.rawValue = 0
            missionItem.sideOverlap = 0
            missionItem.frontalOverlap = 0
176 177 178
            return
        }

Don Gagne's avatar
Don Gagne committed
179 180 181
        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
182

Don Gagne's avatar
Don Gagne committed
183
        groundResolution = (altitude * sensorWidth * 100) / (imageWidth * focalLength)
184 185 186 187 188 189 190 191 192 193 194 195

        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
196 197 198
        missionItem.groundResolution.rawValue = groundResolution
        missionItem.sideOverlap.rawValue = sideOverlap
        missionItem.frontalOverlap.rawValue = frontOverlap
199
    }
Don Gagne's avatar
Don Gagne committed
200
    */
201

202
    function polygonCaptureStarted() {
Don Gagne's avatar
Don Gagne committed
203
        missionItem.clearPolygon()
204
    }
Don Gagne's avatar
Don Gagne committed
205

206 207 208
    function polygonCaptureFinished(coordinates) {
        for (var i=0; i<coordinates.length; i++) {
            missionItem.addPolygonCoordinate(coordinates[i])
Don Gagne's avatar
Don Gagne committed
209
        }
210
    }
Don Gagne's avatar
Don Gagne committed
211

212 213
    function polygonAdjustVertex(vertexIndex, vertexCoordinate) {
        missionItem.adjustPolygonCoordinate(vertexIndex, vertexCoordinate)
Don Gagne's avatar
Don Gagne committed
214 215
    }

216 217 218
    function polygonAdjustStarted() { }
    function polygonAdjustFinished() { }

Don Gagne's avatar
Don Gagne committed
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
    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()
            }
        }
    }

241 242
    QGCPalette { id: qgcPal; colorGroupEnabled: true }

Don Gagne's avatar
Don Gagne committed
243
    ExclusiveGroup {
Don Gagne's avatar
Don Gagne committed
244 245 246 247 248 249
        id: cameraOrientationGroup

        onCurrentChanged: {
            if (gridTypeCombo.currentIndex >= _gridTypeCustomCamera) {
                recalcFromCameraValues()
            }
250
        }
Don Gagne's avatar
Don Gagne committed
251 252
    }

Don Gagne's avatar
Don Gagne committed
253 254
    ExclusiveGroup { id: fixedValueGroup }

255 256 257 258 259
    Column {
        id:                 editorColumn
        anchors.margins:    _margin
        anchors.top:        parent.top
        anchors.left:       parent.left
260
        anchors.right:      parent.right
261 262 263
        spacing:            _margin

        QGCLabel {
264 265
            anchors.left:   parent.left
            anchors.right:  parent.right
266 267
            wrapMode:       Text.WordWrap
            font.pointSize: ScreenTools.smallFontPointSize
Don Gagne's avatar
Don Gagne committed
268 269 270
            text:           gridTypeCombo.currentIndex == 0 ?
                                qsTr("Create a flight path which covers a polygonal area by specifying all grid parameters.") :
                                qsTr("Create a flight path which fully covers a polygonal area using camera specifications.")
271 272
        }

Don Gagne's avatar
Don Gagne committed
273
        QGCLabel { text: qsTr("Camera:") }
274

Don Gagne's avatar
Don Gagne committed
275 276 277 278 279 280
        Rectangle {
            anchors.left:   parent.left
            anchors.right:  parent.right
            height:         1
            color:          qgcPal.text
        }
281

Don Gagne's avatar
Don Gagne committed
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
        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
                    }
300
                }
Don Gagne's avatar
Don Gagne committed
301
            }
302

Don Gagne's avatar
Don Gagne committed
303 304 305 306 307 308 309 310 311 312 313 314 315 316
            onActivated: {
                if (index == _gridTypeManual) {
                    missionItem.manualGrid = true
                } else {
                    missionItem.manualGrid = false
                    missionItem.camera = gridTypeCombo.textAt(index)
                    _noCameraValueRecalc = true
                    missionItem.cameraSensorWidth.rawValue = cameraModelList.get(index).sensorWidth
                    missionItem.cameraSensorHeight.rawValue = cameraModelList.get(index).sensorHeight
                    missionItem.cameraResolutionWidth.rawValue = cameraModelList.get(index).imageWidth
                    missionItem.cameraResolutionHeight.rawValue = cameraModelList.get(index).imageHeight
                    missionItem.cameraFocalLength.rawValue = cameraModelList.get(index).focalLength
                    _noCameraValueRecalc = false
                    recalcFromCameraValues()
317 318 319 320
                }
            }
        }

Don Gagne's avatar
Don Gagne committed
321 322
        // Camera based grid ui
        Column {
Don Gagne's avatar
Don Gagne committed
323
            anchors.left:   parent.left
Don Gagne's avatar
Don Gagne committed
324 325 326
            anchors.right:  parent.right
            spacing:        _margin
            visible:        gridTypeCombo.currentIndex != _gridTypeManual
Don Gagne's avatar
Don Gagne committed
327

Don Gagne's avatar
Don Gagne committed
328 329
            Row {
                spacing: _margin
330

Don Gagne's avatar
Don Gagne committed
331 332 333 334 335 336 337
                QGCRadioButton {
                    id:             cameraOrientationLandscape
                    width:          _editFieldWidth
                    text:           "Landscape"
                    checked:        true
                    exclusiveGroup: cameraOrientationGroup
                }
338

Don Gagne's avatar
Don Gagne committed
339 340 341 342 343
                QGCRadioButton {
                    id:             cameraOrientationPortrait
                    text:           "Portrait"
                    exclusiveGroup: cameraOrientationGroup
                }
344 345
            }

Don Gagne's avatar
Don Gagne committed
346 347 348 349 350
            Column {
                anchors.left:   parent.left
                anchors.right:  parent.right
                spacing:        _margin
                visible:        gridTypeCombo.currentIndex == _gridTypeCustomCamera
351

Don Gagne's avatar
Don Gagne committed
352 353 354 355
                GridLayout {
                    columns:        3
                    columnSpacing:  _margin
                    rowSpacing:     _margin
356

Don Gagne's avatar
Don Gagne committed
357
                    property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10
Don Gagne's avatar
Don Gagne committed
358

Don Gagne's avatar
Don Gagne committed
359 360 361
                    QGCLabel { }
                    QGCLabel { text: qsTr("Width") }
                    QGCLabel { text: qsTr("Height") }
Don Gagne's avatar
Don Gagne committed
362

Don Gagne's avatar
Don Gagne committed
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419
                    QGCLabel { text: qsTr("Sensor:") }
                    FactTextField {
                        Layout.preferredWidth:  parent._fieldWidth
                        fact:                   missionItem.cameraSensorWidth
                    }
                    FactTextField {
                        Layout.preferredWidth:  parent._fieldWidth
                        fact:                   missionItem.cameraSensorHeight
                    }

                    QGCLabel { text: qsTr("Image:") }
                    FactTextField {
                        Layout.preferredWidth:  parent._fieldWidth
                        fact:                   missionItem.cameraResolutionWidth
                    }
                    FactTextField {
                        Layout.preferredWidth:  parent._fieldWidth
                        fact:                   missionItem.cameraResolutionHeight
                    }
                }

                FactTextFieldRow {
                    spacing: _margin
                    fact:       missionItem.cameraFocalLength
                }
            } // Column - custom camera

            QGCLabel { text: qsTr("Image Overlap") }

            Row {
                spacing:        _margin

                Item {
                    width:  ScreenTools.defaultFontPixelWidth * 2
                    height: 1
                }

                QGCLabel {
                    anchors.baseline:   frontalOverlapField.baseline
                    text:               qsTr("Frontal:")
                }

                FactTextField {
                    id:     frontalOverlapField
                    width:  ScreenTools.defaultFontPixelWidth * 7
                    fact:   missionItem.frontalOverlap
                }

                QGCLabel {
                    anchors.baseline:   frontalOverlapField.baseline
                    text:               qsTr("Side:")
                }

                FactTextField {
                    width:  frontalOverlapField.width
                    fact:   missionItem.sideOverlap
                }
Don Gagne's avatar
Don Gagne committed
420 421
            }

Don Gagne's avatar
Don Gagne committed
422 423 424 425 426 427 428
            QGCLabel { text: qsTr("Grid:") }

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

Don Gagne's avatar
Don Gagne committed
431 432 433 434 435 436
            FactTextFieldGrid {
                anchors.left:   parent.left
                anchors.right:  parent.right
                columnSpacing:  _margin
                rowSpacing:     _margin
                factList:       [ missionItem.gridAngle, missionItem.turnaroundDist ]
Don Gagne's avatar
Don Gagne committed
437 438
            }

Don Gagne's avatar
Don Gagne committed
439 440 441 442 443 444
            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
445 446
            }

Don Gagne's avatar
Don Gagne committed
447 448 449 450 451 452 453 454 455 456 457 458 459
            RowLayout {
                anchors.left:   parent.left
                anchors.right:  parent.right
                spacing:        _margin

                QGCRadioButton {
                    id:                 fixedAltitudeRadio
                    anchors.baseline:   gridAltitudeField.baseline
                    text:               qsTr("Altitude:")
                    checked:            missionItem.fixedValueIsAltitude
                    exclusiveGroup:     fixedValueGroup
                    onClicked:          missionItem.fixedValueIsAltitude = true
                }
460

Don Gagne's avatar
Don Gagne committed
461 462 463 464 465
                FactTextField {
                    id:                 gridAltitudeField
                    Layout.fillWidth:   true
                    fact:               missionItem.gridAltitude
                    enabled:            fixedAltitudeRadio.checked
466
                }
Don Gagne's avatar
Don Gagne committed
467
            }
Don Gagne's avatar
Don Gagne committed
468

Don Gagne's avatar
Don Gagne committed
469 470 471 472 473 474 475 476 477 478 479 480
            RowLayout {
                anchors.left:   parent.left
                anchors.right:  parent.right
                spacing:        _margin

                QGCRadioButton {
                    id:                 fixedGroundResolutionRadio
                    anchors.baseline:   groundResolutionField.baseline
                    text:               qsTr("Ground res:")
                    checked:            !missionItem.fixedValueIsAltitude
                    exclusiveGroup:     fixedValueGroup
                    onClicked:          missionItem.fixedValueIsAltitude = false
481 482
                }

Don Gagne's avatar
Don Gagne committed
483 484 485 486 487 488 489 490 491 492
                FactTextField {
                    id:                 groundResolutionField
                    Layout.fillWidth:   true
                    fact:               missionItem.groundResolution
                    enabled:            fixedGroundResolutionRadio.checked
                }
            }
        }

        // Manual grid ui
493
        Column {
Don Gagne's avatar
Don Gagne committed
494 495 496 497
            anchors.left:   parent.left
            anchors.right:  parent.right
            spacing:        _margin
            visible:        gridTypeCombo.currentIndex == _gridTypeManual
498

Don Gagne's avatar
Don Gagne committed
499
            QGCLabel { text: qsTr("Grid:") }
500

Don Gagne's avatar
Don Gagne committed
501 502 503 504 505
            Rectangle {
                anchors.left:   parent.left
                anchors.right:  parent.right
                height:         1
                color:          qgcPal.text
Don Gagne's avatar
Don Gagne committed
506 507
            }

Don Gagne's avatar
Don Gagne committed
508 509 510 511 512 513 514
            FactTextFieldGrid {
                anchors.left:   parent.left
                anchors.right:  parent.right
                columnSpacing:  _margin
                rowSpacing:     _margin
                factList:       [ missionItem.gridAngle, missionItem.gridSpacing, missionItem.gridAltitude, missionItem.turnaroundDist ]
            }
Don Gagne's avatar
Don Gagne committed
515

Don Gagne's avatar
Don Gagne committed
516 517 518 519 520 521
            QGCCheckBox {
                anchors.left:   parent.left
                text:           qsTr("Relative altitude")
                checked:        missionItem.gridAltitudeRelative
                onClicked:      missionItem.gridAltitudeRelative = checked
            }
522

Don Gagne's avatar
Don Gagne committed
523
            QGCLabel { text: qsTr("Camera:") }
524

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

Don Gagne's avatar
Don Gagne committed
532 533 534 535 536 537 538 539 540 541 542 543
            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
544

Don Gagne's avatar
Don Gagne committed
545 546 547 548 549 550
                FactTextField {
                    id:                 cameraTriggerDistanceField
                    Layout.fillWidth:   true
                    fact:               missionItem.cameraTriggerDistance
                    enabled:            missionItem.cameraTrigger
                }
Don Gagne's avatar
Don Gagne committed
551 552 553
            }
        }

554
        QGCLabel { text: qsTr("Polygon:") }
Don Gagne's avatar
Don Gagne committed
555

556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574
        Rectangle {
            anchors.left:   parent.left
            anchors.right:  parent.right
            height:         1
            color:          qgcPal.text
        }

        Row {
            spacing: ScreenTools.defaultFontPixelWidth

            QGCButton {
                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 {
575
                        editorMap.polygonDraw.startCapturePolygon(_root)
576
                    }
577 578 579
                }
            }

580 581 582
            QGCButton {
                text:       editorMap.polygonDraw.adjustingPolygon ? qsTr("Finish Adjust") : qsTr("Adjust")
                visible:    missionItem.polygonPath.length > 0 && !editorMap.polygonDraw.drawingPolygon
583

584 585 586 587
                onClicked: {
                    if (editorMap.polygonDraw.adjustingPolygon) {
                        editorMap.polygonDraw.finishAdjustPolygon()
                    } else {
588
                        editorMap.polygonDraw.startAdjustPolygon(_root, missionItem.polygonPath)
589
                    }
590 591 592
                }
            }
        }
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612

        QGCLabel { text: qsTr("Statistics:") }

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

        Grid {
            columns: 2
            spacing: ScreenTools.defaultFontPixelWidth

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

            QGCLabel { text: qsTr("# shots:") }
            QGCLabel { text: missionItem.cameraShots }
        }
613 614
    }
}