mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-03 16:25:54 +08:00
refs #865, FSX: changed how elevation/CG is updated
This commit is contained in:
committed by
Mathew Sutcliffe
parent
5b3780543f
commit
085f25fa86
@@ -59,6 +59,9 @@ namespace BlackMisc
|
|||||||
//! Get CG above ground
|
//! Get CG above ground
|
||||||
const BlackMisc::PhysicalQuantities::CLength &getCGAboveGround() const { return m_cgAboveGround;}
|
const BlackMisc::PhysicalQuantities::CLength &getCGAboveGround() const { return m_cgAboveGround;}
|
||||||
|
|
||||||
|
//! Has CG above ground
|
||||||
|
bool hasCGAboveGround() const { return m_cgAboveGround.isNull(); }
|
||||||
|
|
||||||
//! Set CG above ground
|
//! Set CG above ground
|
||||||
void setCGAboveGround(const BlackMisc::PhysicalQuantities::CLength &cgAboveGround) { m_cgAboveGround = cgAboveGround; }
|
void setCGAboveGround(const BlackMisc::PhysicalQuantities::CLength &cgAboveGround) { m_cgAboveGround = cgAboveGround; }
|
||||||
|
|
||||||
|
|||||||
@@ -484,20 +484,9 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
void CSimulatorFsx::updateRemoteAircraftFromSimulator(const CSimConnectObject &simObject, const DataDefinitionRemoteAircraftSimData &remoteAircraftData)
|
void CSimulatorFsx::updateRemoteAircraftFromSimulator(const CSimConnectObject &simObject, const DataDefinitionRemoteAircraftSimData &remoteAircraftData)
|
||||||
{
|
{
|
||||||
CInterpolationHints &hints = m_hints[simObject.getCallsign()];
|
// Near ground we use faster updates
|
||||||
|
|
||||||
// we only need elevation near ground, in other cases we ignore it
|
|
||||||
if (remoteAircraftData.aboveGround() <= 100.0)
|
if (remoteAircraftData.aboveGround() <= 100.0)
|
||||||
{
|
{
|
||||||
CElevationPlane elevation(remoteAircraftData.latitude, remoteAircraftData.longitude, remoteAircraftData.elevation);
|
|
||||||
elevation.setSinglePointRadius();
|
|
||||||
|
|
||||||
// const QString debug(hints.debugInfo(elevation));
|
|
||||||
hints.setElevation(elevation); // update elevation
|
|
||||||
hints.setCGAboveGround({ remoteAircraftData.cgToGround, CLengthUnit::ft() });
|
|
||||||
|
|
||||||
// set it in the remote aircraft provider
|
|
||||||
this->updateAircraftGroundElevation(simObject.getCallsign(), elevation);
|
|
||||||
// switch to fast updates
|
// switch to fast updates
|
||||||
if (simObject.getSimDataPeriod() != SIMCONNECT_PERIOD_VISUAL_FRAME)
|
if (simObject.getSimDataPeriod() != SIMCONNECT_PERIOD_VISUAL_FRAME)
|
||||||
{
|
{
|
||||||
@@ -506,13 +495,23 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hints.resetElevation();
|
|
||||||
// switch to slow updates
|
// switch to slow updates
|
||||||
if (simObject.getSimDataPeriod() != SIMCONNECT_PERIOD_SECOND)
|
if (simObject.getSimDataPeriod() != SIMCONNECT_PERIOD_SECOND)
|
||||||
{
|
{
|
||||||
this->requestDataForSimObject(simObject, SIMCONNECT_PERIOD_SECOND);
|
this->requestDataForSimObject(simObject, SIMCONNECT_PERIOD_SECOND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CElevationPlane elevation(remoteAircraftData.latitude, remoteAircraftData.longitude, remoteAircraftData.elevation);
|
||||||
|
elevation.setSinglePointRadius();
|
||||||
|
|
||||||
|
// const QString debug(hints.debugInfo(elevation));
|
||||||
|
CInterpolationHints &hints = m_hints[simObject.getCallsign()];
|
||||||
|
hints.setElevation(elevation); // update elevation
|
||||||
|
hints.setCGAboveGround({ remoteAircraftData.cgToGround, CLengthUnit::ft() }); // normally never changing, but if user changes ModelMatching
|
||||||
|
|
||||||
|
// set it in the remote aircraft provider
|
||||||
|
this->updateAircraftGroundElevation(simObject.getCallsign(), elevation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorFsx::updateOwnAircraftFromSimulator(const DataDefinitionClientAreaSb &sbDataArea)
|
void CSimulatorFsx::updateOwnAircraftFromSimulator(const DataDefinitionClientAreaSb &sbDataArea)
|
||||||
|
|||||||
Reference in New Issue
Block a user