Skip to content
StructureScanMapVisual.qml 3.04 KiB
Newer Older
Don Gagne's avatar
Don Gagne committed
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
Don Gagne's avatar
Don Gagne committed
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

import QtQuick          2.3
import QtQuick.Controls 1.2
import QtLocation       5.3
import QtPositioning    5.3

import QGroundControl               1.0
import QGroundControl.ScreenTools   1.0
import QGroundControl.Palette       1.0
import QGroundControl.Controls      1.0
import QGroundControl.FlightMap     1.0

DonLakeFlyer's avatar
 
DonLakeFlyer committed
/// Structure Scan Complex Mission Item visuals
Don Gagne's avatar
Don Gagne committed
Item {
    id: _root

DonLakeFlyer's avatar
DonLakeFlyer committed
    property var map        ///< Map control to place item in
Don Gagne's avatar
Don Gagne committed

    property var _missionItem:      object
    property var _structurePolygon: object.structurePolygon
    property var _flightPolygon:    object.flightPolygon
Don Gagne's avatar
Don Gagne committed

    signal clicked(int sequenceNumber)

    function _addVisualElements() {
Don Gagne's avatar
 
Don Gagne committed
        objMgr.createObjects([entryPointComponent, exitPointComponent], map, true /* parentObjectIsMap */)
Don Gagne's avatar
Don Gagne committed
    }

    Component.onCompleted: {
        _addVisualElements()
    }

DonLakeFlyer's avatar
 
DonLakeFlyer committed
    QGCDynamicObjectManager { id: objMgr }
Don Gagne's avatar
 
Don Gagne committed

Don Gagne's avatar
Don Gagne committed
    QGCMapPolygonVisuals {
        mapControl:         map
        mapPolygon:         _structurePolygon
Don Gagne's avatar
Don Gagne committed
        interactive:        _missionItem.isCurrentItem
        borderWidth:        1
        borderColor:        "black"
        interiorColor:      "green"
        interiorOpacity:    0.25
    QGCMapPolygonVisuals {
        mapControl:         map
        mapPolygon:         _flightPolygon
        interactive:        false
        borderWidth:        2
        borderColor:        "white"
Don Gagne's avatar
Don Gagne committed
    }

    // Entry point
    Component {
        id: entryPointComponent

        MapQuickItem {
            anchorPoint.x:  sourceItem.anchorPointX
            anchorPoint.y:  sourceItem.anchorPointY
            z:              QGroundControl.zOrderMapItems
            coordinate:     _missionItem.coordinate
            visible:        _missionItem.exitCoordinate.isValid

            sourceItem: MissionItemIndexLabel {
                index:      _missionItem.sequenceNumber
                label:      "Entry"
                checked:    _missionItem.isCurrentItem
                onClicked:  _root.clicked(_missionItem.sequenceNumber)
            }
        }
    }

    // Exit point
    Component {
        id: exitPointComponent

        MapQuickItem {
            anchorPoint.x:  sourceItem.anchorPointX
            anchorPoint.y:  sourceItem.anchorPointY
            z:              QGroundControl.zOrderMapItems
            coordinate:     _missionItem.exitCoordinate
            visible:        _missionItem.exitCoordinate.isValid

            sourceItem: MissionItemIndexLabel {
                index:      _missionItem.lastSequenceNumber
                label:      "Exit"
                checked:    _missionItem.isCurrentItem
                onClicked:  _root.clicked(_missionItem.sequenceNumber)
            }
        }
    }
}