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