13 using namespace swift::misc::aviation;
14 using namespace swift::misc::physical_quantities;
15 using namespace swift::misc::geo;
16 using namespace swift::misc::json;
17 using namespace swift::config;
19 namespace swift::misc::simulation
21 const QStringList &CRemoteAircraftProvider::getLogCategories()
34 return { aircraftInRange };
61 if (!m_situationsByCallsign.
contains(callsign)) {
return empty; }
62 return m_situationsByCallsign[callsign];
68 if (index < 0 || index >= situations.
size()) {
return CAircraftSituation::null(); }
69 return situations[index];
84 return { situations };
92 return { situations };
98 if (!m_situationsByCallsign.
contains(callsign)) {
return -1; }
99 return m_situationsByCallsign[callsign].
size();
106 if (!m_partsByCallsign.
contains(callsign)) {
return empty; }
107 return m_partsByCallsign[callsign];
113 if (!m_partsByCallsign.
contains(callsign)) {
return -1; }
114 return m_partsByCallsign[callsign].
size();
120 return m_aircraftWithParts.
contains(callsign);
126 return m_aircraftWithParts.
size();
132 return m_aircraftWithParts;
139 return m_changesByCallsign[callsign];
145 return m_changesByCallsign[callsign].
size();
151 return m_aircraftInRange.
size();
161 m_partsByCallsign.
clear();
162 m_aircraftWithParts.
clear();
164 m_partsLastModified.
clear();
168 m_situationsByCallsign.
clear();
169 m_latestSituationByCallsign.
clear();
170 m_latestOnGroundProviderElevation.
clear();
171 m_situationsAdded = 0;
172 m_situationsLastModified.
clear();
173 m_testOffset.
clear();
177 m_changesByCallsign.
clear();
182 m_aircraftPartsMessages.
clear();
186 m_reverseLookupMessages.
clear();
190 m_aircraftInRange.
clear();
191 m_dbCGPerCallsign.
clear();
200 m_reverseLookupMessages.
remove(callsign);
218 bool skipEqualValues)
220 Q_ASSERT_X(!callsign.
isEmpty(), Q_FUNC_INFO,
"Missing callsign");
224 if (!m_aircraftInRange.
contains(callsign)) {
return 0; }
225 c = m_aircraftInRange[callsign].apply(vm, skipEqualValues).
size();
235 Q_ASSERT_X(!callsign.
isEmpty(), Q_FUNC_INFO,
"Missing callsign");
238 if (!m_aircraftInRange.
contains(callsign)) {
return false; }
248 bool allowTestAltitudeOffset)
251 if (cs.
isEmpty()) {
return situation; }
254 if (CBuildConfig::isLocalDeveloperDebugBuild())
274 m_situationsLastModified[cs] = now;
276 newSituationsList.
setAdjustedSortHint(CAircraftSituationList::AdjustedTimestampLatestFirst);
277 const int situations = newSituationsList.
size();
285 return situationCorrected;
293 newSituationsList.
setAdjustedSortHint(CAircraftSituationList::AdjustedTimestampLatestFirst);
303 m_latestSituationByCallsign[cs] = situationCorrected;
306 if (CBuildConfig::isLocalDeveloperDebugBuild())
309 "wrong adjusted sort order");
312 Q_FUNC_INFO,
"Wrong size");
319 aircraftModel.
isVtol(),
true,
false);
324 updatedSituations = m_situationsByCallsign[cs];
329 Q_ASSERT_X(!updatedSituations.
isEmpty(), Q_FUNC_INFO,
"Missing situations");
332 this->storeChange(change);
338 return situationCorrected;
345 if (callsign.
isEmpty()) {
return; }
353 m_partsLastModified[callsign] = ts;
360 correctiveParts = partsList;
368 if (!correctiveParts.
isEmpty())
373 if (c > 0) { m_situationsLastModified[callsign] = ts; }
379 if (m_aircraftInRange.
contains(callsign))
391 m_aircraftWithParts.
insert(callsign);
398 qint64 currentOffsetMs)
401 const bool isFull = jsonObject.
value(CAircraftParts::attributeNameIsFullJson()).
toBool();
405 if (!isFull) {
return; }
417 if (CBuildConfig::isLocalDeveloperDebugBuild())
420 const int attributes = jsonObject.
size();
421 const bool correctCount = (attributes == CAircraftParts::attributesCountFullJson);
422 SWIFT_VERIFY_X(correctCount || !CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO,
423 "Wrong full aircraft parts");
427 << attributes << CAircraftParts::attributesCountFullJson;
432 if (attributes < 1) {
return; }
477 if (m_aircraftPartsMessages.
contains(callsign))
482 else { m_aircraftPartsMessages.
insert(callsign, message); }
513 if (!m_aircraftInRange.
contains(callsign)) {
return false; }
514 return m_aircraftInRange[callsign].setEnabled(enabledForRendering);
519 if (callsigns.
isEmpty()) {
return 0; }
524 if (!m_aircraftInRange.
contains(cs)) {
continue; }
525 if (m_aircraftInRange[cs].setEnabled(enabledForRendering)) { c++; }
551 if (!m_aircraftInRange.
contains(callsign)) {
return false; }
552 return m_aircraftInRange[callsign].setFastPositionUpdates(enableFastPositonUpdates);
558 if (!m_aircraftInRange.
contains(callsign)) {
return false; }
559 return m_aircraftInRange[callsign].setRendered(rendered);
564 if (callsigns.
isEmpty()) {
return 0; }
568 if (!m_aircraftInRange.
contains(cs)) {
continue; }
569 if (m_aircraftInRange[cs].setRendered(rendered)) { c++; }
577 bool *setForOnGroundPosition)
585 bool setForOnGndPosition =
false;
591 if (situations.
isEmpty()) {
return 0; }
593 &setForOnGndPosition);
594 if (updated < 1) {
return 0; }
595 m_situationsLastModified[callsign] = now;
597 if (info == CAircraftSituation::FromProvider && latestSituation.
isOnGround())
599 m_latestOnGroundProviderElevation[callsign] = latestSituation;
604 if (!change.
isNull()) { this->storeChange(change); }
608 if (m_aircraftInRange.
contains(callsign))
610 m_aircraftInRange[callsign].setGroundElevationChecked(elevation, info);
613 if (setForOnGroundPosition) { *setForOnGroundPosition = setForOnGndPosition; }
620 if (!m_aircraftInRange.
contains(callsign)) {
return false; }
621 m_aircraftInRange[callsign].setCG(cg);
629 if (!m_aircraftInRange.
contains(callsign)) {
return false; }
639 if (modelString.
isEmpty()) {
return callsigns; }
647 callsigns.
push_back(aircraft.getCallsign());
656 return m_dbCGPerCallsign.
contains(callsign) ? m_dbCGPerCallsign[callsign] : CLength::null();
662 return m_dbCGPerCallsign.
contains(modelString) ? m_dbCGPerCallsign[modelString] : CLength::null();
668 m_dbCGPerCallsign[callsign] = cgFromDB;
674 m_dbCGPerModelString[modelString] = cgFromDB;
681 for (
const CCallsign &cs : callsigns) { m_aircraftInRange[cs].setRendered(
false); }
687 m_enableReverseLookupMsgs = enable;
693 return m_enableReverseLookupMsgs;
699 return m_reverseLookupMessages.
value(callsign);
705 if (callsign.
isEmpty()) {
return; }
706 if (messages.
isEmpty()) {
return; }
708 if (!m_enableReverseLookupMsgs) {
return; }
709 if (m_reverseLookupMessages.
contains(callsign))
714 else { m_reverseLookupMessages.
insert(callsign, messages); }
719 if (callsign.
isEmpty()) {
return; }
720 if (message.
isEmpty()) {
return; }
727 if (callsign.
isEmpty()) {
return; }
728 if (message.
isEmpty()) {
return; }
737 if (callsign.
isEmpty()) {
return false; }
739 return m_testOffset.
contains(callsign);
765 return m_enableReverseLookupMsgs;
773 bool *setForOnGroundPosition)
775 if (setForOnGroundPosition) { *setForOnGroundPosition =
false; }
776 if (elevationPlane.
isNull()) {
return 0; }
777 if (situations.
isEmpty()) {
return 0; }
786 bool setForOnGndPosition =
false;
790 const bool set = s.setGroundElevationChecked(elevationPlane, info);
795 const bool guessed = (latest ? simpleChange : CAircraftSituationChange::null()).guessOnGround(s, model);
801 if (!setForOnGndPosition && s.hasInboundGroundDetails() && s.isOnGround())
803 setForOnGndPosition =
true;
809 if (setForOnGroundPosition) { *setForOnGroundPosition = setForOnGndPosition; }
822 return m_aircraftPartsMessages.
value(callsign);
828 return m_enableAircraftPartsHistory;
834 m_enableAircraftPartsHistory = enabled;
840 return m_situationsAdded;
846 return m_situationsLastModified.
value(callsign, -1);
852 return m_partsLastModified.
value(callsign, -1);
856 const CLength &range,
int minValues,
857 int sufficientValues)
const
869 m_testOffset.
remove(callsign);
873 m_testOffset[callsign] = offset;
885 if (callsign.
isEmpty()) {
return false; }
887 return m_aircraftInRange.
contains(callsign);
892 if (callsign.
isEmpty()) {
return false; }
900 std::function<
void(
const CCallsign &)> removedAircraftFunction,
903 Q_ASSERT_X(receiver, Q_FUNC_INFO,
"Missing receiver");
911 Q_ASSERT_X(c1 || !addedSituationFunction, Q_FUNC_INFO,
"connect failed");
916 Q_ASSERT_X(c2 || !addedPartsFunction, Q_FUNC_INFO,
"connect failed");
921 Q_ASSERT_X(c3 || !removedAircraftFunction, Q_FUNC_INFO,
"connect failed");
926 Q_ASSERT_X(c4 || !aircraftSnapshotSlot, Q_FUNC_INFO,
"connect failed");
934 m_partsByCallsign.
remove(callsign);
935 m_aircraftWithParts.
remove(callsign);
936 m_partsLastModified.
remove(callsign);
940 m_situationsByCallsign.
remove(callsign);
941 m_latestSituationByCallsign.
remove(callsign);
942 m_latestOnGroundProviderElevation.
remove(callsign);
943 m_situationsLastModified.
remove(callsign);
947 m_aircraftPartsMessages.
remove(callsign);
949 bool removedCallsign =
false;
952 m_dbCGPerCallsign.
remove(callsign);
953 const int c = m_aircraftInRange.
remove(callsign);
954 removedCallsign = c > 0;
956 return removedCallsign;
961 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
962 return this->
provider()->getAircraftInRange();
967 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
968 return this->
provider()->isAircraftInRange(callsign);
973 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
974 return this->
provider()->isVtolAircraft(callsign);
979 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
980 return this->
provider()->getAircraftInRangeCount();
985 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
986 return this->
provider()->getAircraftInRangeCallsigns();
991 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
992 return this->
provider()->getAircraftInRangeForCallsign(callsign);
997 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
998 return this->
provider()->getAircraftInRangeModelForCallsign(callsign);
1003 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1004 return this->
provider()->getLatestAirspaceAircraftSnapshot();
1010 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1011 return this->
provider()->remoteAircraftSituations(callsign);
1016 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1017 return this->
provider()->remoteAircraftSituation(callsign, index);
1022 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1023 return this->
provider()->latestRemoteAircraftSituations();
1028 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1029 return this->
provider()->latestOnGroundProviderElevations();
1034 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1035 return this->
provider()->remoteAircraftSituationChanges(callsign);
1040 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1041 return this->
provider()->remoteAircraftParts(callsign);
1046 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1047 return this->
provider()->remoteAircraftPartsCount(callsign);
1052 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1053 return this->
provider()->remoteAircraftSupportingParts();
1058 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1059 return this->
provider()->remoteAircraftSituationsCount(callsign);
1065 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1066 return this->
provider()->updateAircraftModel(callsign, model, originator);
1072 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1073 return this->
provider()->updateAircraftNetworkModel(callsign, model, originator);
1078 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1079 return this->
provider()->updateAircraftRendered(callsign, rendered);
1084 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1085 return this->
provider()->updateMultipleAircraftRendered(callsigns, rendered);
1090 bool *updatedAircraftGroundElevation)
1092 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1093 return this->
provider()->updateAircraftGroundElevation(callsign, elevation, info,
1094 updatedAircraftGroundElevation);
1099 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1100 return this->
provider()->updateCG(callsign, cg);
1105 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1106 return this->
provider()->updateCGForModel(modelString, cg);
1112 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1113 return this->
provider()->updateCGAndModelString(callsign, cg, modelString);
1118 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1119 this->
provider()->updateMarkAllAsNotRendered();
1124 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1125 return this->
provider()->aircraftSituationsAdded();
1130 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1131 return this->
provider()->aircraftPartsAdded();
1136 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1137 return this->
provider()->situationsLastModified(callsign);
1142 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1143 return this->
provider()->partsLastModified(callsign);
1147 const CLength &range,
int minValues)
const
1149 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1150 return this->
provider()->averageElevationOfNonMovingAircraft(reference, range, minValues);
1155 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1156 return this->
provider()->isRemoteAircraftSupportingParts(callsign);
1161 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1162 return this->
provider()->getRemoteAircraftSupportingPartsCount();
1167 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1168 return this->
provider()->updateAircraftEnabled(callsign, enabledForRendering);
1173 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1174 return this->
provider()->setAircraftEnabledFlag(callsign, enabledForRendering);
1179 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1180 return this->
provider()->updateMultipleAircraftEnabled(callsigns, enabledForRendering);
1193 if (partsList.
isEmpty()) {
return; }
1199 Q_ASSERT_X(!partsList.
isEmpty(), Q_FUNC_INFO,
"Need at least 1 value");
1204 static const CCallsign wildcard(
"ZZZZ");
size_type size() const
Returns number of elements in the collection.
void remove(const T &object)
Efficient remove using the find and erase of the implementation container. Typically O(log n).
iterator insert(const_iterator hint, const T &value)
For compatibility with std::inserter.
bool isEmpty() const
Synonym for empty.
iterator push_back(const T &value)
Synonym for insert.
void clear()
Removes all elements in the collection.
Base class with a member CIdentifier to be inherited by a class which has an identity in the environm...
bool isMyIdentifier(const CIdentifier &otherIdentifier) const
My identifier?
Value object encapsulating information identifying a component of a modular distributed swift process...
Thrown when a convertFromJson method encounters an unrecoverable error in JSON data.
static const QString & matching()
Matching.
static const QString & network()
Network specific, but not necessarily one specific flight network.
Class for emitting a log message.
static void preformatted(const CStatusMessage &statusMessage)
Sends a verbatim, preformatted message to the log.
Derived & warning(const char16_t(&format)[N])
Set the severity to warning, providing a format string.
bool isEmpty() const
Message empty.
Specialized value object compliant map for variants, based on indexes.
bool contains(const T &object) const
Return true if there is an element equal to given object. Uses the most efficient implementation avai...
size_type size() const
Returns number of elements in the sequence.
const_reference frontOrDefault() const
Access the first element, or a default-initialized value if the sequence is empty.
void push_back(const T &value)
Appends an element at the end of the sequence.
reference front()
Access the first element.
bool isEmpty() const
Synonym for empty.
Streamable status message, e.g.
static CStatusMessage fromJsonException(const CJsonException &ex, const CLogCategoryList &categories, const QString &prefix)
Object from JSON exception message.
constexpr static auto SeverityDebug
Status severities.
void setSeverity(StatusSeverity severity)
Severity.
constexpr static auto SeverityInfo
Status severities.
Status messages, e.g. from Core -> GUI.
static CVariant from(T &&value)
Synonym for fromValue().
IRemoteAircraftProvider * provider()
Provider.
void setCurrentUtcTime()
Set the current time as timestamp.
qint64 latestTimestampMsecsSinceEpoch() const
Latest timestamp.
OBJ latestObject() const
Latest object.
int removeBefore(const QDateTime &dateTime)
Remove objects with timestamp before dateTime.
bool isSortedLatestFirst() const
Is completely sorted: latest last.
qint64 getTimeOffsetMs() const
Milliseconds to add to timestamp for interpolation.
void setTimeOffsetMs(qint64 offset)
Milliseconds to add to timestamp for interpolation.
bool isSortedAdjustedLatestFirst() const
Is completely sorted: latest last.
void setAdjustedSortHint(HintAdjustedTimestampSort hint)
Set the hint.
MillisecondsMinMaxMean getOffsetMinMaxMean() const
Difference of timestamp values.
void push_frontKeepLatestAdjustedFirst(const OBJ &value, bool replaceSameTimestamp=true, int maxElements=-1)
Insert as first element by keeping maxElements and the latest first.
void prefillLatestAdjustedFirst(const OBJ &value, int elements, qint64 deltaTimeMs=-1)
Prefill with elements.
void push_frontKeepLatestFirstAdjustOffset(const OBJ &value, bool replaceSameTimestamp=true, int maxElements=-1)
Insert as first element by keeping maxElements and the latest first.
Value object encapsulating information of aircraft's parts.
void setPartsDetails(PartsDetails details)
Set parts details.
Value object encapsulating a list of aircraft parts.
Value object about changes in situations.
const CCallsign & getCallsign() const
Get callsign.
bool guessOnGround(CAircraftSituation &situation, const simulation::CAircraftModel &model) const
Guess on ground flag.
Value object encapsulating a list of aircraft parts.
Value object encapsulating information of an aircraft's situation.
void setCG(const physical_quantities::CLength &cg)
Set CG.
aviation::COnGroundInfo getOnGroundInfo() const
On ground info.
bool shouldGuessOnGround() const
Should we guess on ground?
CAircraftSituation withAltitudeOffset(const physical_quantities::CLength &offset) const
Situation with altitude offset.
GndElevationInfo
Where did we get elevation from?
bool hasCG() const
Has CG set?
bool hasVelocity() const
Is velocity non-zero?
bool isOnGround() const
Is on ground?
const CCallsign & getCallsign() const
Corresponding callsign.
const physical_quantities::CLength & getCG() const
Get CG if any.
bool hasInboundGroundDetails() const
Has inbound ground details.
List of aircraft situations.
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.
int adjustGroundFlag(const CAircraftParts &parts, double timeDeviationFactor=0.1)
Adjust flag from parts by using CAircraftSituation::adjustGroundFlag.
int transferElevationForward(const physical_quantities::CLength &radius=geo::CElevationPlane::singlePointRadius())
Transfer elevations forward from older to newer.
void setOnGroundDetails(COnGroundInfo::OnGroundDetails details)
Set on ground details for all situations.
bool isSortedAdjustedLatestFirstWithoutNullPositions() const
Latest first and no null positions?
Value object encapsulating information of a callsign.
bool isEmpty() const
Is empty?
Value object for a set of callsigns.
OnGroundDetails getGroundDetails() const
Get ground details.
OBJ findFirstByCallsign(const CCallsign &callsign, const OBJ &ifNotFound={}) const
Find the first aircraft by callsign, if none return given one.
Plane of same elevation, can be a single point or larger area (e.g. airport)
bool isNull() const
Existing value?
bool isValidVectorRange() const
Check values.
void setRelativeDistance(const physical_quantities::CLength &distance)
Set relative distance.
void setRelativeBearing(const physical_quantities::CAngle &angle)
Set bearing to own plane.
QString toQString(bool i18n=false) const
Cast as QString.
Physical unit angle (radians, degrees)
Physical unit length (length)
bool isNull() const
Is quantity null?
bool isZeroEpsilonConsidered() const
Quantity value <= epsilon.
Aircraft model (used by another pilot, my models on disk)
bool isVtol() const
VTOL aircraft?
const physical_quantities::CLength & getCG() const
Get center of gravity.
bool hasCG() const
CG value available?
Current situation in the skies analyzed.
geo::CElevationPlane averageElevationOfNonMovingAircraft(const aviation::CAircraftSituation &reference, const physical_quantities::CLength &range, int minValues=1) const
Average elevation of aircraft in given range, which are NOT moving.
int aircraftSituationsAdded() const
Number of situations added.
CAirspaceAircraftSnapshot getLatestAirspaceAircraftSnapshot() const
Current snapshot.
aviation::CCallsignSet getAircraftInRangeCallsigns() const
Unique callsigns for aircraft in range.
bool isAircraftInRange(const aviation::CCallsign &callsign) const
Is aircraft in range?
aviation::CAircraftSituationList latestRemoteAircraftSituations() const
Latest aircraft situation for all callsigns.
aviation::CAircraftSituation remoteAircraftSituation(const aviation::CCallsign &callsign, int index) const
Rendered aircraft situations (per callsign and index)
bool updateMultipleAircraftEnabled(const aviation::CCallsignSet &callsigns, bool enabledForRendering)
Enable/disable aircraft.
qint64 partsLastModified(const aviation::CCallsign &callsign) const
When last modified.
aviation::CAircraftSituationList remoteAircraftSituations(const aviation::CCallsign &callsign) const
Rendered aircraft situations (per callsign, time history)
qint64 situationsLastModified(const aviation::CCallsign &callsign) const
When last modified.
bool updateMultipleAircraftRendered(const aviation::CCallsignSet &callsigns, bool rendered)
Set aircraft rendered.
CSimulatedAircraftList getAircraftInRange() const
All remote aircraft.
int updateAircraftGroundElevation(const aviation::CCallsign &callsign, const geo::CElevationPlane &elevation, aviation::CAircraftSituation::GndElevationInfo info, bool *updateAircraftGroundElevation)
Update the ground elevation.
int getAircraftInRangeCount() const
Count remote aircraft.
aviation::CAircraftSituationList latestOnGroundProviderElevations() const
Latest aircraft situation "on ground" having a provider elevation.
aviation::CCallsignSet remoteAircraftSupportingParts() const
Remote aircraft supporting parts.
void updateMarkAllAsNotRendered()
Mark all as not rendered.
bool updateAircraftEnabled(const aviation::CCallsign &callsign, bool enabledForRendering)
Enable/disable aircraft and follow up logic like sending signals.
bool updateAircraftNetworkModel(const aviation::CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator)
Change network model.
CSimulatedAircraft getAircraftInRangeForCallsign(const aviation::CCallsign &callsign) const
Aircraft for callsign.
aviation::CAircraftPartsList remoteAircraftParts(const aviation::CCallsign &callsign) const
All parts (per callsign, time history)
aviation::CAircraftSituationChangeList remoteAircraftSituationChanges(const aviation::CCallsign &callsign) const
Aircraft changes.
bool isVtolAircraft(const aviation::CCallsign &callsign) const
Is VTOL aircraft?
bool updateCG(const aviation::CCallsign &callsign, const physical_quantities::CLength &cg)
Update the CG.
bool updateCGAndModelString(const aviation::CCallsign &callsign, const physical_quantities::CLength &cg, const QString &modelString)
Update the CG and model string.
bool isRemoteAircraftSupportingParts(const aviation::CCallsign &callsign) const
Is remote aircraft supporting parts?
int remoteAircraftSituationsCount(const aviation::CCallsign &callsign) const
Number of remote aircraft situations for callsign.
CAircraftModel getAircraftInRangeModelForCallsign(const aviation::CCallsign &callsign) const
Aircraft model for callsign.
bool updateAircraftRendered(const aviation::CCallsign &callsign, bool rendered)
Set aircraft rendered.
bool setAircraftEnabledFlag(const aviation::CCallsign &callsign, bool enabledForRendering)
Just set enable/disable aircraft flag, no further logic.
aviation::CCallsignSet updateCGForModel(const QString &modelString, const physical_quantities::CLength &cg)
Update the CG for this model string.
int aircraftPartsAdded() const
Number of parts added.
bool updateAircraftModel(const aviation::CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator)
Change model.
int getRemoteAircraftSupportingPartsCount() const
Number of aircraft supporting parts.
int remoteAircraftPartsCount(const aviation::CCallsign &callsign) const
All parts (per callsign, time history)
swift::misc::CStatusMessageList getReverseLookupMessages(const swift::misc::aviation::CCallsign &callsign) const
Get reverse lookup meesages.
bool isAircraftInRange(const aviation::CCallsign &callsign) const
Is aircraft in range?
int remoteAircraftSituationChangesCount(const aviation::CCallsign &callsign) const
Aircraft changes count.
void updateMarkAllAsNotRendered()
Mark all as not rendered.
int updateMultipleAircraftRendered(const aviation::CCallsignSet &callsigns, bool rendered)
Set aircraft rendered.
CSimulatedAircraftList getAircraftInRange() const
All remote aircraft.
virtual aviation::CAircraftSituation storeAircraftSituation(const aviation::CAircraftSituation &situation, bool allowTestAltitudeOffset=true)
Store an aircraft situation.
static const QStringList & getLogCategories()
Log categories.
bool updateCGAndModelString(const aviation::CCallsign &callsign, const physical_quantities::CLength &cg, const QString &modelString)
Update the CG and model string.
bool setAircraftEnabledFlag(const swift::misc::aviation::CCallsign &callsign, bool enabledForRendering)
Just set enable/disable aircraft flag, no further logic.
aviation::CCallsignSet remoteAircraftSupportingParts() const
Remote aircraft supporting parts.
bool hasTestAltitudeOffset(const aviation::CCallsign &callsign) const
Has test offset value?
bool addNewAircraftInRange(const CSimulatedAircraft &aircraft)
Add new aircraft, ignored if aircraft already exists.
aviation::CAircraftSituation addTestAltitudeOffsetToSituation(const aviation::CAircraftSituation &situation) const
Add an offset for testing.
int getRemoteAircraftSupportingPartsCount() const
Number of aircraft supporting parts.
bool removeAircraft(const aviation::CCallsign &callsign)
Remove all aircraft in range.
qint64 situationsLastModified(const aviation::CCallsign &callsign) const
When last modified.
void changedAircraftInRange()
Aircraft were changed.
bool isAircraftPartsHistoryEnabled() const
Is storing aircraft parts history enabled?
int remoteAircraftSituationsCount(const aviation::CCallsign &callsign) const
Number of remote aircraft situations for callsign.
aviation::CAircraftSituation remoteAircraftSituation(const aviation::CCallsign &callsign, int index) const
Rendered aircraft situations (per callsign and index)
geo::CElevationPlane averageElevationOfNonMovingAircraft(const aviation::CAircraftSituation &reference, const physical_quantities::CLength &range, int minValues=1, int sufficientValues=2) const
Average elevation of aircraft in given range, which are NOT moving.
aviation::CAircraftSituationList remoteAircraftSituations(const aviation::CCallsign &callsign) const
Rendered aircraft situations (per callsign, time history)
bool isVtolAircraft(const aviation::CCallsign &callsign) const
Is VTOL aircraft?
aviation::CAircraftSituationChangeList remoteAircraftSituationChanges(const aviation::CCallsign &callsign) const
Aircraft changes.
void addedAircraftParts(const swift::misc::aviation::CCallsign &callsign, const swift::misc::aviation::CAircraftParts &parts)
Parts added.
MillisecondsMinMaxMean remoteAircraftSituationsTimestampDifferenceMinMaxMean(const aviation::CCallsign &callsign) const
Average update time.
int updateAircraftInRange(const aviation::CCallsign &callsign, const CPropertyIndexVariantMap &vm, bool skipEqualValues=true)
Update aircraft.
aviation::CCallsignSet updateCGForModel(const QString &modelString, const physical_quantities::CLength &cg)
Update the CG for this model string.
void enableAircraftPartsHistory(bool enabled)
Enable storing of aircraft parts history.
CStatusMessageList getAircraftPartsHistory(const aviation::CCallsign &callsign) const
Get aircraft parts history.
void addedAircraft(const swift::misc::simulation::CSimulatedAircraft &remoteAircraft)
A new aircraft appeared.
void storeAircraftParts(const aviation::CCallsign &callsign, const aviation::CAircraftParts &parts, bool removeOutdated)
Store an aircraft part.
bool updateAircraftInRangeDistanceBearing(const aviation::CCallsign &callsign, const aviation::CAircraftSituation &situation, const physical_quantities::CLength &distance, const physical_quantities::CAngle &bearing)
Update aircraft bearing, distance and situation.
int remoteAircraftPartsCount(const aviation::CCallsign &callsign) const
All parts (per callsign, time history)
bool updateAircraftEnabled(const aviation::CCallsign &callsign, bool enabledForRendering)
Enable/disable aircraft and follow up logic like sending signals.
void rememberCGFromDB(const physical_quantities::CLength &cgFromDB, const aviation::CCallsign &callsign)
CG values from DB.
void removeReverseLookupMessages(const aviation::CCallsign &callsign)
Remove the lookup messages.
void addReverseLookupMessages(const aviation::CCallsign &callsign, const CStatusMessageList &messages)
Reverse lookup messages.
int aircraftPartsAdded() const
Number of parts added.
bool guessOnGroundAndUpdateModelCG(aviation::CAircraftSituation &situation, const aviation::CAircraftSituationChange &change, const CAircraftModel &aircraftModel)
Guess situation "on ground" and update model's CG if applicable.
aviation::CAircraftSituationList latestRemoteAircraftSituations() const
Latest aircraft situation for all callsigns.
void airspaceAircraftSnapshot(const swift::misc::simulation::CAirspaceAircraftSnapshot &snapshot)
New aircraft snapshot.
bool updateAircraftNetworkModel(const aviation::CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator)
Change network model.
bool updateAircraftModel(const aviation::CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator)
Change model.
void addedAircraftSituation(const swift::misc::aviation::CAircraftSituation &situation)
Situation added.
physical_quantities::CLength getCGFromDB(const aviation::CCallsign &callsign) const
CG values from DB.
void clear()
Clear all data.
qint64 partsLastModified(const aviation::CCallsign &callsign) const
When last modified.
bool updateFastPositionEnabled(const aviation::CCallsign &callsign, bool enableFastPositonUpdates)
Change fast position updates.
QList< QMetaObject::Connection > connectRemoteAircraftProviderSignals(QObject *receiver, std::function< void(const aviation::CAircraftSituation &)> addedSituationSlot, std::function< void(const aviation::CCallsign &, const aviation::CAircraftParts &)> addedPartsSlot, std::function< void(const aviation::CCallsign &)> removedAircraftSlot, std::function< void(const CAirspaceAircraftSnapshot &)> aircraftSnapshotSlot)
Connect signals to slot receiver. As the interface is no QObject, slots can not be connected directly...
bool updateAircraftRendered(const aviation::CCallsign &callsign, bool rendered)
Set aircraft rendered.
aviation::CAircraftSituationList latestOnGroundProviderElevations() const
Latest aircraft situation "on ground" having a provider elevation.
ReverseLookupLogging whatToReverseLog() const
What to log?
aviation::CCallsignSet getAircraftInRangeCallsigns() const
Unique callsigns for aircraft in range.
ReverseLookupLogging isReverseLookupMessagesEnabled() const
Enabled reverse lookup logging?
CAircraftModel getAircraftInRangeModelForCallsign(const aviation::CCallsign &callsign) const
Aircraft model for callsign.
CSimulatedAircraft getAircraftInRangeForCallsign(const aviation::CCallsign &callsign) const
Aircraft for callsign.
int aircraftSituationsAdded() const
Number of situations added.
aviation::CAircraftPartsList remoteAircraftParts(const aviation::CCallsign &callsign) const
All parts (per callsign, time history)
static int setGroundElevationCheckedAndGuessGround(aviation::CAircraftSituationList &situations, const geo::CElevationPlane &elevationPlane, aviation::CAircraftSituation::GndElevationInfo info, const simulation::CAircraftModel &model, aviation::CAircraftSituationChange *changeOut, bool *setForOnGroundPosition)
Set ground elevation from elevation plane and guess ground.
void enableReverseLookupMessages(ReverseLookupLogging enable)
Enable reverse lookup logging.
void removeAllAircraft()
Remove all aircraft in range.
void addReverseLookupMessage(const aviation::CCallsign &callsign, const CStatusMessage &message)
Reverse lookup messages.
int updateMultipleAircraftEnabled(const aviation::CCallsignSet &callsigns, bool enabledForRendering)
Enable/disable aircraft.
bool updateCG(const aviation::CCallsign &callsign, const physical_quantities::CLength &cg)
Update the CG.
bool isRemoteAircraftSupportingParts(const aviation::CCallsign &callsign) const
Is remote aircraft supporting parts?
int getAircraftInRangeCount() const
Count remote aircraft.
bool hasTestAltitudeOffsetGlobalValue() const
Has test offset value?
bool testAddAltitudeOffset(const aviation::CCallsign &callsign, const physical_quantities::CLength &offset)
Offset for callsign.
void removedAircraft(const swift::misc::aviation::CCallsign &callsign)
An aircraft disappeared.
int updateAircraftGroundElevation(const aviation::CCallsign &callsign, const geo::CElevationPlane &elevation, aviation::CAircraftSituation::GndElevationInfo info, bool *setForOnGroundPosition)
Update the ground elevation.
Comprehensive information of an aircraft.
void setPartsSynchronized(bool synchronized)
Set the synchronisation flag.
bool isPartsSynchronized() const
Have parts been synchronized with a remote client?
bool setCG(const physical_quantities::CLength &cg)
Set the center of gravity.
void setModelString(const QString &modelString)
Set model string.
void setSituation(const aviation::CAircraftSituation &situation)
Set situation. Won't overwrite the velocity unless it held the default value.
const aviation::CCallsign & getCallsign() const
Get callsign.
bool hasValidCallsign() const
Valid callsign?
const simulation::CAircraftModel & getModel() const
Get model (model used for mapping)
void setParts(const aviation::CAircraftParts &parts)
Set aircraft parts.
bool isVtol() const
VTOL aircraft?
Value object encapsulating a list of aircraft.
static constexpr int MaxPartsAgePerCallsignSecs
How many seconds to keep parts for interpolation.
static const aviation::CCallsign & testAltitudeOffsetCallsign()
Wildcard callsign.
aviation::CAircraftParts getLatestAircraftParts(const aviation::CCallsign &callsign) const
Get the latest aircraft parts (if any, otherwise default)
static constexpr int MaxPartsPerCallsign
How many parts we keep per callsign.
static constexpr int MaxSituationsPerCallsign
How many situations we keep per callsign.
static void removeOutdatedParts(aviation::CAircraftPartsList &partsList)
Remove outdated aircraft parts, but never the most recent one.
virtual aviation::CAircraftPartsList remoteAircraftParts(const aviation::CCallsign &callsign) const =0
All parts (per callsign, time history)
SWIFT_MISC_EXPORT bool caseInsensitiveStringCompare(const QString &c1, const QString &c2)
Case insensitive string compare.
StatusSeverity
Status severities.
qint64 currentMSecsSinceEpoch()
bool contains(const Key &key) const const
QHash< Key, T >::iterator insert(const Key &key, const T &value)
QList< Key > keys() const const
bool remove(const Key &key)
qsizetype size() const const
T value(const Key &key) const const
QList< T > values() const const
QByteArray toJson(QJsonDocument::JsonFormat format) const const
qsizetype size() const const
QJsonValue value(QLatin1StringView key) const const
bool toBool(bool defaultValue) const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool isEmpty() const const
QString trimmed() const const
Milliseconds minimum/maximum/mean.
#define SWIFT_VERIFY_X(COND, WHERE, WHAT)
A weaker kind of assert.