6import QGroundControl.Controls
7import QGroundControl.FlightMap
8import QGroundControl.PlanView
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!
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
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
28 property string fmode: vehicle.flightMode
30 // Add the mission item visuals to the map
32 model: largeMapView ? _missionController.visualItems : 0
34 delegate: MissionItemMapVisual {
37 onClicked: _guidedController.confirmAction(_guidedController.actionSetWaypoint, Math.max(object.sequenceNumber, 1))
41 Component.onCompleted: {
42 _missionLineViewComponent = missionLineViewComponent.createObject(map)
43 if (_missionLineViewComponent.status === Component.Error)
44 console.log(_missionLineViewComponent.errorString())
45 map.addMapItemGroup(_missionLineViewComponent)
48 Component.onDestruction: {
49 if (_missionLineViewComponent) {
50 // Must remove MapItemGroup before destruction, otherwise we crash on quit
51 map.removeMapItemGroup(_missionLineViewComponent)
52 _missionLineViewComponent.destroy()
57 id: missionLineViewComponent
61 model: _missionController.simpleFlightPathSegments
65 model: _missionController.directionArrows
67 delegate: MapLineArrow {
68 fromCoord: object ? object.coordinate1 : undefined
69 toCoord: object ? object.coordinate2 : undefined
71 z: QGroundControl.zOrderWaypointLines + 1