mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-28 11:45:40 +08:00
refs #551, formatting and minor changes found during searching for the issue
This commit is contained in:
@@ -189,7 +189,8 @@ namespace BlackCore
|
|||||||
maxRenderedBoundary = this->m_simulatorMaxRenderedBoundary;
|
maxRenderedBoundary = this->m_simulatorMaxRenderedBoundary;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \fixme Analyzer: generate only when restricted?
|
// remark for simulation snapshot is used when there are restrictions
|
||||||
|
// nevertheless we calculate all the time as the snapshot could be used in other scenarios
|
||||||
|
|
||||||
CSimulatedAircraftList aircraftInRange(getAircraftInRange()); // thread safe copy from provider
|
CSimulatedAircraftList aircraftInRange(getAircraftInRange()); // thread safe copy from provider
|
||||||
CAirspaceAircraftSnapshot snapshot(
|
CAirspaceAircraftSnapshot snapshot(
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
// data, split situations by time
|
// data, split situations by time
|
||||||
if (currentTimeMsSinceEpoc < 0) { currentTimeMsSinceEpoc = QDateTime::currentMSecsSinceEpoch(); }
|
if (currentTimeMsSinceEpoc < 0) { currentTimeMsSinceEpoc = QDateTime::currentMSecsSinceEpoch(); }
|
||||||
qint64 splitTimeMsSinceEpoch = currentTimeMsSinceEpoc - TimeOffsetMs;
|
qint64 splitTimeMsSinceEpoch = currentTimeMsSinceEpoc - TimeOffsetMs; // \todo needs to be variable in the future with interim positions
|
||||||
|
|
||||||
QList<CAircraftSituationList> splitSituations(remoteAircraftSituations(callsign).splitByTime(splitTimeMsSinceEpoch, true));
|
QList<CAircraftSituationList> splitSituations(remoteAircraftSituations(callsign).splitByTime(splitTimeMsSinceEpoch, true));
|
||||||
CAircraftSituationList &situationsNewer = splitSituations[0]; // newer part
|
CAircraftSituationList &situationsNewer = splitSituations[0]; // newer part
|
||||||
@@ -87,7 +87,8 @@ namespace BlackCore
|
|||||||
// < 0 should not happen due to the split, > 1 can happen if new values are delayed beyond split time
|
// < 0 should not happen due to the split, > 1 can happen if new values are delayed beyond split time
|
||||||
// 1) values > 1 mean extrapolation
|
// 1) values > 1 mean extrapolation
|
||||||
// 2) values > 2 mean no new situations coming in
|
// 2) values > 2 mean no new situations coming in
|
||||||
double simulationTimeFraction = 1 - ((newSituation.getMSecsSinceEpoch() - splitTimeMsSinceEpoch) / deltaTime);
|
double distanceToSplitTime = newSituation.getMSecsSinceEpoch() - splitTimeMsSinceEpoch;
|
||||||
|
double simulationTimeFraction = 1 - (distanceToSplitTime / deltaTime);
|
||||||
if (simulationTimeFraction > 2.0)
|
if (simulationTimeFraction > 2.0)
|
||||||
{
|
{
|
||||||
if (this->m_withDebugMsg)
|
if (this->m_withDebugMsg)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
this->setObjectName("Simulator: " + info.getIdentifier());
|
this->setObjectName("Simulator: " + info.getIdentifier());
|
||||||
|
|
||||||
// provider signals
|
// provider signals, hook up with remote aircraft provider
|
||||||
m_remoteAircraftProviderConnections.append(
|
m_remoteAircraftProviderConnections.append(
|
||||||
this->m_remoteAircraftProvider->connectRemoteAircraftProviderSignals(
|
this->m_remoteAircraftProvider->connectRemoteAircraftProviderSignals(
|
||||||
this, // receiver must match object in bind
|
this, // receiver must match object in bind
|
||||||
@@ -339,7 +339,7 @@ namespace BlackCore
|
|||||||
changed = r > 0;
|
changed = r > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we handled snapshot
|
// we have handled snapshot
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
emit airspaceSnapshotHandled();
|
emit airspaceSnapshotHandled();
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace BlackCore
|
|||||||
//! Slow timer used to highlight aircraft, can be used for other things too
|
//! Slow timer used to highlight aircraft, can be used for other things too
|
||||||
virtual void ps_oneSecondTimer();
|
virtual void ps_oneSecondTimer();
|
||||||
|
|
||||||
//! Recalculate the rendered aircraft
|
//! Recalculate the rendered aircraft, this happens when restrictions are applied (max. aircraft, range)
|
||||||
virtual void ps_recalculateRenderedAircraft(const BlackMisc::Simulation::CAirspaceAircraftSnapshot &snapshot);
|
virtual void ps_recalculateRenderedAircraft(const BlackMisc::Simulation::CAirspaceAircraftSnapshot &snapshot);
|
||||||
|
|
||||||
//! Provider added situation
|
//! Provider added situation
|
||||||
|
|||||||
@@ -33,15 +33,23 @@ namespace BlackMisc
|
|||||||
|
|
||||||
CSimulatedAircraftList aircraft(allAircraft);
|
CSimulatedAircraftList aircraft(allAircraft);
|
||||||
aircraft.sortByDistanceToOwnAircraft();
|
aircraft.sortByDistanceToOwnAircraft();
|
||||||
|
int numberAll = aircraft.size();
|
||||||
|
Q_ASSERT_X(numberAll == allAircraft.size(), Q_FUNC_INFO, "aircraft got lost");
|
||||||
CSimulatedAircraftList vtolAircraft(aircraft.findByVtol(true));
|
CSimulatedAircraftList vtolAircraft(aircraft.findByVtol(true));
|
||||||
|
int numberVtol = vtolAircraft.size();
|
||||||
m_aircraftCallsignsByDistance = aircraft.getCallsigns();
|
m_aircraftCallsignsByDistance = aircraft.getCallsigns();
|
||||||
|
Q_ASSERT_X(m_aircraftCallsignsByDistance.size() == allAircraft.size(), Q_FUNC_INFO, "redundant or missing callsigns");
|
||||||
m_vtolAircraftCallsignsByDistance = vtolAircraft.getCallsigns();
|
m_vtolAircraftCallsignsByDistance = vtolAircraft.getCallsigns();
|
||||||
|
Q_ASSERT_X(m_vtolAircraftCallsignsByDistance.size() == numberVtol, Q_FUNC_INFO, "redundant or missing callsigns");
|
||||||
|
|
||||||
// no restrictions, just find by attributes
|
// no restrictions, just find by attributes
|
||||||
if (!restricted)
|
if (!restricted)
|
||||||
{
|
{
|
||||||
m_enabledAircraftCallsignsByDistance = aircraft.findByEnabled(true).getCallsigns();
|
m_enabledAircraftCallsignsByDistance = aircraft.findByEnabled(true).getCallsigns();
|
||||||
m_disabledAircraftCallsignsByDistance = aircraft.findByEnabled(false).getCallsigns();
|
m_disabledAircraftCallsignsByDistance = aircraft.findByEnabled(false).getCallsigns();
|
||||||
|
int numberEnabled = m_enabledAircraftCallsignsByDistance.size();
|
||||||
|
int numberDisabled = m_disabledAircraftCallsignsByDistance.size();
|
||||||
|
Q_ASSERT_X(numberEnabled + numberDisabled == numberAll, Q_FUNC_INFO, "Mismatch in enabled/disabled/all");
|
||||||
m_enabledVtolAircraftCallsignsByDistance = vtolAircraft.findByEnabled(true).getCallsigns();
|
m_enabledVtolAircraftCallsignsByDistance = vtolAircraft.findByEnabled(true).getCallsigns();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ namespace BlackMisc
|
|||||||
//! Constructor
|
//! Constructor
|
||||||
CAirspaceAircraftSnapshot(
|
CAirspaceAircraftSnapshot(
|
||||||
const BlackMisc::Simulation::CSimulatedAircraftList &allAircraft,
|
const BlackMisc::Simulation::CSimulatedAircraftList &allAircraft,
|
||||||
bool restricted = false,
|
bool restricted = false,
|
||||||
bool renderingEnabled = true,
|
bool renderingEnabled = true,
|
||||||
int maxAircraft = 100,
|
int maxAircraft = 100,
|
||||||
const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance = BlackMisc::PhysicalQuantities::CLength(0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit()),
|
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 &maxRenderedBoundary = BlackMisc::PhysicalQuantities::CLength(0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit())
|
||||||
);
|
);
|
||||||
@@ -103,9 +103,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
BlackMisc::Aviation::CCallsignSet m_vtolAircraftCallsignsByDistance;
|
BlackMisc::Aviation::CCallsignSet m_vtolAircraftCallsignsByDistance;
|
||||||
BlackMisc::Aviation::CCallsignSet m_enabledVtolAircraftCallsignsByDistance;
|
BlackMisc::Aviation::CCallsignSet m_enabledVtolAircraftCallsignsByDistance;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user