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:
Klaus Basan
2015-05-28 04:04:28 +02:00
parent 718b10d9f6
commit d8d0eca3d8
13 changed files with 86 additions and 62 deletions

View File

@@ -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
{

View File

@@ -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