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

Don Gagne's avatar
Don Gagne committed
25 26 27 28 29 30 31
    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

32
    ListModel {
Don Gagne's avatar
Don Gagne committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 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
        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
90 91

    function recalcFromCameraValues() {
Don Gagne's avatar
Don Gagne committed
92 93 94 95 96 97 98 99 100 101 102 103
        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
104 105 106
            return
        }

Don Gagne's avatar
Don Gagne committed
107 108
        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
109 110
        var gridSpacing
        var cameraTriggerDistance
111

Don Gagne's avatar
Don Gagne committed
112 113 114 115 116
        if (missionItem.fixedValueIsAltitude) {
            groundResolution = (altitude * sensorWidth * 100) /  (imageWidth * focalLength)
        } else {
            altitude = (imageWidth * groundResolution * focalLength) / (sensorWidth * 100)
        }
117

Don Gagne's avatar
Don Gagne committed
118
        if (cameraOrientationLandscape.checked) {
Don Gagne's avatar
Don Gagne committed
119 120
            imageSizeSideGround = (imageWidth * groundResolution) / 100
            imageSizeFrontGround = (imageHeight * groundResolution) / 100
Don Gagne's avatar
Don Gagne committed
121
        } else {
Don Gagne's avatar
Don Gagne committed
122 123
            imageSizeSideGround = (imageHeight * groundResolution) / 100
            imageSizeFrontGround = (imageWidth * groundResolution) / 100
Don Gagne's avatar
Don Gagne committed
124 125
        }

126 127 128
        gridSpacing = imageSizeSideGround * ( (100-sideOverlap) / 100 )
        cameraTriggerDistance = imageSizeFrontGround * ( (100-frontalOverlap) / 100 )

Don Gagne's avatar
Don Gagne committed
129 130 131 132 133
        if (missionItem.fixedValueIsAltitude) {
            missionItem.groundResolution.rawValue = groundResolution
        } else {
            missionItem.gridAltitude.rawValue = altitude
        }
Don Gagne's avatar
Don Gagne committed
134 135 136 137
        missionItem.gridSpacing.rawValue = gridSpacing
        missionItem.cameraTriggerDistance.rawValue = cameraTriggerDistance
    }

Don Gagne's avatar
Don Gagne committed
138
    /*
139
    function recalcFromMissionValues() {
Don Gagne's avatar
Don Gagne committed
140 141 142 143 144
        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
145 146 147 148 149 150

        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
151 152 153
            missionItem.groundResolution.rawValue = 0
            missionItem.sideOverlap = 0
            missionItem.frontalOverlap = 0
154 155 156
            return
        }

Don Gagne's avatar
Don Gagne committed
157 158 159
        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
160

Don Gagne's avatar
Don Gagne committed
161
        groundResolution = (altitude * sensorWidth * 100) / (imageWidth * focalLength)
162 163 164 165 166 167 168 169 170 171 172 173

        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
174 175 176
        missionItem.groundResolution.rawValue = groundResolution
        missionItem.sideOverlap.rawValue = sideOverlap
        missionItem.frontalOverlap.rawValue = frontOverlap
177
    }
Don Gagne's avatar
Don Gagne committed
178
    */
179

180
    function polygonCaptureStarted() {
Don Gagne's avatar
Don Gagne committed
181
        missionItem.clearPolygon()
182
    }
Don Gagne's avatar
Don Gagne committed
183

184 185 186
    function polygonCaptureFinished(coordinates) {
        for (var i=0; i<coordinates.length; i++) {
            missionItem.addPolygonCoordinate(coordinates[i])
Don Gagne's avatar
Don Gagne committed
187
        }
188
    }
Don Gagne's avatar
Don Gagne committed
189

190 191
    function polygonAdjustVertex(vertexIndex, vertexCoordinate) {
        missionItem.adjustPolygonCoordinate(vertexIndex, vertexCoordinate)
Don Gagne's avatar
Don Gagne committed
192 193
    }

194 195 196
    function polygonAdjustStarted() { }
    function polygonAdjustFinished() { }

Don Gagne's avatar
Don Gagne committed
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
    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()
            }
        }
    }

219 220
    QGCPalette { id: qgcPal; colorGroupEnabled: true }

Don Gagne's avatar
Don Gagne committed
221
    ExclusiveGroup {
Don Gagne's avatar
Don Gagne committed
222 223 224 225 226 227
        id: cameraOrientationGroup

        onCurrentChanged: {
            if (gridTypeCombo.currentIndex >= _gridTypeCustomCamera) {
                recalcFromCameraValues()
            }
228
        }
Don Gagne's avatar
Don Gagne committed
229 230
    }

Don Gagne's avatar
Don Gagne committed
231 232
    ExclusiveGroup { id: fixedValueGroup }

233 234 235 236 237
    Column {
        id:                 editorColumn
        anchors.margins:    _margin
        anchors.top:        parent.top
        anchors.left:       parent.left
238
        anchors.right:      parent.right
239 240 241
        spacing:            _margin

        QGCLabel {
242 243
            anchors.left:   parent.left
            anchors.right:  parent.right
244 245
            wrapMode:       Text.WordWrap
            font.pointSize: ScreenTools.smallFontPointSize
Don Gagne's avatar
Don Gagne committed
246 247 248
            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.")
249 250
        }

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

Don Gagne's avatar
Don Gagne committed
253 254 255 256 257 258
        Rectangle {
            anchors.left:   parent.left
            anchors.right:  parent.right
            height:         1
            color:          qgcPal.text
        }
259

Don Gagne's avatar
Don Gagne committed
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
        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
                    }
