17 using namespace swift::misc::aviation;
18 using namespace swift::misc::geo;
19 using namespace swift::misc::physical_quantities;
20 using namespace swift::misc::simulation;
31 void groundFlagInterpolation();
34 void partsToSituationGndFlag();
47 void CTestInterpolatorParts::groundFlagInterpolation()
56 const qint64 ts = 1425000000000;
57 const qint64 deltaT = 5000;
58 const int number = CRemoteAircraftProviderDummy::MaxPartsPerCallsign;
60 const qint64 farFuture = ts + 3 * number * deltaT;
61 const qint64 farPast = ts - 4 * number * deltaT;
64 for (
int i = 0; i < number; i++)
69 QVERIFY2(parts.
size() == number,
"Wrong parts size of list");
78 interpolator.markAsUnitTest();
87 QVERIFY2(pTs == ts,
"Expect latest ts");
88 result = interpolator.getInterpolation(farPast, setup, 0);
92 QVERIFY2(pTs == oldestTs,
"Expect oldest ts");
101 interpolator.markAsUnitTest();
113 void CTestInterpolatorParts::partsToSituationGndFlag()
118 const qint64 ts = 1425000000000;
119 const qint64 deltaT = 5000;
120 const int number = 10;
123 for (
int i = 0; i < number; i++)
130 for (
int i = 0; i < number; i++)
137 for (
int i = 0; i < number; i++)
152 qint64 distanceMs = -1;
153 const qint64 Offset = 33;
159 QVERIFY2(distanceMs == deltaT - Offset,
"Offset time wrong");
163 CAircraftParts CTestInterpolatorParts::createTestParts(
int number, qint64 ts, qint64 deltaT,
bool onGround)
175 qint64 deltaT, qint64 offset)
178 const CLatitude lat(number, CAngleUnit::deg());
179 const CLongitude lng(180.0 + number, CAngleUnit::deg());
181 const CAngle bank(number, CAngleUnit::deg());
182 const CAngle pitch(number, CAngleUnit::deg());
183 const CSpeed gs(number * 10, CSpeedUnit::km_h());
197 #include "testinterpolatorparts.moc"
Aircraft parts interpolation, mainly ground flag interpolation.
size_type size() const
Returns number of elements in the sequence.
void push_back(const T &value)
Appends an element at the end of the sequence.
void setMSecsSinceEpoch(qint64 mSecsSinceEpoch)
Timestamp as ms value.
qint64 oldestTimestampMsecsSinceEpoch() const
Oldest timestamp.
qint64 getAdjustedMSecsSinceEpoch() const
Timestamp with offset added for interpolation.
void setTimeOffsetMs(qint64 offset)
Milliseconds to add to timestamp for interpolation.
void addMsecsToOffset(qint64 msToAdd)
Adds a time to all offset values.
Value object encapsulating information about aircraft's engines.
Value object encapsulating a list of aircraft engines.
Value object encapsulating information about aircraft's lights.
Value object encapsulating information of aircraft's parts.
void setOnGround(bool onGround)
Set aircraft on ground.
Value object encapsulating a list of aircraft parts.
int setOnGround(bool onGround)
Set on ground for all entries.
Value object encapsulating information of an aircraft's situation.
bool setGroundElevation(const aviation::CAltitude &altitude, GndElevationInfo info, bool transferred=false)
Elevation of the ground directly beneath at the given situation.
aviation::COnGroundInfo getOnGroundInfo() const
On ground info.
void setOnGroundInfo(const aviation::COnGroundInfo &info)
Set the on ground info.
bool adjustGroundFlag(const CAircraftParts &parts, bool alwaysSetDetails, double timeDeviationFactor=0.1, qint64 *differenceMs=nullptr)
Transfer ground flag from parts.
List of aircraft situations.
Altitude as used in aviation, can be AGL or MSL altitude.
Value object encapsulating information of a callsign.
Heading as used in aviation, can be true or magnetic heading.
@ InFromParts
set from aircraft parts
@ NotSetGroundDetails
not set or unknown if correct (e.g.
IsOnGround getOnGround() const
Is on ground?
OnGroundDetails getGroundDetails() const
Get ground details.
Physical unit angle (radians, degrees)
Value object for interpolator and rendering.
Value object for interpolator and rendering per callsign.
const CPartsStatus & getPartsStatus() const
Get status.
Cubic spline interpolator.
bool isSupportingParts() const
Supporting parts.
Dummy implementation for testing purpose.
void insertNewAircraftParts(const aviation::CCallsign &callsign, const aviation::CAircraftParts &parts, bool removeOutdatedParts)
For testing, add new situation and fire signals.
virtual int remoteAircraftPartsCount(const aviation::CCallsign &callsign) const
All parts (per callsign, time history)
void clear()
Clear all data.
Free functions in swift::misc.
SWIFTTEST_MAIN(MiscTest::CTestInterpolatorParts)
main