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