mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Ref T773, allow to set test elevation (from log.display)
This commit is contained in:
committed by
Mat Sutcliffe
parent
5f1bd14fcf
commit
60b556f118
@@ -233,6 +233,9 @@ namespace BlackCore
|
||||
//! Enable pseudo elevations (testing)
|
||||
void setTestEnablePseudoElevation(bool enable) { m_enablePseudoElevation = enable; }
|
||||
|
||||
//! Set an elevation for testing
|
||||
void setTestElevation(const BlackMisc::Aviation::CAltitude &altitude) { m_pseudoElevation = altitude; }
|
||||
|
||||
//! Debug function to check state after all aircraft have been removed
|
||||
//! \remarks only in local developer builds
|
||||
virtual BlackMisc::CStatusMessageList debugVerifyStateAfterAllAircraftRemoved() const;
|
||||
@@ -603,6 +606,7 @@ namespace BlackCore
|
||||
qint64 m_statsLastUpdateAircraftRequestedMs = 0; //!< when was the last aircraft update requested
|
||||
qint64 m_statsUpdateAircraftRequestedDeltaMs = 0; //!< delta time between 2 aircraft updates
|
||||
|
||||
BlackMisc::Aviation::CAltitude m_pseudoElevation { BlackMisc::Aviation::CAltitude::null() }; //!< pseudo elevation for testing purposes
|
||||
BlackMisc::Simulation::CSimulatorInternals m_simulatorInternals; //!< setup read from the sim
|
||||
BlackMisc::Simulation::CInterpolationLogger m_interpolationLogger; //!< log.interpolation
|
||||
BlackMisc::Simulation::CAutoPublishData m_autoPublishing; //!< for the DB
|
||||
|
||||
@@ -245,6 +245,19 @@ namespace BlackGui
|
||||
{
|
||||
if (!m_simulator) { return; }
|
||||
m_simulator->setTestEnablePseudoElevation(checked);
|
||||
|
||||
CAltitude elvTest = CAltitude::null();
|
||||
if (!ui->le_ElevationTestValue->text().isEmpty())
|
||||
{
|
||||
CLength l;
|
||||
const QString v = ui->le_ElevationTestValue->text();
|
||||
l.parseFromString(v);
|
||||
if (!l.isNull())
|
||||
{
|
||||
elvTest = CAltitude(l, CAltitude::MeanSeaLevel);
|
||||
}
|
||||
}
|
||||
m_simulator->setTestElevation(elvTest);
|
||||
}
|
||||
|
||||
void CInterpolationLogDisplay::toggleStartStop()
|
||||
|
||||
@@ -877,9 +877,16 @@
|
||||
<item row="1" column="1">
|
||||
<widget class="QListView" name="lv_ElevevationHistory"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QWidget" name="wi_ElvButtons" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_ElevationAtPosition">
|
||||
<property name="text">
|
||||
<string>Elevation:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hs_ElvButtons">
|
||||
<property name="orientation">
|
||||
@@ -895,6 +902,12 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_ElvClear">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>clear</string>
|
||||
</property>
|
||||
@@ -911,7 +924,7 @@
|
||||
<widget class="QLineEdit" name="le_ElvHistoryCount">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<width>75</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@@ -946,16 +959,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_ElevationTestValue">
|
||||
<property name="placeholderText">
|
||||
<string>elv. test value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_ElevationAtPosition">
|
||||
<property name="text">
|
||||
<string>Elevation for coordinates:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -215,17 +215,31 @@ namespace BlackSimPlugin
|
||||
if (hasRequested || !m_enablePseudoElevation) { return hasRequested; }
|
||||
|
||||
// For TESTING purposes ONLY
|
||||
// we could not request elevation
|
||||
// very crude 1st implementation
|
||||
const double elvRnd = CMathUtils::randomDouble(1000);
|
||||
const CAltitude alt(elvRnd, CLengthUnit::ft());
|
||||
// we could not request elevation, so we provide a random value or set value
|
||||
CElevationPlane elv(reference, CElevationPlane::singlePointRadius());
|
||||
elv.setGeodeticHeight(alt);
|
||||
if (m_pseudoElevation.isNull())
|
||||
{
|
||||
const double elvRnd = CMathUtils::randomDouble(1000);
|
||||
const CAltitude alt(elvRnd, CLengthUnit::ft());
|
||||
elv.setGeodeticHeight(alt);
|
||||
}
|
||||
else
|
||||
{
|
||||
elv.setGeodeticHeight(m_pseudoElevation);
|
||||
}
|
||||
|
||||
QPointer<CSimulatorEmulated> myself(this);
|
||||
QTimer::singleShot(444, this, [ = ]
|
||||
{
|
||||
if (!myself) { return; }
|
||||
|
||||
// update in simulator
|
||||
ISimulationEnvironmentProvider::rememberGroundElevation(callsign, elv); // in simulator
|
||||
|
||||
// and in remote aircraft for given callsign
|
||||
const int updated = CRemoteAircraftAware::updateAircraftGroundElevation(callsign, elv, CAircraftSituation::FromProvider);
|
||||
Q_UNUSED(updated)
|
||||
|
||||
emit myself->receivedRequestedElevation(elv, callsign);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user