Skip to content

Commit

Permalink
Viewer3DSettingsMenu is changed to Viewer3DSettingsDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
omid-esrafilian committed Feb 22, 2024
1 parent 5d1421f commit 421464a
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 74 deletions.
2 changes: 1 addition & 1 deletion qgroundcontrol.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
<file alias="VTOLLandingPatternEditor.qml">src/PlanView/VTOLLandingPatternEditor.qml</file>
<file alias="QGroundControl/Controls/MockLinkOptionsDlg.qml">src/comm/MockLinkOptionsDlg.qml</file>
<file alias="QGroundControl/FlightDisplay/FlyViewInsetViewer.qml">src/FlightDisplay/FlyViewInsetViewer.qml</file>
<file alias="Viewer3D/Viewer3DSettingMenu.qml">src/Viewer3D/Viewer3D/Viewer3DSettingMenu.qml</file>
<file alias="Viewer3D/Viewer3DSettingsDialog.qml">src/Viewer3D/Viewer3D/Viewer3DSettingsDialog.qml</file>
<file alias="Viewer3D/Viewer3D.qml">src/Viewer3D/Viewer3D/Viewer3D.qml</file>
<file alias="Viewer3D/qmldir">src/Viewer3D/Viewer3D/qmldir</file>
<file alias="Viewer3D/Models3D/CameraLightModel.qml">src/Viewer3D/Viewer3D/Models3D/CameraLightModel.qml</file>
Expand Down
4 changes: 2 additions & 2 deletions src/FlightDisplay/FlyViewToolStripActionList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ToolStripActionList {
iconSource = "/qmlimages/Viewer3D/City3DMapIcon.svg"
text = qsTr("3D View")
city_map_setting_icon.enabled = false
viewer3DWindow.settingMenuOpen = false
viewer3DWindow.settingsDialogOpen = false
city_map_setting_icon.checked = false
}
},
Expand All @@ -66,7 +66,7 @@ ToolStripActionList {
enabled: false
visible: enabled
onTriggered:{
viewer3DWindow.settingMenuOpen = !viewer3DWindow.settingMenuOpen
viewer3DWindow.settingsDialogOpen = !viewer3DWindow.settingsDialogOpen
}
},
PreFlightCheckListShowAction { onTriggered: displayPreFlightChecklist() },
Expand Down
1 change: 1 addition & 0 deletions src/Viewer3D/Viewer3D/Models3D/CameraLightModel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Node {
PerspectiveCamera {

id: cameraPerspectiveOne
clipFar: 100000

eulerRotation{
x: -90
Expand Down
39 changes: 13 additions & 26 deletions src/Viewer3D/Viewer3D/Viewer3D.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import QGroundControl.Palette
import QGroundControl.ScreenTools
import QGroundControl.Controls

// 3D Viewer modules
import QGroundControl.Viewer3D
import Viewer3D.Models3D


/// @author Omid Esrafilian <[email protected]>

Item{
id: viewer3DBody
property bool viewer3DOpen: false
property bool settingMenuOpen: false
property bool settingsDialogOpen: false

Component{
id: viewer3DManagerComponent
Expand Down Expand Up @@ -58,36 +59,22 @@ Item{
}
}

onSettingMenuOpenChanged:{
if(settingMenuOpen === true){
settingMenuComponent.createObject(mainWindow).open()
onSettingsDialogOpenChanged:{
if(settingsDialogOpen === true){
settingsDialogComponent.createObject(mainWindow).open()
}
}

Component {
id: settingMenuComponent

QGCPopupDialog{
id: settingMenuDialog
title: qsTr("3D view settings")
buttons: Dialog.Ok | Dialog.Cancel
id: settingsDialogComponent

Viewer3DSettingMenu{
id: viewer3DSettingMenu
viewer3DManager: view3DManagerLoader.item
visible: true
}

onRejected: {
settingMenuOpen = false
viewer3DSettingMenu.menuClosed(false)
settingMenuDialog.close()
}
Viewer3DSettingsDialog{
id: view3DSettingsDialog
viewer3DManager: view3DManagerLoader.item
visible: true

onAccepted: {
settingMenuOpen = false
viewer3DSettingMenu.menuClosed(true)
settingMenuDialog.close()
onClosed:{
settingsDialogOpen = false
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,24 @@ import QGroundControl.Palette
import QGroundControl.ScreenTools
import QGroundControl.Controls

import QGroundControl.Viewer3D

/// @author Omid Esrafilian <[email protected]>

Flickable {
QGCPopupDialog{
property var viewer3DManager: null

signal menuClosed(bool accept)
title: qsTr("3D view settings")
buttons: Dialog.Ok | Dialog.Cancel

property var viewer3DManager: null
property int leftMarginSpace: ScreenTools.defaultFontPixelWidth

id: window_body
clip: true
visible: true
width: Screen.width * 0.25
height: Screen.height * 0.2
contentWidth: width;
contentHeight: main_column.height
boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar {}

Column {
id: main_column
anchors{
right: parent.right
left: parent.left
margins: ScreenTools.defaultFontPixelWidth
}
spacing: ScreenTools.defaultFontPixelHeight * 0.5
ColumnLayout {
property int leftMarginSpace: ScreenTools.defaultFontPixelWidth

id: window_body
clip: true
visible: true
spacing: ScreenTools.defaultFontPixelHeight / 2
RowLayout{
anchors{
right: parent.right
left: parent.left
}
Layout.fillWidth: true
QGCLabel {
wrapMode: Text.WordWrap
visible: true
Expand All @@ -55,19 +38,19 @@ Flickable {
showUnits: false
visible: true
Layout.fillWidth: true
implicitWidth: ScreenTools.defaultFontPixelWidth * 50


readOnly: true

text: (viewer3DManager)?(viewer3DManager.viewer3DSetting.osmFilePath.rawValue):("nan")
}
}
RowLayout{
anchors{
right: parent.right
left: parent.left
}
Layout.alignment: Qt.AlignRight

QGCButton {
id: map_file_btn
Layout.alignment: Qt.AlignRight

visible: true
text: qsTr("Select File")
Expand All @@ -89,15 +72,14 @@ Flickable {
}

GridLayout{
anchors{
left: parent.left
}
columns: 2
columnSpacing: ScreenTools.defaultFontPixelHeight
rowSpacing: ScreenTools.defaultFontPixelWidth
Layout.fillWidth: true

QGCLabel {
wrapMode: Text.WordWrap
Layout.fillWidth: true
text: qsTr("Average Building Level Height:")
}

Expand All @@ -124,6 +106,7 @@ Flickable {
QGCLabel {
wrapMode: Text.WordWrap
visible: true
Layout.fillWidth: true
text: qsTr("Vehicles Altitude Bias:")
}

Expand All @@ -149,16 +132,14 @@ Flickable {
}
}

onMenuClosed: function (accept){
if(accept === true){
viewer3DManager.qmlBackend.osmFilePath = map_file_text_feild.text
viewer3DManager.qmlBackend.altitudeBias = parseFloat(height_bias_textfeild.text)
onAccepted: {
viewer3DManager.qmlBackend.osmFilePath = map_file_text_feild.text
viewer3DManager.qmlBackend.altitudeBias = parseFloat(height_bias_textfeild.text)

viewer3DManager.viewer3DSetting.osmFilePath.rawValue = map_file_text_feild.text
viewer3DManager.viewer3DSetting.buildingLevelHeight.rawValue = parseFloat(bld_level_height_textfeild.text)
viewer3DManager.viewer3DSetting.altitudeBias.rawValue = parseFloat(height_bias_textfeild.text)
viewer3DManager.viewer3DSetting.osmFilePath.rawValue = map_file_text_feild.text
viewer3DManager.viewer3DSetting.buildingLevelHeight.rawValue = parseFloat(bld_level_height_textfeild.text)
viewer3DManager.viewer3DSetting.altitudeBias.rawValue = parseFloat(height_bias_textfeild.text)

viewer3DManager.osmParser.buildingLevelHeight = parseFloat(bld_level_height_textfeild.text)
}
viewer3DManager.osmParser.buildingLevelHeight = parseFloat(bld_level_height_textfeild.text)
}
}

0 comments on commit 421464a

Please sign in to comment.