Ref T259, Ref T243 removed interpolation hints

* no longer needed with providers in that form
* pure refactoring commit, just guarantees compilation
* already minor adjustments to use providers
This commit is contained in:
Klaus Basan
2018-03-20 20:15:26 +01:00
parent 476768f6ec
commit 0c06ac26f7
37 changed files with 140 additions and 586 deletions

View File

@@ -439,11 +439,8 @@ namespace BlackSimPlugin
CInterpolatorMulti *im = m_interpolators[cs];
CInterpolationStatus statusInterpolation;
CPartsStatus statusParts;
CInterpolationHints hints;
Q_ASSERT_X(im, Q_FUNC_INFO, "interpolator missing");
if (m_hints.contains(cs)) { hints = m_hints[cs]; }
hints.setLoggingInterpolation(log);
const CAircraftSituation s = im->getInterpolatedSituation(now, setup, hints, statusInterpolation);
const CAircraftSituation s = im->getInterpolatedSituation(now, setup, statusInterpolation);
const CAircraftParts p = im->getInterpolatedParts(now, setup, statusParts, log);
m_countInterpolatedParts++;
m_countInterpolatedSituations++;

View File

@@ -15,7 +15,6 @@
#include "directplayerror.h"
#include "directplayutils.h"
#include "blackcore/simulator.h"
#include "blackmisc/simulation/interpolationhints.h"
#include "blackmisc/aviation/aircraftsituation.h"
#include "blackmisc/geo/coordinategeodetic.h"
#include "blackmisc/logmessage.h"
@@ -174,10 +173,8 @@ namespace BlackSimPlugin
if (m_clientStatus == Disconnected) { return; }
CInterpolationStatus status;
CInterpolationHints hints; // \fixme 201701 #865 KB if there is an elevation provider for FS9 add it here or set elevation
CInterpolationAndRenderingSetupPerCallsign setup = this->simulator()->getInterpolationSetupPerCallsignOrDefault(m_callsign);
hints.setLoggingInterpolation(setup.logInterpolation());
const CAircraftSituation situation = m_interpolator.getInterpolatedSituation(-1, setup, hints, status);
const CAircraftSituation situation = m_interpolator.getInterpolatedSituation(-1, setup, status);
// Test only for successful position. FS9 requires constant positions
if (!status.hasValidSituation()) { return; }

View File

