QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
FlyViewGeo.qml
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * (c) 2009-2024 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 *
5 * QGroundControl is licensed according to the terms in the file
6 * COPYING.md in the root of the source code directory.
7 *
8 ****************************************************************************/
9
10import QtQuick
11
12import QGroundControl
13import QGroundControl.Controls
14import QGroundControl.GeoMap
15
16/// Experimental 2D/3D map view (preview feature): the GeoMap-engine
17/// counterpart of FlyView. View chrome around a FlyViewGeoMap.
18Item {
19 id: root
20
21 QGCPalette { id: qgcPal }
22
23 Rectangle {
24 id: toolbar
25 anchors.left: parent.left
26 anchors.right: parent.right
27 anchors.top: parent.top
28 height: ScreenTools.toolbarHeight
29 color: qgcPal.toolbarBackground
30
31 QGCToolBarButton {
32 objectName: "toolbar_qgcLogo"
33 height: parent.height
34 icon.source: "/res/QGCLogoFull.svg"
35 logo: true
36 onClicked: mainWindow.showToolSelectDialog()
37 }
38
39 QGCLabel {
40 anchors.centerIn: parent
41 text: qsTr("GeoView (preview)")
42 font.pointSize: ScreenTools.largeFontPointSize
43 }
44 }
45
46 // The 3D scene only exists while this is the active view: View3D
47 // costs RHI/scene-graph resources even when hidden.
48 Loader {
49 id: sceneLoader
50 anchors.left: parent.left
51 anchors.right: parent.right
52 anchors.top: toolbar.bottom
53 anchors.bottom: parent.bottom
54 active: root.visible
55 sourceComponent: Item {
56 FlyViewGeoMap {
57 id: geoMap
58 anchors.fill: parent
59 }
60
61 // Bottom-left overlay: dataset attribution (required by the terrain
62 // tiles' terms) plus live SurfaceModel stats for manual verification;
63 // last line adds the perf counters while Stats is on
64 Rectangle {
65 anchors.left: parent.left
66 anchors.bottom: parent.bottom
67 anchors.margins: ScreenTools.defaultFontPixelWidth / 2
68 width: debugOverlayLabel.implicitWidth + ScreenTools.defaultFontPixelWidth
69 height: debugOverlayLabel.implicitHeight + ScreenTools.defaultFontPixelWidth
70 radius: ScreenTools.defaultFontPixelWidth / 2
71 color: Qt.rgba(0, 0, 0, 0.5)
72
73 QGCLabel {
74 id: debugOverlayLabel
75 objectName: "flyViewGeoDebugOverlay"
76 anchors.centerIn: parent
77 font.family: ScreenTools.fixedFontFamily
78 color: "white"
79 text: qsTr("Terrain: Mapzen/Tilezen Terrain Tiles — SRTM (NASA), 3DEP (USGS), GMTED2010, ETOPO1 (NOAA)")
80 + "\n" + qsTr("patches: %1 pending: %2 max zoom: %3")
81 .arg(geoMap.patchCount)
82 .arg(geoMap.pendingCount)
83 .arg(geoMap.maxZoomLevel)
84 + (geoMap.modelStats !== "" ? "\n" + geoMap.modelStats : "")
85 }
86 }
87
88 Column {
89 anchors.right: parent.right
90 anchors.top: parent.top
91 anchors.margins: ScreenTools.defaultFontPixelWidth
92 spacing: ScreenTools.defaultFontPixelHeight / 2
93
94 // 2D<->3D mode switch: the mode flips immediately (2D locks tilt
95 // gestures); GeoMap's mode-change handler animates tilt and terrain
96 QGCButton {
97 objectName: "flyViewGeoModeButton"
98 text: geoMap.camera.mode === GeoMapCamera.Mode2D ? qsTr("3D") : qsTr("2D")
99 onClicked: geoMap.camera.mode = (geoMap.camera.mode === GeoMapCamera.Mode2D)
100 ? GeoMapCamera.Mode3D : GeoMapCamera.Mode2D
101 }
102
103 // Compass: needle tracks heading, click animates back to north-up
104 QGCButton {
105 objectName: "flyViewGeoCompassButton"
106 text: qsTr("N")
107 rotation: -geoMap.camera.heading
108 onClicked: geoMap.animateHeadingToNorth()
109 }
110
111 // Diagnostic: report holes, terrain cliffs, and bad height
112 // data to the debug output
113 QGCButton {
114 objectName: "flyViewGeoAnalyzeButton"
115 text: qsTr("Analyze")
116 onClicked: geoMap.analyzeSurface()
117 }
118
119 // Render-statistics overlay toggle (perf diagnostics)
120 QGCButton {
121 objectName: "flyViewGeoStatsButton"
122 text: qsTr("Stats")
123 onClicked: geoMap.renderStats = !geoMap.renderStats
124 }
125
126 // Perf capture: records per-second counters; the CSV path
127 // shows in the debug overlay when stopped
128 QGCButton {
129 objectName: "flyViewGeoRecordButton"
130 text: geoMap.perfCapturing ? qsTr("Stop") : qsTr("Record")
131 onClicked: geoMap.perfCapturing ? geoMap.stopPerfCapture() : geoMap.startPerfCapture()
132 }
133 }
134 }
135 }
136}