FlyViewMap.qml 22.5 KB
Newer Older
1 2
/****************************************************************************
 *
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
9

10 11 12 13 14
import QtQuick                      2.11
import QtQuick.Controls             2.4
import QtLocation                   5.3
import QtPositioning                5.3
import QtQuick.Dialogs              1.2
15 16

import QGroundControl               1.0
17 18 19
import QGroundControl.Airspace      1.0
import QGroundControl.Controllers   1.0
import QGroundControl.Controls      1.0
20 21 22
import QGroundControl.FlightDisplay 1.0
import QGroundControl.FlightMap     1.0
import QGroundControl.Palette       1.0
23
import QGroundControl.ScreenTools   1.0
24 25
import QGroundControl.Vehicle       1.0

26 27
import Wima 1.0

28
FlightMap {
29 30
    id:                         _root
    allowGCSLocationCenter:     true
31
    allowVehicleLocationCenter: !_keepVehicleCentered
32
    planView:                   false
33 34
    zoomLevel:                  QGroundControl.flightMapZoom
    center:                     QGroundControl.flightMapPosition
35

36 37 38 39 40 41
    property Item pipState: _pipState
    QGCPipState {
        id:         _pipState
        pipOverlay: _pipOverlay
        isDark:     _isFullWindowItemDark
    }
42

43
    property var    rightPanelWidth
44
    property var    planMasterController
45 46
    property bool   pipMode:                    false   // true: map is shown in a small pip mode
    property var    toolInsets                          // Insets for the center viewport area
47
    property var    wimaController
48

49
    property var    _activeVehicle:             QGroundControl.multiVehicleManager.activeVehicle
50 51 52
    property var    _planMasterController:      planMasterController
    property var    _geoFenceController:        planMasterController.geoFenceController
    property var    _rallyPointController:      planMasterController.rallyPointController
53
    property var    _activeVehicleCoordinate:   _activeVehicle ? _activeVehicle.coordinate : QtPositioning.coordinate()
54
    property real   _toolButtonTopMargin:       parent.height - mainWindow.height + (ScreenTools.defaultFontPixelHeight / 2)
Gus Grubba's avatar
Gus Grubba committed
55
    property bool   _airspaceEnabled:           QGroundControl.airmapSupported ? (QGroundControl.settingsManager.airMapSettings.enableAirMap.rawValue && QGroundControl.airspaceManager.connected): false
56 57
    property var    _flyViewSettings:           QGroundControl.settingsManager.flyViewSettings
    property bool   _keepMapCenteredOnVehicle:  _flyViewSettings.keepMapCenteredOnVehicle.rawValue
58

59
    property bool   _disableVehicleTracking:    false
60 61
    property bool   _keepVehicleCentered:       pipMode ? true : false
    property bool   _saveZoomLevelSetting:      true
62

63 64
    property bool   _wimaEnabled:               wimaController.enableWimaController.value

65
    function updateAirspace(reset) {
66
        if(_airspaceEnabled) {
67 68
            var coordinateNW = _root.toCoordinate(Qt.point(0,0), false /* clipToViewPort */)
            var coordinateSE = _root.toCoordinate(Qt.point(width,height), false /* clipToViewPort */)
69
            if(coordinateNW.isValid && coordinateSE.isValid) {
70
                QGroundControl.airspaceManager.setROI(coordinateNW, coordinateSE, false /*planView*/, reset)
71
            }
72
        }
73 74
    }

75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
    function _adjustMapZoomForPipMode() {
        _saveZoomLevelSetting = false
        if (pipMode) {
            if (QGroundControl.flightMapZoom > 3) {
                zoomLevel = QGroundControl.flightMapZoom - 3
            }
        } else {
            zoomLevel = QGroundControl.flightMapZoom
        }
        _saveZoomLevelSetting = true
    }

    onPipModeChanged: _adjustMapZoomForPipMode()

    onVisibleChanged: {
        if (visible) {
            // Synchronize center position with Plan View
            center = QGroundControl.flightMapPosition
        }
    }
95 96

    onZoomLevelChanged: {
97 98 99 100
        if (_saveZoomLevelSetting) {
            QGroundControl.flightMapZoom = zoomLevel
            updateAirspace(false)
        }
101 102
    }
    onCenterChanged: {
103
        QGroundControl.flightMapPosition = center
104
        updateAirspace(false)
105
    }