278
                }
Don Gagne's avatar
Don Gagne committed
279
            }
280

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

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

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

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

Don Gagne's avatar
Don Gagne committed
324 325 326 327 328
            Column {
                anchors.left:   parent.left
                anchors.right:  parent.right
                spacing:        _margin
                visible:        gridTypeCombo.currentIndex == _gridTypeCustomCamera
329

Don Gagne's avatar
Don Gagne committed
330 331 332 333
                GridLayout {
                    columns:        3
                    columnSpacing:  _margin
                    rowSpacing:     _margin
334

Don Gagne's avatar
Don Gagne committed
335
                    property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10
Don Gagne's avatar
Don Gagne committed
336

Don Gagne's avatar
Don Gagne committed
337 338 339
                    QGCLabel { }
                    QGCLabel { text: qsTr("Width") }
                    QGCLabel { text: qsTr("Height") }
Don Gagne's avatar
Don Gagne committed
340

Don Gagne's avatar
Don Gagne committed
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 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
                    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
398 399
            }

Don Gagne's avatar
Don Gagne committed
400 401 402 403 404 405 406
            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
407 408
            }

Don Gagne's avatar
Don Gagne committed
409 410 411 412 413 414
            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
415 416
            }

Don Gagne's avatar
Don Gagne committed
417 418 419 420 421 422
            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
423 424
            }

Don Gagne's avatar
Don Gagne committed
425 426 427 428 429 430 431 432 433 434 435 436 437
            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
                }
438

Don Gagne's avatar
Don Gagne committed
439 440 441 442 443
                FactTextField {
                    id:                 gridAltitudeField
                    Layout.fillWidth:   true
                    fact:               missionItem.gridAltitude
                    enabled:            fixedAltitudeRadio.checked
444
                }
Don Gagne's avatar
Don Gagne committed
445
            }
Don Gagne's avatar
Don Gagne committed
446

Don Gagne's avatar
Don Gagne committed
447 448 449 450 451 452 453 454 455 456 457 458
            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
459 460
                }

Don Gagne's avatar
Don Gagne committed
461 462 463 464 465 466 467 468 469 470
                FactTextField {
                    id:                 groundResolutionField
                    Layout.fillWidth:   true
                    fact:               missionItem.groundResolution
                    enabled:            fixedGroundResolutionRadio.checked
                }
            }
        }

        // Manual grid ui
471
        Column {
Don Gagne's avatar
Don Gagne committed
472 473 474 475
            anchors.left:   parent.left
            anchors.right:  parent.right
            spacing:        _margin
            visible:        gridTypeCombo.currentIndex == _gridTypeManual
476

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

Don Gagne's avatar
Don Gagne committed
479 480 481 482 483
            Rectangle {
                anchors.left:   parent.left
                anchors.right:  parent.right
                height:         1
                color:          qgcPal.text
Don Gagne's avatar
Don Gagne committed
484 485
            }

Don Gagne's avatar
Don Gagne committed
486 487 488 489 490 491 492
            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
493

Don Gagne's avatar
Don Gagne committed
494 495 496 497 498 499
            QGCCheckBox {
                anchors.left:   parent.left
                text:           qsTr("Relative altitude")
                checked:        missionItem.gridAltitudeRelative
                onClicked:      missionItem.gridAltitudeRelative = checked
            }
500

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

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

Don Gagne's avatar
Don Gagne committed
510 511 512 513 514 515 516 517 518 519 520 521
            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
522

Don Gagne's avatar
Don Gagne committed
523 524 525 526 527 528
                FactTextField {
                    id:                 cameraTriggerDistanceField
                    Layout.fillWidth:   true
                    fact:               missionItem.cameraTriggerDistance
                    enabled:            missionItem.cameraTrigger
                }
Don Gagne's avatar
Don Gagne committed
529 530 531
            }
        }

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

534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552
        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 {
553
                        editorMap.polygonDraw.startCapturePolygon(_root)
554
                    }
555 556 557
                }
            }

558 559 560
            QGCButton {
                text:       editorMap.polygonDraw.adjustingPolygon ? qsTr("Finish Adjust") : qsTr("Adjust")
                visible:    missionItem.polygonPath.length > 0 && !editorMap.polygonDraw.drawingPolygon
561

562 563 564 565
                onClicked: {
                    if (editorMap.polygonDraw.adjustingPolygon) {
                        editorMap.polygonDraw.finishAdjustPolygon()
                    } else {
566
                        editorMap.polygonDraw.startAdjustPolygon(_root, missionItem.polygonPath)
567
                    }
568 569 570
                }
            }
        }
571 572 573 574 575 576 577 578 579 580 581

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

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

        Grid {
582 583
            columns:        2
            columnSpacing:  ScreenTools.defaultFontPixelWidth
584 585 586 587 588 589

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

            QGCLabel { text: qsTr("# shots:") }
            QGCLabel { text: missionItem.cameraShots }
590 591 592

            QGCLabel { text: qsTr("Shot interval:") }
            QGCLabel { text: missionItem.timeBetweenShots.toFixed(1) + " " + qsTr("secs")}
593
        }
594 595
    }
}