Ref T280, provider improvements

* store the changes per callsign
* aircraft stored per callsign
* moved "guessOnGroundAndUpdateModelCG" down to IRemoteAircraftProvider (from airspace monitor, "one level deeper in base class"
This commit is contained in:
Klaus Basan
2018-06-13 23:19:58 +02:00
parent d49831abc4
commit 3467bef45c
8 changed files with 196 additions and 105 deletions

View File

@@ -51,19 +51,16 @@ namespace BlackMisc
return c;
}
int CAircraftSituationList::setGroundElevationCheckedAndGuessGround(const CElevationPlane &elevationPlane, CAircraftSituation::GndElevationInfo info, const CAircraftModel &model)
int CAircraftSituationList::setGroundElevationCheckedAndGuessGround(const CElevationPlane &elevationPlane, CAircraftSituation::GndElevationInfo info, const CAircraftModel &model, CAircraftSituationChange *changeOut)
{
if (elevationPlane.isNull()) { return 0; }
if (this->isEmpty()) { return 0; }
Q_ASSERT_X(this->isSortedAdjustedLatestFirstWithoutNullPositions(), Q_FUNC_INFO, "Need sorted situations without NULL positions");
Q_ASSERT_X(m_tsAdjustedSortHint == CAircraftSituationList::AdjustedTimestampLatestFirst || this->isSortedAdjustedLatestFirstWithoutNullPositions(), Q_FUNC_INFO, "Need sorted situations without NULL positions");
const CAircraftSituationChange change(*this, model.getCG(), model.isVtol(), true, true);
if (changeOut) { *changeOut = change; } // copy over
int c = 0;
bool first = true;
if (this->front().getCallsign().equalsString("AFL2353"))
{
c = 0;
}
bool latest = true;
for (CAircraftSituation &s : *this)
{
@@ -71,10 +68,11 @@ namespace BlackMisc
if (set)
{
// change is only valid for the latest situation
s.guessOnGround(first ? change : CAircraftSituationChange::null(), model);
// this will do nothing if not appropriate
s.guessOnGround(latest ? change : CAircraftSituationChange::null(), model);
c++;
}
first = false;
latest = false;
}
return c;
}