106

Gus Grubba's avatar
Gus Grubba committed
107
    on_AirspaceEnabledChanged: {
108
        updateAirspace(true)
Gus Grubba's avatar
Gus Grubba committed
109 110
    }

111 112 113 114 115 116 117 118 119 120
    // We track whether the user has panned or not to correctly handle automatic map positioning
    Connections {
        target: gesture

        onPanStarted:       _disableVehicleTracking = true
        onFlickStarted:     _disableVehicleTracking = true
        onPanFinished:      panRecenterTimer.restart()
        onFlickFinished:    panRecenterTimer.restart()
    }

121 122 123 124 125 126 127 128 129 130 131 132 133 134
    function pointInRect(point, rect) {
        return point.x > rect.x &&
                point.x < rect.x + rect.width &&
                point.y > rect.y &&
                point.y < rect.y + rect.height;
    }

    property real _animatedLatitudeStart
    property real _animatedLatitudeStop
    property real _animatedLongitudeStart
    property real _animatedLongitudeStop
    property real animatedLatitude
    property real animatedLongitude

135 136
    onAnimatedLatitudeChanged: _root.center = QtPositioning.coordinate(animatedLatitude, animatedLongitude)
    onAnimatedLongitudeChanged: _root.center = QtPositioning.coordinate(animatedLatitude, animatedLongitude)
137 138 139 140 141 142 143 144 145 146 147 148 149

    NumberAnimation on animatedLatitude { id: animateLat; from: _animatedLatitudeStart; to: _animatedLatitudeStop; duration: 1000 }
    NumberAnimation on animatedLongitude { id: animateLong; from: _animatedLongitudeStart; to: _animatedLongitudeStop; duration: 1000 }

    function animatedMapRecenter(fromCoord, toCoord) {
        _animatedLatitudeStart = fromCoord.latitude
        _animatedLongitudeStart = fromCoord.longitude
        _animatedLatitudeStop = toCoord.latitude
        _animatedLongitudeStop = toCoord.longitude
        animateLat.start()
        animateLong.start()
    }

150 151 152 153 154 155 156
    function _insetRect() {
        return Qt.rect(toolInsets.leftEdgeCenterInset,
                       toolInsets.topEdgeCenterInset,
                       _root.width - toolInsets.leftEdgeCenterInset - toolInsets.rightEdgeCenterInset,
                       _root.height - toolInsets.topEdgeCenterInset - toolInsets.bottomEdgeCenterInset)
    }

157
    function recenterNeeded() {
158 159 160
        var vehiclePoint = _root.fromCoordinate(_activeVehicleCoordinate, false /* clipToViewport */)
        var insetRect = _insetRect()
        return !pointInRect(vehiclePoint, insetRect)
161 162 163
    }

    function updateMapToVehiclePosition() {
164 165 166
        if (animateLat.running || animateLong.running) {
            return
        }
167
        // We let FlightMap handle first vehicle position
168
        if (!_keepMapCenteredOnVehicle && firstVehiclePositionReceived && _activeVehicleCoordinate.isValid && !_disableVehicleTracking) {
169
            if (_keepVehicleCentered) {
170
                _root.center = _activeVehicleCoordinate
171
            } else {
DonLakeFlyer's avatar
DonLakeFlyer committed
172
                if (firstVehiclePositionReceived && recenterNeeded()) {
173 174 175 176 177 178 179 180
                    // Move the map such that the vehicle is centered within the inset area
                    var vehiclePoint = _root.fromCoordinate(_activeVehicleCoordinate, false /* clipToViewport */)
                    var insetRect = _insetRect()
                    var centerInsetPoint = Qt.point(insetRect.x + insetRect.width / 2, insetRect.y + insetRect.height / 2)
                    var centerOffset = Qt.point((_root.width / 2) - centerInsetPoint.x, (_root.height / 2) - centerInsetPoint.y)
                    var vehicleOffsetPoint = Qt.point(vehiclePoint.x + centerOffset.x, vehiclePoint.y + centerOffset.y)
                    var vehicleOffsetCoord = _root.toCoordinate(vehicleOffsetPoint, false /* clipToViewport */)
                    animatedMapRecenter(_root.center, vehicleOffsetCoord)
181 182
                }
            }
183 184 185
        }
    }

