QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
Viewer3DSettings.qml
Go to the documentation of this file.
1import QGroundControl
2import QGroundControl.AppSettings
3import QGroundControl.Controls
4import QGroundControl.FactControls
5import QtQuick
6import QtQuick.Layouts
7
8SettingsPage {
9 property Fact _viewer3DAltitudeBias: _viewer3DSettings.altitudeBias
10 property Fact _viewer3DBuildingLevelHeight: _viewer3DSettings.buildingLevelHeight
11 property Fact _viewer3DEnabled: _viewer3DSettings.enabled
12 property Fact _viewer3DMapProvider: _viewer3DSettings.mapProvider
13 property Fact _viewer3DOsmFilePath: _viewer3DSettings.osmFilePath
14 property var _viewer3DSettings: QGroundControl.settingsManager.viewer3DSettings
15
16 SettingsGroupLayout {
17 Layout.fillWidth: true
18 heading: qsTr("3D View")
19
20 FactCheckBoxSlider {
21 Layout.fillWidth: true
22 fact: _viewer3DEnabled
23 text: qsTr("Enabled")
24 visible: _viewer3DEnabled.visible
25 }
26
27 LabelledFactComboBox {
28 Layout.fillWidth: true
29 enabled: _viewer3DEnabled.rawValue
30 fact: _viewer3DMapProvider
31 label: qsTr("Map Provider")
32 visible: _viewer3DMapProvider.visible
33 }
34
35 ColumnLayout {
36 Layout.fillWidth: true
37 enabled: _viewer3DEnabled.rawValue
38 spacing: ScreenTools.defaultFontPixelWidth
39 visible: _viewer3DMapProvider.rawValue === 0
40
41 RowLayout {
42 Layout.fillWidth: true
43 spacing: ScreenTools.defaultFontPixelWidth
44
45 QGCLabel {
46 text: qsTr("3D Map File:")
47 wrapMode: Text.WordWrap
48 }
49
50 QGCTextField {
51 id: osmFileTextField
52
53 Layout.fillWidth: true
54 height: ScreenTools.defaultFontPixelWidth * 4.5
55 readOnly: true
56 showUnits: false
57 text: _viewer3DOsmFilePath.rawValue
58 unitsLabel: ""
59 }
60 }
61
62 RowLayout {
63 Layout.alignment: Qt.AlignRight
64 spacing: ScreenTools.defaultFontPixelWidth
65
66 QGCButton {
67 text: qsTr("Clear")
68
69 onClicked: {
70 _viewer3DOsmFilePath.value = "";
71 }
72 }
73
74 QGCButton {
75 text: qsTr("Select File")
76
77 onClicked: {
78 var filename = _viewer3DOsmFilePath.rawValue;
79 const found = filename.match(/(.*)[\/\\]/);
80 if (found) {
81 filename = found[1] || ''; // extracting the directory from the file path
82 fileDialog.folder = (filename[0] === "/") ? (filename.slice(1)) : (filename);
83 }
84 fileDialog.openForLoad();
85 }
86
87 QGCFileDialog {
88 id: fileDialog
89
90 nameFilters: [qsTr("OpenStreetMap files (*.osm)")]
91 title: qsTr("Select map file")
92
93 onAcceptedForLoad: file => {
94 _viewer3DOsmFilePath.value = file;
95 }
96 }
97 }
98 }
99 }
100
101 LabelledFactTextField {
102 Layout.fillWidth: true
103 enabled: _viewer3DEnabled.rawValue
104 fact: _viewer3DBuildingLevelHeight
105 label: qsTr("Average Building Level Height")
106 visible: _viewer3DBuildingLevelHeight.visible
107 }
108
109 LabelledFactTextField {
110 Layout.fillWidth: true
111 enabled: _viewer3DEnabled.rawValue
112 fact: _viewer3DAltitudeBias
113 label: qsTr("Vehicles Altitude Bias")
114 visible: _viewer3DAltitudeBias.visible
115 }
116 }
117}