QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
FlyViewGeoMapChrome.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/// View chrome for a FlyViewGeoMap: diagnostic buttons plus the terrain
17/// stats overlay, shown only when the GeoMap debug UI setting is on. Hosted
18/// by the Fly View GeoMap engine adapter; the 2D/3D and compass camera
19/// controls live in FlyViewGeoMapControls.
20Item {
21 id: root
22
23 required property var geoMap
24
25 // UI tests look chrome items up by objectName
26 property string objectNamePrefix: "flyViewGeoMap"
27
28 // Margins let the Fly View host push the chrome clear of its own widgets
29 property real buttonsTopMargin: ScreenTools.defaultFontPixelWidth
30 property real buttonsRightMargin: ScreenTools.defaultFontPixelWidth
31 property real overlayBottomMargin: ScreenTools.defaultFontPixelWidth / 2
32
33 readonly property bool _debugUIEnabled: QGroundControl.settingsManager.flyViewSettings.geoMapDebugUI.rawValue
34
35 // Bottom-left overlay: live SurfaceModel stats for manual verification;
36 // last line adds the perf counters while Stats is on. Terrain dataset
37 // attribution lives in the user guide (docs/en/qgc-user-guide/fly_view/geoview.md)
38 Rectangle {
39 anchors.left: parent.left
40 anchors.bottom: parent.bottom
41 anchors.leftMargin: ScreenTools.defaultFontPixelWidth / 2
42 anchors.bottomMargin: root.overlayBottomMargin
43 width: debugOverlayLabel.implicitWidth + ScreenTools.defaultFontPixelWidth
44 height: debugOverlayLabel.implicitHeight + ScreenTools.defaultFontPixelWidth
45 radius: ScreenTools.defaultFontPixelWidth / 2
46 color: Qt.rgba(0, 0, 0, 0.5)
47 visible: root._debugUIEnabled
48
49 QGCLabel {
50 id: debugOverlayLabel
51 objectName: root.objectNamePrefix + "DebugOverlay"
52 anchors.centerIn: parent
53 font.family: ScreenTools.fixedFontFamily
54 color: "white"
55 text: qsTr("patches: %1 pending: %2 max zoom: %3")
56 .arg(root.geoMap.patchCount)
57 .arg(root.geoMap.pendingCount)
58 .arg(root.geoMap.maxZoomLevel)
59 + (root.geoMap.modelStats !== "" ? "\n" + root.geoMap.modelStats : "")
60 }
61 }
62
63 Column {
64 anchors.right: parent.right
65 anchors.top: parent.top
66 anchors.topMargin: root.buttonsTopMargin
67 anchors.rightMargin: root.buttonsRightMargin
68 spacing: ScreenTools.defaultFontPixelHeight / 2
69 visible: root._debugUIEnabled
70
71 // Diagnostic: report holes, terrain cliffs, and bad height
72 // data to the debug output
73 QGCButton {
74 objectName: root.objectNamePrefix + "AnalyzeButton"
75 text: qsTr("Analyze")
76 onClicked: root.geoMap.analyzeSurface()
77 }
78
79 // Render-statistics overlay toggle (perf diagnostics)
80 QGCButton {
81 objectName: root.objectNamePrefix + "StatsButton"
82 text: qsTr("Stats")
83 onClicked: root.geoMap.renderStats = !root.geoMap.renderStats
84 }
85
86 // Perf capture: records per-second counters; the CSV path
87 // shows in the debug overlay when stopped
88 QGCButton {
89 objectName: root.objectNamePrefix + "RecordButton"
90 text: root.geoMap.perfCapturing ? qsTr("Stop") : qsTr("Record")
91 onClicked: root.geoMap.perfCapturing ? root.geoMap.stopPerfCapture() : root.geoMap.startPerfCapture()
92 }
93 }
94}