186 187 188 189 190 191
    on_ActiveVehicleCoordinateChanged: {
        if (_keepMapCenteredOnVehicle && _activeVehicleCoordinate.isValid && !_disableVehicleTracking) {
            _root.center = _activeVehicleCoordinate
        }
    }

192
    Timer {
193 194 195
        id:         panRecenterTimer
        interval:   10000
        running:    false
196
        onTriggered: {
197
            _disableVehicleTracking = false
198
            updateMapToVehiclePosition()
199 200 201
        }
    }

202 203 204 205 206 207 208
    Timer {
        interval:       500
        running:        true
        repeat:         true
        onTriggered:    updateMapToVehiclePosition()
    }

209
    QGCMapPalette { id: mapPal; lightColors: isSatelliteMap }
Don Gagne's avatar
Don Gagne committed
210

211
    Connections {
212 213
        target:                 _missionController
        ignoreUnknownSignals:   true
214
        onNewItemsFromVehicle: {
215
            var visualItems = _missionController.visualItems
216
            if (visualItems && visualItems.count !== 1) {
217
                mapFitFunctions.fitMapViewportToMissionItems()
218
                firstVehiclePositionReceived = true
219 220
            }
        }
221 222
    }

223 224 225 226 227 228 229 230 231 232 233 234 235
    Connections {
        target: _wimaController

        onVisualItemsChanged: {
            var visualItems = _wimaController.visualItems
            if (visualItems && visualItems.count > 0) {
                if (recenterNeeded()){
                    mapFitFunctions.fitMapViewportToAreas()
                }
            }
        }
    }

Don Gagne's avatar
Don Gagne committed
236
    MapFitFunctions {
237
        id:                         mapFitFunctions // The name for this id cannot be changed without breaking references outside of this code. Beware!
238
        map:                        _root
Don Gagne's avatar
Don Gagne committed
239
        usePlannedHomePosition:     false
240
        planMasterController:       _planMasterController
241

242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
        function fitMapViewportToAreas() {
            if (!_wimaController.visualItems) {
                // Being called prior to controller.start
                return
            }

            var coordList = [ ]
            for (var i = 0; i < _wimaController.visualItems.count; i++){
                var area = _wimaController.visualItems.get(i)
                for (var j = 0; j < area.path.length; ++j){
                    var vertex = area.path[j]
                    coordList.push(vertex)
                }
            }
            fitMapViewportToAllCoordinates(coordList)
        }
Don Gagne's avatar
Don Gagne committed
258
    }
259

260
    // Add wima Areas to the Map
261
    Repeater {
262 263
        property bool _enableWima: wimaController.enableWimaController.value
        model: _enableWima ? wimaController.visualItems : 0
264 265 266 267
        delegate: WimaMapVisual{
            map:               flightMap
            qgcView:           flightMap.qgcView
            visible: true
268
        }
269 270
    }

271
    // Add missionItems generated by wima planer to the map
Valentin Platzgummer's avatar
Valentin Platzgummer committed
272
    // all Items
273 274 275 276 277
    WimaPlanMapItems {
        map:            flightMap
        largeMapView:   _mainIsMap
        missionItems:   wimaController.missionItems
        path:           wimaController.waypointPath
278
        showItems:      _wimaEnabled
279 280
        zOrderWP:       QGroundControl.zOrderWimaAllWaypointIndicators
        zOrderLines:    QGroundControl.zOrderWimaAllWaypointLines
281
        color:          "green"
282
    }
