mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 13:55:36 +08:00
refs #840, add support for interpolation hints
This commit is contained in:
committed by
Mathew Sutcliffe
parent
534b9fb09e
commit
46fafde7a0
@@ -16,6 +16,7 @@
|
|||||||
#include "blackmisc/interpolator.h"
|
#include "blackmisc/interpolator.h"
|
||||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||||
#include "blackmisc/simulation/airspaceaircraftsnapshot.h"
|
#include "blackmisc/simulation/airspaceaircraftsnapshot.h"
|
||||||
|
#include "blackmisc/simulation/interpolationhints.h"
|
||||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||||
#include "blackmisc/pq/physicalquantity.h"
|
#include "blackmisc/pq/physicalquantity.h"
|
||||||
#include "blackmisc/simplecommandparser.h"
|
#include "blackmisc/simplecommandparser.h"
|
||||||
@@ -169,7 +170,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSimulatorCommon::setInitialAircraftSituation(CSimulatedAircraft &aircraft) const
|
bool CSimulatorCommon::setInitialAircraftSituation(CSimulatedAircraft &aircraft)
|
||||||
{
|
{
|
||||||
if (!this->m_interpolator) { return false; }
|
if (!this->m_interpolator) { return false; }
|
||||||
const CCallsign callsign(aircraft.getCallsign());
|
const CCallsign callsign(aircraft.getCallsign());
|
||||||
@@ -179,7 +180,9 @@ namespace BlackCore
|
|||||||
// to avoid position jittering when displayed
|
// to avoid position jittering when displayed
|
||||||
const qint64 time = QDateTime::currentMSecsSinceEpoch();
|
const qint64 time = QDateTime::currentMSecsSinceEpoch();
|
||||||
IInterpolator::InterpolationStatus interpolationStatus;
|
IInterpolator::InterpolationStatus interpolationStatus;
|
||||||
const CAircraftSituation as(m_interpolator->getInterpolatedSituation(callsign, time, aircraft.isVtol(), interpolationStatus));
|
CInterpolationHints &hints = m_hints[aircraft.getCallsign()];
|
||||||
|
hints.setVtolAircraft(aircraft.isVtol());
|
||||||
|
const CAircraftSituation as(m_interpolator->getInterpolatedSituation(callsign, time, hints, interpolationStatus));
|
||||||
if (interpolationStatus.didInterpolationSucceed())
|
if (interpolationStatus.didInterpolationSucceed())
|
||||||
{
|
{
|
||||||
aircraft.setSituation(as);
|
aircraft.setSituation(as);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "blackmisc/simulation/simulatorinfo.h"
|
#include "blackmisc/simulation/simulatorinfo.h"
|
||||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||||
#include "blackmisc/simulation/simulatorinternals.h"
|
#include "blackmisc/simulation/simulatorinternals.h"
|
||||||
|
#include "blackmisc/simulation/interpolationhints.h"
|
||||||
#include "blackmisc/weather/weathergridprovider.h"
|
#include "blackmisc/weather/weathergridprovider.h"
|
||||||
#include "blackmisc/pq/length.h"
|
#include "blackmisc/pq/length.h"
|
||||||
#include "blackmisc/pq/time.h"
|
#include "blackmisc/pq/time.h"
|
||||||
@@ -146,7 +147,7 @@ namespace BlackCore
|
|||||||
void resetAircraftFromProvider(const BlackMisc::Aviation::CCallsign &callsign);
|
void resetAircraftFromProvider(const BlackMisc::Aviation::CCallsign &callsign);
|
||||||
|
|
||||||
//! Override situation from current interpolator values, if any!
|
//! Override situation from current interpolator values, if any!
|
||||||
bool setInitialAircraftSituation(BlackMisc::Simulation::CSimulatedAircraft &aircraft) const;
|
bool setInitialAircraftSituation(BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||||
|
|
||||||
//! Set own model
|
//! Set own model
|
||||||
void reverseLookupAndUpdateOwnAircraftModel(const BlackMisc::Simulation::CAircraftModel &model);
|
void reverseLookupAndUpdateOwnAircraftModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||||
@@ -165,6 +166,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
// some optional functionality which can be used by the sims as needed
|
// some optional functionality which can be used by the sims as needed
|
||||||
BlackMisc::Simulation::CSimulatedAircraftList m_aircraftToAddAgainWhenRemoved; //!< add this model again when removed, normally used to change model
|
BlackMisc::Simulation::CSimulatedAircraftList m_aircraftToAddAgainWhenRemoved; //!< add this model again when removed, normally used to change model
|
||||||
|
QHash<BlackMisc::Aviation::CCallsign, BlackMisc::Simulation::CInterpolationHints> m_hints; //!< last ground elevation fetched
|
||||||
|
|
||||||
//! Lookup against DB data
|
//! Lookup against DB data
|
||||||
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
static BlackMisc::Simulation::CAircraftModel reverseLookupModel(const BlackMisc::Simulation::CAircraftModel &model);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace BlackMisc
|
|||||||
//! Properties by index
|
//! Properties by index
|
||||||
enum ColumnIndex
|
enum ColumnIndex
|
||||||
{
|
{
|
||||||
IndexInterpolatorDebugMessages = BlackMisc::CPropertyIndex::GloablIndexInterpolatorSetup,
|
IndexInterpolatorDebugMessages = BlackMisc::CPropertyIndex::GlobalIndexCInterpolatioRenderingSetup,
|
||||||
IndexSimulatorDebugMessages,
|
IndexSimulatorDebugMessages,
|
||||||
IndexForceFullInterpolation,
|
IndexForceFullInterpolation,
|
||||||
IndexMaxRenderedAircraft,
|
IndexMaxRenderedAircraft,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "interpolator.h"
|
#include "interpolator.h"
|
||||||
#include "blackmisc/aviation/callsign.h"
|
#include "blackmisc/aviation/callsign.h"
|
||||||
|
#include "blackmisc/simulation/interpolationhints.h"
|
||||||
|
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
@@ -24,14 +25,14 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
|
|
||||||
BlackMisc::Aviation::CAircraftSituation IInterpolator::getInterpolatedSituation(const CCallsign &callsign, qint64 currentTimeSinceEpoc,
|
BlackMisc::Aviation::CAircraftSituation IInterpolator::getInterpolatedSituation(const CCallsign &callsign, qint64 currentTimeSinceEpoc,
|
||||||
bool isVtolAircraft, InterpolationStatus &status) const
|
const CInterpolationHints &hints, InterpolationStatus &status) const
|
||||||
{
|
{
|
||||||
// has to be thread safe
|
// has to be thread safe
|
||||||
|
|
||||||
status.reset();
|
status.reset();
|
||||||
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "empty callsign");
|
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "empty callsign");
|
||||||
|
|
||||||
auto currentSituation = this->getInterpolatedSituation(this->remoteAircraftSituations(callsign), currentTimeSinceEpoc, isVtolAircraft, status);
|
auto currentSituation = this->getInterpolatedSituation(this->remoteAircraftSituations(callsign), currentTimeSinceEpoc, hints, status);
|
||||||
currentSituation.setCallsign(callsign); // make sure callsign is correct
|
currentSituation.setCallsign(callsign); // make sure callsign is correct
|
||||||
return currentSituation;
|
return currentSituation;
|
||||||
}
|
}
|
||||||
@@ -67,6 +68,14 @@ namespace BlackMisc
|
|||||||
return m_setup;
|
return m_setup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IInterpolator::setGroundElevationFromHint(const CInterpolationHints &hints, CAircraftSituation &situation)
|
||||||
|
{
|
||||||
|
if (hints.getElevation().isNull()) return;
|
||||||
|
if (situation.hasGroundElevation()) return;
|
||||||
|
if (!hints.isWithinRange(situation)) return;
|
||||||
|
situation.setGroundElevation(hints.getElevation().geodeticHeight());
|
||||||
|
}
|
||||||
|
|
||||||
bool IInterpolator::InterpolationStatus::allTrue() const
|
bool IInterpolator::InterpolationStatus::allTrue() const
|
||||||
{
|
{
|
||||||
return m_interpolationSucceeded && m_changedPosition;
|
return m_interpolationSucceeded && m_changedPosition;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
{
|
{
|
||||||
namespace Aviation { class CCallsign; }
|
namespace Aviation { class CCallsign; }
|
||||||
|
namespace Simulation { class CInterpolationHints; }
|
||||||
|
|
||||||
//! Interpolator, calculation inbetween positions
|
//! Interpolator, calculation inbetween positions
|
||||||
class BLACKMISC_EXPORT IInterpolator :
|
class BLACKMISC_EXPORT IInterpolator :
|
||||||
@@ -91,14 +92,14 @@ namespace BlackMisc
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
||||||
const BlackMisc::Aviation::CCallsign &callsign, qint64 currentTimeSinceEpoc,
|
const BlackMisc::Aviation::CCallsign &callsign, qint64 currentTimeSinceEpoc,
|
||||||
bool isVtolAircraft, InterpolationStatus &status) const;
|
const CInterpolationHints &hints, InterpolationStatus &status) const;
|
||||||
|
|
||||||
//! Current interpolated situation, to be implemented by subclass
|
//! Current interpolated situation, to be implemented by subclass
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
//! \remark public only for XP driver
|
//! \remark public only for XP driver
|
||||||
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
||||||
const BlackMisc::Aviation::CAircraftSituationList &situations, qint64 currentTimeSinceEpoc,
|
const BlackMisc::Aviation::CAircraftSituationList &situations, qint64 currentTimeSinceEpoc,
|
||||||
bool isVtolAircraft, InterpolationStatus &status) const = 0;
|
const CInterpolationHints &hints, InterpolationStatus &status) const = 0;
|
||||||
|
|
||||||
//! Parts before given offset time (aka pending parts)
|
//! Parts before given offset time (aka pending parts)
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
@@ -124,6 +125,9 @@ namespace BlackMisc
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
CInterpolationAndRenderingSetup getInterpolatorSetup() const;
|
CInterpolationAndRenderingSetup getInterpolatorSetup() const;
|
||||||
|
|
||||||
|
//! Set the ground elevation from hints, if possible and not already set
|
||||||
|
static void setGroundElevationFromHint(const CInterpolationHints &hints, BlackMisc::Aviation::CAircraftSituation &situation);
|
||||||
|
|
||||||
CInterpolationAndRenderingSetup m_setup; //!< allows to disable debug messages
|
CInterpolationAndRenderingSetup m_setup; //!< allows to disable debug messages
|
||||||
mutable QReadWriteLock m_lock; //!< lock interpolator
|
mutable QReadWriteLock m_lock; //!< lock interpolator
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "blackmisc/pq/physicalquantity.h"
|
#include "blackmisc/pq/physicalquantity.h"
|
||||||
#include "blackmisc/pq/speed.h"
|
#include "blackmisc/pq/speed.h"
|
||||||
#include "blackmisc/pq/units.h"
|
#include "blackmisc/pq/units.h"
|
||||||
|
#include "blackmisc/simulation/interpolationhints.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/compare.h"
|
#include "blackmisc/compare.h"
|
||||||
#include "blackmisc/range.h"
|
#include "blackmisc/range.h"
|
||||||
@@ -37,7 +38,7 @@ using namespace BlackMisc::Simulation;
|
|||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
{
|
{
|
||||||
CAircraftSituation CInterpolatorLinear::getInterpolatedSituation(const BlackMisc::Aviation::CAircraftSituationList &situations, qint64 currentTimeMsSinceEpoc, bool vtolAiracraft, InterpolationStatus &status) const
|
CAircraftSituation CInterpolatorLinear::getInterpolatedSituation(const CAircraftSituationList &situations, qint64 currentTimeMsSinceEpoc, const CInterpolationHints &hints, InterpolationStatus &status) const
|
||||||
{
|
{
|
||||||
// has to be thread safe
|
// has to be thread safe
|
||||||
const CInterpolationAndRenderingSetup setup = this->getInterpolatorSetup();
|
const CInterpolationAndRenderingSetup setup = this->getInterpolatorSetup();
|
||||||
@@ -94,6 +95,13 @@ namespace BlackMisc
|
|||||||
Q_ASSERT(oldSituation.getAdjustedMSecsSinceEpoch() < newSituation.getAdjustedMSecsSinceEpoch());
|
Q_ASSERT(oldSituation.getAdjustedMSecsSinceEpoch() < newSituation.getAdjustedMSecsSinceEpoch());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// take hint into account to calculate elevation and above ground level
|
||||||
|
if (!hints.getElevation().isNull())
|
||||||
|
{
|
||||||
|
setGroundElevationFromHint(hints, oldSituation);
|
||||||
|
setGroundElevationFromHint(hints, newSituation);
|
||||||
|
}
|
||||||
|
|
||||||
CAircraftSituation currentSituation(oldSituation);
|
CAircraftSituation currentSituation(oldSituation);
|
||||||
CCoordinateGeodetic currentPosition;
|
CCoordinateGeodetic currentPosition;
|
||||||
|
|
||||||
@@ -125,15 +133,15 @@ namespace BlackMisc
|
|||||||
currentSituation.setPosition(currentPosition);
|
currentSituation.setPosition(currentPosition);
|
||||||
|
|
||||||
// Interpolate altitude: Alt = (AltB - AltA) * t + AltA
|
// Interpolate altitude: Alt = (AltB - AltA) * t + AltA
|
||||||
const CAltitude oldAlt(oldSituation.getAltitude());
|
const CAltitude oldAlt(oldSituation.getCorrectedAltitude(hints.getCGAboveGround()));
|
||||||
const CAltitude newAlt(newSituation.getAltitude());
|
const CAltitude newAlt(newSituation.getCorrectedAltitude(hints.getCGAboveGround()));
|
||||||
Q_ASSERT_X(oldAlt.getReferenceDatum() == newAlt.getReferenceDatum(), Q_FUNC_INFO, "mismatch in reference"); // otherwise no calculation is possible
|
Q_ASSERT_X(oldAlt.getReferenceDatum() == newAlt.getReferenceDatum(), Q_FUNC_INFO, "mismatch in reference"); // otherwise no calculation is possible
|
||||||
currentSituation.setAltitude(CAltitude((newAlt - oldAlt)
|
currentSituation.setAltitude(CAltitude((newAlt - oldAlt)
|
||||||
* simulationTimeFraction
|
* simulationTimeFraction
|
||||||
+ oldAlt,
|
+ oldAlt,
|
||||||
oldAlt.getReferenceDatum()));
|
oldAlt.getReferenceDatum()));
|
||||||
|
|
||||||
if (!setup.isForcingFullInterpolation() && !vtolAiracraft && newVec == oldVec && oldAlt == newAlt)
|
if (!setup.isForcingFullInterpolation() && !hints.isVtolAircraft() && newVec == oldVec && oldAlt == newAlt)
|
||||||
{
|
{
|
||||||
// stop interpolation here, does not work for VTOL aircraft. We need a flag for VTOL aircraft
|
// stop interpolation here, does not work for VTOL aircraft. We need a flag for VTOL aircraft
|
||||||
return currentSituation;
|
return currentSituation;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace BlackMisc
|
|||||||
using IInterpolator::getInterpolatedSituation;
|
using IInterpolator::getInterpolatedSituation;
|
||||||
|
|
||||||
//! \copydoc IInterpolator::getInterpolatedSituation
|
//! \copydoc IInterpolator::getInterpolatedSituation
|
||||||
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(const BlackMisc::Aviation::CAircraftSituationList &situations, qint64 currentTimeSinceEpoc, bool vtolAiracraft, InterpolationStatus &status) const override;
|
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(const BlackMisc::Aviation::CAircraftSituationList &situations, qint64 currentTimeSinceEpoc, const BlackMisc::Simulation::CInterpolationHints &hints, InterpolationStatus &status) const override;
|
||||||
|
|
||||||
//! Log category
|
//! Log category
|
||||||
static QString getLogCategory() { return "swift.interpolatorlinear"; }
|
static QString getLogCategory() { return "swift.interpolatorlinear"; }
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ namespace BlackMisc
|
|||||||
GlobalIndexICoordinateGeodetic = 5000,
|
GlobalIndexICoordinateGeodetic = 5000,
|
||||||
GlobalIndexICoordinateWithRelativePosition = 5100,
|
GlobalIndexICoordinateWithRelativePosition = 5100,
|
||||||
GlobalIndexCCoordinateGeodetic = 5200,
|
GlobalIndexCCoordinateGeodetic = 5200,
|
||||||
|
GlobalIndexCElevationPlane = 5300,
|
||||||
GlobalIndexCClient = 6000,
|
GlobalIndexCClient = 6000,
|
||||||
GlobalIndexClientCapabilities = 6100, //!< used with map key
|
GlobalIndexClientCapabilities = 6100, //!< used with map key
|
||||||
GlobalIndexCUser = 6200,
|
GlobalIndexCUser = 6200,
|
||||||
@@ -142,7 +143,8 @@ namespace BlackMisc
|
|||||||
GlobalIndexCSettingsReaders = 14400,
|
GlobalIndexCSettingsReaders = 14400,
|
||||||
GlobalIndexCViewUpdateSettings = 14500,
|
GlobalIndexCViewUpdateSettings = 14500,
|
||||||
GlobalIndexCGeneralGuiSettings = 14600,
|
GlobalIndexCGeneralGuiSettings = 14600,
|
||||||
GloablIndexInterpolatorSetup = 15000,
|
GlobalIndexCInterpolatioRenderingSetup = 15000,
|
||||||
|
GlobalIndexCInterpolationHints = 15100,
|
||||||
GlobalIndexLineNumber = 20000, //!< pseudo index for line numbers
|
GlobalIndexLineNumber = 20000, //!< pseudo index for line numbers
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
#include "blackmisc/iconlist.h"
|
#include "blackmisc/iconlist.h"
|
||||||
#include "blackmisc/identifier.h"
|
#include "blackmisc/identifier.h"
|
||||||
#include "blackmisc/identifierlist.h"
|
#include "blackmisc/identifierlist.h"
|
||||||
#include "blackmisc/interpolationrenderingsetup.h"
|
|
||||||
#include "blackmisc/input/registermetadatainput.h"
|
#include "blackmisc/input/registermetadatainput.h"
|
||||||
#include "blackmisc/logcategory.h"
|
#include "blackmisc/logcategory.h"
|
||||||
#include "blackmisc/logcategorylist.h"
|
#include "blackmisc/logcategorylist.h"
|
||||||
@@ -89,7 +88,6 @@ namespace BlackMisc
|
|||||||
CVariant::registerMetadata();
|
CVariant::registerMetadata();
|
||||||
CVariantList::registerMetadata();
|
CVariantList::registerMetadata();
|
||||||
CVariantMap::registerMetadata();
|
CVariantMap::registerMetadata();
|
||||||
CInterpolationAndRenderingSetup::registerMetadata();
|
|
||||||
|
|
||||||
// sub namespaces
|
// sub namespaces
|
||||||
Audio::registerMetadata();
|
Audio::registerMetadata();
|
||||||
|
|||||||
@@ -9,10 +9,6 @@
|
|||||||
|
|
||||||
#include "registermetadatasimulation.h"
|
#include "registermetadatasimulation.h"
|
||||||
#include "simulation.h"
|
#include "simulation.h"
|
||||||
#include "blackmisc/simulation/simulatorsettings.h"
|
|
||||||
#include "blackmisc/simulation/modelsettings.h"
|
|
||||||
#include "blackmisc/valueobject.h"
|
|
||||||
#include "blackmisc/variant.h"
|
|
||||||
|
|
||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackMisc::Simulation::Fsx;
|
using namespace BlackMisc::Simulation::Fsx;
|
||||||
@@ -32,19 +28,21 @@ namespace BlackMisc
|
|||||||
CDistributor::registerMetadata();
|
CDistributor::registerMetadata();
|
||||||
CDistributorList::registerMetadata();
|
CDistributorList::registerMetadata();
|
||||||
CDistributorListPreferences::registerMetadata();
|
CDistributorListPreferences::registerMetadata();
|
||||||
|
CInterpolationAndRenderingSetup::registerMetadata();
|
||||||
|
CInterpolationHints::registerMetadata();
|
||||||
|
CModelSettings::registerMetadata();
|
||||||
CSimConnectUtilities::registerMetadata();
|
CSimConnectUtilities::registerMetadata();
|
||||||
CSimulatedAircraft::registerMetadata();
|
CSimulatedAircraft::registerMetadata();
|
||||||
CSimulatedAircraftList::registerMetadata();
|
CSimulatedAircraftList::registerMetadata();
|
||||||
CSimulatorInfo::registerMetadata();
|
CSimulatorInfo::registerMetadata();
|
||||||
CSimulatorInfoList::registerMetadata();
|
CSimulatorInfoList::registerMetadata();
|
||||||
|
CSimulatorInternals::registerMetadata();
|
||||||
|
CSimulatorMessagesSettings::registerMetadata();
|
||||||
CSimulatorPluginInfo::registerMetadata();
|
CSimulatorPluginInfo::registerMetadata();
|
||||||
CSimulatorPluginInfoList::registerMetadata();
|
CSimulatorPluginInfoList::registerMetadata();
|
||||||
CSimulatorInternals::registerMetadata();
|
CSimulatorSettings::registerMetadata();
|
||||||
CVPilotModelRule::registerMetadata();
|
CVPilotModelRule::registerMetadata();
|
||||||
CVPilotModelRuleSet::registerMetadata();
|
CVPilotModelRuleSet::registerMetadata();
|
||||||
CSimulatorSettings::registerMetadata();
|
|
||||||
CModelSettings::registerMetadata();
|
|
||||||
CSimulatorMessagesSettings::registerMetadata();
|
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "multiplayerpacketparser.h"
|
#include "multiplayerpacketparser.h"
|
||||||
#include "directplayerror.h"
|
#include "directplayerror.h"
|
||||||
#include "directplayutils.h"
|
#include "directplayutils.h"
|
||||||
|
#include "blackmisc/simulation/interpolationhints.h"
|
||||||
#include "blackmisc/aviation/aircraftsituation.h"
|
#include "blackmisc/aviation/aircraftsituation.h"
|
||||||
#include "blackmisc/geo/coordinategeodetic.h"
|
#include "blackmisc/geo/coordinategeodetic.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
@@ -169,8 +170,8 @@ namespace BlackSimPlugin
|
|||||||
if (m_clientStatus == Disconnected) { return; }
|
if (m_clientStatus == Disconnected) { return; }
|
||||||
|
|
||||||
IInterpolator::InterpolationStatus status;
|
IInterpolator::InterpolationStatus status;
|
||||||
bool vtolAircraft(false);
|
const CInterpolationHints hints;
|
||||||
CAircraftSituation situation = this->m_interpolator->getInterpolatedSituation(m_callsign, -1, vtolAircraft, status);
|
const CAircraftSituation situation = this->m_interpolator->getInterpolatedSituation(m_callsign, -1, hints, status);
|
||||||
|
|
||||||
// Test only for successful interpolation. FS9 requires constant positions
|
// Test only for successful interpolation. FS9 requires constant positions
|
||||||
if (!status.didInterpolationSucceed()) { return; }
|
if (!status.didInterpolationSucceed()) { return; }
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "blackmisc/interpolator.h"
|
#include "blackmisc/interpolator.h"
|
||||||
#include "blackmisc/interpolatorlinear.h"
|
#include "blackmisc/interpolatorlinear.h"
|
||||||
|
#include "blackmisc/simulation/interpolationhints.h"
|
||||||
#include "blackmisc/simulation/remoteaircraftproviderdummy.h"
|
#include "blackmisc/simulation/remoteaircraftproviderdummy.h"
|
||||||
#include "XPMPMultiplayer.h"
|
#include "XPMPMultiplayer.h"
|
||||||
#include <XPLM/XPLMProcessing.h>
|
#include <XPLM/XPLMProcessing.h>
|
||||||
@@ -305,7 +306,8 @@ namespace XBus
|
|||||||
case xpmpDataType_Position:
|
case xpmpDataType_Position:
|
||||||
{
|
{
|
||||||
BlackMisc::IInterpolator::InterpolationStatus status;
|
BlackMisc::IInterpolator::InterpolationStatus status;
|
||||||
auto situation = m_interpolator->getInterpolatedSituation(plane->situations, -1, false, status);
|
const BlackMisc::Simulation::CInterpolationHints hints;
|
||||||
|
auto situation = m_interpolator->getInterpolatedSituation(plane->situations, -1, hints, status);
|
||||||
if (! status.didInterpolationSucceed()) { return xpmpData_Unavailable; }
|
if (! status.didInterpolationSucceed()) { return xpmpData_Unavailable; }
|
||||||
if (! status.hasChangedPosition()) { return xpmpData_Unchanged; }
|
if (! status.hasChangedPosition()) { return xpmpData_Unchanged; }
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "blackmisc/pq/physicalquantity.h"
|
#include "blackmisc/pq/physicalquantity.h"
|
||||||
#include "blackmisc/pq/speed.h"
|
#include "blackmisc/pq/speed.h"
|
||||||
#include "blackmisc/pq/units.h"
|
#include "blackmisc/pq/units.h"
|
||||||
|
#include "blackmisc/simulation/interpolationhints.h"
|
||||||
#include "blackmisc/simulation/remoteaircraftprovider.h"
|
#include "blackmisc/simulation/remoteaircraftprovider.h"
|
||||||
#include "blackmisc/simulation/remoteaircraftproviderdummy.h"
|
#include "blackmisc/simulation/remoteaircraftproviderdummy.h"
|
||||||
|
|
||||||
@@ -89,6 +90,7 @@ namespace BlackMiscTest
|
|||||||
|
|
||||||
// interpolation functional check
|
// interpolation functional check
|
||||||
IInterpolator::InterpolationStatus status;
|
IInterpolator::InterpolationStatus status;
|
||||||
|
const CInterpolationHints hints;
|
||||||
double latOld = 360.0;
|
double latOld = 360.0;
|
||||||
double lngOld = 360.0;
|
double lngOld = 360.0;
|
||||||
for (qint64 currentTime = ts - 2 * deltaT + offset; currentTime < ts + offset; currentTime += (deltaT / 20))
|
for (qint64 currentTime = ts - 2 * deltaT + offset; currentTime < ts + offset; currentTime += (deltaT / 20))
|
||||||
@@ -97,7 +99,7 @@ namespace BlackMiscTest
|
|||||||
// from: ts - 2 * deltaT + offset
|
// from: ts - 2 * deltaT + offset
|
||||||
// to: ts + offset
|
// to: ts + offset
|
||||||
CAircraftSituation currentSituation(interpolator.getInterpolatedSituation
|
CAircraftSituation currentSituation(interpolator.getInterpolatedSituation
|
||||||
(cs, currentTime, false, status)
|
(cs, currentTime, hints, status)
|
||||||
);
|
);
|
||||||
QVERIFY2(status.didInterpolationSucceed(), "Interpolation was not succesful");
|
QVERIFY2(status.didInterpolationSucceed(), "Interpolation was not succesful");
|
||||||
QVERIFY2(status.hasChangedPosition(), "Interpolation did not changed");
|
QVERIFY2(status.hasChangedPosition(), "Interpolation did not changed");
|
||||||
@@ -114,7 +116,6 @@ namespace BlackMiscTest
|
|||||||
int interpolationNo = 0;
|
int interpolationNo = 0;
|
||||||
qint64 startTimeMsSinceEpoch = ts - 2 * deltaT;
|
qint64 startTimeMsSinceEpoch = ts - 2 * deltaT;
|
||||||
|
|
||||||
|
|
||||||
// Pseudo performance test:
|
// Pseudo performance test:
|
||||||
// Those make not completely sense, as the performance depends on the implementation of
|
// Those make not completely sense, as the performance depends on the implementation of
|
||||||
// the dummy provider, which is different from the real provider
|
// the dummy provider, which is different from the real provider
|
||||||
@@ -128,7 +129,7 @@ namespace BlackMiscTest
|
|||||||
// from: ts - 2* deltaT + offset
|
// from: ts - 2* deltaT + offset
|
||||||
// to: ts + offset
|
// to: ts + offset
|
||||||
CAircraftSituation currentSituation(interpolator.getInterpolatedSituation
|
CAircraftSituation currentSituation(interpolator.getInterpolatedSituation
|
||||||
(cs, currentTime, false, status)
|
(cs, currentTime, hints, status)
|
||||||
);
|
);
|
||||||
QVERIFY2(status.allTrue(), "Failed interpolation");
|
QVERIFY2(status.allTrue(), "Failed interpolation");
|
||||||
QVERIFY2(currentSituation.getCallsign() == cs, "Wrong callsign");
|
QVERIFY2(currentSituation.getCallsign() == cs, "Wrong callsign");
|
||||||
|
|||||||
Reference in New Issue
Block a user