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 MissionItemIndicatorGroup {
31 id: _missionItemIndicatorGroup
34 missionItems: _root.largeMapView ? _root._missionController.visualItems : null
35 onItemSelected: (sequenceNumber) => {
36 _root._guidedController.confirmAction(_root._guidedController.actionSetWaypoint, Math.max(sequenceNumber, 1))
40 // Add the mission item visuals to the map
42 model: largeMapView ? _missionController.visualItems : 0
44 delegate: MissionItemMapVisual {
47 indicatorGroup: _missionItemIndicatorGroup
48 onClicked: _guidedController.confirmAction(_guidedController.actionSetWaypoint, Math.max(object.sequenceNumber, 1))
52 Component.onCompleted: {
53 _missionLineViewComponent = missionLineViewComponent.createObject(map)
54 if (_missionLineViewComponent.status === Component.Error)
55 console.log(_missionLineViewComponent.errorString())
56 map.addMapItemGroup(_missionLineViewComponent)
59 Component.onDestruction: {
60 if (_missionLineViewComponent) {
61 // Must remove MapItemGroup before destruction, otherwise we crash on quit
62 map.removeMapItemGroup(_missionLineViewComponent)
63 _missionLineViewComponent.destroy()
68 id: missionLineViewComponent
72 model: _missionController.simpleFlightPathSegments
76 model: _missionController.directionArrows
78 delegate: MapLineArrow {
79 fromCoord: object ? object.coordinate1 : undefined
80 toCoord: object ? object.coordinate2 : undefined
83 z: QGroundControl.zOrderWaypointLines + 1