283 284 285 286 287 288 289
    // Add trajectory lines to the map
    MapPolyline {
        id:         trajectoryPolyline
        line.width: 3
        line.color: "red"
        z:          QGroundControl.zOrderTrajectoryLines
        visible:    !pipMode
290

291 292 293 294
        Connections {
            target:                 QGroundControl.multiVehicleManager
            onActiveVehicleChanged: trajectoryPolyline.path = _activeVehicle ? _activeVehicle.trajectoryPoints.list() : []
        }
DonLakeFlyer's avatar
DonLakeFlyer committed
295

296 297 298 299 300
        Connections {
            target:                 _activeVehicle ? _activeVehicle.trajectoryPoints : null
            onPointAdded:           trajectoryPolyline.addCoordinate(coordinate)
            onUpdateLastPoint:      trajectoryPolyline.replaceCoordinate(trajectoryPolyline.pathLength() - 1, coordinate)
            onPointsCleared:        trajectoryPolyline.path = []
Don Gagne's avatar
Don Gagne committed
301
        }
302 303 304 305
    }

    // Add the vehicles to the map
    MapItemView {
306
        model: QGroundControl.multiVehicleManager.vehicles
DonLakeFlyer's avatar
DonLakeFlyer committed
307
        delegate: VehicleMapItem {
Don Gagne's avatar
Don Gagne committed
308 309
            vehicle:        object
            coordinate:     object.coordinate
310 311 312 313 314 315 316 317 318 319 320 321
            map:            _root
            size:           pipMode ? ScreenTools.defaultFontPixelHeight : ScreenTools.defaultFontPixelHeight * 3
            z:              QGroundControl.zOrderVehicles
        }
    }
    // Add distance sensor view
    MapItemView{
        model: QGroundControl.multiVehicleManager.vehicles
        delegate: ProximityRadarMapView {
            vehicle:        object
            coordinate:     object.coordinate
            map:            _root
DonLakeFlyer's avatar
DonLakeFlyer committed
322
            z:              QGroundControl.zOrderVehicles
Don Gagne's avatar
Don Gagne committed
323
        }
324
    }
325 326
    // Add ADSB vehicles to the map
    MapItemView {
327
        model: QGroundControl.adsbVehicleManager.adsbVehicles
328 329 330
        delegate: VehicleMapItem {
            coordinate:     object.coordinate
            altitude:       object.altitude
331
            callsign:       object.callsign
332
            heading:        object.heading
Gus Grubba's avatar
Gus Grubba committed
333
            alert:          object.alert
334
            map:            _root
335 336 337 338
            z:              QGroundControl.zOrderVehicles
        }
    }

339 340 341 342 343
    // Add the items associated with each vehicles flight plan to the map
    Repeater {
        model: QGroundControl.multiVehicleManager.vehicles

        PlanMapItems {
344 345 346 347
            map:                    _root
            largeMapView:           !pipMode
            planMasterController:   _planMasterController
            vehicle:                _vehicle
348 349 350 351 352 353 354 355

            property var _vehicle: object

            PlanMasterController {
                id: masterController
                Component.onCompleted: startStaticActiveVehicle(object)
            }
        }
356 357
    }

358 359 360 361 362 363 364 365 366 367 368
    MapItemView {
        model: pipMode ? undefined : _missionController.directionArrows

        delegate: MapLineArrow {
            fromCoord:      object ? object.coordinate1 : undefined
            toCoord:        object ? object.coordinate2 : undefined
            arrowPosition:  2
            z:              QGroundControl.zOrderWaypointLines
        }
    }

369 370
    // Allow custom builds to add map items
    CustomMapItems {
371 372
        map:            _root
        largeMapView:   !pipMode
373 374
    }

375
    GeoFenceMapVisuals {
376
        map:                    _root
377
        myGeoFenceController:   _geoFenceController
378
        interactive:            false
379
        planView:               false
380
        homePosition:           _activeVehicle && _activeVehicle.homePosition.isValid ? _activeVehicle.homePosition :  QtPositioning.coordinate()
381 382
    }

383 384
    // Rally points on map
    MapItemView {
385
        model: _rallyPointController.points
386 387 388

        delegate: MapQuickItem {
            id:             itemIndicator
389 390
            anchorPoint.x:  sourceItem.anchorPointX
            anchorPoint.y:  sourceItem.anchorPointY
391 392 393 394 395 396 397 398 399 400
            coordinate:     object.coordinate
            z:              QGroundControl.zOrderMapItems

            sourceItem: MissionItemIndexLabel {
                id:         itemIndexLabel
                label:      qsTr("R", "rally point map item label")
            }
        }
    }

DonLakeFlyer's avatar
DonLakeFlyer committed
401 402 403 404 405 406 407 408 409 410
    // Camera trigger points
    MapItemView {
        model: _activeVehicle ? _activeVehicle.cameraTriggerPoints : 0

        delegate: CameraTriggerIndicator {
            coordinate:     object.coordinate
            z:              QGroundControl.zOrderTopMost
        }
    }

411
    // GoTo Location visuals
