StructureScanMapVisual.qml 3.25 KB
Newer Older
1 2
/****************************************************************************
 *
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 *
 * 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

21
/// Structure Scan Complex Mission Item visuals
22 23 24
Item {
    id: _root

DonLakeFlyer's avatar
DonLakeFlyer committed
25
    property var map        ///< Map control to place item in
26 27

    property var _missionItem:      object
28 29
    property var _structurePolygon: object.structurePolygon
    property var _flightPolygon:    object.flightPolygon
30
    property bool interactive:      parent.interactive
31 32 33 34

    signal clicked(int sequenceNumber)

    function _addVisualElements() {
35
        objMgr.createObjects([entryPointComponent, exitPointComponent], map, true /* parentObjectIsMap */)
36 37 38 39 40 41
    }

    Component.onCompleted: {
        _addVisualElements()
    }

42
    QGCDynamicObjectManager { id: objMgr }
43 44 45

    QGCMapPolygonVisuals {
        mapControl:         map
46
        mapPolygon:         _structurePolygon
47
        interactive:        _missionItem.isCurrentItem && _root.interactive
48 49 50
        borderWidth:        1
        borderColor:        "black"
        interiorColor:      "green"
51 52
        altColor:           "red"
        interiorOpacity:    0.5 * _root.opacity
53 54
    }

55 56 57 58 59 60
    QGCMapPolygonVisuals {
        mapControl:         map
        mapPolygon:         _flightPolygon
        interactive:        false
        borderWidth:        2
        borderColor:        "white"
61
        interiorOpacity:    _root.opacity
62 63 64 65 66 67 68 69 70 71 72
    }

    // Entry point
    Component {
        id: entryPointComponent

        MapQuickItem {
            anchorPoint.x:  sourceItem.anchorPointX
            anchorPoint.y:  sourceItem.anchorPointY
            z:              QGroundControl.zOrderMapItems
            coordinate:     _missionItem.coordinate
73
            visible:        _missionItem.exitCoordinate.isValid && _root.interactive
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92

            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
93
            visible:        _missionItem.exitCoordinate.isValid && _root.interactive
94 95 96 97 98 99 100 101 102 103

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