@@ -163,10 +163,10 @@ namespace BlackSimPlugin
CAircraftSituation CSimConnectObject::getInterpolatedSituation(
qint64 currentTimeSinceEpoc,
const CInterpolationAndRenderingSetupPerCallsign &setup,
const CInterpolationHints &hints, CInterpolationStatus &status) const
CInterpolationStatus &status) const
{
Q_ASSERT(m_interpolator);
return m_interpolator->getInterpolatedSituation(currentTimeSinceEpoc, setup, hints, status);
return m_interpolator->getInterpolatedSituation(currentTimeSinceEpoc, setup, status);
}
CAircraftParts CSimConnectObject::getInterpolatedParts(

View File

@@ -164,7 +164,7 @@ namespace BlackSimPlugin
BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
qint64 currentTimeSinceEpoc,
const BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign &setup,
const BlackMisc::Simulation::CInterpolationHints &hints, BlackMisc::Simulation::CInterpolationStatus &status) const;
BlackMisc::Simulation::CInterpolationStatus &status) const;
//! \copydoc BlackMisc::Simulation::CInterpolator::getInterpolatedParts
BlackMisc::Aviation::CAircraftParts getInterpolatedParts(

View File

@@ -15,7 +15,6 @@
#include "blackmisc/simulation/fscommon/fscommonutil.h"
#include "blackmisc/simulation/aircraftmodel.h"
#include "blackmisc/simulation/interpolatormulti.h"
#include "blackmisc/simulation/interpolationhints.h"
#include "blackmisc/simulation/simulatorplugininfo.h"
#include "blackmisc/aviation/airportlist.h"
#include "blackmisc/geo/elevationplane.h"
@@ -489,11 +488,6 @@ namespace BlackSimPlugin
CElevationPlane elevation(remoteAircraftData.latitude, remoteAircraftData.longitude, remoteAircraftData.elevation);
elevation.setSinglePointRadius();
// const QString debug(hints.debugInfo(elevation));
CInterpolationHints &hints = m_hints[simObject.getCallsign()];
hints.setElevationPlane(elevation); // update elevation
hints.setCGAboveGround({ remoteAircraftData.cgToGround, CLengthUnit::ft() }); // normally never changing, but if user changes ModelMatching update possible
// set it in the remote aircraft provider
this->updateAircraftGroundElevation(simObject.getCallsign(), elevation);
@@ -915,7 +909,6 @@ namespace BlackSimPlugin
// clean up anyway
this->removeFromAddPendingAndAddAgainAircraft(callsign);
m_hints.remove(callsign);
// really remove from simulator
if (!m_simConnectObjects.contains(callsign)) { return false; } // already fully removed or not yet added
@@ -1126,10 +1119,7 @@ namespace BlackSimPlugin
// get interpolated situation
CInterpolationStatus interpolatorStatus;
CInterpolationHints hints(m_hints[callsign]);
hints.setAircraftParts(useAircraftParts ? parts : CAircraftParts(), useAircraftParts);
hints.setLoggingInterpolation(logInterpolationAndParts);
const CAircraftSituation interpolatedSituation = simObject.getInterpolatedSituation(currentTimestamp, setup, hints, interpolatorStatus);
const CAircraftSituation interpolatedSituation = simObject.getInterpolatedSituation(currentTimestamp, setup, interpolatorStatus);
if (interpolatorStatus.hasValidSituation())
{

View File

@@ -632,9 +632,6 @@ namespace BlackSimPlugin
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "wrong thread");
if (callsign.isEmpty()) { return false; } // can happen if an object is not an aircraft
// clean up anyway
m_hints.remove(callsign);
// really remove from simulator
if (!m_xplaneAircraftObjects.contains(callsign)) { return false; } // already fully removed or not yet added
@@ -837,10 +834,7 @@ namespace BlackSimPlugin
// get interpolated situation
CInterpolationStatus interpolatorStatus;
CInterpolationHints hints(m_hints[callsign]);
hints.setAircraftParts(useAircraftParts ? parts : CAircraftParts(), useAircraftParts);
hints.setLoggingInterpolation(logInterpolationAndParts);
const CAircraftSituation interpolatedSituation = xplaneAircraft.getInterpolatedSituation(currentTimestamp, setup, hints, interpolatorStatus);
const CAircraftSituation interpolatedSituation = xplaneAircraft.getInterpolatedSituation(currentTimestamp, setup, interpolatorStatus);
if (interpolatorStatus.hasValidSituation())
{
@@ -999,13 +993,8 @@ namespace BlackSimPlugin
CElevationPlane elevation(CLatitude(latitudeDeg, CAngleUnit::deg()), CLongitude(longitudeDeg, CAngleUnit::deg()), CAltitude(elevationMeters, CLengthUnit::m()));
elevation.setSinglePointRadius();
// The entire vertical offset (CG offset) is still very experimental in X-Plane. Libxplanemp simply calculates the lowest Y
// value from all the OpenGL model vertices. I assume its in meters.
// The unit of modelVerticalOffset is still very unknown. This needs to be confirmed.
CInterpolationHints &hints = m_hints[cs];
hints.setElevationPlane(elevation); // update elevation
hints.setCGAboveGround({ modelVerticalOffsetMeters, CLengthUnit::m() });
this->rememberGroundElevation(elevation);
this->insertCG(CLength(modelVerticalOffsetMeters, CLengthUnit::m()), callsign);
// set it in the remote aircraft provider
this->updateAircraftGroundElevation(cs, elevation);

View File

@@ -92,10 +92,10 @@ namespace BlackSimPlugin
CAircraftSituation CXPlaneMPAircraft::getInterpolatedSituation(
qint64 currentTimeSinceEpoc,
const CInterpolationAndRenderingSetupPerCallsign &setup,
const CInterpolationHints &hints, CInterpolationStatus &status) const
CInterpolationStatus &status) const
{
Q_ASSERT(m_interpolator);
return m_interpolator->getInterpolatedSituation(currentTimeSinceEpoc, setup, hints, status);
return m_interpolator->getInterpolatedSituation(currentTimeSinceEpoc, setup, status);
}
CAircraftParts CXPlaneMPAircraft::getInterpolatedParts(

View File

@@ -90,7 +90,7 @@ namespace BlackSimPlugin
BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
qint64 currentTimeSinceEpoc,
const BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign &setup,
const BlackMisc::Simulation::CInterpolationHints &hints, BlackMisc::Simulation::CInterpolationStatus &status) const;
BlackMisc::Simulation::CInterpolationStatus &status) const;
//! \copydoc BlackMisc::Simulation::CInterpolator::getInterpolatedParts
BlackMisc::Aviation::CAircraftParts getInterpolatedParts(