Ref T683, settings for "record gnd.elevation" (based on own aircraft)

This commit is contained in:
Klaus Basan
2019-06-12 02:07:33 +02:00
parent 1a9ec78bb3
commit 17ef62dd3e
4 changed files with 186 additions and 115 deletions

View File

@@ -128,6 +128,7 @@ namespace BlackGui
// record GND // record GND
ui->pb_ApplyRecordOwnAircraftGnd->setEnabled(m_pluginLoaded); ui->pb_ApplyRecordOwnAircraftGnd->setEnabled(m_pluginLoaded);
ui->cb_RecordOwnGndPositions->setEnabled(m_pluginLoaded); ui->cb_RecordOwnGndPositions->setEnabled(m_pluginLoaded);
ui->le_RecordOwnGndPositionsRadius->setEnabled(m_pluginLoaded);
// led // led
ui->led_RestrictedRendering->setOn(m_pluginLoaded ? setup.isRenderingRestricted() : false); ui->led_RestrictedRendering->setOn(m_pluginLoaded ? setup.isRenderingRestricted() : false);
@@ -157,6 +158,10 @@ namespace BlackGui
// CG // CG
ui->comp_CGSourceSelector->setValue(settings); ui->comp_CGSourceSelector->setValue(settings);
// record
ui->le_RecordOwnGndPositionsRadius->setText(settings.getRecordedGndRadius().valueRoundedWithUnit(CLengthUnit::m(), 1, false, true));
ui->cb_RecordOwnGndPositions->setChecked(settings.isRecordOwnAircraftGnd());
// rendering // rendering
const int maxAircraft = setup.getMaxRenderedAircraft(); const int maxAircraft = setup.getMaxRenderedAircraft();
ui->le_MaxAircraft->setText(setup.isMaxAircraftRestricted() ? QString::number(maxAircraft) : ""); ui->le_MaxAircraft->setText(setup.isMaxAircraftRestricted() ? QString::number(maxAircraft) : "");
@@ -291,7 +296,7 @@ namespace BlackGui
} }
} }
CSimulatorSettings CSettingsSimulatorComponent::getSimulatorSettings(bool &ok) CSimulatorSettings CSettingsSimulatorComponent::getSimulatorSettings(bool &ok)
{ {
ok = false; ok = false;
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return {}; } if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return {}; }
@@ -331,9 +336,14 @@ namespace BlackGui
void CSettingsSimulatorComponent::onApplyRecordGnd() void CSettingsSimulatorComponent::onApplyRecordGnd()
{ {
bool ok = false; bool ok = false;
CSimulatorSettings settings = getSimulatorSettings(ok); CSimulatorSettings settings = this->getSimulatorSettings(ok);
if (!ok || !settings.setRecordOwnAircraftGnd(ui->cb_RecordOwnGndPositions->isChecked())) { return; } if (!ok) { return; }
setSimulatorSettings(settings); CLength radius;
radius.parseFromString(ui->le_RecordOwnGndPositionsRadius->text());
const bool c1 = settings.setRecordOwnAircraftGnd(ui->cb_RecordOwnGndPositions->isChecked());
const bool c2 = settings.setRecordedGndRadius(radius);
if (!c1 && !c2) { return; }
this->setSimulatorSettings(settings);
} }
void CSettingsSimulatorComponent::clearRestricedRendering() void CSettingsSimulatorComponent::clearRestricedRendering()

View File

