12import QGroundControl.Controls
13import QGroundControl.FlyView
14import QGroundControl.FlightMap
15import QGroundControl.Toolbar
16import QGroundControl.Viewer3D
21 readonly property bool _is3DMode: QGCViewer3DManager.displayMode === QGCViewer3DManager.View3D
22 readonly property bool _keepSceneAlive: QGroundControl.settingsManager.viewer3DSettings.keepSceneAlive.rawValue
24 // These should only be used by MainRootWindow
25 property var planController: _planController
26 property var guidedController: _guidedController
28 PlanMasterController {
31 Component.onCompleted: start()
34 property bool _mainWindowIsMap: _mapControl ? _mapControl.pipState.state === _mapControl.pipState.fullState : true
35 property bool _isFullWindowItemDark: _mainWindowIsMap ? (_mapControl ? _mapControl.isSatelliteMap : true) : true
36 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
37 property var _missionController: _planController.missionController
38 property var _geoFenceController: _planController.geoFenceController
39 property var _rallyPointController: _planController.rallyPointController
40 property real _margins: ScreenTools.defaultFontPixelWidth / 2
41 property var _guidedController: guidedActionsController
42 property var _guidedValueSlider: guidedValueSlider
43 property var _widgetLayer: widgetLayer
44 property real _toolsMargin: ScreenTools.defaultFontPixelWidth * 0.75
45 property real _rightPanelWidth: ScreenTools.defaultFontPixelWidth * 30
46 property var _mapControl: mapEngineLoader.item
47 property real _widgetMargin: ScreenTools.defaultFontPixelWidth * 0.75
48 property var _layerOccluders: widgetLayer.occluders
49 property var _mapOccluders: _layerOccluders.all.concat(customOverlay.customOccluders).map(r => Qt.rect(r.x + widgetLayer.x, r.y + widgetLayer.y, r.width, r.height))
51 property real _fullItemZorder: 0
52 property real _pipItemZorder: QGroundControl.zOrderWidgets
54 function dropMainStatusIndicatorTool() {
55 toolbar.dropMainStatusIndicatorTool();
62 // Map engine switch (issue #14901): QtLocation FlyViewMap or the
63 // experimental GeoMap engine, only one instantiated at a time. The
64 // loaded item is positioned/reparented by its PipState, not the Loader.
65 // Engine choice is snapshotted at startup (setting is
66 // qgcRebootRequired): a live swap would leave stale cross-map state
67 // (guided controller registrations, ROI coordinate).
70 Component.onCompleted: sourceComponent = QGroundControl.settingsManager.flyViewSettings.useGeoMapEngine.rawValue ? geoMapEngineComponent : qtLocationEngineComponent
74 id: qtLocationEngineComponent
77 objectName: "flyViewMap"
78 planMasterController: _planController
79 rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9
81 pipMode: !_mainWindowIsMap
82 viewportRect: Qt.rect(widgetLayer.x, widgetLayer.y, widgetLayer.width, widgetLayer.height)
83 occluders: _mapOccluders
84 mapName: "FlightDisplayView"
91 id: geoMapEngineComponent
93 FlyViewGeoMapAdapter {
94 objectName: "flyViewGeoMapAdapter"
95 planMasterController: _planController
96 rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9
98 pipMode: !_mainWindowIsMap
99 viewportRect: Qt.rect(widgetLayer.x, widgetLayer.y, widgetLayer.width, widgetLayer.height)
100 occluders: _mapOccluders
101 chromeTopMargin: widgetLayer.y + _layerOccluders.topRight.y + _layerOccluders.topRight.height + _widgetMargin
102 chromeBottomMargin: mapHolder.height - widgetLayer.y - Math.min(_layerOccluders.pipView.y, _layerOccluders.virtualJoystickLeft.y) + ScreenTools.defaultFontPixelWidth / 2
103 mapName: "FlightDisplayView"
116 objectName: "flyViewPipView"
117 anchors.left: parent.left
118 anchors.bottom: parent.bottom
119 anchors.margins: _toolsMargin
120 item1IsFullSettingsKey: "MainFlyWindowIsMap"
122 item2: QGroundControl.videoManager.hasVideo ? videoControl : null
123 show: QGroundControl.videoManager.hasVideo && !QGroundControl.videoManager.fullScreen &&
124 (videoControl.pipState.state === videoControl.pipState.pipState ||
125 (_mapControl && _mapControl.pipState.state === _mapControl.pipState.pipState))
126 z: QGroundControl.zOrderWidgets
131 objectName: "flyViewWidgetLayer"
132 anchors.top: parent.top
133 anchors.bottom: parent.bottom
134 anchors.left: parent.left
135 anchors.right: guidedValueSlider.visible ? guidedValueSlider.left : parent.right
136 anchors.margins: _widgetMargin
137 anchors.topMargin: toolbar.height + _widgetMargin
138 z: _fullItemZorder + 2
139 pipViewRect: _pipView.visible ? Qt.rect(_pipView.x + _pipView.occupiedRect.x - x, _pipView.y + _pipView.occupiedRect.y - y, _pipView.occupiedRect.width, _pipView.occupiedRect.height) : Qt.rect(0, height, 0, 0)
140 mapControl: _mapControl
141 viewer3DCameraController: viewer3DLoader.item ? viewer3DLoader.item.cameraController : null
142 visible: !QGroundControl.videoManager.fullScreen
147 anchors.fill: widgetLayer
148 z: _fullItemZorder + 2
149 occluders: _layerOccluders
150 mapControl: _mapControl
151 visible: !QGroundControl.videoManager.fullScreen
154 // Development tool for visualizing the occluders, show if needed
155 FlyViewOccluderViewer {
157 anchors.fill: widgetLayer
159 occluders: _layerOccluders
160 customOccluders: customOverlay.customOccluders
164 GuidedActionsController {
165 id: guidedActionsController
166 missionController: _missionController
167 guidedValueSlider: _guidedValueSlider
170 //-- Guided value slider (e.g. altitude)
172 id: guidedValueSlider
173 objectName: "guidedValueSlider"
174 anchors.right: parent.right
175 anchors.top: parent.top
176 anchors.bottom: parent.bottom
177 anchors.topMargin: toolbar.height
178 z: QGroundControl.zOrderTopMost
190 target: QGCViewer3DManager
191 function onDisplayModeChanged() {
192 if (QGCViewer3DManager.displayMode === QGCViewer3DManager.View3D) {
193 if (!viewer3DLoader.item) {
194 viewer3DLoader.setSource("qrc:/qml/QGroundControl/Viewer3D/Models3D/Viewer3DModel.qml")
196 } else if (!_keepSceneAlive) {
197 viewer3DLoader.source = ""
205 guidedValueSlider: _guidedValueSlider
206 visible: !QGroundControl.videoManager.fullScreen