Don Gagne's avatar
Don Gagne committed
412
    MapQuickItem {
413 414
        id:             gotoLocationItem
        visible:        false
Don Gagne's avatar
Don Gagne committed
415
        z:              QGroundControl.zOrderMapItems
416 417
        anchorPoint.x:  sourceItem.anchorPointX
        anchorPoint.y:  sourceItem.anchorPointY
Don Gagne's avatar
Don Gagne committed
418
        sourceItem: MissionItemIndexLabel {
DonLakeFlyer's avatar
DonLakeFlyer committed
419 420
            checked:    true
            index:      -1
421
            label:      qsTr("Go here", "Go to location waypoint")
Don Gagne's avatar
Don Gagne committed
422
        }
423

424 425 426
        property bool inGotoFlightMode: _activeVehicle ? _activeVehicle.flightMode === _activeVehicle.gotoFlightMode : false

        onInGotoFlightModeChanged: {
427
            if (!inGotoFlightMode && gotoLocationItem.visible) {
428
                // Hide goto indicator when vehicle falls out of guided mode
429
                gotoLocationItem.visible = false
430 431 432
            }
        }

433 434 435 436 437 438
        Connections {
            target: QGroundControl.multiVehicleManager
            onActiveVehicleChanged: {
                if (!activeVehicle) {
                    gotoLocationItem.visible = false
                }
439 440 441
            }
        }

442 443 444 445
        function show(coord) {
            gotoLocationItem.coordinate = coord
            gotoLocationItem.visible = true
        }
446

447 448 449 450
        function hide() {
            gotoLocationItem.visible = false
        }

451 452 453 454 455 456 457 458
        function actionConfirmed() {
            // We leave the indicator visible. The handling for onInGuidedModeChanged will hide it.
        }

        function actionCancelled() {
            hide()
        }
    }
459

460
    // Orbit editing visuals
461
    QGCMapCircleVisuals {
462 463 464 465
        id:             orbitMapCircle
        mapControl:     parent
        mapCircle:      _mapCircle
        visible:        false
466

467 468
        property alias center:              _mapCircle.center
        property alias clockwiseRotation:   _mapCircle.clockwiseRotation
469 470
        readonly property real defaultRadius: 30

471 472 473 474 475 476
        Connections {
            target: QGroundControl.multiVehicleManager
            onActiveVehicleChanged: {
                if (!activeVehicle) {
                    orbitMapCircle.visible = false
                }
477 478 479
            }
        }

480
        function show(coord) {
DonLakeFlyer's avatar
DonLakeFlyer committed
481
            _mapCircle.radius.rawValue = defaultRadius
482 483 484 485 486 487 488 489
            orbitMapCircle.center = coord
            orbitMapCircle.visible = true
        }

        function hide() {
            orbitMapCircle.visible = false
        }

490 491 492 493 494 495 496 497 498
        function actionConfirmed() {
            // Live orbit status is handled by telemetry so we hide here and telemetry will show again.
            hide()
        }

        function actionCancelled() {
            hide()
        }

DonLakeFlyer's avatar
DonLakeFlyer committed
499 500 501 502
        function radius() {
            return _mapCircle.radius.rawValue
        }

503
        Component.onCompleted: globals.guidedControllerFlyView.orbitMapCircle = orbitMapCircle
504 505 506 507

        QGCMapCircle {
            id:                 _mapCircle
            interactive:        true
DonLakeFlyer's avatar
DonLakeFlyer committed
508
            radius.rawValue:    30
509 510
            showRotation:       true
            clockwiseRotation:  true
511 512 513
        }
    }

514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541
    // ROI Location visuals
    MapQuickItem {
        id:             roiLocationItem
        visible:        _activeVehicle && _activeVehicle.isROIEnabled
        z:              QGroundControl.zOrderMapItems
        anchorPoint.x:  sourceItem.anchorPointX
        anchorPoint.y:  sourceItem.anchorPointY
        sourceItem: MissionItemIndexLabel {
            checked:    true
            index:      -1
            label:      qsTr("ROI here", "Make this a Region Of Interest")
        }

        //-- Visibilty controlled by actual state
        function show(coord) {
            roiLocationItem.coordinate = coord
        }

        function hide() {
        }

        function actionConfirmed() {
        }

        function actionCancelled() {
        }
    }

542
    // Orbit telemetry visuals
543
    QGCMapCircleVisuals {
544
        id:             orbitTelemetryCircle
545
        mapControl:     parent
Gus Grubba's avatar
Gus Grubba committed
546
        mapCircle:      _activeVehicle ? _activeVehicle.orbitMapCircle : null
547 548 549
        visible:        _activeVehicle ? _activeVehicle.orbitActive : false
    }

