mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
Ref T259, Ref T243 access to last interpolated situation to check if near ground
This commit is contained in:
@@ -146,6 +146,12 @@ namespace BlackSimPlugin
|
||||
return m_interpolator->getInterpolatedParts(currentTimeSinceEpoc, setup, partsStatus, log);
|
||||
}
|
||||
|
||||
const CAircraftSituation &CSimConnectObject::getLastInterpolatedSituation() const
|
||||
{
|
||||
if (!m_interpolator) { return CAircraftSituation::null(); }
|
||||
return m_interpolator->getLastInterpolatedSituation();
|
||||
}
|
||||
|
||||
bool CSimConnectObjects::setSimConnectObjectIdForRequestId(DWORD requestId, DWORD objectId, bool resetSentParts)
|
||||
{
|
||||
// First check, if this request id belongs to us
|
||||
|
||||
@@ -161,6 +161,9 @@ namespace BlackSimPlugin
|
||||
const BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign &setup,
|
||||
BlackMisc::Simulation::CPartsStatus &partsStatus, bool log) const;
|
||||
|
||||
//! Last interpolated situation
|
||||
const BlackMisc::Aviation::CAircraftSituation &getLastInterpolatedSituation() const;
|
||||
|
||||
//! Interpolator
|
||||
BlackMisc::Simulation::CInterpolatorMulti *getInterpolator() const { return m_interpolator.data(); }
|
||||
|
||||
|
||||
@@ -485,6 +485,9 @@ namespace BlackSimPlugin
|
||||
}
|
||||
|
||||
// CElevationPlane: deg, deg, feet
|
||||
// we only remember near ground
|
||||
if (simObject.getLastInterpolatedSituation().canLikelySkipNearGroundInterpolation()) { return; }
|
||||
|
||||
CElevationPlane elevation(remoteAircraftData.latitudeDeg, remoteAircraftData.longitudeDeg, remoteAircraftData.elevationFt);
|
||||
elevation.setSinglePointRadius();
|
||||
this->rememberElevationAndCG(simObject.getCallsign(), elevation, CLength(remoteAircraftData.cgToGroundFt, CLengthUnit::ft()));
|
||||
|
||||
@@ -707,7 +707,7 @@ namespace BlackSimPlugin
|
||||
// update situation
|
||||
if (!xplaneAircraft.isSameAsSent(interpolatedSituation))
|
||||
{
|
||||
m_xplaneAircraftObjects[xplaneAircraft.getCallsign()].setPositionAsSent(interpolatedSituation);
|
||||
m_xplaneAircraftObjects[xplaneAircraft.getCallsign()].setSituationAsSent(interpolatedSituation);
|
||||
m_trafficProxy->setPlanePosition(interpolatedSituation.getCallsign().asString(),
|
||||
interpolatedSituation.latitude().value(CAngleUnit::deg()),
|
||||
interpolatedSituation.longitude().value(CAngleUnit::deg()),
|
||||
@@ -784,8 +784,10 @@ namespace BlackSimPlugin
|
||||
|
||||
void CSimulatorXPlane::updateRemoteAircraftFromSimulator(const QString &callsign, double latitudeDeg, double longitudeDeg, double elevationMeters, double modelVerticalOffsetMeters)
|
||||
{
|
||||
// we skip if we are not near ground
|
||||
const CCallsign cs(callsign);
|
||||
if (!m_xplaneAircraftObjects.contains(cs)) { return; }
|
||||
if (m_xplaneAircraftObjects[cs].getSituationAsSent().canLikelySkipNearGroundInterpolation()) { return; }
|
||||
|
||||
CElevationPlane elevation(CLatitude(latitudeDeg, CAngleUnit::deg()), CLongitude(longitudeDeg, CAngleUnit::deg()), CAltitude(elevationMeters, CLengthUnit::m()));
|
||||
elevation.setSinglePointRadius();
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace BlackSimPlugin
|
||||
CXSwiftBusWeatherProxy *m_weatherProxy { nullptr };
|
||||
QTimer m_fastTimer;
|
||||
QTimer m_slowTimer;
|
||||
BlackMisc::Aviation::CAirportList m_airportsInRange; //!< aiports in range of own aircraft
|
||||
BlackMisc::Aviation::CAirportList m_airportsInRange; //!< aiports in range of own aircraft
|
||||
BlackMisc::CData<BlackMisc::Simulation::Data::TModelSetCacheXP> m_modelSet { this };
|
||||
|
||||
// Driver Interpolation
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace BlackSimPlugin
|
||||
|
||||
bool CXPlaneMPAircraft::isSameAsSent(const CAircraftSituation &position) const
|
||||
{
|
||||
return m_positionAsSent == position;
|
||||
return m_situationAsSent == position;
|
||||
}
|
||||
|
||||
void CXPlaneMPAircraft::toggleInterpolatorMode()
|
||||
|
||||
@@ -55,8 +55,11 @@ namespace BlackSimPlugin
|
||||
//! Parts as sent to simulator
|
||||
void setPartsAsSent(const BlackMisc::Aviation::CAircraftParts &parts) { m_partsAsSent = parts; }
|
||||
|
||||
//! Situation as sent to simulator
|
||||
const BlackMisc::Aviation::CAircraftSituation &getSituationAsSent() const { return m_situationAsSent; }
|
||||
|
||||
//! Position as sent
|
||||
void setPositionAsSent(const BlackMisc::Aviation::CAircraftSituation &position) { m_positionAsSent = position; }
|
||||
void setSituationAsSent(const BlackMisc::Aviation::CAircraftSituation &position) { m_situationAsSent = position; }
|
||||
|
||||
//! Same as sent
|
||||
bool isSameAsSent(const BlackMisc::Aviation::CAircraftSituation &position) const;
|
||||
@@ -94,7 +97,7 @@ namespace BlackSimPlugin
|
||||
private:
|
||||
BlackMisc::Simulation::CSimulatedAircraft m_aircraft; //!< corresponding aircraft
|
||||
QSharedPointer<BlackMisc::Simulation::CInterpolatorMulti> m_interpolator; //!< shared pointer because CSimConnectObject can be copied
|
||||
BlackMisc::Aviation::CAircraftSituation m_positionAsSent;
|
||||
BlackMisc::Aviation::CAircraftSituation m_situationAsSent;
|
||||
BlackMisc::Aviation::CAircraftParts m_partsAsSent;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user