CircularGeneratorMapVisual.qml 1.52 KB
Newer Older
1 2
import QtQuick 			2.0
import QGroundControl   1.0
3
import QtLocation 5.11
4 5 6 7

Item {
    id: _root

8 9 10
    visible: true

    // Expects the following properties:
11 12 13 14 15 16 17
    property var map        ///< Map control to place item in
    property var generator
    property bool checked: false


    signal clicked()

18 19
    Item {
        id: refPointItem
20

21
        property var reference: generator.reference
22

23 24 25 26
        onReferenceChanged: {
            if (mapItem.coordinate !== reference){
                mapItem.coordinate = reference
            }
27 28
        }

29 30
        MapQuickItem {
            id: mapItem
31

32

33 34 35 36 37
            coordinate:     _root.generator.reference
            anchorPoint.x:  sourceItem.anchorPointX
            anchorPoint.y:  sourceItem.anchorPointY
            visible:        refPointItem.visible
            z:		        QGroundControl.zOrderMapItems
38

39 40 41 42 43 44 45 46 47 48
            sourceItem:
                MissionItemIndexLabel {
                checked:            true
                label:              qsTr("Reference")
                highlightSelected:  true
                onClicked:          _root.clicked(0)
                visible:            mapItem.visible
                z:				    mapItem.z
            }
        }
49

50 51 52 53
        ItemDragger {
            anchor:  mapItem
            z:				QGroundControl.zOrderMapItems+1
            draggable: true
54

55 56
            onDragStop:{
                _root.generator.reference = mapItem.coordinate
57
            }
58
        }
59

60 61
        Component.onCompleted: {
            _root.map.addMapItem(mapItem)
62 63 64
        }
    }
}