@@ -6,14 +6,14 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>352</width> <width>368</width>
<height>343</height> <height>281</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Simulator settings</string> <string>Simulator settings</string>
</property> </property>
<layout class="QGridLayout" name="gl_SettingsSimulator" columnstretch="0,0,0"> <layout class="QGridLayout" name="gl_SettingsSimulator" columnstretch="0,1,0">
<property name="leftMargin"> <property name="leftMargin">
<number>2</number> <number>2</number>
</property> </property>
@@ -69,11 +69,11 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>346</width> <width>362</width>
<height>269</height> <height>207</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gl_SimulatorSettings" columnstretch="0,10,3"> <layout class="QGridLayout" name="gl_SimulatorSettings" columnstretch="0,0,0">
<property name="leftMargin"> <property name="leftMargin">
<number>4</number> <number>4</number>
</property> </property>
@@ -86,10 +86,13 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>4</number> <number>4</number>
</property> </property>
<item row="7" column="2"> <item row="4" column="2">
<widget class="QPushButton" name="pb_ApplyMaxDistance"> <widget class="QPushButton" name="pb_DisableRendering">
<property name="toolTip">
<string>disable all rendering</string>
</property>
<property name="text"> <property name="text">
<string>apply</string> <string>dis.</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -100,29 +103,26 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="7" column="2">
<widget class="QPushButton" name="pb_ApplyCGSource"> <widget class="QPushButton" name="pb_ApplyMaxDistance">
<property name="text"> <property name="text">
<string>apply</string> <string>apply</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="2"> <item row="7" column="1">
<widget class="QPushButton" name="pb_ApplyMaxAircraft"> <layout class="QHBoxLayout" name="hl_MaxDistance">
<property name="text"> <property name="spacing">
<string>apply</string> <number>4</number>
</property> </property>
</widget> <item>
</item> <widget class="QLineEdit" name="le_MaxDistance">
<item row="4" column="1"> <property name="placeholderText">
<widget class="BlackGui::CLedWidget" name="led_RenderingEnabled" native="true"> <string>no restrictions</string>
<property name="minimumSize"> </property>
<size> </widget>
<width>10</width> </item>
<height>0</height> </layout>
</size>
</property>
</widget>
</item> </item>
<item row="5" column="0"> <item row="5" column="0">
<widget class="QLabel" name="lbl_RestrictedRendering"> <widget class="QLabel" name="lbl_RestrictedRendering">
@@ -137,50 +137,12 @@
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="lbl_RecordOwnGndPositions"> <widget class="QLabel" name="lbl_RecordOwnGndPositions">
<property name="text"> <property name="text">
<string>Record gnd.</string> <string>Record gnd.pos.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0"> <item row="6" column="2">
<widget class="QLabel" name="lbl_MaxDistance"> <widget class="QPushButton" name="pb_ApplyMaxAircraft">
<property name="text">
<string>Max.dist.(NM)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="BlackGui::Components::CCGSourceSelector" name="comp_CGSourceSelector"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_CGSource">
<property name="text">
<string>CG (vert offset):</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="cb_RecordOwnGndPositions">
<property name="text">
<string>record own gnd positions</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pb_DisableRendering">
<property name="text">
<string>disable</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="cb_ComSync">
<property name="text">
<string>use COM sync.</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pb_ApplyComSync">
<property name="text"> <property name="text">
<string>apply</string> <string>apply</string>
</property> </property>
@@ -252,23 +214,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="5" column="2">
<widget class="QPushButton" name="pb_ClearRestrictedRendering">
<property name="text">
<string>clear</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_TimeSync">
<property name="toolTip">
<string>Time synchronization</string>
</property>
<property name="text">
<string>Time synch.</string>
</property>
</widget>
</item>
<item row="5" column="1"> <item row="5" column="1">
<layout class="QHBoxLayout" name="hl_RestrictedRendering"> <layout class="QHBoxLayout" name="hl_RestrictedRendering">
<property name="spacing"> <property name="spacing">
@@ -286,6 +231,38 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="1">
<widget class="QWidget" name="wi_RecordOwnGndPositions" native="true">
<layout class="QHBoxLayout" name="hl_RecordOwnGndPositions">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="cb_RecordOwnGndPositions">
<property name="text">
<string>record pos.radius</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="le_RecordOwnGndPositionsRadius">
<property name="placeholderText">
<string>e.g. 250m</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0"> <item row="6" column="0">
<widget class="QLabel" name="lbl_MaxAircraft"> <widget class="QLabel" name="lbl_MaxAircraft">
<property name="text"> <property name="text">
@@ -293,30 +270,51 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="0" column="0">
<widget class="QLabel" name="lbl_ComSync"> <widget class="QLabel" name="lbl_TimeSync">
<property name="toolTip"> <property name="toolTip">
<string>Synchronize COM unit with simulator</string> <string>Time synchronization</string>
</property> </property>
<property name="text"> <property name="text">
<string>COM synch.</string> <string>Time synch.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item row="2" column="2">
<widget class="QPushButton" name="pb_ApplyRecordOwnAircraftGnd"> <widget class="QPushButton" name="pb_ApplyComSync">
<property name="text"> <property name="text">
<string>apply</string> <string>apply</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="4" column="1">
<widget class="QLabel" name="lbl_RenderingEnabled"> <widget class="BlackGui::CLedWidget" name="led_RenderingEnabled" native="true">
<property name="toolTip"> <property name="minimumSize">
<string>Rendering enabled</string> <size>
<width>10</width>
<height>0</height>
</size>
</property> </property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pb_ApplyCGSource">
<property name="text"> <property name="text">
<string>Rendering enabled</string> <string>apply</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="pb_ClearRestrictedRendering">
<property name="text">
<string>clear</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="lbl_MaxDistance">
<property name="text">
<string>Max.dist.(NM)</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -334,19 +332,49 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="7" column="1"> <item row="3" column="2">
<layout class="QHBoxLayout" name="hl_MaxDistance"> <widget class="QPushButton" name="pb_ApplyRecordOwnAircraftGnd">
<property name="spacing"> <property name="text">
<number>4</number> <string>apply</string>
</property> </property>
<item> </widget>
<widget class="QLineEdit" name="le_MaxDistance"> </item>
<property name="placeholderText"> <item row="2" column="1">
<string>no restrictions</string> <widget class="QCheckBox" name="cb_ComSync">
</property> <property name="text">
</widget> <string>use COM sync.</string>
</item> </property>
</layout> </widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lbl_RenderingEnabled">
<property name="toolTip">
<string>Rendering enabled</string>
</property>
<property name="text">
<string>Rendering enabled</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_CGSource">
<property name="text">
<string>CG (vert offset):</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="BlackGui::Components::CCGSourceSelector" name="comp_CGSourceSelector"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbl_ComSync">
<property name="toolTip">
<string>Synchronize COM unit with simulator</string>
</property>
<property name="text">
<string>COM synch.</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -375,10 +403,23 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>pb_Check</tabstop>
<tabstop>sa_Settings</tabstop>
<tabstop>cb_TimeSync</tabstop> <tabstop>cb_TimeSync</tabstop>
<tabstop>le_TimeSyncOffset</tabstop> <tabstop>le_TimeSyncOffset</tabstop>
<tabstop>pb_ApplyTimeSync</tabstop>
<tabstop>pb_ApplyCGSource</tabstop>
<tabstop>cb_ComSync</tabstop>
<tabstop>pb_ApplyComSync</tabstop>
<tabstop>cb_RecordOwnGndPositions</tabstop>
<tabstop>le_RecordOwnGndPositionsRadius</tabstop>
<tabstop>pb_ApplyRecordOwnAircraftGnd</tabstop>
<tabstop>pb_DisableRendering</tabstop>
<tabstop>pb_ClearRestrictedRendering</tabstop>
<tabstop>le_MaxAircraft</tabstop> <tabstop>le_MaxAircraft</tabstop>
<tabstop>pb_ApplyMaxAircraft</tabstop>
<tabstop>le_MaxDistance</tabstop> <tabstop>le_MaxDistance</tabstop>
<tabstop>pb_ApplyMaxDistance</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>

