QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
PlanMapItems.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// Adds visual items associated with the Flight Plan to the map.
10// Currently only used by Fly View even though it's called PlanMapItems!
11Item {
12 id: _root
13
14 property var map ///< Map control to show items on
15 property bool largeMapView ///< true: map takes up entire view, false: map is in small window
16 property var planMasterController ///< Reference to PlanMasterController for vehicle
17 property var vehicle ///< Vehicle associated with these items
18
19 property var _map: map
20 property var _vehicle: vehicle
21 property var _missionController: planMasterController.missionController
22 property var _geoFenceController: planMasterController.geoFenceController
23 property var _rallyPointController: planMasterController.rallyPointController
24 property var _guidedController: globals.guidedControllerFlyView
25 property var _missionLineViewComponent
26
27 property string fmode: vehicle.flightMode
28
29 // Add the mission item visuals to the map
30 Repeater {
31 model: largeMapView ? _missionController.visualItems : 0
32
33 delegate: MissionItemMapVisual {
34 map: _map
35 vehicle: _vehicle
36 onClicked: _guidedController.confirmAction(_guidedController.actionSetWaypoint, Math.max(object.sequenceNumber, 1))
37 }
38 }
39
40 Component.onCompleted: {
41 _missionLineViewComponent = missionLineViewComponent.createObject(map)
42 if (_missionLineViewComponent.status === Component.Error)
43 console.log(_missionLineViewComponent.errorString())
44 map.addMapItemGroup(_missionLineViewComponent)
45 }
46
47 Component.onDestruction: {
48 if (_missionLineViewComponent) {
49 // Must remove MapItemGroup before destruction, otherwise we crash on quit
50 map.removeMapItemGroup(_missionLineViewComponent)
51 _missionLineViewComponent.destroy()
52 }
53 }
54
55 Component {
56 id: missionLineViewComponent
57
58 MapItemGroup {
59 MissionLineView {
60 model: _missionController.simpleFlightPathSegments
61 }
62
63 MapItemView {
64 model: _missionController.directionArrows
65
66 delegate: MapLineArrow {
67 fromCoord: object ? object.coordinate1 : undefined
68 toCoord: object ? object.coordinate2 : undefined
69 arrowPosition: 3
70 z: QGroundControl.zOrderWaypointLines + 1
71 }
72 }
73 }
74 }
75}