14using namespace swift::misc::geo;
15using namespace swift::misc::physical_quantities;
16using namespace swift::misc::math;
20namespace swift::misc::aviation
46 if (this->
size() > index)
48 return (*
this)[index];
55 qint64 newerThanAdjustedMs)
57 if (elevationPlane.
isNull())
135 if (this->
size() < 2)
148 if (!newerSituation.
isNull())
150 Q_ASSERT_X(situation.getAltitude().getReferenceDatum() ==
152 Q_FUNC_INFO,
"Wrong reference");
159 newerSituation = situation;
166 if (this->
size() < 2)
180 if (!newerSituation.
isNull())
182 Q_ASSERT_X(situation.getAltitude().getReferenceDatum() ==
184 Q_FUNC_INFO,
"Wrong reference");
191 newerSituation = situation;
198 if (this->
size() < 2)
213 const CSpeed deltaSpeed = newerGs - situation.getGroundSpeed();
219 newerGs = situation.getGroundSpeed();
226 if (this->
size() < 2)
241 const CSpeed deltaSpeed = newerGs - situation.getGroundSpeed();
247 newerGs = situation.getGroundSpeed();
252 QPair<bool, COnGroundInfo::IsOnGround>
255 if (this->
size() < 2)
257 return {
false, COnGroundInfo::OnGroundSituationUnknown };
263 QPair<bool, COnGroundInfo::IsOnGround> ret(
false, f);
269 bool changed =
false;
273 if (!changed && s.getOnGroundInfo().getOnGround() == f)
282 if (s.getOnGroundInfo().getOnGround() != t)
293 if (this->
size() < 2)
305 return this->
size() - 1 == c;
310 if (this->
size() < 2)
321 const int c = this->
countOnGround(COnGroundInfo::NotOnGround);
322 return this->
size() - 1 == c;
327 if (this->
size() < 2)
334 const double minRotate = stdDevAndMean.first + stdDevAndMean.second;
335 const bool rotate = pitches.
front() > minRotate;
378 if (bestDistance.
isNull() || bestDistance > distance)
380 situationWithElevation = s;
381 bestDistance = distance;
384 return situationWithElevation;
405 if (offset.
isNull() || this->isEmpty())
490 if (gsValues.
size() != this->size())
511 if (this->
size() < 2)
515 Q_ASSERT_X(
m_tsAdjustedSortHint == CAircraftSituationList::AdjustedTimestampLatestFirst, Q_FUNC_INFO,
516 "need latest first");
518 for (
int i = 1; i < this->
size(); ++i)
533 if (this->
size() < minValues)
539 .findWithinRange(reference, range)
540 .sortedByEuclideanDistanceSquared(
reference);
541 if (
sorted.size() < minValues)
561 if (valuesInFt.
size() >= sufficientValues)
567 if (valuesInFt.
size() < minValues)
574 if (elvStdDevMean.first > MaxDevFt)
QPair< CAngle, CAngle > CAnglePair
Pair of angle.
static CAngleUnit deg()
Degrees.
Q_REQUIRED_RESULT CSequence sorted(Predicate p) const
CAircraftSituation & reference
void pop_front()
Removes an element at the front of the sequence.
qint64 getAdjustedMSecsSinceEpoch() const
Timestamp with offset added for interpolation.
bool isSortedAdjustedLatestFirst() const
CAircraftSituationList getSortedAdjustedLatestFirst() const
HintAdjustedTimestampSort m_tsAdjustedSortHint
Value object encapsulating information of aircraft's parts.
Value object encapsulating information of an aircraft's situation.
bool hasGroundElevation() const
Is ground elevation value available.
CAltitude addAltitudeOffset(const physical_quantities::CLength &offset)
Add offset to altitude.
bool transferGroundElevationFromMe(CAircraftSituation &transferToSituation, const physical_quantities::CLength &radius=geo::CElevationPlane::singlePointRadius()) const
Transfer from "this" situation to otherSituation.
aviation::COnGroundInfo getOnGroundInfo() const
On ground info.
GndElevationInfo getGroundElevationInfo() const
How did we get gnd.elevation?
GndElevationInfo
Where did we get elevation from?
@ FromProvider
from swift::misc::simulation::ISimulationEnvironmentProvider
bool setGroundElevationChecked(const geo::CElevationPlane &elevationPlane, GndElevationInfo info, bool transferred=false)
Set elevation of the ground directly beneath, but checked.
static const CAircraftSituation & null()
Null situation.
bool isOnGround() const
Is on ground?
const CAltitude & getGroundElevation() const
Elevation of the ground directly beneath.
void setOnGroundInfo(const aviation::COnGroundInfo &info)
Set the on ground info.
const physical_quantities::CAngle & getPitch() const
Get pitch.
bool isNull() const
Null situation.
const CAltitude & getAltitude() const
Get altitude.
const physical_quantities::CSpeed & getGroundSpeed() const
Get ground speed.
const geo::CElevationPlane & getGroundElevationPlane() const
Elevation of the ground directly beneath.
bool isMoving() const
Is moving? Means ground speed > epsilon.
bool isOnGroundFromNetwork() const
On ground by network flag?
void setOnGroundDetails(COnGroundInfo::OnGroundDetails details)
On ground details.
bool isOnGroundFromParts() const
On ground by parts?
static const physical_quantities::CLength & allowedAltitudeDeviation()
Within this range deviation is so small we consider values "almost constant".
bool adjustGroundFlag(const CAircraftParts &parts, bool alwaysSetDetails, double timeDeviationFactor=0.1, qint64 *differenceMs=nullptr)
Transfer ground flag from parts.
bool isJustTouchingDown(bool alreadySortedLatestFirst=false) const
Is just touching down?
CAircraftSituation findClosestElevationWithinRange(const geo::ICoordinateGeodetic &coordinate, const physical_quantities::CLength &range=geo::CElevationPlane::singlePointRadius()) const
CLosest elevation within given range.
CAircraftSituationList withoutFrontSituation() const
Remove the first situation.
bool isConstAccelerating(bool alreadySortedLatestFirst=false) const
Constantly accelerating?
CAircraftSituationList()=default
Default constructor.
bool isConstNotOnGround() const
Are all situations not on ground?
physical_quantities::CAnglePair pitchStandardDeviationAndMean() const
Pitch angles standard deviation and mean.
QPair< bool, COnGroundInfo::IsOnGround > isGndFlagStableChanging(bool alreadySortedLatestFirst=false) const
Is the ground flag changing for the situations.
int countOnGround(COnGroundInfo::IsOnGround og) const
Count the number of situations with COnGroundInfo::IsOnGround.
CSequence()=default
Default constructor.
QList< double > elevationValues(const physical_quantities::CLengthUnit &unit) const
All elevation values.
QList< double > groundSpeedValues(const physical_quantities::CSpeedUnit &unit) const
All ground speed values.
QList< double > pitchValues(const physical_quantities::CAngleUnit &unit) const
All pitch values.
int setGroundElevationChecked(const geo::CElevationPlane &elevationPlane, CAircraftSituation::GndElevationInfo info, qint64 newerThanAdjustedMs=-1)
Set ground elevation from elevation plane.
geo::CElevationPlane averageElevationOfTaxiingOnGroundAircraft(const CAircraftSituation &reference, const physical_quantities::CLength &range, int minValues=1, int sufficientValues=2) const
Average elevation for "nearby" aircraft "not/slowly moving" and having an elevation.
bool isConstDecelarating(bool alreadySortedLatestFirst=false) const
Constantly decelarating?
CAircraftSituation indexOrNull(int index) const
Index or NULL.
bool isConstDescending(bool alreadySortedLatestFirst=false) const
Constantly descending?
int adjustGroundFlag(const CAircraftParts &parts, double timeDeviationFactor=0.1)
Adjust flag from parts by using CAircraftSituation::adjustGroundFlag.
bool isConstOnGround() const
Are all situations on ground?
int addAltitudeOffset(const physical_quantities::CLength &offset)
Add an offset to each altitude.
bool isRotatingUp(bool alreadySortedLatestFirst=false) const
Is rotating up?
bool isJustTakingOff(bool alreadySortedLatestFirst=false) const
Is just taking off?
int transferElevationForward(const physical_quantities::CLength &radius=geo::CElevationPlane::singlePointRadius())
Transfer elevations forward from older to newer.
void setOnGroundInfo(const COnGroundInfo &info)
Set on ground.
void setOnGroundDetails(COnGroundInfo::OnGroundDetails details)
Set on ground details for all situations.
bool areAllOnGroundDetailsSame(COnGroundInfo::OnGroundDetails details) const
Are all on ground details the same?
bool containsOnGroundDetails(COnGroundInfo::OnGroundDetails details) const
Contains on ground details?
QList< double > altitudeValues(const physical_quantities::CLengthUnit &unit) const
All altitude values.
bool isSortedAdjustedLatestFirstWithoutNullPositions() const
Latest first and no null positions?
bool isConstAscending(bool alreadySortedLatestFirst=false) const
Constantly ascending?
CAircraftSituation backOrNull() const
Back or NULL.
CAircraftSituation frontOrNull() const
Front or NULL.
bool containsPushBack() const
Contains any push back?
physical_quantities::CSpeedPair groundSpeedStandardDeviationAndMean() const
Ground speed standard deviation and mean.
Altitude as used in aviation, can be AGL or MSL altitude.
ReferenceDatum getReferenceDatum() const
Get reference datum (MSL or AGL).
Information about the ground status.
OnGroundDetails
Reliability of on ground information.
@ InFromParts
set from aircraft parts
IsOnGround getOnGround() const
Is on ground?
OnGroundDetails getGroundDetails() const
Get ground details.
Plane of same elevation, can be a single point or larger area (e.g. airport).
static const physical_quantities::CLength & singlePointRadius()
Radius for single point.
bool isNull() const
Existing value?
const aviation::CAltitude & getAltitude() const
Altitude (synonym for geodetic height).
static const CElevationPlane & null()
NULL plane.
Geodetic coordinate, a position in 3D space relative to the reference geoid.
physical_quantities::CLength calculateGreatCircleDistance(const ICoordinateGeodetic &otherCoordinate) const
Great circle distance.
bool containsNullPosition() const
bool containsNullPositionOrHeight() const
CAircraftSituationList findWithGeodeticMSLHeight() const
static QPair< double, double > standardDeviationAndMean(const QList< double > &values)
Standard deviation (first) and mean (second).
Physical unit angle (radians, degrees).
Specialized class for angles (degrees, radian).
Physical unit length (length).
Specialized class for distance units (meter, foot, nautical miles).
static CLengthUnit ft()
Foot ft.
bool isNegativeWithEpsilonConsidered() const
Value <= 0 epsilon considered.
bool isNull() const
Is quantity null?
double value(MU unit) const
Value in given unit.
static const CSpeed & null()
bool isPositiveWithEpsilonConsidered() const
Value >= 0 epsilon considered.
Specialized class for speed units (m/s, ft/s, NM/h).
static CSpeedUnit kts()
Knots.
QList< T >::reference front()
void push_back(QList< T >::parameter_type value)
qsizetype size() const const
#define SWIFT_DEFINE_SEQUENCE_MIXINS(Namespace, T, List)
Explicit template definition of mixins for a CSequence subclass.
QPair< CSpeed, CSpeed > CSpeedPair
Pair of speeds.