6import QGroundControl.Controls
7import QGroundControl.FlightMap
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!
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
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
27 property string fmode: vehicle.flightMode
29 // Add the mission item visuals to the map
31 model: largeMapView ? _missionController.visualItems : 0
33 delegate: MissionItemMapVisual {
36 onClicked: _guidedController.confirmAction(_guidedController.actionSetWaypoint, Math.max(object.sequenceNumber, 1))
40 Component.onCompleted: {
41 _missionLineViewComponent = missionLineViewComponent.createObject(map)
42 if (_missionLineViewComponent.status === Component.Error)
43 console.log(_missionLineViewComponent.errorString())
44 map.addMapItemGroup(_missionLineViewComponent)
47 Component.onDestruction: {
48 if (_missionLineViewComponent) {
49 // Must remove MapItemGroup before destruction, otherwise we crash on quit
50 map.removeMapItemGroup(_missionLineViewComponent)
51 _missionLineViewComponent.destroy()
56 id: missionLineViewComponent
60 model: _missionController.simpleFlightPathSegments
64 model: _missionController.directionArrows
66 delegate: MapLineArrow {
67 fromCoord: object ? object.coordinate1 : undefined
68 toCoord: object ? object.coordinate2 : undefined
70 z: QGroundControl.zOrderWaypointLines + 1