QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
CustomMapItems.qml
Go to the documentation of this file.
1import QtQuick
2import QtLocation
3import QtPositioning
4
5import QGroundControl
6import QGroundControl.Controls
7import QGroundControl.FlightMap
8
9// Allow custom builds to add visual items associated with the Flight Plan to the map
10Item {
11 property var map ///< Map control to show items on
12 property bool largeMapView ///< true: map takes up entire view, false: map is in small window
13
14 Instantiator {
15 model: QGroundControl.corePlugin.customMapItems
16
17 Item {
18 property var _customObject
19
20 Component.onCompleted: {
21 var controlUrl = object.url
22 if (controlUrl !== "") {
23 var component = Qt.createComponent(controlUrl);
24 if (component.status === Component.Ready) {
25 _customObject = component.createObject(map, { "customMapObject": object })
26 if (_customObject) {
27 map.addMapItem(_customObject)
28 }
29 } else {
30 console.log("Component creation failed", component.errorString())
31 }
32 }
33 }
34
35 Component.onDestruction: {
36 if (_customObject) {
37 _customObject.destroy()
38 }
39 }
40 }
41 }
42}