From e247f20482c8dda6d3ec6419117e5851e2885210 Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Tue, 9 Jan 2024 21:20:15 +0100 Subject: [PATCH] refactor: Remove unused sceneryOffset in aircraft situation --- src/blackgui/models/aircraftsituationlistmodel.cpp | 1 - src/blackmisc/aviation/aircraftsituation.cpp | 11 ----------- src/blackmisc/aviation/aircraftsituation.h | 9 --------- src/blackmisc/simulation/remoteaircraftprovider.cpp | 10 ---------- 4 files changed, 31 deletions(-) diff --git a/src/blackgui/models/aircraftsituationlistmodel.cpp b/src/blackgui/models/aircraftsituationlistmodel.cpp index c5e2a280e..972b675e8 100644 --- a/src/blackgui/models/aircraftsituationlistmodel.cpp +++ b/src/blackgui/models/aircraftsituationlistmodel.cpp @@ -23,7 +23,6 @@ namespace BlackGui::Models m_columns.addColumn(CColumn("altitude", CAircraftSituation::IndexAltitude, new CAltitudeFormatter())); m_columns.addColumn(CColumn("CG", CAircraftSituation::IndexCG, new CPhysiqalQuantiyFormatter(CLengthUnit::ft(), 1))); - m_columns.addColumn(CColumn("sc.os.", "scenery offset", CAircraftSituation::IndexSceneryOffset, new CPhysiqalQuantiyFormatter(CLengthUnit::ft(), 1))); m_columns.addColumn(CColumn("latitude", CAircraftSituation::IndexLatitude, new CLatLonFormatter())); m_columns.addColumn(CColumn("longitude", CAircraftSituation::IndexLongitude, new CLatLonFormatter())); m_columns.addColumn(CColumn("gs.", CAircraftSituation::IndexGroundSpeed, new CSpeedKtsFormatter())); diff --git a/src/blackmisc/aviation/aircraftsituation.cpp b/src/blackmisc/aviation/aircraftsituation.cpp index 095e0862c..3092678c6 100644 --- a/src/blackmisc/aviation/aircraftsituation.cpp +++ b/src/blackmisc/aviation/aircraftsituation.cpp @@ -117,8 +117,6 @@ namespace BlackMisc::Aviation u"[cor] | og: " % this->getOnGroundInfo().toQString(i18n) % u" | CG: " % (m_cg.isNull() ? QStringLiteral("null") : m_cg.valueRoundedWithUnit(CLengthUnit::m(), 1) % u' ' % m_cg.valueRoundedWithUnit(CLengthUnit::ft(), 1)) % - u" | offset: " % - (m_sceneryOffset.isNull() ? QStringLiteral("null") : m_sceneryOffset.valueRoundedWithUnit(CLengthUnit::m(), 1) % u' ' % m_sceneryOffset.valueRoundedWithUnit(CLengthUnit::ft(), 1)) % u" | skip ng: " % boolToYesNo(this->canLikelySkipNearGroundInterpolation()) % u" | bank: " % m_bank.toQString(i18n) % u" | pitch: " % m_pitch.toQString(i18n) % @@ -270,7 +268,6 @@ namespace BlackMisc::Aviation case IndexVelocity: return QVariant::fromValue(this->getVelocity()); case IndexBank: return m_bank.propertyByIndex(index.copyFrontRemoved()); case IndexCG: return m_cg.propertyByIndex(index.copyFrontRemoved()); - case IndexSceneryOffset: return m_sceneryOffset.propertyByIndex(index.copyFrontRemoved()); case IndexGroundSpeed: return m_groundSpeed.propertyByIndex(index.copyFrontRemoved()); case IndexGroundElevationPlane: return m_groundElevationPlane.propertyByIndex(index.copyFrontRemoved()); case IndexCallsign: return m_correspondingCallsign.propertyByIndex(index.copyFrontRemoved()); @@ -305,7 +302,6 @@ namespace BlackMisc::Aviation case IndexBank: m_bank.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexVelocity: m_velocity.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexCG: m_cg.setPropertyByIndex(index.copyFrontRemoved(), variant); break; - case IndexSceneryOffset: m_sceneryOffset.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexGroundSpeed: m_groundSpeed.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexGroundElevationPlane: m_groundElevationPlane.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexCallsign: m_correspondingCallsign.setPropertyByIndex(index.copyFrontRemoved(), variant); break; @@ -332,7 +328,6 @@ namespace BlackMisc::Aviation case IndexPitch: return m_pitch.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getPitch()); case IndexBank: return m_bank.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getBank()); case IndexCG: return m_cg.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCG()); - case IndexSceneryOffset: return m_sceneryOffset.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getSceneryOffset()); case IndexGroundSpeed: return m_groundSpeed.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getGroundSpeed()); case IndexGroundElevationPlane: case IndexGroundElevationPlusInfo: @@ -415,7 +410,6 @@ namespace BlackMisc::Aviation m_elvInfo = NoElevationInfo; m_isElvInfoTransferred = false; m_cg.setNull(); - m_sceneryOffset.setNull(); } bool CAircraftSituation::isOnGroundFromParts() const @@ -834,11 +828,6 @@ namespace BlackMisc::Aviation m_cg = cg.switchedUnit(this->getAltitudeOrDefaultUnit()); } - void CAircraftSituation::setSceneryOffset(const CLength &sceneryOffset) - { - m_sceneryOffset = sceneryOffset.switchedUnit(this->getAltitudeOrDefaultUnit()); - } - bool CAircraftSituation::adjustGroundFlag(const CAircraftParts &parts, bool alwaysSetDetails, double timeDeviationFactor, qint64 *differenceMs) { Q_ASSERT_X(timeDeviationFactor >= 0 && timeDeviationFactor <= 1.0, Q_FUNC_INFO, "Expect 0..1"); diff --git a/src/blackmisc/aviation/aircraftsituation.h b/src/blackmisc/aviation/aircraftsituation.h index 6071d7006..202c9e6b6 100644 --- a/src/blackmisc/aviation/aircraftsituation.h +++ b/src/blackmisc/aviation/aircraftsituation.h @@ -73,7 +73,6 @@ namespace BlackMisc IndexGroundElevationPlusInfo, IndexCallsign, IndexCG, - IndexSceneryOffset, IndexCanLikelySkipNearGroundInterpolation }; @@ -399,12 +398,6 @@ namespace BlackMisc //! Has CG set? bool hasCG() const { return !m_cg.isNull(); } - //! Get scenery offset if any - const PhysicalQuantities::CLength &getSceneryOffset() const { return m_sceneryOffset; } - - //! Set scenery offset - void setSceneryOffset(const PhysicalQuantities::CLength &sceneryOffset); - //! Set flag indicating this is an interim position update void setInterimFlag(bool flag) { m_isInterim = flag; } @@ -501,7 +494,6 @@ namespace BlackMisc PhysicalQuantities::CAngle m_bank { 0, nullptr }; PhysicalQuantities::CSpeed m_groundSpeed { 0, nullptr }; PhysicalQuantities::CLength m_cg { 0, nullptr }; - PhysicalQuantities::CLength m_sceneryOffset { 0, nullptr }; bool m_hasVelocity = false; CAircraftVelocity m_velocity; bool m_isInterim = false; //!< interim situation? @@ -519,7 +511,6 @@ namespace BlackMisc BLACK_METAMEMBER(bank), BLACK_METAMEMBER(groundSpeed), BLACK_METAMEMBER(cg), - BLACK_METAMEMBER(sceneryOffset), BLACK_METAMEMBER(hasVelocity), BLACK_METAMEMBER(velocity), BLACK_METAMEMBER(groundElevationPlane), diff --git a/src/blackmisc/simulation/remoteaircraftprovider.cpp b/src/blackmisc/simulation/remoteaircraftprovider.cpp index 8a7e6d485..bdfed6467 100644 --- a/src/blackmisc/simulation/remoteaircraftprovider.cpp +++ b/src/blackmisc/simulation/remoteaircraftprovider.cpp @@ -333,16 +333,6 @@ namespace BlackMisc::Simulation const CAircraftSituationChange change(updatedSituations, situationCorrected.getCG(), aircraftModel.isVtol(), true, true); this->storeChange(change); - if (change.hasSceneryDeviation()) - { - const CLength offset = change.getGuessedSceneryDeviation(); - situationCorrected.setSceneryOffset(offset); - - QWriteLocker lock(&m_lockSituations); - m_latestSituationByCallsign[cs].setSceneryOffset(offset); - m_situationsByCallsign[cs].front().setSceneryOffset(offset); - } - // situation has been added emit this->addedAircraftSituation(situationCorrected);