mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #395, improved snapshot handling
* disabled sets distance and max.aircraft to 0 * fixed changed snapshot detection * added rendering enabled to signal, only one function to decide (instead of duplicated logic)
This commit is contained in:
@@ -64,10 +64,11 @@ namespace BlackCore
|
||||
return m_latestAircraftSnapshot;
|
||||
}
|
||||
|
||||
void CAirspaceAnalyzer::setSimulatorRenderRestrictionsChanged(bool restricted, int maxAircraft, const CLength &maxRenderedDistance, const CLength &maxRenderedBoundary)
|
||||
void CAirspaceAnalyzer::setSimulatorRenderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const CLength &maxRenderedDistance, const CLength &maxRenderedBoundary)
|
||||
{
|
||||
QWriteLocker l(&m_lockRestrictions);
|
||||
this->m_simulatorRenderedAircraftRestricted = restricted;
|
||||
this->m_simulatorRenderingEnabled = enabled;
|
||||
this->m_simulatorMaxRenderedAircraft = maxAircraft;
|
||||
this->m_simulatorMaxRenderedDistance = maxRenderedDistance;
|
||||
this->m_simulatorMaxRenderedBoundary = maxRenderedBoundary;
|
||||
@@ -177,33 +178,37 @@ namespace BlackCore
|
||||
Q_ASSERT_X(!isCurrentThreadApplicationThread(), Q_FUNC_INFO, "Expect to run in background thread");
|
||||
Q_ASSERT_X(!isApplicationThreadObjectThread(this), Q_FUNC_INFO, "Expect to run in background thread affinity");
|
||||
|
||||
bool restricted;
|
||||
bool restricted, enabled;
|
||||
int maxAircraft;
|
||||
CLength maxRenderedDistance, maxRenderedBoundary;
|
||||
{
|
||||
QReadLocker l(&m_lockRestrictions);
|
||||
restricted = this->m_simulatorRenderedAircraftRestricted;
|
||||
enabled = this->m_simulatorRenderingEnabled,
|
||||
maxAircraft = this->m_simulatorMaxRenderedAircraft;
|
||||
maxRenderedDistance = this->m_simulatorMaxRenderedDistance;
|
||||
maxRenderedBoundary = this->m_simulatorMaxRenderedBoundary;
|
||||
}
|
||||
|
||||
//! \todo Analyzer: generate only when restricted?
|
||||
//! \fixme Analyzer: generate only when restricted?
|
||||
|
||||
CSimulatedAircraftList aircraftInRange(getAircraftInRange()); // thread safe copy from provider
|
||||
CAirspaceAircraftSnapshot snapshot(
|
||||
aircraftInRange,
|
||||
restricted, maxAircraft, maxRenderedDistance, maxRenderedBoundary
|
||||
restricted, enabled,
|
||||
maxAircraft, maxRenderedDistance, maxRenderedBoundary
|
||||
);
|
||||
|
||||
// lock block
|
||||
{
|
||||
QWriteLocker l(&m_lockSnapshot);
|
||||
bool wasValid = m_latestAircraftSnapshot.isValidSnapshot();
|
||||
if (wasValid)
|
||||
{
|
||||
snapshot.setRestrictionChanged(m_latestAircraftSnapshot);
|
||||
}
|
||||
m_latestAircraftSnapshot = snapshot;
|
||||
|
||||
if (!wasValid) { return; } // ignore the 1st snapshot
|
||||
snapshot.setRestrictionChanged(m_latestAircraftSnapshot);
|
||||
}
|
||||
|
||||
emit airspaceAircraftSnapshot(snapshot);
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace BlackCore
|
||||
BlackMisc::Simulation::CAirspaceAircraftSnapshot getLatestAirspaceAircraftSnapshot() const;
|
||||
|
||||
//! Render restrictions in simulator
|
||||
void setSimulatorRenderRestrictionsChanged(bool restricted, int maxAircraft, const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance, const BlackMisc::PhysicalQuantities::CLength &maxRenderedBoundary);
|
||||
void setSimulatorRenderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance, const BlackMisc::PhysicalQuantities::CLength &maxRenderedBoundary);
|
||||
|
||||
//! Gracefully shut down, e.g. for thread safety
|
||||
void gracefulShutdown();
|
||||
@@ -102,7 +102,7 @@ namespace BlackCore
|
||||
//! Analyze the airspace
|
||||
void analyzeAirspace();
|
||||
|
||||
QTimer m_timer{this}; //!< multi purpose timer for snapshots and watchdog
|
||||
QTimer m_timer {this}; //!< multi purpose timer for snapshots and watchdog
|
||||
|
||||
// watchdog
|
||||
CCallsignTimestampSet m_aircraftCallsignTimestamps; //!< for watchdog (pilots)
|
||||
@@ -114,6 +114,7 @@ namespace BlackCore
|
||||
// snapshot
|
||||
BlackMisc::Simulation::CAirspaceAircraftSnapshot m_latestAircraftSnapshot;
|
||||
bool m_simulatorRenderedAircraftRestricted = false;
|
||||
bool m_simulatorRenderingEnabled = true;
|
||||
int m_simulatorMaxRenderedAircraft = -1;
|
||||
BlackMisc::PhysicalQuantities::CLength m_simulatorMaxRenderedDistance { 0.0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit() };
|
||||
BlackMisc::PhysicalQuantities::CLength m_simulatorMaxRenderedBoundary { 0.0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit() };
|
||||
|
||||
@@ -447,11 +447,12 @@ namespace BlackCore
|
||||
emit this->connectionStatusChanged(from, to);
|
||||
}
|
||||
|
||||
void CContextNetwork::ps_simulatorRenderRestrictionsChanged(bool restricted, int maxAircraft, const CLength &maxRenderedDistance, const CLength &maxRenderedBoundary)
|
||||
void CContextNetwork::ps_simulatorRenderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const CLength &maxRenderedDistance, const CLength &maxRenderedBoundary)
|
||||
{
|
||||
// mainly passing changed restrictions from simulator to network
|
||||
if (!m_airspace) { return; }
|
||||
if (!m_airspace->analyzer()) { return; }
|
||||
m_airspace->analyzer()->setSimulatorRenderRestrictionsChanged(restricted, maxAircraft, maxRenderedDistance, maxRenderedBoundary);
|
||||
m_airspace->analyzer()->setSimulatorRenderRestrictionsChanged(restricted, enabled, maxAircraft, maxRenderedDistance, maxRenderedBoundary);
|
||||
}
|
||||
|
||||
void CContextNetwork::ps_dataFileRead(int lines)
|
||||
|
||||
@@ -280,7 +280,7 @@ namespace BlackCore
|
||||
|
||||
//! Render restrictions have been changed, used with analyzer
|
||||
//! \sa CAirspaceAnalyzer
|
||||
void ps_simulatorRenderRestrictionsChanged(bool restricted, int maxAircraft, const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance, const BlackMisc::PhysicalQuantities::CLength &maxRenderedBoundary);
|
||||
void ps_simulatorRenderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance, const BlackMisc::PhysicalQuantities::CLength &maxRenderedBoundary);
|
||||
|
||||
};
|
||||
} // ns
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace BlackCore
|
||||
void simulatorPluginChanged(const BlackMisc::Simulation::CSimulatorPluginInfo &info);
|
||||
|
||||
//! Render restrictions have been changed
|
||||
void renderRestrictionsChanged(bool restricted, int maxAircraft, const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance, const BlackMisc::PhysicalQuantities::CLength &maxRenderedBoundary);
|
||||
void renderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance, const BlackMisc::PhysicalQuantities::CLength &maxRenderedBoundary);
|
||||
|
||||
//! Installed aircraft models ready or changed
|
||||
void installedAircraftModelsChanged();
|
||||
|
||||
@@ -255,11 +255,7 @@ namespace BlackCore
|
||||
int CContextSimulator::getMaxRenderedAircraft() const
|
||||
{
|
||||
if (m_debugEnabled) {CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulatorPlugin)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!m_simulatorPlugin) { return 0; }
|
||||
Q_ASSERT(m_simulatorPlugin->simulator);
|
||||
return m_simulatorPlugin->simulator->getMaxRenderedAircraft();
|
||||
}
|
||||
@@ -267,22 +263,18 @@ namespace BlackCore
|
||||
void CContextSimulator::setMaxRenderedAircraft(int number)
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << number; }
|
||||
if (!m_simulatorPlugin) { return; }
|
||||
Q_ASSERT(m_simulatorPlugin->simulator);
|
||||
m_simulatorPlugin->simulator->setMaxRenderedAircraft(number);
|
||||
|
||||
if (m_simulatorPlugin)
|
||||
{
|
||||
Q_ASSERT(m_simulatorPlugin->simulator);
|
||||
m_simulatorPlugin->simulator->setMaxRenderedAircraft(number);
|
||||
}
|
||||
}
|
||||
|
||||
void CContextSimulator::setMaxRenderedDistance(CLength &distance)
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << distance; }
|
||||
if (m_simulatorPlugin)
|
||||
{
|
||||
Q_ASSERT(m_simulatorPlugin->simulator);
|
||||
this->m_simulatorPlugin->simulator->setMaxRenderedDistance(distance);
|
||||
}
|
||||
if (!m_simulatorPlugin) { return; }
|
||||
Q_ASSERT(m_simulatorPlugin->simulator);
|
||||
this->m_simulatorPlugin->simulator->setMaxRenderedDistance(distance);
|
||||
}
|
||||
|
||||
QString CContextSimulator::getRenderRestrictionText() const
|
||||
@@ -308,10 +300,7 @@ namespace BlackCore
|
||||
CLength CContextSimulator::getMaxRenderedDistance() const
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulatorPlugin)
|
||||
{
|
||||
return CLength(0, CLengthUnit::nullUnit());
|
||||
}
|
||||
if (!m_simulatorPlugin) { return CLength(0, CLengthUnit::nullUnit()); }
|
||||
Q_ASSERT(m_simulatorPlugin->simulator);
|
||||
return this->m_simulatorPlugin->simulator->getMaxRenderedDistance();
|
||||
}
|
||||
|
||||
@@ -101,15 +101,15 @@ namespace BlackCore
|
||||
//! \copydoc IContextSimulator::setMaxRenderedAircraft
|
||||
virtual void setMaxRenderedAircraft(int number) override;
|
||||
|
||||
//! \copydoc IContextSimulator::getMaxRenderedDistance
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getMaxRenderedDistance() const override;
|
||||
|
||||
//! \copydoc IContextSimulator::setMaxRenderedDistance
|
||||
virtual void setMaxRenderedDistance(BlackMisc::PhysicalQuantities::CLength &distance) override;
|
||||
|
||||
//! \copydoc IContextSimulator::getRenderRestrictionText
|
||||
virtual QString getRenderRestrictionText() const override;
|
||||
|
||||
//! \copydoc IContextSimulator::getMaxRenderedDistance
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getMaxRenderedDistance() const override;
|
||||
|
||||
//! \copydoc IContextSimulator::getRenderedDistanceBoundary
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getRenderedDistanceBoundary() const override;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace BlackCore
|
||||
"modelMatchingCompleted", this, SIGNAL(modelMatchingCompleted(BlackMisc::Simulation::CSimulatedAircraft)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
|
||||
"renderRestrictionsChanged", this, SIGNAL(renderRestrictionsChanged(bool, int, BlackMisc::PhysicalQuantities::CLength, BlackMisc::PhysicalQuantities::CLength)));
|
||||
"renderRestrictionsChanged", this, SIGNAL(renderRestrictionsChanged(bool, bool, int, BlackMisc::PhysicalQuantities::CLength, BlackMisc::PhysicalQuantities::CLength)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
|
||||
"simulatorPluginChanged", this, SIGNAL(simulatorPluginChanged(BlackMisc::Simulation::CSimulatorPluginInfo)));
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace BlackCore
|
||||
void ownAircraftModelChanged(BlackMisc::Simulation::CSimulatedAircraft aircraft);
|
||||
|
||||
//! Render restrictions have been changed
|
||||
void renderRestrictionsChanged(bool restricted, int maxAircraft, const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance, const BlackMisc::PhysicalQuantities::CLength &maxRenderedBoundary);
|
||||
void renderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance, const BlackMisc::PhysicalQuantities::CLength &maxRenderedBoundary);
|
||||
|
||||
//! A single model has been matched
|
||||
void modelMatchingCompleted(BlackMisc::Simulation::CSimulatedAircraft aircraft);
|
||||
|
||||
@@ -157,7 +157,9 @@ namespace BlackCore
|
||||
if (maxRenderedAircraft == m_maxRenderedAircraft) { return; }
|
||||
if (maxRenderedAircraft < 1)
|
||||
{
|
||||
// disable, we set both values to 0
|
||||
m_maxRenderedAircraft = 0;
|
||||
m_maxRenderedDistance = CLength(0.0, CLengthUnit::NM());
|
||||
}
|
||||
else if (maxRenderedAircraft >= MaxAircraftInfinite)
|
||||
{
|
||||
@@ -169,7 +171,8 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
bool r = isRenderingRestricted();
|
||||
emit renderRestrictionsChanged(r, getMaxRenderedAircraft(), getMaxRenderedDistance(), getRenderedDistanceBoundary());
|
||||
bool e = isRenderingEnabled();
|
||||
emit renderRestrictionsChanged(r, e, getMaxRenderedAircraft(), getMaxRenderedDistance(), getRenderedDistanceBoundary());
|
||||
}
|
||||
|
||||
void CSimulatorCommon::setMaxRenderedDistance(CLength &distance)
|
||||
@@ -179,6 +182,12 @@ namespace BlackCore
|
||||
{
|
||||
m_maxRenderedDistance = CLength(0.0, CLengthUnit::nullUnit());
|
||||
}
|
||||
else if (distance.isZeroEpsilonConsidered())
|
||||
{
|
||||
// zero means disabled, we disable max aircraft too
|
||||
this->m_maxRenderedAircraft = 0;
|
||||
this->m_maxRenderedDistance = CLength(0.0, CLengthUnit::NM());
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_ASSERT(!distance.isNegativeWithEpsilonConsidered());
|
||||
@@ -186,7 +195,8 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
bool r = isRenderingRestricted();
|
||||
emit renderRestrictionsChanged(r, getMaxRenderedAircraft(), getMaxRenderedDistance(), getRenderedDistanceBoundary());
|
||||
bool e = isRenderingEnabled();
|
||||
emit renderRestrictionsChanged(r, e, getMaxRenderedAircraft(), getMaxRenderedDistance(), getRenderedDistanceBoundary());
|
||||
}
|
||||
|
||||
CLength CSimulatorCommon::getMaxRenderedDistance() const
|
||||
@@ -273,7 +283,7 @@ namespace BlackCore
|
||||
{
|
||||
this->m_maxRenderedDistance = CLength(0, CLengthUnit::nullUnit());
|
||||
this->m_maxRenderedAircraft = MaxAircraftInfinite;
|
||||
emit renderRestrictionsChanged(false, getMaxRenderedAircraft(), getMaxRenderedDistance(), getRenderedDistanceBoundary());
|
||||
emit renderRestrictionsChanged(false, true, getMaxRenderedAircraft(), getMaxRenderedDistance(), getRenderedDistanceBoundary());
|
||||
}
|
||||
|
||||
int CSimulatorCommon::physicallyRemoveMultipleRemoteAircraft(const CCallsignSet &callsigns)
|
||||
|
||||
@@ -98,13 +98,19 @@ namespace BlackGui
|
||||
// time sync
|
||||
this->ui->cb_TimeSync->setEnabled(m_pluginLoaded);
|
||||
this->ui->le_TimeSyncOffset->setEnabled(m_pluginLoaded);
|
||||
this->ui->sb_MaxDistance->setEnabled(m_pluginLoaded);
|
||||
this->ui->sb_MaxAircraft->setEnabled(m_pluginLoaded);
|
||||
this->ui->pb_ApplyTimeSync->setEnabled(m_pluginLoaded);
|
||||
|
||||
// led
|
||||
this->ui->led_RestrictedRendering->setOn(m_pluginLoaded ? getIContextSimulator()->isRenderingRestricted() : false);
|
||||
this->ui->lbl_RestrictionText->setText(m_pluginLoaded ? getIContextSimulator()->getRenderRestrictionText() : "");
|
||||
|
||||
this->ui->sb_MaxDistance->setEnabled(m_pluginLoaded);
|
||||
this->ui->sb_MaxAircraft->setEnabled(m_pluginLoaded);
|
||||
this->ui->pb_ApplyMaxAircraft->setEnabled(m_pluginLoaded);
|
||||
this->ui->pb_ApplyMaxDistance->setEnabled(m_pluginLoaded);
|
||||
this->ui->pb_ClearRestrictedRendering->setEnabled((m_pluginLoaded));
|
||||
this->ui->pb_DisableRendering->setEnabled(m_pluginLoaded);
|
||||
|
||||
if (m_pluginLoaded)
|
||||
{
|
||||
bool timeSynced = this->getIContextSimulator()->isTimeSynchronized();
|
||||
@@ -112,14 +118,15 @@ namespace BlackGui
|
||||
CTime timeOffset = this->getIContextSimulator()->getTimeSynchronizationOffset();
|
||||
this->ui->le_TimeSyncOffset->setText(timeOffset.formattedHrsMin());
|
||||
|
||||
int distanceBoundaryNM = getIContextSimulator()->getRenderedDistanceBoundary().valueInteger(CLengthUnit::NM());
|
||||
this->ui->sb_MaxDistance->setMaximum(distanceBoundaryNM);
|
||||
this->ui->sb_MaxAircraft->setValue(getIContextSimulator()->getMaxRenderedAircraft());
|
||||
int maxAircraft = getIContextSimulator()->getMaxRenderedAircraft();
|
||||
this->ui->sb_MaxAircraft->setValue(maxAircraft);
|
||||
|
||||
CLength distanceBoundary(getIContextSimulator()->getRenderedDistanceBoundary());
|
||||
int distanceBoundaryNM = distanceBoundary.valueInteger(CLengthUnit::NM());
|
||||
CLength maxDistance(getIContextSimulator()->getMaxRenderedDistance());
|
||||
int distanceNM = maxDistance.isNull() ? distanceBoundaryNM : maxDistance.valueInteger(CLengthUnit::NM());
|
||||
this->ui->sb_MaxDistance->setMaximum(distanceBoundaryNM);
|
||||
this->ui->sb_MaxDistance->setValue(distanceNM);
|
||||
|
||||
this->ui->led_RenderingEnabled->setOn(getIContextSimulator()->isRenderingEnabled());
|
||||
}
|
||||
else
|
||||
@@ -132,7 +139,7 @@ namespace BlackGui
|
||||
{
|
||||
Q_ASSERT(this->getIContextSimulator());
|
||||
Q_ASSERT(this->getIContextSettings());
|
||||
if (!this->getIContextSimulator() || !this->getIContextSettings()) return;
|
||||
if (!this->getIContextSimulator() || !this->getIContextSettings()) { return; }
|
||||
|
||||
CSimulatorPluginInfoList simDrivers = this->getIContextSimulator()->getAvailableSimulatorPlugins();
|
||||
simDrivers.insert(simDrivers.begin(), CSimulatorPluginInfo());
|
||||
@@ -171,9 +178,13 @@ namespace BlackGui
|
||||
|
||||
// get initial aircraft to render
|
||||
int noRequested = this->ui->sb_MaxAircraft->value();
|
||||
int oldValue = this->getIContextSimulator()->getMaxRenderedAircraft();
|
||||
if (oldValue == noRequested) { return; }
|
||||
|
||||
// set value
|
||||
this->getIContextSimulator()->setMaxRenderedAircraft(noRequested);
|
||||
|
||||
// real value
|
||||
// re-read real value
|
||||
int noRendered = this->getIContextSimulator()->getMaxRenderedAircraft();
|
||||
if (noRequested == noRendered)
|
||||
{
|
||||
@@ -189,14 +200,22 @@ namespace BlackGui
|
||||
|
||||
void CSettingsSimulatorComponent::ps_onApplyMaxRenderedDistance()
|
||||
{
|
||||
Q_ASSERT(getIContextSimulator());
|
||||
Q_ASSERT_X(getIContextSimulator(), Q_FUNC_INFO, "missing context");
|
||||
|
||||
// get initial aircraft to render
|
||||
int maxDistanceNM = this->ui->sb_MaxDistance->value();
|
||||
CLength distance(maxDistanceNM, CLengthUnit::NM());
|
||||
this->getIContextSimulator()->setMaxRenderedDistance(distance);
|
||||
CLogMessage(this).info("Max.distance requested: %1") << distance.valueRoundedWithUnit(2, true);
|
||||
this->setGuiValues();
|
||||
CLength currentDistance(this->getIContextSimulator()->getMaxRenderedDistance());
|
||||
if (maxDistanceNM == currentDistance.valueInteger(CLengthUnit::NM()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
CLength distance(maxDistanceNM, CLengthUnit::NM());
|
||||
CLogMessage(this).info("Max.distance requested: %1") << distance.valueRoundedWithUnit(2, true);
|
||||
this->getIContextSimulator()->setMaxRenderedDistance(distance);
|
||||
this->setGuiValues();
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingsSimulatorComponent::ps_onApplyDisableRendering()
|
||||
@@ -246,14 +265,13 @@ namespace BlackGui
|
||||
m_pluginLoaded = true;
|
||||
this->ui->comp_SettingsSimulatorFsx->setVisible(hasFsxDriver);
|
||||
this->ui->lbl_PluginInfo->setText(info.getDescription());
|
||||
this->setGuiValues();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pluginLoaded = false;
|
||||
this->ui->lbl_PluginInfo->setText("No plugin loaded");
|
||||
this->setGuiValues();
|
||||
}
|
||||
this->setGuiValues();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,16 +21,13 @@ namespace BlackMisc
|
||||
|
||||
CAirspaceAircraftSnapshot::CAirspaceAircraftSnapshot(
|
||||
const CSimulatedAircraftList &allAircraft,
|
||||
bool restricted, int maxAircraft, const CLength &maxRenderedDistance, const CLength &maxRenderedBoundary) :
|
||||
bool restricted, bool renderingEnabled, int maxAircraft,
|
||||
const CLength &maxRenderedDistance, const CLength &maxRenderedBoundary) :
|
||||
m_timestampMsSinceEpoch(QDateTime::currentMSecsSinceEpoch()),
|
||||
m_restricted(restricted),
|
||||
m_renderingEnabled(renderingEnabled),
|
||||
m_threadName(QThread::currentThread()->objectName())
|
||||
{
|
||||
m_renderingEnabled = !restricted || (
|
||||
maxAircraft > 0 &&
|
||||
(maxRenderedBoundary.isNull() || maxRenderedBoundary.isPositiveWithEpsilonConsidered()) &&
|
||||
(maxRenderedDistance.isNull() || maxRenderedDistance.isPositiveWithEpsilonConsidered())
|
||||
);
|
||||
if (allAircraft.isEmpty()) { return; }
|
||||
|
||||
CSimulatedAircraftList aircraft(allAircraft);
|
||||
@@ -92,7 +89,9 @@ namespace BlackMisc
|
||||
{
|
||||
if (this->isValidSnapshot() == snapshot.isValidSnapshot())
|
||||
{
|
||||
this->m_restrictionChanged = (snapshot.m_restricted != this->m_restricted);
|
||||
this->m_restrictionChanged =
|
||||
(snapshot.m_restricted != this->m_restricted) ||
|
||||
(snapshot.m_renderingEnabled != this->m_renderingEnabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace BlackMisc
|
||||
CAirspaceAircraftSnapshot(
|
||||
const BlackMisc::Simulation::CSimulatedAircraftList &allAircraft,
|
||||
bool restricted = false,
|
||||
bool renderingEnabled = true,
|
||||
int maxAircraft = 100,
|
||||
const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance = BlackMisc::PhysicalQuantities::CLength(0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit()),
|
||||
const BlackMisc::PhysicalQuantities::CLength &maxRenderedBoundary = BlackMisc::PhysicalQuantities::CLength(0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit())
|
||||
@@ -90,8 +91,8 @@ namespace BlackMisc
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CAirspaceAircraftSnapshot)
|
||||
qint64 m_timestampMsSinceEpoch = -1;
|
||||
bool m_restricted = false;
|
||||
bool m_restrictionChanged = false;
|
||||
bool m_renderingEnabled = true;
|
||||
bool m_restrictionChanged = false;
|
||||
QString m_threadName; //!< generating thread name for debugging purposes
|
||||
|
||||
// remark closest aircraft always first
|
||||
|
||||
Reference in New Issue
Block a user