diff --git a/src/blackcore/airspacemonitor.cpp b/src/blackcore/airspacemonitor.cpp index c83658fee..2c3ab6c99 100644 --- a/src/blackcore/airspacemonitor.cpp +++ b/src/blackcore/airspacemonitor.cpp @@ -932,7 +932,7 @@ namespace BlackCore } // do we already have ground details? - if (situation.getOnGroundDetails() == CAircraftSituation::NotSet) + if (situation.getOnGroundDetails() == CAircraftSituation::NotSetGroundDetails) { const CClient client = this->getClientOrDefaultForCallsign(callsign); if (client.hasCapability(CClient::FsdWithGroundFlag)) diff --git a/src/blackcore/simulator.h b/src/blackcore/simulator.h index 086a94c31..f1faded27 100644 --- a/src/blackcore/simulator.h +++ b/src/blackcore/simulator.h @@ -351,7 +351,8 @@ namespace BlackCore }; } // namespace -Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "org.swift-project.blackcore.simulatorinterface") +Q_DECLARE_INTERFACE(BlackCore::ISimulator, "org.swift-project.blackcore.simulator") +Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "org.swift-project.blackcore.simulatorfactory") Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::ISimulator::SimulatorStatus) #endif // guard diff --git a/src/blackmisc/aviation/aircraftparts.cpp b/src/blackmisc/aviation/aircraftparts.cpp index a87c46a47..a0fe42244 100644 --- a/src/blackmisc/aviation/aircraftparts.cpp +++ b/src/blackmisc/aviation/aircraftparts.cpp @@ -92,7 +92,7 @@ namespace BlackMisc } else { - if (!situation.hasInboundGroundInformation()) + if (!situation.hasInboundGroundDetails()) { // the ground flag is not reliable and we have no ground elevation if (situation.getOnGroundDetails() == CAircraftSituation::OnGroundByGuessing) diff --git a/src/blackmisc/aviation/aircraftsituation.cpp b/src/blackmisc/aviation/aircraftsituation.cpp index 47cb59eb8..ea6ac8595 100644 --- a/src/blackmisc/aviation/aircraftsituation.cpp +++ b/src/blackmisc/aviation/aircraftsituation.cpp @@ -50,15 +50,15 @@ namespace BlackMisc QString CAircraftSituation::convertToQString(bool i18n) const { return QStringLiteral("ts: ") % this->getFormattedTimestampAndOffset(true) % - QStringLiteral(" ") % m_position.toQString(i18n) % - QStringLiteral(" bank: ") % (m_bank.toQString(i18n)) % - QStringLiteral(" pitch: ") % (m_pitch.toQString(i18n)) % - QStringLiteral(" heading: ") % (m_heading.toQString(i18n)) % - QStringLiteral(" og: ") % this->getOnGroundInfo() % - QStringLiteral(" factor: ") % QString::number(m_onGroundFactor, 'f', 2) % - QStringLiteral(" gs: ") % m_groundSpeed.valueRoundedWithUnit(CSpeedUnit::kts(), 1, true) % + QStringLiteral(" | ") % m_position.toQString(i18n) % + QStringLiteral(" | bank: ") % (m_bank.toQString(i18n)) % + QStringLiteral(" | pitch: ") % (m_pitch.toQString(i18n)) % + QStringLiteral(" | heading: ") % (m_heading.toQString(i18n)) % + QStringLiteral(" | og: ") % this->getOnGroundInfo() % + QStringLiteral(" | factor: ") % QString::number(m_onGroundFactor, 'f', 2) % + QStringLiteral(" | gs: ") % m_groundSpeed.valueRoundedWithUnit(CSpeedUnit::kts(), 1, true) % QStringLiteral(" ") % m_groundSpeed.valueRoundedWithUnit(CSpeedUnit::m_s(), 1, true) % - QStringLiteral(" elevation: ") % (m_groundElevationPlane.toQString(i18n)); + QStringLiteral(" | elevation: ") % (m_groundElevationPlane.toQString(i18n)); } const QString &CAircraftSituation::isOnGroundToString(CAircraftSituation::IsOnGround onGround) @@ -98,7 +98,7 @@ namespace BlackMisc case CAircraftSituation::InFromNetwork: return inNetwork; case CAircraftSituation::InFromParts: return inFromParts; case CAircraftSituation::InNoGroundInfo: return InNoGroundInfo; - case CAircraftSituation::NotSet: + case CAircraftSituation::NotSetGroundDetails: default: return unknown; } } @@ -229,7 +229,7 @@ namespace BlackMisc m_bank.setNull(); m_groundElevationPlane.setNull(); m_groundSpeed.setNull(); - m_onGroundDetails = CAircraftSituation::NotSet; + m_onGroundDetails = CAircraftSituation::NotSetGroundDetails; } const QString &CAircraftSituation::onGroundAsString() const @@ -239,8 +239,9 @@ namespace BlackMisc bool CAircraftSituation::isOnGroundInfoAvailable() const { + if (this->hasInboundGroundDetails()) { return true; } return this->getOnGround() != CAircraftSituation::OnGroundSituationUnknown && - this->getOnGroundDetails() != CAircraftSituation::NotSet; + this->getOnGroundDetails() != CAircraftSituation::NotSetGroundDetails; } void CAircraftSituation::setOnGround(bool onGround) @@ -326,7 +327,7 @@ namespace BlackMisc this->setOnGroundDetails(OnGroundByInterpolation); if (this->getOnGroundFactor() < 0.0) { - this->setOnGround(NotSet); + this->setOnGround(NotSetGroundDetails); return false; } diff --git a/src/blackmisc/aviation/aircraftsituation.h b/src/blackmisc/aviation/aircraftsituation.h index 9e1717119..c25d45daf 100644 --- a/src/blackmisc/aviation/aircraftsituation.h +++ b/src/blackmisc/aviation/aircraftsituation.h @@ -79,7 +79,7 @@ namespace BlackMisc //! Reliability of on ground information enum OnGroundDetails { - NotSet, + NotSetGroundDetails, // interpolated situation OnGroundByInterpolation, //!< strongest for remote aircraft OnGroundByElevationAndCG, @@ -229,8 +229,8 @@ namespace BlackMisc //! Is ground elevation value available bool hasGroundElevation() const; - //! Has inbound ground information - bool hasInboundGroundInformation() const; + //! Has inbound ground details + bool hasInboundGroundDetails() const; //! Elevation of the ground directly beneath at the given situation void setGroundElevation(const Aviation::CAltitude &altitude); @@ -261,7 +261,7 @@ namespace BlackMisc const PhysicalQuantities::CLengthUnit &getAltitudeUnit() const { return m_position.geodeticHeight().getUnit(); } //! Get altitude under consideration of ground elevation and ground flag - //! \remark with dragToGround it will also compensate overflows, otherwise ony underflow + //! \remark with dragToGround it will also compensate overflows, otherwise only underflow CAltitude getCorrectedAltitude(const PhysicalQuantities::CLength ¢erOfGravity = PhysicalQuantities::CLength::null(), bool enableDragToGround = true, AltitudeCorrection *correctetion = nullptr) const; //! Set the corrected altitude from CAircraftSituation::getCorrectedAltitude @@ -364,7 +364,7 @@ namespace BlackMisc bool m_isInterim = false; Geo::CElevationPlane m_groundElevationPlane; //!< NULL elevation as default int m_onGround = static_cast(CAircraftSituation::OnGroundSituationUnknown); - int m_onGroundDetails = static_cast(CAircraftSituation::NotSet); + int m_onGroundDetails = static_cast(CAircraftSituation::NotSetGroundDetails); double m_onGroundFactor = -1; //!< interpolated ground flag, 1..on ground, 0..not on ground, -1 no info BLACK_METACLASS( diff --git a/src/blackmisc/geo/coordinategeodetic.cpp b/src/blackmisc/geo/coordinategeodetic.cpp index aa39009b1..3e9c4818b 100644 --- a/src/blackmisc/geo/coordinategeodetic.cpp +++ b/src/blackmisc/geo/coordinategeodetic.cpp @@ -146,8 +146,8 @@ namespace BlackMisc { Q_UNUSED(i18n); return this->latitudeAsString() % QLatin1Char(' ') % - this->longitudeAsString() % QLatin1Char(' ') % - this->geodeticHeightAsString(); + QStringLiteral(" | ") % this->longitudeAsString() % QLatin1Char(' ') % + QStringLiteral(" | ") % this->geodeticHeightAsString(); } CVariant CCoordinateGeodetic::propertyByIndex(const BlackMisc::CPropertyIndex &index) const @@ -305,12 +305,8 @@ namespace BlackMisc const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexRelativeBearing: - m_relativeBearing.setPropertyByIndex(index.copyFrontRemoved(), variant); - break; - case IndexRelativeDistance: - m_relativeDistance.setPropertyByIndex(index.copyFrontRemoved(), variant); - break; + case IndexRelativeBearing: m_relativeBearing.setPropertyByIndex(index.copyFrontRemoved(), variant); break; + case IndexRelativeDistance: m_relativeDistance.setPropertyByIndex(index.copyFrontRemoved(), variant); break; default: const QString m = QString("no property, index ").append(index.toQString()); BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m)); diff --git a/src/blackmisc/simulation/remoteaircraftprovider.cpp b/src/blackmisc/simulation/remoteaircraftprovider.cpp index f20087e2f..816a631ca 100644 --- a/src/blackmisc/simulation/remoteaircraftprovider.cpp +++ b/src/blackmisc/simulation/remoteaircraftprovider.cpp @@ -121,8 +121,20 @@ namespace BlackMisc } // locked members - { QWriteLocker l(&m_lockParts); m_partsByCallsign.clear(); m_aircraftWithParts.clear(); m_partsAdded = 0; m_partsLastModified.clear(); } - { QWriteLocker l(&m_lockSituations); m_situationsByCallsign.clear(); m_situationsAdded = 0; m_situationsLastModified.clear(); } + { + QWriteLocker l(&m_lockParts); + m_partsByCallsign.clear(); + m_aircraftWithParts.clear(); + m_partsAdded = 0; + m_partsLastModified.clear(); + } + { + QWriteLocker l(&m_lockSituations); + m_situationsByCallsign.clear(); + m_situationsAdded = 0; + m_situationsLastModified.clear(); + m_testOffset.clear(); + } { QWriteLocker l(&m_lockPartsHistory); m_aircraftPartsHistory.clear(); } { QWriteLocker l(&m_lockMessages); m_reverseLookupMessages.clear(); } { QWriteLocker l(&m_lockAircraft); m_aircraftInRange.clear(); } @@ -187,7 +199,7 @@ namespace BlackMisc } // unify all inbound ground information - if (situation.hasInboundGroundInformation()) + if (situation.hasInboundGroundDetails()) { situationList.setOnGroundDetails(situation.getOnGroundDetails()); } diff --git a/src/blackmisc/simulation/remoteaircraftprovider.h b/src/blackmisc/simulation/remoteaircraftprovider.h index 6ddd7009e..548b4ab7a 100644 --- a/src/blackmisc/simulation/remoteaircraftprovider.h +++ b/src/blackmisc/simulation/remoteaircraftprovider.h @@ -145,7 +145,7 @@ namespace BlackMisc //! \threadsafe virtual bool updateFastPositionEnabled(const Aviation::CCallsign &callsign, bool enableFastPositonUpdates) = 0; - //! Ground elevation of aircraft + //! Update the ground elevation //! \threadsafe virtual int updateAircraftGroundElevation(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation) = 0; @@ -360,7 +360,7 @@ namespace BlackMisc //! \remark latest parts are kept first //! \threadsafe //! @{ - void storeAircraftParts(const Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftParts &parts, bool removeOutdated); + void storeAircraftParts(const Aviation::CCallsign &callsign, const Aviation::CAircraftParts &parts, bool removeOutdated); void storeAircraftParts(const Aviation::CCallsign &callsign, const QJsonObject &jsonObject, int currentOffset); //! @} diff --git a/tests/blackmisc/testinterpolatorparts.cpp b/tests/blackmisc/testinterpolatorparts.cpp index 625862694..3f4336fe5 100644 --- a/tests/blackmisc/testinterpolatorparts.cpp +++ b/tests/blackmisc/testinterpolatorparts.cpp @@ -108,7 +108,7 @@ namespace BlackMiscTest for (int i = 0; i < number; i++) { CAircraftSituation s = createTestSituation(cs, i, ts, deltaT, 0); - s.setOnGround(CAircraftSituation::OnGroundSituationUnknown, CAircraftSituation::NotSet); + s.setOnGround(CAircraftSituation::OnGroundSituationUnknown, CAircraftSituation::NotSetGroundDetails); situations.push_back(s); } @@ -124,7 +124,7 @@ namespace BlackMiscTest const qint64 Offset = 33; partsOnGround.addMsecsToOffset(Offset); CAircraftSituation s1 = situations[1]; - s1.setOnGroundDetails(CAircraftSituation::NotSet); + s1.setOnGroundDetails(CAircraftSituation::NotSetGroundDetails); s1.adjustGroundFlag(partsOnGround, true, 0.1, &distanceMs); QVERIFY2(s1.getOnGround(), "Supposed to be on ground"); QVERIFY2(distanceMs == deltaT - Offset, "Offset time wrong");