mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
refs #806, apply CInterpolationAndRenderingSetup
* removed no longer needed signatures * some renaming of CInterpolationAndRenderingSetup functions * adjusted UI element
This commit is contained in:
@@ -74,14 +74,13 @@ namespace BlackCore
|
||||
return m_latestAircraftSnapshot;
|
||||
}
|
||||
|
||||
void CAirspaceAnalyzer::setSimulatorRenderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const CLength &maxRenderedDistance, const CLength &maxRenderedBoundary)
|
||||
void CAirspaceAnalyzer::setSimulatorRenderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const CLength &maxRenderedDistance)
|
||||
{
|
||||
QWriteLocker l(&m_lockRestrictions);
|
||||
this->m_simulatorRenderedAircraftRestricted = restricted;
|
||||
this->m_simulatorRenderingEnabled = enabled;
|
||||
this->m_simulatorMaxRenderedAircraft = maxAircraft;
|
||||
this->m_simulatorMaxRenderedDistance = maxRenderedDistance;
|
||||
this->m_simulatorMaxRenderedBoundary = maxRenderedBoundary;
|
||||
}
|
||||
|
||||
void CAirspaceAnalyzer::gracefulShutdown()
|
||||
@@ -190,14 +189,13 @@ namespace BlackCore
|
||||
|
||||
bool restricted, enabled;
|
||||
int maxAircraft;
|
||||
CLength maxRenderedDistance, maxRenderedBoundary;
|
||||
CLength maxRenderedDistance;
|
||||
{
|
||||
QReadLocker l(&m_lockRestrictions);
|
||||
restricted = this->m_simulatorRenderedAircraftRestricted;
|
||||
enabled = this->m_simulatorRenderingEnabled,
|
||||
maxAircraft = this->m_simulatorMaxRenderedAircraft;
|
||||
maxRenderedDistance = this->m_simulatorMaxRenderedDistance;
|
||||
maxRenderedBoundary = this->m_simulatorMaxRenderedBoundary;
|
||||
}
|
||||
|
||||
// remark for simulation snapshot is used when there are restrictions
|
||||
@@ -207,7 +205,7 @@ namespace BlackCore
|
||||
CAirspaceAircraftSnapshot snapshot(
|
||||
aircraftInRange,
|
||||
restricted, enabled,
|
||||
maxAircraft, maxRenderedDistance, maxRenderedBoundary
|
||||
maxAircraft, maxRenderedDistance
|
||||
);
|
||||
|
||||
// lock block
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace BlackCore
|
||||
BlackMisc::Simulation::CAirspaceAircraftSnapshot getLatestAirspaceAircraftSnapshot() const;
|
||||
|
||||
//! Render restrictions in simulator
|
||||
void setSimulatorRenderRestrictionsChanged(bool restricted, bool enabled, 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);
|
||||
|
||||
//! Gracefully shut down, e.g. for thread safety
|
||||
void gracefulShutdown();
|
||||
@@ -134,7 +134,6 @@ namespace BlackCore
|
||||
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() };
|
||||
mutable QReadWriteLock m_lockSnapshot; //!< lock snapshot
|
||||
mutable QReadWriteLock m_lockRestrictions; //!< lock simulator restrictions
|
||||
};
|
||||
|
||||
@@ -432,12 +432,12 @@ namespace BlackCore
|
||||
emit this->connectionStatusChanged(from, to);
|
||||
}
|
||||
|
||||
void CContextNetwork::ps_simulatorRenderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const CLength &maxRenderedDistance, const CLength &maxRenderedBoundary)
|
||||
void CContextNetwork::ps_simulatorRenderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const CLength &maxRenderedDistance)
|
||||
{
|
||||
// mainly passing changed restrictions from simulator to network
|
||||
if (!m_airspace) { return; }
|
||||
if (!m_airspace->analyzer()) { return; }
|
||||
m_airspace->analyzer()->setSimulatorRenderRestrictionsChanged(restricted, enabled, maxAircraft, maxRenderedDistance, maxRenderedBoundary);
|
||||
m_airspace->analyzer()->setSimulatorRenderRestrictionsChanged(restricted, enabled, maxAircraft, maxRenderedDistance);
|
||||
}
|
||||
|
||||
void CContextNetwork::ps_updateMetars(const BlackMisc::Weather::CMetarList &metars)
|
||||
|
||||
@@ -309,7 +309,7 @@ namespace BlackCore
|
||||
|
||||
//! Render restrictions have been changed, used with analyzer
|
||||
//! \sa CAirspaceAnalyzer
|
||||
void ps_simulatorRenderRestrictionsChanged(bool restricted, bool enabled, 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);
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace BlackCore
|
||||
void simulatorPluginChanged(BlackMisc::Simulation::CSimulatorPluginInfo info);
|
||||
|
||||
//! Render restrictions have been changed
|
||||
void renderRestrictionsChanged(bool restricted, bool enabled, 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);
|
||||
|
||||
//! Model set ready or changed
|
||||
void modelSetChanged();
|
||||
@@ -161,32 +161,8 @@ namespace BlackCore
|
||||
//! Is time synchronization on?
|
||||
virtual bool isTimeSynchronized() const = 0;
|
||||
|
||||
//! Max. number of remote aircraft rendered
|
||||
virtual int getMaxRenderedAircraft() const = 0;
|
||||
|
||||
//! Max. rendered distance
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getMaxRenderedDistance() const = 0;
|
||||
|
||||
//! Technical range until aircraft are visible
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getRenderedDistanceBoundary() const = 0;
|
||||
|
||||
//! Text describing the rendering restrictions
|
||||
virtual QString getRenderRestrictionText() const = 0;
|
||||
|
||||
//! Max. number of remote aircraft rendered and provide optional selection which aircraft those are
|
||||
virtual void setMaxRenderedAircraft(int number) = 0;
|
||||
|
||||
//! Max. distance until we render an aircraft
|
||||
virtual void setMaxRenderedDistance(const BlackMisc::PhysicalQuantities::CLength &distance) = 0;
|
||||
|
||||
//! Delete all restrictions (if any) -> unlimited number of aircraft
|
||||
virtual void deleteAllRenderingRestrictions() = 0;
|
||||
|
||||
//! Is number of aircraft restricted ormax distance set?
|
||||
virtual bool isRenderingRestricted() const = 0;
|
||||
|
||||
//! Rendering enabled at all
|
||||
virtual bool isRenderingEnabled() const = 0;
|
||||
//! Set interpolation and rendering
|
||||
virtual BlackMisc::CInterpolationAndRenderingSetup getInterpolationAndRenderingSetup() const = 0;
|
||||
|
||||
//! Set interpolation and rendering
|
||||
virtual void setInterpolationAndRenderingSetup(const BlackMisc::CInterpolationAndRenderingSetup &setup) = 0;
|
||||
|
||||
@@ -133,25 +133,11 @@ namespace BlackCore
|
||||
return false;
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::getMaxRenderedAircraft
|
||||
virtual int getMaxRenderedAircraft() const override
|
||||
//! \copydoc ISimulator::getInterpolationAndRenderingSetup
|
||||
virtual BlackMisc::CInterpolationAndRenderingSetup getInterpolationAndRenderingSetup() const override
|
||||
{
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::setMaxRenderedAircraft
|
||||
virtual void setMaxRenderedAircraft(int number) override
|
||||
{
|
||||
Q_UNUSED(number);
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::setMaxRenderedDistance
|
||||
virtual void setMaxRenderedDistance(const BlackMisc::PhysicalQuantities::CLength &distance) override
|
||||
{
|
||||
Q_UNUSED(distance);
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return BlackMisc::CInterpolationAndRenderingSetup();
|
||||
}
|
||||
|
||||
//! \copydoc ISimulator::setInterpolationAndRenderingSetup
|
||||
@@ -161,47 +147,6 @@ namespace BlackCore
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::setMaxRenderedDistance
|
||||
virtual void deleteAllRenderingRestrictions() override
|
||||
{
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::isRenderingRestricted
|
||||
virtual bool isRenderingRestricted() const override
|
||||
{
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return false;
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::isRenderingEnabled
|
||||
virtual bool isRenderingEnabled() const override
|
||||
{
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return false;
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::getMaxRenderedDistance
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getMaxRenderedDistance() const override
|
||||
{
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return BlackMisc::PhysicalQuantities::CLength();
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::getRenderedDistanceBoundary
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getRenderedDistanceBoundary() const override
|
||||
{
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return BlackMisc::PhysicalQuantities::CLength();
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::getRenderRestrictionText
|
||||
virtual QString getRenderRestrictionText() const override
|
||||
{
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return QString();
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::getTimeSynchronizationOffset
|
||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override
|
||||
{
|
||||
|
||||
@@ -212,29 +212,12 @@ namespace BlackCore
|
||||
return m_simulatorPlugin.second->isTimeSynchronized();
|
||||
}
|
||||
|
||||
int CContextSimulator::getMaxRenderedAircraft() const
|
||||
CInterpolationAndRenderingSetup CContextSimulator::getInterpolationAndRenderingSetup() const
|
||||
{
|
||||
if (m_debugEnabled) {CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (m_simulatorPlugin.first.isUnspecified()) { return 0; }
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (m_simulatorPlugin.first.isUnspecified()) { return CInterpolationAndRenderingSetup(); }
|
||||
Q_ASSERT(m_simulatorPlugin.second);
|
||||
return m_simulatorPlugin.second->getMaxRenderedAircraft();
|
||||
}
|
||||
|
||||
void CContextSimulator::setMaxRenderedAircraft(int number)
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << number; }
|
||||
if (m_simulatorPlugin.first.isUnspecified()) { return; }
|
||||
Q_ASSERT(m_simulatorPlugin.second);
|
||||
m_simulatorPlugin.second->setMaxRenderedAircraft(number);
|
||||
|
||||
}
|
||||
|
||||
void CContextSimulator::setMaxRenderedDistance(const CLength &distance)
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << distance; }
|
||||
if (m_simulatorPlugin.first.isUnspecified()) { return; }
|
||||
Q_ASSERT(m_simulatorPlugin.second);
|
||||
m_simulatorPlugin.second->setMaxRenderedDistance(distance);
|
||||
return m_simulatorPlugin.second->getInterpolationAndRenderingSetup();
|
||||
}
|
||||
|
||||
void CContextSimulator::setInterpolationAndRenderingSetup(const CInterpolationAndRenderingSetup &setup)
|
||||
@@ -245,71 +228,6 @@ namespace BlackCore
|
||||
m_simulatorPlugin.second->setInterpolationAndRenderingSetup(setup);
|
||||
}
|
||||
|
||||
QString CContextSimulator::getRenderRestrictionText() const
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (m_simulatorPlugin.first.isUnspecified()) { return ""; }
|
||||
|
||||
Q_ASSERT(m_simulatorPlugin.second);
|
||||
if (!m_simulatorPlugin.second->isRenderingRestricted()) { return "none"; }
|
||||
QString rt;
|
||||
if (m_simulatorPlugin.second->isMaxAircraftRestricted())
|
||||
{
|
||||
rt.append(QString::number(m_simulatorPlugin.second->getMaxRenderedAircraft())).append(" A/C");
|
||||
}
|
||||
if (m_simulatorPlugin.second->isMaxDistanceRestricted())
|
||||
{
|
||||
if (!rt.isEmpty()) { rt.append(" ");}
|
||||
rt.append(m_simulatorPlugin.second->getMaxRenderedDistance().valueRoundedWithUnit(CLengthUnit::NM(), 0));
|
||||
}
|
||||
return rt;
|
||||
}
|
||||
|
||||
CLength CContextSimulator::getMaxRenderedDistance() const
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (m_simulatorPlugin.first.isUnspecified()) { return CLength(0, CLengthUnit::nullUnit()); }
|
||||
Q_ASSERT(m_simulatorPlugin.second);
|
||||
return m_simulatorPlugin.second->getMaxRenderedDistance();
|
||||
}
|
||||
|
||||
CLength CContextSimulator::getRenderedDistanceBoundary() const
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (m_simulatorPlugin.first.isUnspecified())
|
||||
{
|
||||
return CLength(20.0, CLengthUnit::NM());
|
||||
}
|
||||
Q_ASSERT(m_simulatorPlugin.second);
|
||||
return m_simulatorPlugin.second->getRenderedDistanceBoundary();
|
||||
}
|
||||
|
||||
void CContextSimulator::deleteAllRenderingRestrictions()
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulatorPlugin.first.isUnspecified())
|
||||
{
|
||||
Q_ASSERT(m_simulatorPlugin.second);
|
||||
m_simulatorPlugin.second->deleteAllRenderingRestrictions();
|
||||
}
|
||||
}
|
||||
|
||||
bool CContextSimulator::isRenderingRestricted() const
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (m_simulatorPlugin.first.isUnspecified()) { return false; }
|
||||
Q_ASSERT(m_simulatorPlugin.second);
|
||||
return m_simulatorPlugin.second->isRenderingRestricted();
|
||||
}
|
||||
|
||||
bool CContextSimulator::isRenderingEnabled() const
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (m_simulatorPlugin.first.isUnspecified()) { return false; }
|
||||
Q_ASSERT(m_simulatorPlugin.second);
|
||||
return m_simulatorPlugin.second->isRenderingEnabled();
|
||||
}
|
||||
|
||||
CTime CContextSimulator::getTimeSynchronizationOffset() const
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
|
||||
@@ -87,19 +87,11 @@ namespace BlackCore
|
||||
virtual QStringList getModelSetCompleterStrings(bool sorted) const override;
|
||||
virtual int getModelSetCount() const override;
|
||||
virtual BlackMisc::Simulation::CAircraftModelList getModelSetModelsStartingWith(const QString modelString) const override;
|
||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override;
|
||||
virtual bool setTimeSynchronization(bool enable, const BlackMisc::PhysicalQuantities::CTime &offset) override;
|
||||
virtual bool isTimeSynchronized() const override;
|
||||
virtual int getMaxRenderedAircraft() const override;
|
||||
virtual void setMaxRenderedAircraft(int number) override;
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getMaxRenderedDistance() const override;
|
||||
virtual void setMaxRenderedDistance(const BlackMisc::PhysicalQuantities::CLength &distance) override;
|
||||
virtual BlackMisc::CInterpolationAndRenderingSetup getInterpolationAndRenderingSetup() const override;
|
||||
virtual void setInterpolationAndRenderingSetup(const BlackMisc::CInterpolationAndRenderingSetup &setup) override;
|
||||
virtual QString getRenderRestrictionText() const override;
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getRenderedDistanceBoundary() const override;
|
||||
virtual void deleteAllRenderingRestrictions() override;
|
||||
virtual bool isRenderingRestricted() const override;
|
||||
virtual bool isRenderingEnabled() const override;
|
||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override;
|
||||
virtual BlackMisc::CPixmap iconForModel(const QString &modelString) const override;
|
||||
virtual void highlightAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const BlackMisc::PhysicalQuantities::CTime &displayTime) override;
|
||||
virtual bool resetToModelMatchingAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
|
||||
@@ -129,14 +129,9 @@ namespace BlackCore
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("isTimeSynchronized"));
|
||||
}
|
||||
|
||||
void CContextSimulatorProxy::setMaxRenderedAircraft(int number)
|
||||
CInterpolationAndRenderingSetup CContextSimulatorProxy::getInterpolationAndRenderingSetup() const
|
||||
{
|
||||
m_dBusInterface->callDBus(QLatin1Literal("setMaxRenderedAircraft"), number);
|
||||
}
|
||||
|
||||
void CContextSimulatorProxy::setMaxRenderedDistance(const CLength &distance)
|
||||
{
|
||||
m_dBusInterface->callDBus(QLatin1Literal("setMaxRenderedDistance"), distance);
|
||||
return m_dBusInterface->callDBusRet<CInterpolationAndRenderingSetup>(QLatin1Literal("getInterpolationAndRenderingSetup"));
|
||||
}
|
||||
|
||||
void CContextSimulatorProxy::setInterpolationAndRenderingSetup(const CInterpolationAndRenderingSetup &setup)
|
||||
@@ -144,41 +139,6 @@ namespace BlackCore
|
||||
m_dBusInterface->callDBus(QLatin1Literal("setInterpolationAndRenderingSetup"), setup);
|
||||
}
|
||||
|
||||
void CContextSimulatorProxy::deleteAllRenderingRestrictions()
|
||||
{
|
||||
m_dBusInterface->callDBus(QLatin1Literal("deleteAllRenderingRestrictions"));
|
||||
}
|
||||
|
||||
bool CContextSimulatorProxy::isRenderingRestricted() const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("isRenderingRestricted"));
|
||||
}
|
||||
|
||||
bool CContextSimulatorProxy::isRenderingEnabled() const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("isRenderingEnabled"));
|
||||
}
|
||||
|
||||
CLength CContextSimulatorProxy::getMaxRenderedDistance() const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<CLength>(QLatin1Literal("getMaxRenderedDistance"));
|
||||
}
|
||||
|
||||
CLength CContextSimulatorProxy::getRenderedDistanceBoundary() const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<CLength>(QLatin1Literal("getRenderedDistanceBoundary"));
|
||||
}
|
||||
|
||||
QString CContextSimulatorProxy::getRenderRestrictionText() const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<QString>(QLatin1Literal("getRenderRestrictionText"));
|
||||
}
|
||||
|
||||
int CContextSimulatorProxy::getMaxRenderedAircraft() const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<int>(QLatin1Literal("getMaxRenderedAircraft"));
|
||||
}
|
||||
|
||||
CTime CContextSimulatorProxy::getTimeSynchronizationOffset() const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<BlackMisc::PhysicalQuantities::CTime>(QLatin1Literal("getTimeSynchronizationOffset"));
|
||||
|
||||
@@ -67,16 +67,8 @@ namespace BlackCore
|
||||
virtual BlackMisc::Simulation::CSimulatorSetup getSimulatorSetup() const override;
|
||||
virtual bool setTimeSynchronization(bool enable, const BlackMisc::PhysicalQuantities::CTime &offset) override;
|
||||
virtual bool isTimeSynchronized() const override;
|
||||
virtual int getMaxRenderedAircraft() const override;
|
||||
virtual void setMaxRenderedAircraft(int number) override;
|
||||
virtual void setMaxRenderedDistance(const BlackMisc::PhysicalQuantities::CLength &distance) override;
|
||||
virtual BlackMisc::CInterpolationAndRenderingSetup getInterpolationAndRenderingSetup() const override;
|
||||
virtual void setInterpolationAndRenderingSetup(const BlackMisc::CInterpolationAndRenderingSetup &setup) override;
|
||||
virtual void deleteAllRenderingRestrictions() override;
|
||||
virtual bool isRenderingRestricted() const override;
|
||||
virtual bool isRenderingEnabled() const override;
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getMaxRenderedDistance() const override;
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getRenderedDistanceBoundary() const override;
|
||||
virtual QString getRenderRestrictionText() const override;
|
||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override;
|
||||
virtual BlackMisc::CPixmap iconForModel(const QString &modelString) const override;
|
||||
virtual void highlightAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const BlackMisc::PhysicalQuantities::CTime &displayTime) override;
|
||||
|
||||
@@ -124,35 +124,8 @@ namespace BlackCore
|
||||
//! Time synchronization offset
|
||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const = 0;
|
||||
|
||||
//! Max. rendered aircraft
|
||||
virtual int getMaxRenderedAircraft() const = 0;
|
||||
|
||||
//! Max. rendered aircraft
|
||||
virtual void setMaxRenderedAircraft(int maxRenderedAircraft) = 0;
|
||||
|
||||
//! Max. distance for rendered aircraft
|
||||
virtual void setMaxRenderedDistance(const BlackMisc::PhysicalQuantities::CLength &distance) = 0;
|
||||
|
||||
//! Max. distance for rendered aircraft
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getMaxRenderedDistance() const = 0;
|
||||
|
||||
//! Technical range until aircraft are visible
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getRenderedDistanceBoundary() const = 0;
|
||||
|
||||
//! Restricted number of aircraft
|
||||
virtual bool isMaxAircraftRestricted() const = 0;
|
||||
|
||||
//! Restriced distance
|
||||
virtual bool isMaxDistanceRestricted() const = 0;
|
||||
|
||||
//! Is there a restriction? No rendering -> limited number of aircraft -> unlimited number of aircraft
|
||||
virtual bool isRenderingRestricted() const = 0;
|
||||
|
||||
//! Is rendering enabled?
|
||||
virtual bool isRenderingEnabled() const = 0;
|
||||
|
||||
//! Delete all restrictions (if any) -> unlimited number of aircraft
|
||||
virtual void deleteAllRenderingRestrictions() = 0;
|
||||
//! Debugging messages etc.
|
||||
virtual BlackMisc::CInterpolationAndRenderingSetup getInterpolationAndRenderingSetup() const = 0;
|
||||
|
||||
//! Enable debugging messages etc.
|
||||
virtual void setInterpolationAndRenderingSetup(const BlackMisc::CInterpolationAndRenderingSetup &setup) = 0;
|
||||
@@ -162,7 +135,7 @@ namespace BlackCore
|
||||
virtual bool isPhysicallyRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) const = 0;
|
||||
|
||||
//! Physically rendered (displayed in simulator)
|
||||
//! This shall only return aircraft really visible in the simulator
|
||||
//! This shall only return aircraft handled in the simulator
|
||||
virtual BlackMisc::Aviation::CCallsignSet physicallyRenderedAircraft() const = 0;
|
||||
|
||||
//! Highlight the aircraft for given time (or disable highlight)
|
||||
@@ -187,7 +160,7 @@ namespace BlackCore
|
||||
void ownAircraftModelChanged(const BlackMisc::Simulation::CAircraftModel &model);
|
||||
|
||||
//! Render restrictions have been changed
|
||||
void renderRestrictionsChanged(bool restricted, bool enabled, 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);
|
||||
|
||||
//! Aircraft rendering changed
|
||||
void aircraftRenderingChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace BlackCore
|
||||
if (!remoteAircraft.isEnabled()) { return false; }
|
||||
|
||||
// if not restriced, directly change
|
||||
if (!isRenderingRestricted()) { this->physicallyAddRemoteAircraft(remoteAircraft); return true; }
|
||||
if (!m_interpolationRenderingSetup.isRenderingRestricted()) { this->physicallyAddRemoteAircraft(remoteAircraft); return true; }
|
||||
|
||||
// will be added with next snapshot ps_recalculateRenderedAircraft
|
||||
return false;
|
||||
@@ -94,7 +94,7 @@ namespace BlackCore
|
||||
bool CSimulatorCommon::logicallyRemoveRemoteAircraft(const CCallsign &callsign)
|
||||
{
|
||||
// if not restriced, directly change
|
||||
if (!isRenderingRestricted()) { this->physicallyRemoveRemoteAircraft(callsign); return true; }
|
||||
if (!m_interpolationRenderingSetup.isRenderingRestricted()) { this->physicallyRemoveRemoteAircraft(callsign); return true; }
|
||||
|
||||
// will be added with next snapshot ps_recalculateRenderedAircraft
|
||||
return false;
|
||||
@@ -227,32 +227,6 @@ namespace BlackCore
|
||||
return m_defaultModel;
|
||||
}
|
||||
|
||||
int CSimulatorCommon::getMaxRenderedAircraft() const
|
||||
{
|
||||
return m_interpolationRenderingSetup.getMaxRenderedAircraft();
|
||||
}
|
||||
|
||||
void CSimulatorCommon::setMaxRenderedAircraft(int maxRenderedAircraft)
|
||||
{
|
||||
if (!m_interpolationRenderingSetup.setMaxRenderedAircraft(maxRenderedAircraft)) { return; }
|
||||
const bool r = isRenderingRestricted();
|
||||
const bool e = isRenderingEnabled();
|
||||
emit renderRestrictionsChanged(r, e, getMaxRenderedAircraft(), getMaxRenderedDistance(), getRenderedDistanceBoundary());
|
||||
}
|
||||
|
||||
void CSimulatorCommon::setMaxRenderedDistance(const CLength &distance)
|
||||
{
|
||||
if (!m_interpolationRenderingSetup.setMaxRenderedDistance(distance)) { return; }
|
||||
const bool r = isRenderingRestricted();
|
||||
const bool e = isRenderingEnabled();
|
||||
emit renderRestrictionsChanged(r, e, getMaxRenderedAircraft(), getMaxRenderedDistance(), getRenderedDistanceBoundary());
|
||||
}
|
||||
|
||||
CLength CSimulatorCommon::getMaxRenderedDistance() const
|
||||
{
|
||||
return (m_interpolationRenderingSetup.getMaxRenderedDistance());
|
||||
}
|
||||
|
||||
const CSimulatorPluginInfo &CSimulatorCommon::getSimulatorPluginInfo() const
|
||||
{
|
||||
return m_simulatorPluginInfo;
|
||||
@@ -269,25 +243,21 @@ namespace BlackCore
|
||||
this->m_remoteAircraftProviderConnections.disconnectAll(); // disconnect signals from provider
|
||||
}
|
||||
|
||||
CLength CSimulatorCommon::getRenderedDistanceBoundary() const
|
||||
{
|
||||
return CLength(20.0, CLengthUnit::NM());
|
||||
}
|
||||
|
||||
bool CSimulatorCommon::isMaxAircraftRestricted() const
|
||||
{
|
||||
return m_interpolationRenderingSetup.isMaxAircraftRestricted();
|
||||
}
|
||||
|
||||
bool CSimulatorCommon::isMaxDistanceRestricted() const
|
||||
{
|
||||
return m_interpolationRenderingSetup.isMaxDistanceRestricted();
|
||||
}
|
||||
|
||||
void CSimulatorCommon::setInterpolationAndRenderingSetup(const CInterpolationAndRenderingSetup &setup)
|
||||
{
|
||||
this->m_interpolationRenderingSetup = setup;
|
||||
this->m_interpolator->setInterpolatorSetup(setup);
|
||||
if (this->m_interpolationRenderingSetup == setup) { return; }
|
||||
this->m_interpolationRenderingSetup = setup;
|
||||
|
||||
const bool r = setup.isRenderingRestricted();
|
||||
const bool e = setup.isRenderingEnabled();
|
||||
|
||||
emit renderRestrictionsChanged(r, e, setup.getMaxRenderedAircraft(), setup.getMaxRenderedDistance());
|
||||
}
|
||||
|
||||
CInterpolationAndRenderingSetup CSimulatorCommon::getInterpolationAndRenderingSetup() const
|
||||
{
|
||||
return m_interpolationRenderingSetup;
|
||||
}
|
||||
|
||||
void CSimulatorCommon::highlightAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const BlackMisc::PhysicalQuantities::CTime &displayTime)
|
||||
@@ -302,22 +272,6 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
bool CSimulatorCommon::isRenderingEnabled() const
|
||||
{
|
||||
return m_interpolationRenderingSetup.isRenderingEnabled();
|
||||
}
|
||||
|
||||
bool CSimulatorCommon::isRenderingRestricted() const
|
||||
{
|
||||
return this->isMaxDistanceRestricted() || this->isMaxAircraftRestricted();
|
||||
}
|
||||
|
||||
void CSimulatorCommon::deleteAllRenderingRestrictions()
|
||||
{
|
||||
m_interpolationRenderingSetup.deleteAllRenderingRestrictions();
|
||||
emit renderRestrictionsChanged(false, true, getMaxRenderedAircraft(), getMaxRenderedDistance(), getRenderedDistanceBoundary());
|
||||
}
|
||||
|
||||
int CSimulatorCommon::physicallyRemoveMultipleRemoteAircraft(const CCallsignSet &callsigns)
|
||||
{
|
||||
int removed = 0;
|
||||
|
||||
@@ -69,21 +69,12 @@ namespace BlackCore
|
||||
//! \name ISimulator implementations
|
||||
//! @{
|
||||
virtual BlackMisc::Simulation::CAircraftModel getDefaultModel() const override;
|
||||
virtual int getMaxRenderedAircraft() const override;
|
||||
virtual void setMaxRenderedAircraft(int maxRenderedAircraft) override;
|
||||
virtual void setMaxRenderedDistance(const BlackMisc::PhysicalQuantities::CLength &distance) override;
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getMaxRenderedDistance() const override;
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getRenderedDistanceBoundary() const override;
|
||||
virtual bool isMaxAircraftRestricted() const override;
|
||||
virtual bool isMaxDistanceRestricted() const override;
|
||||
virtual void setInterpolationAndRenderingSetup(const BlackMisc::CInterpolationAndRenderingSetup &setup) override;
|
||||
virtual BlackMisc::CInterpolationAndRenderingSetup getInterpolationAndRenderingSetup() const override;
|
||||
virtual void highlightAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const BlackMisc::PhysicalQuantities::CTime &displayTime) override;
|
||||
virtual bool isRenderingEnabled() const override;
|
||||
virtual bool isRenderingRestricted() const override;
|
||||
virtual const BlackMisc::Simulation::CSimulatorPluginInfo &getSimulatorPluginInfo() const override;
|
||||
virtual const BlackMisc::Simulation::CSimulatorSetup &getSimulatorSetup() const override;
|
||||
virtual void unload() override;
|
||||
virtual void deleteAllRenderingRestrictions() override;
|
||||
virtual int physicallyRemoveMultipleRemoteAircraft(const BlackMisc::Aviation::CCallsignSet &callsigns) override;
|
||||
//! @}
|
||||
|
||||
|
||||
@@ -61,6 +61,9 @@ namespace BlackGui
|
||||
ui->led_RestrictedRendering->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Limited", "Unlimited", 14);
|
||||
ui->led_RenderingEnabled->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Rendering enabled", "No aircraft will be rendered", 14);
|
||||
|
||||
ui->le_MaxAircraft->setValidator(new QIntValidator(ui->le_MaxAircraft));
|
||||
ui->le_MaxDistance->setValidator(new QIntValidator(ui->le_MaxDistance));
|
||||
|
||||
// connects
|
||||
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorPluginChanged, this, &CSettingsSimulatorComponent::ps_simulatorPluginChanged);
|
||||
connect(ui->ps_EnabledSimulators, &CPluginSelector::pluginStateChanged, this, &CSettingsSimulatorComponent::ps_pluginStateChanged);
|
||||
@@ -71,8 +74,10 @@ namespace BlackGui
|
||||
connect(ui->pb_ApplyMaxDistance, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_onApplyMaxRenderedDistance);
|
||||
connect(ui->pb_ClearRestrictedRendering, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_clearRestricedRendering);
|
||||
connect(ui->pb_DisableRendering, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_onApplyDisableRendering);
|
||||
connect(ui->sb_MaxAircraft, &QSpinBox::editingFinished, this, &CSettingsSimulatorComponent::ps_onApplyMaxRenderedAircraft);
|
||||
connect(ui->sb_MaxDistance, &QSpinBox::editingFinished, this, &CSettingsSimulatorComponent::ps_onApplyMaxRenderedDistance);
|
||||
connect(ui->le_MaxAircraft, &QLineEdit::editingFinished, this, &CSettingsSimulatorComponent::ps_onApplyMaxRenderedAircraft);
|
||||
connect(ui->le_MaxDistance, &QLineEdit::editingFinished, this, &CSettingsSimulatorComponent::ps_onApplyMaxRenderedDistance);
|
||||
connect(ui->le_MaxAircraft, &QLineEdit::returnPressed, this, &CSettingsSimulatorComponent::ps_onApplyMaxRenderedAircraft);
|
||||
connect(ui->le_MaxDistance, &QLineEdit::returnPressed, this, &CSettingsSimulatorComponent::ps_onApplyMaxRenderedDistance);
|
||||
|
||||
// list all available simulators
|
||||
for (const auto &p : getAvailablePlugins())
|
||||
@@ -81,6 +86,7 @@ namespace BlackGui
|
||||
ui->ps_EnabledSimulators->addPlugin(p.getIdentifier(), p.getName(), !config.isEmpty(), false);
|
||||
}
|
||||
|
||||
// config
|
||||
ps_reloadPluginConfig();
|
||||
}
|
||||
|
||||
@@ -89,17 +95,19 @@ namespace BlackGui
|
||||
|
||||
void CSettingsSimulatorComponent::setGuiValues()
|
||||
{
|
||||
const CInterpolationAndRenderingSetup setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetup();
|
||||
|
||||
// time sync
|
||||
ui->cb_TimeSync->setEnabled(m_pluginLoaded);
|
||||
ui->le_TimeSyncOffset->setEnabled(m_pluginLoaded);
|
||||
ui->pb_ApplyTimeSync->setEnabled(m_pluginLoaded);
|
||||
|
||||
// led
|
||||
ui->led_RestrictedRendering->setOn(m_pluginLoaded ? sGui->getIContextSimulator()->isRenderingRestricted() : false);
|
||||
ui->lbl_RestrictionText->setText(m_pluginLoaded ? sGui->getIContextSimulator()->getRenderRestrictionText() : "");
|
||||
ui->led_RestrictedRendering->setOn(m_pluginLoaded ? setup.isRenderingRestricted() : false);
|
||||
ui->lbl_RestrictionText->setText(m_pluginLoaded ? setup.getRenderRestrictionText() : "");
|
||||
|
||||
ui->sb_MaxDistance->setEnabled(m_pluginLoaded);
|
||||
ui->sb_MaxAircraft->setEnabled(m_pluginLoaded);
|
||||
ui->le_MaxDistance->setEnabled(m_pluginLoaded);
|
||||
ui->le_MaxAircraft->setEnabled(m_pluginLoaded);
|
||||
ui->pb_ApplyMaxAircraft->setEnabled(m_pluginLoaded);
|
||||
ui->pb_ApplyMaxDistance->setEnabled(m_pluginLoaded);
|
||||
ui->pb_ClearRestrictedRendering->setEnabled((m_pluginLoaded));
|
||||
@@ -112,16 +120,12 @@ namespace BlackGui
|
||||
CTime timeOffset = sGui->getIContextSimulator()->getTimeSynchronizationOffset();
|
||||
ui->le_TimeSyncOffset->setText(timeOffset.formattedHrsMin());
|
||||
|
||||
int maxAircraft = sGui->getIContextSimulator()->getMaxRenderedAircraft();
|
||||
ui->sb_MaxAircraft->setValue(maxAircraft);
|
||||
const int maxAircraft = setup.getMaxRenderedAircraft();
|
||||
ui->le_MaxAircraft->setText(setup.isMaxAircraftRestricted() ? QString::number(maxAircraft) : "");
|
||||
|
||||
CLength distanceBoundary(sGui->getIContextSimulator()->getRenderedDistanceBoundary());
|
||||
int distanceBoundaryNM = distanceBoundary.valueInteger(CLengthUnit::NM());
|
||||
CLength maxDistance(sGui->getIContextSimulator()->getMaxRenderedDistance());
|
||||
int distanceNM = maxDistance.isNull() ? distanceBoundaryNM : maxDistance.valueInteger(CLengthUnit::NM());
|
||||
ui->sb_MaxDistance->setMaximum(distanceBoundaryNM);
|
||||
ui->sb_MaxDistance->setValue(distanceNM);
|
||||
ui->led_RenderingEnabled->setOn(sGui->getIContextSimulator()->isRenderingEnabled());
|
||||
const CLength maxDistance(setup.getMaxRenderedDistance());
|
||||
ui->le_MaxDistance->setText(setup.isMaxDistanceRestricted() ? QString::number(maxDistance.valueInteger(CLengthUnit::NM())) : "");
|
||||
ui->led_RenderingEnabled->setOn(setup.isRenderingEnabled());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -140,10 +144,10 @@ namespace BlackGui
|
||||
|
||||
CSimulatorPluginInfoList simDrivers(getAvailablePlugins());
|
||||
auto selected = std::find_if(simDrivers.begin(), simDrivers.end(),
|
||||
[&identifier](const CSimulatorPluginInfo &info)
|
||||
{
|
||||
return info.getIdentifier() == identifier;
|
||||
});
|
||||
[&identifier](const CSimulatorPluginInfo & info)
|
||||
{
|
||||
return info.getIdentifier() == identifier;
|
||||
});
|
||||
|
||||
if (selected->isUnspecified())
|
||||
{
|
||||
@@ -169,15 +173,18 @@ namespace BlackGui
|
||||
void CSettingsSimulatorComponent::ps_onApplyMaxRenderedAircraft()
|
||||
{
|
||||
// get initial aircraft to render
|
||||
const int noRequested = ui->sb_MaxAircraft->value();
|
||||
const int oldValue = sGui->getIContextSimulator()->getMaxRenderedAircraft();
|
||||
CInterpolationAndRenderingSetup setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetup();
|
||||
int noRequested = ui->le_MaxAircraft->text().isEmpty() ? setup.InfiniteAircraft() : ui->le_MaxAircraft->text().toInt();
|
||||
const int oldValue = setup.getMaxRenderedAircraft();
|
||||
if (oldValue == noRequested) { return; }
|
||||
|
||||
// set value
|
||||
sGui->getIContextSimulator()->setMaxRenderedAircraft(noRequested);
|
||||
setup.setMaxRenderedAircraft(noRequested);
|
||||
sGui->getIContextSimulator()->setInterpolationAndRenderingSetup(setup);
|
||||
|
||||
// re-read real value
|
||||
int noRendered = sGui->getIContextSimulator()->getMaxRenderedAircraft();
|
||||
setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetup();
|
||||
const int noRendered = setup.getMaxRenderedAircraft();
|
||||
if (noRequested == noRendered)
|
||||
{
|
||||
CLogMessage(this).info("Max.rendered aircraft: %1") << noRendered;
|
||||
@@ -185,7 +192,7 @@ namespace BlackGui
|
||||
else
|
||||
{
|
||||
CLogMessage(this).info("Max.rendered aircraft: %1, requested: %2") << noRendered << noRequested;
|
||||
ui->sb_MaxAircraft->setValue(noRendered);
|
||||
ui->le_MaxAircraft->setText(QString::number(noRendered));
|
||||
}
|
||||
this->setGuiValues();
|
||||
}
|
||||
@@ -193,24 +200,32 @@ namespace BlackGui
|
||||
void CSettingsSimulatorComponent::ps_onApplyMaxRenderedDistance()
|
||||
{
|
||||
// get initial aircraft to render
|
||||
int maxDistanceNM = ui->sb_MaxDistance->value();
|
||||
CLength currentDistance(sGui->getIContextSimulator()->getMaxRenderedDistance());
|
||||
if (maxDistanceNM == currentDistance.valueInteger(CLengthUnit::NM()))
|
||||
CInterpolationAndRenderingSetup setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetup();
|
||||
CLength newDistance(0, CLengthUnit::nullUnit());
|
||||
if (!ui->le_MaxDistance->text().isEmpty())
|
||||
{
|
||||
newDistance = CLength(ui->le_MaxDistance->text().toInt(), CLengthUnit::NM());
|
||||
}
|
||||
|
||||
CLength currentDistance(setup.getMaxRenderedDistance());
|
||||
if (currentDistance == newDistance)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
CLength distance(maxDistanceNM, CLengthUnit::NM());
|
||||
CLogMessage(this).info("Max.distance requested: %1") << distance.valueRoundedWithUnit(2, true);
|
||||
sGui->getIContextSimulator()->setMaxRenderedDistance(distance);
|
||||
CLogMessage(this).info("Max.distance requested: %1") << newDistance.valueRoundedWithUnit(2, true);
|
||||
setup.setMaxRenderedDistance(newDistance);
|
||||
sGui->getIContextSimulator()->setInterpolationAndRenderingSetup(setup);
|
||||
this->setGuiValues();
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingsSimulatorComponent::ps_onApplyDisableRendering()
|
||||
{
|
||||
sGui->getIContextSimulator()->setMaxRenderedAircraft(0);
|
||||
CInterpolationAndRenderingSetup setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetup();
|
||||
setup.disableRendering();
|
||||
sGui->getIContextSimulator()->setInterpolationAndRenderingSetup(setup);
|
||||
this->setGuiValues();
|
||||
}
|
||||
|
||||
@@ -235,7 +250,9 @@ namespace BlackGui
|
||||
|
||||
void CSettingsSimulatorComponent::ps_clearRestricedRendering()
|
||||
{
|
||||
sGui->getIContextSimulator()->deleteAllRenderingRestrictions();
|
||||
CInterpolationAndRenderingSetup setup;
|
||||
setup.clearAllRenderingRestrictions();
|
||||
sGui->getIContextSimulator()->setInterpolationAndRenderingSetup(setup);
|
||||
this->setGuiValues();
|
||||
}
|
||||
|
||||
@@ -262,12 +279,12 @@ namespace BlackGui
|
||||
{
|
||||
CSimulatorPluginInfoList simDrivers(getAvailablePlugins());
|
||||
auto selected = std::find_if(simDrivers.begin(), simDrivers.end(),
|
||||
[&identifier](const CSimulatorPluginInfo &info)
|
||||
{
|
||||
return info.getIdentifier() == identifier;
|
||||
});
|
||||
[&identifier](const CSimulatorPluginInfo & info)
|
||||
{
|
||||
return info.getIdentifier() == identifier;
|
||||
});
|
||||
|
||||
QWidget* aw = qApp->activeWindow();
|
||||
QWidget *aw = qApp->activeWindow();
|
||||
|
||||
CPluginDetailsWindow *w = new CPluginDetailsWindow(aw);
|
||||
w->setAttribute(Qt::WA_DeleteOnClose);
|
||||
@@ -282,10 +299,10 @@ namespace BlackGui
|
||||
{
|
||||
CSimulatorPluginInfoList simDrivers(getAvailablePlugins());
|
||||
auto selected = std::find_if(simDrivers.begin(), simDrivers.end(),
|
||||
[&identifier](const CSimulatorPluginInfo &info)
|
||||
{
|
||||
return info.getIdentifier() == identifier;
|
||||
});
|
||||
[&identifier](const CSimulatorPluginInfo & info)
|
||||
{
|
||||
return info.getIdentifier() == identifier;
|
||||
});
|
||||
|
||||
QString configId = m_plugins->getPluginConfigId(selected->getIdentifier());
|
||||
IPluginConfig *config = m_plugins->getPluginById<IPluginConfig>(configId);
|
||||
|
||||
@@ -265,22 +265,22 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="lbl_MaxAircraft">
|
||||
<property name="text">
|
||||
<string>Max.aircraft</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<layout class="QHBoxLayout" name="hl_MaxAircraft">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="sb_MaxAircraft">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
<widget class="QLineEdit" name="le_MaxAircraft">
|
||||
<property name="placeholderText">
|
||||
<string>no restrictions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -311,25 +311,22 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="lbl_MaxDistance">
|
||||
<property name="text">
|
||||
<string>Max.dist.(NM)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="8" column="1">
|
||||
<layout class="QHBoxLayout" name="hl_MaxDistance">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="sb_MaxDistance">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
<widget class="QLineEdit" name="le_MaxDistance">
|
||||
<property name="placeholderText">
|
||||
<string>no restrictions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -29,6 +29,11 @@ namespace BlackMisc
|
||||
return m_maxRenderedDistance.isPositiveWithEpsilonConsidered();
|
||||
}
|
||||
|
||||
bool CInterpolationAndRenderingSetup::isRenderingRestricted() const
|
||||
{
|
||||
return isRenderingEnabled() && (isMaxAircraftRestricted() || isMaxDistanceRestricted());
|
||||
}
|
||||
|
||||
int CInterpolationAndRenderingSetup::getMaxRenderedAircraft() const
|
||||
{
|
||||
return (m_maxRenderedAircraft <= InfiniteAircraft()) ? m_maxRenderedAircraft : InfiniteAircraft();
|
||||
@@ -40,8 +45,7 @@ namespace BlackMisc
|
||||
if (maxRenderedAircraft < 1)
|
||||
{
|
||||
// disable, we set both values to 0
|
||||
m_maxRenderedAircraft = 0;
|
||||
m_maxRenderedDistance = CLength(0.0, CLengthUnit::NM()); // real 0
|
||||
this->disableRendering();
|
||||
}
|
||||
else if (maxRenderedAircraft >= InfiniteAircraft())
|
||||
{
|
||||
@@ -65,8 +69,7 @@ namespace BlackMisc
|
||||
else if (distance.isZeroEpsilonConsidered())
|
||||
{
|
||||
// zero means disabled, we disable max aircraft too
|
||||
this->m_maxRenderedAircraft = 0;
|
||||
this->m_maxRenderedDistance = CLength(0.0, CLengthUnit::NM()); // real 0
|
||||
this->disableRendering();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -76,7 +79,7 @@ namespace BlackMisc
|
||||
return true;
|
||||
}
|
||||
|
||||
void CInterpolationAndRenderingSetup::disableMaxRenderedDistance()
|
||||
void CInterpolationAndRenderingSetup::clearMaxRenderedDistance()
|
||||
{
|
||||
this->setMaxRenderedDistance(CLength(0.0, CLengthUnit::nullUnit()));
|
||||
}
|
||||
@@ -86,17 +89,39 @@ namespace BlackMisc
|
||||
return m_maxRenderedAircraft < InfiniteAircraft();
|
||||
}
|
||||
|
||||
void CInterpolationAndRenderingSetup::deleteAllRenderingRestrictions()
|
||||
void CInterpolationAndRenderingSetup::clearAllRenderingRestrictions()
|
||||
{
|
||||
this->m_maxRenderedDistance = CLength(0, CLengthUnit::nullUnit());
|
||||
this->m_maxRenderedAircraft = InfiniteAircraft();
|
||||
}
|
||||
|
||||
void CInterpolationAndRenderingSetup::disableRendering()
|
||||
{
|
||||
this->m_maxRenderedAircraft = 0;
|
||||
this->m_maxRenderedDistance = CLength(0, CLengthUnit::NM()); // zero distance
|
||||
}
|
||||
|
||||
bool CInterpolationAndRenderingSetup::isMaxDistanceRestricted() const
|
||||
{
|
||||
return !m_maxRenderedDistance.isNull();
|
||||
}
|
||||
|
||||
QString CInterpolationAndRenderingSetup::getRenderRestrictionText() const
|
||||
{
|
||||
if (!this->isRenderingRestricted()) { return "none"; }
|
||||
QString rt;
|
||||
if (this->isMaxAircraftRestricted())
|
||||
{
|
||||
rt.append(QString::number(this->getMaxRenderedAircraft())).append(" A/C");
|
||||
}
|
||||
if (this->isMaxDistanceRestricted())
|
||||
{
|
||||
if (!rt.isEmpty()) { rt.append(" ");}
|
||||
rt.append(this->getMaxRenderedDistance().valueRoundedWithUnit(CLengthUnit::NM(), 0));
|
||||
}
|
||||
return rt;
|
||||
}
|
||||
|
||||
QString CInterpolationAndRenderingSetup::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
|
||||
@@ -71,12 +71,15 @@ namespace BlackMisc
|
||||
bool setMaxRenderedDistance(const BlackMisc::PhysicalQuantities::CLength &distance);
|
||||
|
||||
//! Disable
|
||||
void disableMaxRenderedDistance();
|
||||
void clearMaxRenderedDistance();
|
||||
|
||||
//! Rendering enabled
|
||||
//! Rendering enabled (at all)
|
||||
bool isRenderingEnabled() const;
|
||||
|
||||
//! Max. distance for rendering
|
||||
//! Rendering enabled, but restricted
|
||||
bool isRenderingRestricted() const;
|
||||
|
||||
//! Max.distance for rendering
|
||||
BlackMisc::PhysicalQuantities::CLength getMaxRenderedDistance() const { return m_maxRenderedDistance; }
|
||||
|
||||
//! Restricted by distance?
|
||||
@@ -85,8 +88,14 @@ namespace BlackMisc
|
||||
//! Restricted by quantity?
|
||||
bool isMaxAircraftRestricted() const;
|
||||
|
||||
//! Disable all render restrictions
|
||||
void deleteAllRenderingRestrictions();
|
||||
//! Remove all render restrictions
|
||||
void clearAllRenderingRestrictions();
|
||||
|
||||
//! Entirely disable rendering
|
||||
void disableRendering();
|
||||
|
||||
//! Text describing the restrictions
|
||||
QString getRenderRestrictionText() const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace BlackMisc
|
||||
CAirspaceAircraftSnapshot::CAirspaceAircraftSnapshot(
|
||||
const CSimulatedAircraftList &allAircraft,
|
||||
bool restricted, bool renderingEnabled, int maxAircraft,
|
||||
const CLength &maxRenderedDistance, const CLength &maxRenderedBoundary) :
|
||||
const CLength &maxRenderedDistance) :
|
||||
m_timestampMsSinceEpoch(QDateTime::currentMSecsSinceEpoch()),
|
||||
m_restricted(restricted),
|
||||
m_renderingEnabled(renderingEnabled),
|
||||
@@ -69,13 +69,11 @@ namespace BlackMisc
|
||||
int count = 0; // when max. aircraft reached?
|
||||
for (const CSimulatedAircraft ¤tAircraft : aircraft)
|
||||
{
|
||||
CCallsign cs(currentAircraft.getCallsign());
|
||||
const CCallsign cs(currentAircraft.getCallsign());
|
||||
if (currentAircraft.isEnabled())
|
||||
{
|
||||
CLength distance(currentAircraft.getRelativeDistance());
|
||||
if (count >= maxAircraft ||
|
||||
(!maxRenderedDistance.isNull() && distance >= maxRenderedBoundary) ||
|
||||
(!maxRenderedBoundary.isNull() && distance >= maxRenderedBoundary))
|
||||
if (count >= maxAircraft || (!maxRenderedDistance.isNull() && distance >= maxRenderedDistance))
|
||||
{
|
||||
m_disabledAircraftCallsignsByDistance.push_back(cs);
|
||||
}
|
||||
|
||||
@@ -39,14 +39,11 @@ namespace BlackMisc
|
||||
CAirspaceAircraftSnapshot();
|
||||
|
||||
//! Constructor
|
||||
CAirspaceAircraftSnapshot(
|
||||
const BlackMisc::Simulation::CSimulatedAircraftList &allAircraft,
|
||||
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())
|
||||
);
|
||||
const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance = BlackMisc::PhysicalQuantities::CLength(0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit()));
|
||||
|
||||
//! Time when snapshot was taken
|
||||
const QDateTime getTimestamp() const { return QDateTime::fromMSecsSinceEpoch(m_timestampMsSinceEpoch); }
|
||||
|
||||
Reference in New Issue
Block a user