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 IRemoteAircraftProvider::IRemoteAircraftProvider() {}
23 IRemoteAircraftProvider::~IRemoteAircraftProvider() {}
25 const QStringList &CRemoteAircraftProvider::getLogCategories()
31 CRemoteAircraftProvider::CRemoteAircraftProvider(QObject *parent)
37 QReadLocker l(&m_lockAircraft);
38 const QList<CSimulatedAircraft> aircraftInRange = m_aircraftInRange.values();
45 QReadLocker l(&m_lockAircraft);
46 const QList<CCallsign> callsigns = m_aircraftInRange.keys();
66 QReadLocker l(&m_lockSituations);
67 if (!m_situationsByCallsign.contains(callsign)) {
return empty; }
68 return m_situationsByCallsign[callsign];
74 if (index < 0 || index >= situations.
size()) {
return CAircraftSituation::null(); }
75 return situations[index];
87 QReadLocker l(&m_lockSituations);
88 const QList<CAircraftSituation> situations(m_latestSituationByCallsign.values());
95 QReadLocker l(&m_lockSituations);
96 const QList<CAircraftSituation> situations(m_latestOnGroundProviderElevation.values());
103 QReadLocker l(&m_lockSituations);
104 if (!m_situationsByCallsign.contains(callsign)) {
return -1; }
105 return m_situationsByCallsign[callsign].size();
111 QReadLocker l(&m_lockParts);
112 if (!m_partsByCallsign.contains(callsign)) {
return empty; }
113 return m_partsByCallsign[callsign];
118 QReadLocker l(&m_lockParts);
119 if (!m_partsByCallsign.contains(callsign)) {
return -1; }
120 return m_partsByCallsign[callsign].size();
125 QReadLocker l(&m_lockParts);
126 return m_aircraftWithParts.
contains(callsign);
131 QReadLocker l(&m_lockParts);
132 return m_aircraftWithParts.
size();
137 QReadLocker l(&m_lockParts);
138 return m_aircraftWithParts;
144 QReadLocker l(&m_lockChanges);
145 return m_changesByCallsign[callsign];
150 QReadLocker l(&m_lockChanges);
151 return m_changesByCallsign[callsign].size();
156 QReadLocker l(&m_lockAircraft);
157 return m_aircraftInRange.size();
166 QWriteLocker l(&m_lockParts);
167 m_partsByCallsign.clear();
168 m_aircraftWithParts.
clear();
170 m_partsLastModified.clear();
173 QWriteLocker l(&m_lockSituations);
174 m_situationsByCallsign.clear();
175 m_latestSituationByCallsign.clear();
176 m_latestOnGroundProviderElevation.clear();
177 m_situationsAdded = 0;
178 m_situationsLastModified.clear();
179 m_testOffset.clear();
182 QWriteLocker l(&m_lockChanges);
183 m_changesByCallsign.clear();
187 QWriteLocker l(&m_lockPartsHistory);
188 m_aircraftPartsMessages.clear();
191 QWriteLocker l(&m_lockMessages);
192 m_reverseLookupMessages.clear();
195 QWriteLocker l(&m_lockAircraft);
196 m_aircraftInRange.clear();
197 m_dbCGPerCallsign.clear();
205 QWriteLocker l(&m_lockMessages);
206 m_reverseLookupMessages.remove(callsign);
215 QWriteLocker l(&m_lockAircraft);
216 m_aircraftInRange.insert(aircraft.
getCallsign(), aircraft);
224 bool skipEqualValues)
226 Q_ASSERT_X(!callsign.
isEmpty(), Q_FUNC_INFO,
"Missing callsign");
229 QWriteLocker l(&m_lockAircraft);
230 if (!m_aircraftInRange.contains(callsign)) {
return 0; }
231 c = m_aircraftInRange[callsign].apply(vm, skipEqualValues).size();
241 Q_ASSERT_X(!callsign.
isEmpty(), Q_FUNC_INFO,
"Missing callsign");
243 QWriteLocker l(&m_lockAircraft);
244 if (!m_aircraftInRange.contains(callsign)) {
return false; }
254 bool allowTestAltitudeOffset)
257 if (cs.
isEmpty()) {
return situation; }
260 if (CBuildConfig::isLocalDeveloperDebugBuild())
277 const qint64 now = QDateTime::currentMSecsSinceEpoch();
278 QWriteLocker lock(&m_lockSituations);
280 m_situationsLastModified[cs] = now;
282 newSituationsList.
setAdjustedSortHint(CAircraftSituationList::AdjustedTimestampLatestFirst);
283 const int situations = newSituationsList.
size();
291 return situationCorrected;
299 newSituationsList.
setAdjustedSortHint(CAircraftSituationList::AdjustedTimestampLatestFirst);
309 m_latestSituationByCallsign[cs] = situationCorrected;
312 if (CBuildConfig::isLocalDeveloperDebugBuild())
315 "wrong adjusted sort order");
318 Q_FUNC_INFO,
"Wrong size");
325 aircraftModel.
isVtol(),
true,
false);
330 updatedSituations = m_situationsByCallsign[cs];
335 Q_ASSERT_X(!updatedSituations.
isEmpty(), Q_FUNC_INFO,
"Missing situations");
338 this->storeChange(change);
344 return situationCorrected;
351 if (callsign.
isEmpty()) {
return; }
354 const qint64 ts = QDateTime::currentMSecsSinceEpoch();
357 QWriteLocker lock(&m_lockParts);
359 m_partsLastModified[callsign] = ts;
366 correctiveParts = partsList;
374 if (!correctiveParts.
isEmpty())
376 QWriteLocker lock(&m_lockSituations);
379 if (c > 0) { m_situationsLastModified[callsign] = ts; }
384 QWriteLocker l(&m_lockAircraft);
385 if (m_aircraftInRange.contains(callsign))
396 QWriteLocker l(&m_lockParts);
397 m_aircraftWithParts.
insert(callsign);
404 qint64 currentOffsetMs)
407 const bool isFull = jsonObject.value(CAircraftParts::attributeNameIsFullJson()).toBool();
411 if (!isFull) {
return; }
423 if (CBuildConfig::isLocalDeveloperDebugBuild())
426 const int attributes = jsonObject.size();
427 const bool correctCount = (attributes == CAircraftParts::attributesCountFullJson);
428 SWIFT_VERIFY_X(correctCount || !CBuildConfig::isLocalDeveloperDebugBuild(), Q_FUNC_INFO,
429 "Wrong full aircraft parts");
433 << attributes << CAircraftParts::attributesCountFullJson;
438 if (attributes < 1) {
return; }
443 const QJsonObject config = applyIncrementalObject(parts.
toJson(), jsonObject);
454 const QJsonObject config = applyIncrementalObject(parts.
toJson(), jsonObject);
476 const QJsonDocument doc(jsonObject);
477 const QString partsAsString = doc.toJson(QJsonDocument::Compact);
479 callsign.
isEmpty() ? callsign.
toQString() +
": " + partsAsString.trimmed() :
480 partsAsString.trimmed());
482 QReadLocker l(&m_lockPartsHistory);
483 if (m_aircraftPartsMessages.contains(callsign))
488 else { m_aircraftPartsMessages.insert(callsign, message); }
496 QWriteLocker lock(&m_lockChanges);
518 QWriteLocker l(&m_lockAircraft);
519 if (!m_aircraftInRange.contains(callsign)) {
return false; }
520 return m_aircraftInRange[callsign].setEnabled(enabledForRendering);
525 if (callsigns.
isEmpty()) {
return 0; }
526 QWriteLocker l(&m_lockAircraft);
530 if (!m_aircraftInRange.contains(cs)) {
continue; }
531 if (m_aircraftInRange[cs].setEnabled(enabledForRendering)) { c++; }
556 QWriteLocker l(&m_lockAircraft);
557 if (!m_aircraftInRange.contains(callsign)) {
return false; }
558 return m_aircraftInRange[callsign].setFastPositionUpdates(enableFastPositonUpdates);
563 QWriteLocker l(&m_lockAircraft);
564 if (!m_aircraftInRange.contains(callsign)) {
return false; }
565 return m_aircraftInRange[callsign].setRendered(rendered);
570 if (callsigns.
isEmpty()) {
return 0; }
574 if (!m_aircraftInRange.contains(cs)) {
continue; }
575 if (m_aircraftInRange[cs].setRendered(rendered)) { c++; }
583 bool *setForOnGroundPosition)
588 const qint64 now = QDateTime::currentMSecsSinceEpoch();
591 bool setForOnGndPosition =
false;
595 QWriteLocker l(&m_lockSituations);
597 if (situations.
isEmpty()) {
return 0; }
599 &setForOnGndPosition);
600 if (updated < 1) {
return 0; }
601 m_situationsLastModified[callsign] = now;
603 if (info == CAircraftSituation::FromProvider && latestSituation.
isOnGround())
605 m_latestOnGroundProviderElevation[callsign] = latestSituation;
610 if (!change.
isNull()) { this->storeChange(change); }
613 QWriteLocker l(&m_lockAircraft);
614 if (m_aircraftInRange.contains(callsign))
616 m_aircraftInRange[callsign].setGroundElevationChecked(elevation, info);
619 if (setForOnGroundPosition) { *setForOnGroundPosition = setForOnGndPosition; }
625 QWriteLocker l(&m_lockAircraft);
626 if (!m_aircraftInRange.contains(callsign)) {
return false; }
627 m_aircraftInRange[callsign].setCG(cg);
632 const QString &modelString)
634 QWriteLocker l(&m_lockAircraft);
635 if (!m_aircraftInRange.contains(callsign)) {
return false; }
638 if (!modelString.isEmpty()) { aircraft.
setModelString(modelString); }
645 if (modelString.isEmpty()) {
return callsigns; }
647 QWriteLocker l(&m_lockAircraft);
653 callsigns.
push_back(aircraft.getCallsign());
661 QReadLocker l(&m_lockAircraft);
662 return m_dbCGPerCallsign.contains(callsign) ? m_dbCGPerCallsign[callsign] : CLength::null();
667 QReadLocker l(&m_lockAircraft);
668 return m_dbCGPerCallsign.contains(modelString) ? m_dbCGPerCallsign[modelString] : CLength::null();
673 QWriteLocker l(&m_lockAircraft);
674 m_dbCGPerCallsign[callsign] = cgFromDB;
679 QWriteLocker l(&m_lockAircraft);
680 m_dbCGPerModelString[modelString] = cgFromDB;
686 QWriteLocker l(&m_lockAircraft);
687 for (
const CCallsign &cs : callsigns) { m_aircraftInRange[cs].setRendered(
false); }
692 QWriteLocker l(&m_lockMessages);
693 m_enableReverseLookupMsgs = enable;
698 QReadLocker l(&m_lockMessages);
699 return m_enableReverseLookupMsgs;
704 QReadLocker l(&m_lockMessages);
705 return m_reverseLookupMessages.value(callsign);
711 if (callsign.
isEmpty()) {
return; }
712 if (messages.
isEmpty()) {
return; }
713 QWriteLocker l(&m_lockMessages);
714 if (!m_enableReverseLookupMsgs) {
return; }
715 if (m_reverseLookupMessages.contains(callsign))
720 else { m_reverseLookupMessages.insert(callsign, messages); }
725 if (callsign.
isEmpty()) {
return; }
726 if (message.
isEmpty()) {
return; }
733 if (callsign.
isEmpty()) {
return; }
734 if (message.isEmpty()) {
return; }
743 if (callsign.
isEmpty()) {
return false; }
744 QReadLocker l(&m_lockSituations);
745 return m_testOffset.contains(callsign);
750 QReadLocker l(&m_lockSituations);
761 QReadLocker l(&m_lockSituations);
770 QReadLocker l(&m_lockMessages);
771 return m_enableReverseLookupMsgs;
779 bool *setForOnGroundPosition)
781 if (setForOnGroundPosition) { *setForOnGroundPosition =
false; }
782 if (elevationPlane.
isNull()) {
return 0; }
783 if (situations.
isEmpty()) {
return 0; }
792 bool setForOnGndPosition =
false;
796 const bool set = s.setGroundElevationChecked(elevationPlane, info);
801 const bool guessed = (latest ? simpleChange : CAircraftSituationChange::null()).guessOnGround(s, model);
807 if (!setForOnGndPosition && s.hasInboundGroundDetails() && s.isOnGround())
809 setForOnGndPosition =
true;
815 if (setForOnGroundPosition) { *setForOnGroundPosition = setForOnGndPosition; }
827 QReadLocker l(&m_lockPartsHistory);
828 return m_aircraftPartsMessages.value(callsign);
833 QReadLocker l(&m_lockPartsHistory);
834 return m_enableAircraftPartsHistory;
839 QWriteLocker l(&m_lockPartsHistory);
840 m_enableAircraftPartsHistory = enabled;
845 QReadLocker l(&m_lockSituations);
846 return m_situationsAdded;
851 QReadLocker l(&m_lockSituations);
852 return m_situationsLastModified.value(callsign, -1);
857 QReadLocker l(&m_lockParts);
858 return m_partsLastModified.value(callsign, -1);
862 const CLength &range,
int minValues,
863 int sufficientValues)
const
872 QWriteLocker l(&m_lockSituations);
875 m_testOffset.remove(callsign);
879 m_testOffset[callsign] = offset;
885 QReadLocker l(&m_lockParts);
891 if (callsign.
isEmpty()) {
return false; }
892 QReadLocker l(&m_lockAircraft);
893 return m_aircraftInRange.contains(callsign);
898 if (callsign.
isEmpty()) {
return false; }
904 QObject *receiver, std::function<
void(
const CAircraftSituation &)> addedSituationFunction,
906 std::function<
void(
const CCallsign &)> removedAircraftFunction,
909 Q_ASSERT_X(receiver, Q_FUNC_INFO,
"Missing receiver");
912 const QMetaObject::Connection uc;
913 const QMetaObject::Connection c1 = addedSituationFunction ?
915 addedSituationFunction, Qt::QueuedConnection) :
917 Q_ASSERT_X(c1 || !addedSituationFunction, Q_FUNC_INFO,
"connect failed");
918 const QMetaObject::Connection c2 = addedPartsFunction ?
920 addedPartsFunction, Qt::QueuedConnection) :
922 Q_ASSERT_X(c2 || !addedPartsFunction, Q_FUNC_INFO,
"connect failed");
923 const QMetaObject::Connection c3 = removedAircraftFunction ?
925 removedAircraftFunction, Qt::QueuedConnection) :
927 Q_ASSERT_X(c3 || !removedAircraftFunction, Q_FUNC_INFO,
"connect failed");
928 const QMetaObject::Connection c4 = aircraftSnapshotSlot ?
930 receiver, aircraftSnapshotSlot, Qt::QueuedConnection) :
932 Q_ASSERT_X(c4 || !aircraftSnapshotSlot, Q_FUNC_INFO,
"connect failed");
933 return QList<QMetaObject::Connection>({ c1, c2, c3, c4 });
939 QWriteLocker l1(&m_lockParts);
940 m_partsByCallsign.remove(callsign);
941 m_aircraftWithParts.
remove(callsign);
942 m_partsLastModified.remove(callsign);
945 QWriteLocker l2(&m_lockSituations);
946 m_situationsByCallsign.remove(callsign);
947 m_latestSituationByCallsign.remove(callsign);
948 m_latestOnGroundProviderElevation.remove(callsign);
949 m_situationsLastModified.remove(callsign);
952 QWriteLocker l4(&m_lockPartsHistory);
953 m_aircraftPartsMessages.remove(callsign);
955 bool removedCallsign =
false;
957 QWriteLocker l(&m_lockAircraft);
958 m_dbCGPerCallsign.remove(callsign);
959 const int c = m_aircraftInRange.remove(callsign);
960 removedCallsign = c > 0;
962 return removedCallsign;
969 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
970 return this->
provider()->getAircraftInRange();
975 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
976 return this->
provider()->isAircraftInRange(callsign);
981 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
982 return this->
provider()->isVtolAircraft(callsign);
987 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
988 return this->
provider()->getAircraftInRangeCount();
993 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
994 return this->
provider()->getAircraftInRangeCallsigns();
999 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1000 return this->
provider()->getAircraftInRangeForCallsign(callsign);
1005 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1006 return this->
provider()->getAircraftInRangeModelForCallsign(callsign);
1011 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1012 return this->
provider()->getLatestAirspaceAircraftSnapshot();
1018 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1019 return this->
provider()->remoteAircraftSituations(callsign);
1024 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1025 return this->
provider()->remoteAircraftSituation(callsign, index);
1030 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1031 return this->
provider()->latestRemoteAircraftSituations();
1036 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1037 return this->
provider()->latestOnGroundProviderElevations();
1042 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1043 return this->
provider()->remoteAircraftSituationChanges(callsign);
1048 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1049 return this->
provider()->remoteAircraftParts(callsign);
1054 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1055 return this->
provider()->remoteAircraftPartsCount(callsign);
1060 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1061 return this->
provider()->remoteAircraftSupportingParts();
1066 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1067 return this->
provider()->remoteAircraftSituationsCount(callsign);
1073 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1074 return this->
provider()->updateAircraftModel(callsign, model, originator);
1080 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1081 return this->
provider()->updateAircraftNetworkModel(callsign, model, originator);
1086 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1087 return this->
provider()->updateAircraftRendered(callsign, rendered);
1092 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1093 return this->
provider()->updateMultipleAircraftRendered(callsigns, rendered);
1098 bool *updatedAircraftGroundElevation)
1100 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1101 return this->
provider()->updateAircraftGroundElevation(callsign, elevation, info,
1102 updatedAircraftGroundElevation);
1107 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1108 return this->
provider()->updateCG(callsign, cg);
1113 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1114 return this->
provider()->updateCGForModel(modelString, cg);
1118 const QString &modelString)
1120 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1121 return this->
provider()->updateCGAndModelString(callsign, cg, modelString);
1126 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1127 this->
provider()->updateMarkAllAsNotRendered();
1132 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1133 return this->
provider()->aircraftSituationsAdded();
1138 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1139 return this->
provider()->aircraftPartsAdded();
1144 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1145 return this->
provider()->situationsLastModified(callsign);
1150 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1151 return this->
provider()->partsLastModified(callsign);
1155 const CLength &range,
int minValues)
const
1157 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1158 return this->
provider()->averageElevationOfNonMovingAircraft(reference, range, minValues);
1163 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1164 return this->
provider()->isRemoteAircraftSupportingParts(callsign);
1169 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1170 return this->
provider()->getRemoteAircraftSupportingPartsCount();
1175 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1176 return this->
provider()->updateAircraftEnabled(callsign, enabledForRendering);
1181 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1182 return this->
provider()->setAircraftEnabledFlag(callsign, enabledForRendering);
1187 Q_ASSERT_X(this->
provider(), Q_FUNC_INFO,
"No object available");
1188 return this->
provider()->updateMultipleAircraftEnabled(callsigns, enabledForRendering);
1201 if (partsList.
isEmpty()) {
return; }
1207 Q_ASSERT_X(!partsList.
isEmpty(), Q_FUNC_INFO,
"Need at least 1 value");
1212 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)
virtual 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.
virtual ~CRemoteAircraftAware()
Destructor.
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)
virtual swift::misc::CStatusMessageList getReverseLookupMessages(const swift::misc::aviation::CCallsign &callsign) const
Get reverse lookup meesages.
virtual bool isAircraftInRange(const aviation::CCallsign &callsign) const
Is aircraft in range?
virtual int remoteAircraftSituationChangesCount(const aviation::CCallsign &callsign) const
Aircraft changes count.
virtual void updateMarkAllAsNotRendered()
Mark all as not rendered.
virtual int updateMultipleAircraftRendered(const aviation::CCallsignSet &callsigns, bool rendered)
Set aircraft rendered.
virtual 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.
virtual bool updateCGAndModelString(const aviation::CCallsign &callsign, const physical_quantities::CLength &cg, const QString &modelString)
Update the CG and model string.
virtual bool setAircraftEnabledFlag(const swift::misc::aviation::CCallsign &callsign, bool enabledForRendering)
Just set enable/disable aircraft flag, no further logic.
virtual 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.
virtual int getRemoteAircraftSupportingPartsCount() const
Number of aircraft supporting parts.
bool removeAircraft(const aviation::CCallsign &callsign)
Remove all aircraft in range.
virtual qint64 situationsLastModified(const aviation::CCallsign &callsign) const
When last modified.
void changedAircraftInRange()
Aircraft were changed.
virtual bool isAircraftPartsHistoryEnabled() const
Is storing aircraft parts history enabled?
virtual int remoteAircraftSituationsCount(const aviation::CCallsign &callsign) const
Number of remote aircraft situations for callsign.
virtual aviation::CAircraftSituation remoteAircraftSituation(const aviation::CCallsign &callsign, int index) const
Rendered aircraft situations (per callsign and index)
virtual 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.
virtual aviation::CAircraftSituationList remoteAircraftSituations(const aviation::CCallsign &callsign) const
Rendered aircraft situations (per callsign, time history)
virtual bool isVtolAircraft(const aviation::CCallsign &callsign) const
Is VTOL aircraft?
virtual 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.
virtual MillisecondsMinMaxMean remoteAircraftSituationsTimestampDifferenceMinMaxMean(const aviation::CCallsign &callsign) const
Average update time.
int updateAircraftInRange(const aviation::CCallsign &callsign, const CPropertyIndexVariantMap &vm, bool skipEqualValues=true)
Update aircraft.
virtual aviation::CCallsignSet updateCGForModel(const QString &modelString, const physical_quantities::CLength &cg)
Update the CG for this model string.
virtual void enableAircraftPartsHistory(bool enabled)
Enable storing of aircraft parts history.
virtual 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.
virtual int remoteAircraftPartsCount(const aviation::CCallsign &callsign) const
All parts (per callsign, time history)
virtual bool updateAircraftEnabled(const aviation::CCallsign &callsign, bool enabledForRendering)
Enable/disable aircraft and follow up logic like sending signals.
virtual 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.
virtual 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.
virtual aviation::CAircraftSituationList latestRemoteAircraftSituations() const
Latest aircraft situation for all callsigns.
void airspaceAircraftSnapshot(const swift::misc::simulation::CAirspaceAircraftSnapshot &snapshot)
New aircraft snapshot.
virtual bool updateAircraftNetworkModel(const aviation::CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator)
Change network model.
virtual bool updateAircraftModel(const aviation::CCallsign &callsign, const CAircraftModel &model, const CIdentifier &originator)
Change model.
void addedAircraftSituation(const swift::misc::aviation::CAircraftSituation &situation)
Situation added.
virtual physical_quantities::CLength getCGFromDB(const aviation::CCallsign &callsign) const
CG values from DB.
void clear()
Clear all data.
virtual qint64 partsLastModified(const aviation::CCallsign &callsign) const
When last modified.
virtual bool updateFastPositionEnabled(const aviation::CCallsign &callsign, bool enableFastPositonUpdates)
Change fast position updates.
virtual 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...
virtual bool updateAircraftRendered(const aviation::CCallsign &callsign, bool rendered)
Set aircraft rendered.
virtual aviation::CAircraftSituationList latestOnGroundProviderElevations() const
Latest aircraft situation "on ground" having a provider elevation.
ReverseLookupLogging whatToReverseLog() const
What to log?
virtual aviation::CCallsignSet getAircraftInRangeCallsigns() const
Unique callsigns for aircraft in range.
virtual ReverseLookupLogging isReverseLookupMessagesEnabled() const
Enabled reverse lookup logging?
virtual CAircraftModel getAircraftInRangeModelForCallsign(const aviation::CCallsign &callsign) const
Aircraft model for callsign.
virtual CSimulatedAircraft getAircraftInRangeForCallsign(const aviation::CCallsign &callsign) const
Aircraft for callsign.
virtual int aircraftSituationsAdded() const
Number of situations added.
virtual 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.
virtual 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.
virtual int updateMultipleAircraftEnabled(const aviation::CCallsignSet &callsigns, bool enabledForRendering)
Enable/disable aircraft.
virtual bool updateCG(const aviation::CCallsign &callsign, const physical_quantities::CLength &cg)
Update the CG.
virtual bool isRemoteAircraftSupportingParts(const aviation::CCallsign &callsign) const
Is remote aircraft supporting parts?
virtual 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.
virtual 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.
Direct thread safe in memory access to remote 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.
Milliseconds minimum/maximum/mean.
#define SWIFT_VERIFY_X(COND, WHERE, WHAT)
A weaker kind of assert.