550 551 552 553
    MapQuickItem {
        id:             orbitCenterIndicator
        anchorPoint.x:  sourceItem.anchorPointX
        anchorPoint.y:  sourceItem.anchorPointY
Don Gagne's avatar
Don Gagne committed
554
        coordinate:     _activeVehicle ? _activeVehicle.orbitMapCircle.center : QtPositioning.coordinate()
555 556 557 558 559 560 561 562 563
        visible:        orbitTelemetryCircle.visible

        sourceItem: MissionItemIndexLabel {
            checked:    true
            index:      -1
            label:      qsTr("Orbit", "Orbit waypoint")
        }
    }

Don Gagne's avatar
Don Gagne committed
564
    // Handle guided mode clicks
565 566
    MouseArea {
        anchors.fill: parent
Don Gagne's avatar
Don Gagne committed
567

568
        QGCMenu {
DonLakeFlyer's avatar
DonLakeFlyer committed
569
            id: clickMenu
570
            property var coord
571
            QGCMenuItem {
DonLakeFlyer's avatar
DonLakeFlyer committed
572
                text:           qsTr("Go to location")
573
                visible:        globals.guidedControllerFlyView.showGotoLocation
DonLakeFlyer's avatar
DonLakeFlyer committed
574 575

                onTriggered: {
576
                    gotoLocationItem.show(clickMenu.coord)
577
                    globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionGoto, clickMenu.coord, gotoLocationItem)
DonLakeFlyer's avatar
DonLakeFlyer committed
578 579
                }
            }
580
            QGCMenuItem {
DonLakeFlyer's avatar
DonLakeFlyer committed
581
                text:           qsTr("Orbit at location")
582
                visible:        globals.guidedControllerFlyView.showOrbit
583

DonLakeFlyer's avatar
DonLakeFlyer committed
584
                onTriggered: {
585
                    orbitMapCircle.show(clickMenu.coord)
586 587 588 589 590 591 592 593 594 595
                    globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionOrbit, clickMenu.coord, orbitMapCircle)
                }
            }
            QGCMenuItem {
                text:           qsTr("ROI at location")
                visible:        globals.guidedControllerFlyView.showROI

                onTriggered: {
                    roiLocationItem.show(clickMenu.coord)
                    globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionROI, clickMenu.coord, roiLocationItem)
DonLakeFlyer's avatar
DonLakeFlyer committed
596 597 598 599
                }
            }
        }

Don Gagne's avatar
Don Gagne committed
600
        onClicked: {
601 602 603 604
            if (!globals.guidedControllerFlyView.guidedUIVisible && (globals.guidedControllerFlyView.showGotoLocation || globals.guidedControllerFlyView.showOrbit || globals.guidedControllerFlyView.showROI)) {
                orbitMapCircle.hide()
                gotoLocationItem.hide()
                var clickCoord = _root.toCoordinate(Qt.point(mouse.x, mouse.y), false /* clipToViewPort */)
605
                clickMenu.coord = clickCoord
DonLakeFlyer's avatar
DonLakeFlyer committed
606
                clickMenu.popup()
Don Gagne's avatar
Don Gagne committed
607 608
            }
        }
609
    }
610

611
    // Airspace overlap support
612
    MapItemView {
613
        model:              _airspaceEnabled && QGroundControl.settingsManager.airMapSettings.enableAirspace && QGroundControl.airspaceManager.airspaceVisible ? QGroundControl.airspaceManager.airspaces.circles : []
614 615 616
        delegate: MapCircle {
            center:         object.center
            radius:         object.radius
617
            color:          object.color
Gus Grubba's avatar
Gus Grubba committed
618 619
            border.color:   object.lineColor
            border.width:   object.lineWidth
620 621 622 623
        }
    }

    MapItemView {
624
        model:              _airspaceEnabled && QGroundControl.settingsManager.airMapSettings.enableAirspace && QGroundControl.airspaceManager.airspaceVisible ? QGroundControl.airspaceManager.airspaces.polygons : []
625 626
        delegate: MapPolygon {
            path:           object.polygon
627
            color:          object.color
Gus Grubba's avatar
Gus Grubba committed
628 629
            border.color:   object.lineColor
            border.width:   object.lineWidth
630 631
        }
    }
632

633
}