View File

@@ -125,6 +125,13 @@ namespace BlackMisc
return true; return true;
} }
bool CSimulatorSettings::setRecordedGndRadius(CLength &radius)
{
if (radius == m_recordedGndRadius) { return false; }
m_recordedGndRadius = radius;
return true;
}
void CSimulatorSettings::resetPaths() void CSimulatorSettings::resetPaths()
{ {
m_excludeDirectoryPatterns.clear(); m_excludeDirectoryPatterns.clear();
@@ -159,6 +166,7 @@ namespace BlackMisc
case IndexComIntegration: return CVariant::fromValue(m_comIntegration); case IndexComIntegration: return CVariant::fromValue(m_comIntegration);
case IndexRecordOwnAircraftGnd: return CVariant::fromValue(m_recordGnd); case IndexRecordOwnAircraftGnd: return CVariant::fromValue(m_recordGnd);
case IndexCGSource: return CVariant::fromValue(m_cgSource); case IndexCGSource: return CVariant::fromValue(m_cgSource);
case IndexRecordOwnAircraftGndRadius: return m_recordedGndRadius.propertyByIndex(index.copyFrontRemoved());
default: return CValueObject::propertyByIndex(index); default: return CValueObject::propertyByIndex(index);
} }
} }
@@ -174,7 +182,8 @@ namespace BlackMisc
case IndexModelExcludeDirectoryPatterns: m_excludeDirectoryPatterns = variant.value<QStringList>(); break; case IndexModelExcludeDirectoryPatterns: m_excludeDirectoryPatterns = variant.value<QStringList>(); break;
case IndexComIntegration: this->setComIntegrated(variant.toBool()); break; case IndexComIntegration: this->setComIntegrated(variant.toBool()); break;
case IndexRecordOwnAircraftGnd: this->setRecordOwnAircraftGnd(variant.toBool()); break; case IndexRecordOwnAircraftGnd: this->setRecordOwnAircraftGnd(variant.toBool()); break;
case IndexCGSource: m_cgSource = variant.toInt(); break; case IndexCGSource: m_cgSource = variant.toInt(); break;
case IndexRecordOwnAircraftGndRadius: m_recordedGndRadius.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
default: CValueObject::setPropertyByIndex(index, variant); break; default: CValueObject::setPropertyByIndex(index, variant); break;
} }
} }

