mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 01:45:38 +08:00
Ref T259, Ref T243 use elevation plane for altitude
general idea: by using the plane class, we can set a elevation and then find a better one * use elevation plane in situation * adjusted depending classes such as hints, lists * using setGroundElevationChecked so elevation can be gradually improved
This commit is contained in:
@@ -30,29 +30,52 @@ namespace BlackMisc
|
||||
CSequence<CAircraftSituation>(il)
|
||||
{ }
|
||||
|
||||
int CAircraftSituationList::setGroundElevationChecked(const CElevationPlane &elevationPlane, bool ignoreNullValues, bool overrideExisting)
|
||||
int CAircraftSituationList::setGroundElevationChecked(const CElevationPlane &elevationPlane, qint64 newerThanAdjustedMs)
|
||||
{
|
||||
if (ignoreNullValues && elevationPlane.isNull()) { return 0; }
|
||||
if (elevationPlane.isNull()) { return 0; }
|
||||
int c = 0;
|
||||
for (CAircraftSituation &s : *this)
|
||||
{
|
||||
const bool set = s.setGroundElevationChecked(elevationPlane, ignoreNullValues, overrideExisting);
|
||||
if (newerThanAdjustedMs >= 0 && s.getAdjustedMSecsSinceEpoch() <= newerThanAdjustedMs) { continue; }
|
||||
const bool set = s.setGroundElevationChecked(elevationPlane);
|
||||
if (set) { c++; }
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
int CAircraftSituationList::setGroundElevationChecked(const CElevationPlane &elevationPlane, qint64 newerThanAdjustedMs, bool ignoreNullValues, bool overrideExisting)
|
||||
int CAircraftSituationList::adjustGroundFlag(const CAircraftParts &parts, double timeDeviationFactor)
|
||||
{
|
||||
if (ignoreNullValues && elevationPlane.isNull()) { return 0; }
|
||||
int c = 0;
|
||||
for (CAircraftSituation &s : *this)
|
||||
for (CAircraftSituation &situation : *this)
|
||||
{
|
||||
if (s.getAdjustedMSecsSinceEpoch() <= newerThanAdjustedMs) { continue; }
|
||||
const bool set = s.setGroundElevationChecked(elevationPlane, ignoreNullValues, overrideExisting);
|
||||
if (set) { c++; }
|
||||
if (situation.adjustGroundFlag(parts, timeDeviationFactor)) { c++; };
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
int CAircraftSituationList::extrapolateGroundFlag()
|
||||
{
|
||||
if (this->isEmpty()) { return 0; }
|
||||
CAircraftSituationList withInfo = this->findByInboundGroundInformation(true);
|
||||
withInfo.sortLatestFirst();
|
||||
if (withInfo.isEmpty()) { return 0; }
|
||||
const CAircraftSituation latest = withInfo.front();
|
||||
|
||||
int c = 0;
|
||||
for (CAircraftSituation &situation : *this)
|
||||
{
|
||||
if (situation.isNewerThanAdjusted(latest))
|
||||
{
|
||||
situation.setOnGround(latest.isOnGround(), latest.getOnGroundDetails());
|
||||
c++;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
CAircraftSituationList CAircraftSituationList::findByInboundGroundInformation(bool hasGroundInfo) const
|
||||
{
|
||||
return this->findBy(&CAircraftSituation::hasInboundGroundInformation, hasGroundInfo);
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user