QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
FlyView.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Dialogs
4import QtQuick.Layouts
5
6import QtLocation
7import QtPositioning
8import QtQuick.Window
9import QtQml.Models
10
11import QGroundControl
12import QGroundControl.Controls
13import QGroundControl.FlyView
14import QGroundControl.FlightMap
15import QGroundControl.Viewer3D
16
17Item {
18 id: _root
19
20 readonly property bool _is3DMode: QGCViewer3DManager.displayMode === QGCViewer3DManager.View3D
21
22 // These should only be used by MainRootWindow
23 property var planController: _planController
24 property var guidedController: _guidedController
25
26 PlanMasterController {
27 id: _planController
28 flyView: true
29 Component.onCompleted: start()
30 }
31
32 property bool _mainWindowIsMap: mapControl.pipState.state === mapControl.pipState.fullState
33 property bool _isFullWindowItemDark: _mainWindowIsMap ? mapControl.isSatelliteMap : true
34 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
35 property var _missionController: _planController.missionController
36 property var _geoFenceController: _planController.geoFenceController
37 property var _rallyPointController: _planController.rallyPointController
38 property real _margins: ScreenTools.defaultFontPixelWidth / 2
39 property var _guidedController: guidedActionsController
40 property var _guidedValueSlider: guidedValueSlider
41 property var _widgetLayer: widgetLayer
42 property real _toolsMargin: ScreenTools.defaultFontPixelWidth * 0.75
43 property rect _centerViewport: Qt.rect(0, 0, width, height)
44 property real _rightPanelWidth: ScreenTools.defaultFontPixelWidth * 30
45 property var _mapControl: mapControl
46 property real _widgetMargin: ScreenTools.defaultFontPixelWidth * 0.75
47
48 property real _fullItemZorder: 0
49 property real _pipItemZorder: QGroundControl.zOrderWidgets
50
51 function _calcCenterViewPort() {
52 var newToolInset = Qt.rect(0, 0, width, height)
53 toolstrip.adjustToolInset(newToolInset)
54 }
55
56 function dropMainStatusIndicatorTool() {
57 toolbar.dropMainStatusIndicatorTool();
58 }
59
60 QGCToolInsets {
61 id: _toolInsets
62 topEdgeLeftInset: toolbar.height
63 topEdgeCenterInset: topEdgeLeftInset
64 topEdgeRightInset: topEdgeLeftInset
65 leftEdgeBottomInset: _pipView.leftEdgeBottomInset
66 bottomEdgeLeftInset: _pipView.bottomEdgeLeftInset
67 }
68
69 Item {
70 id: mapHolder
71 anchors.fill: parent
72
73 FlyViewMap {
74 id: mapControl
75 planMasterController: _planController
76 rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9
77 pipView: _pipView
78 pipMode: !_mainWindowIsMap
79 toolInsets: customOverlay.totalToolInsets
80 mapName: "FlightDisplayView"
81 enabled: !_is3DMode
82 visible: !_is3DMode
83 }
84
85 FlyViewVideo {
86 id: videoControl
87 pipView: _pipView
88 }
89
90 PipView {
91 id: _pipView
92 anchors.left: parent.left
93 anchors.bottom: parent.bottom
94 anchors.margins: _toolsMargin
95 item1IsFullSettingsKey: "MainFlyWindowIsMap"
96 item1: mapControl
97 item2: QGroundControl.videoManager.hasVideo ? videoControl : null
98 show: QGroundControl.videoManager.hasVideo && !QGroundControl.videoManager.fullScreen &&
99 (videoControl.pipState.state === videoControl.pipState.pipState || mapControl.pipState.state === mapControl.pipState.pipState)
100 z: QGroundControl.zOrderWidgets
101
102 property real leftEdgeBottomInset: visible ? width + anchors.margins : 0
103 property real bottomEdgeLeftInset: visible ? height + anchors.margins : 0
104 }
105
106 FlyViewWidgetLayer {
107 id: widgetLayer
108 anchors.top: parent.top
109 anchors.bottom: parent.bottom
110 anchors.left: parent.left
111 anchors.right: guidedValueSlider.visible ? guidedValueSlider.left : parent.right
112 anchors.margins: _widgetMargin
113 anchors.topMargin: toolbar.height + _widgetMargin
114 z: _fullItemZorder + 2
115 parentToolInsets: _toolInsets
116 mapControl: _mapControl
117 visible: !QGroundControl.videoManager.fullScreen
118 }
119
120 FlyViewCustomLayer {
121 id: customOverlay
122 anchors.fill: widgetLayer
123 z: _fullItemZorder + 2
124 parentToolInsets: widgetLayer.totalToolInsets
125 mapControl: _mapControl
126 visible: !QGroundControl.videoManager.fullScreen
127 }
128
129 // Development tool for visualizing the insets for a paticular layer, show if needed
130 FlyViewInsetViewer {
131 id: widgetLayerInsetViewer
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 z: widgetLayer.z + 1
137 insetsToView: widgetLayer.totalToolInsets
138 visible: false
139 }
140
141 GuidedActionsController {
142 id: guidedActionsController
143 missionController: _missionController
144 guidedValueSlider: _guidedValueSlider
145 }
146
147 //-- Guided value slider (e.g. altitude)
148 GuidedValueSlider {
149 id: guidedValueSlider
150 anchors.right: parent.right
151 anchors.top: parent.top
152 anchors.bottom: parent.bottom
153 anchors.topMargin: toolbar.height
154 z: QGroundControl.zOrderTopMost
155 visible: false
156 }
157
158 Loader {
159 id: viewer3DLoader
160 z: 1
161 anchors.fill: parent
162 active: _is3DMode
163
164 onActiveChanged: {
165 if (active) {
166 setSource("qrc:/qml/QGroundControl/Viewer3D/Models3D/Viewer3DModel.qml",
167)
168 }
169 }
170 }
171 }
172
173 FlyViewToolBar {
174 id: toolbar
175 guidedValueSlider: _guidedValueSlider
176 visible: !QGroundControl.videoManager.fullScreen
177 }
178}