View File

@@ -15,10 +15,11 @@
#include "blackmisc/simulation/simulatorinfo.h" #include "blackmisc/simulation/simulatorinfo.h"
#include "blackmisc/network/textmessage.h" #include "blackmisc/network/textmessage.h"
#include "blackmisc/weather/weatherscenario.h" #include "blackmisc/weather/weatherscenario.h"
#include "blackmisc/pq/length.h"
#include "blackmisc/settingscache.h" #include "blackmisc/settingscache.h"
#include "blackmisc/statusmessage.h" #include "blackmisc/statusmessage.h"
#include "blackmisc/blackmiscexport.h"
#include "blackmisc/propertyindex.h" #include "blackmisc/propertyindex.h"
#include "blackmisc/blackmiscexport.h"
#include <QStringList> #include <QStringList>
#include <QObject> #include <QObject>
@@ -41,8 +42,9 @@ namespace BlackMisc
IndexModelDirectories, IndexModelDirectories,
IndexModelExcludeDirectoryPatterns, IndexModelExcludeDirectoryPatterns,
IndexComIntegration, //!< COM unit integration IndexComIntegration, //!< COM unit integration
IndexCGSource,
IndexRecordOwnAircraftGnd, IndexRecordOwnAircraftGnd,
IndexCGSource IndexRecordOwnAircraftGndRadius
}; };
//! Where we get the CG (aka vertical offset) from //! Where we get the CG (aka vertical offset) from
@@ -117,6 +119,12 @@ namespace BlackMisc
//! Record GND values (of own aircraft) //! Record GND values (of own aircraft)
bool setRecordOwnAircraftGnd(bool record); bool setRecordOwnAircraftGnd(bool record);
//! Record GND values with radius
BlackMisc::PhysicalQuantities::CLength getRecordedGndRadius() const { return m_recordedGndRadius; }
//! Record GND values with radius
bool setRecordedGndRadius(BlackMisc::PhysicalQuantities::CLength &radius);
//! Reset the paths //! Reset the paths
void resetPaths(); void resetPaths();
@@ -139,13 +147,16 @@ namespace BlackMisc
bool m_comIntegration = false; //!< COM integration bool m_comIntegration = false; //!< COM integration
bool m_recordGnd = false; //!< Record GND values (of own aircraft) bool m_recordGnd = false; //!< Record GND values (of own aircraft)
int m_cgSource = static_cast<int>(CGFromSimulatorFirst); //!< CG source int m_cgSource = static_cast<int>(CGFromSimulatorFirst); //!< CG source
PhysicalQuantities::CLength m_recordedGndRadius { 250.0, PhysicalQuantities::CLengthUnit::m() };
BLACK_METACLASS( BLACK_METACLASS(
CSimulatorSettings, CSimulatorSettings,
BLACK_METAMEMBER(simulatorDirectory), BLACK_METAMEMBER(simulatorDirectory),
BLACK_METAMEMBER(modelDirectories), BLACK_METAMEMBER(modelDirectories),
BLACK_METAMEMBER(excludeDirectoryPatterns), BLACK_METAMEMBER(excludeDirectoryPatterns),
BLACK_METAMEMBER(comIntegration) BLACK_METAMEMBER(comIntegration),
BLACK_METAMEMBER(recordGnd),
BLACK_METAMEMBER(recordedGndRadius)
); );
}; };