1/****************************************************************************
3 * (c) 2009-2024 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
5 * QGroundControl is licensed according to the terms in the file
6 * COPYING.md in the root of the source code directory.
8 ****************************************************************************/
13import QGroundControl.Controls
14import QGroundControl.GeoMap
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.
23 required property var geoMap
25 // UI tests look chrome items up by objectName
26 property string objectNamePrefix: "flyViewGeoMap"
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
33 readonly property bool _debugUIEnabled: QGroundControl.settingsManager.flyViewSettings.geoMapDebugUI.rawValue
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)
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
51 objectName: root.objectNamePrefix + "DebugOverlay"
52 anchors.centerIn: parent
53 font.family: ScreenTools.fixedFontFamily
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 : "")
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
71 // Diagnostic: report holes, terrain cliffs, and bad height
72 // data to the debug output
74 objectName: root.objectNamePrefix + "AnalyzeButton"
76 onClicked: root.geoMap.analyzeSurface()
79 // Render-statistics overlay toggle (perf diagnostics)
81 objectName: root.objectNamePrefix + "StatsButton"
83 onClicked: root.geoMap.renderStats = !root.geoMap.renderStats
86 // Perf capture: records per-second counters; the CSV path
87 // shows in the debug overlay when stopped
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()