refs #863 Each aircraft gets its own interpolator instance,

so each one can cache calculations from one frame to the next.
The recent situations and parts are members of the interpolator.
This commit is contained in:
Mathew Sutcliffe
2017-02-05 15:54:39 +00:00
parent 2181702c5c
commit a167cc8e43
17 changed files with 108 additions and 87 deletions

View File

@@ -36,7 +36,6 @@
#include "blackmisc/pq/units.h"
#include "blackmisc/simulation/interpolationhints.h"
#include "blackmisc/simulation/remoteaircraftprovider.h"
#include "blackmisc/simulation/remoteaircraftproviderdummy.h"
#include <QCoreApplication>
#include <QDebug>
@@ -57,8 +56,7 @@ namespace BlackMiscTest
void CTestInterpolator::linearInterpolator()
{
QScopedPointer<CRemoteAircraftProviderDummy> provider(new CRemoteAircraftProviderDummy());
CInterpolatorLinear interpolator(provider.data());
CInterpolatorLinear interpolator;
// fixed time so everything can be debugged
const qint64 ts = 1425000000000; // QDateTime::currentMSecsSinceEpoch();
@@ -72,23 +70,19 @@ namespace BlackMiscTest
// check height above ground
CLength hag = (s.getAltitude() - s.getGroundElevation());
QVERIFY2(s.getHeightAboveGround() == hag, "Wrong elevation");
provider->insertNewSituation(s);
interpolator.addAircraftSituation(s);
}
constexpr int partsCount = 10;
for (int i = 0; i < partsCount; i++)
{
CAircraftParts p(getTestParts(i, ts, deltaT));
provider->insertNewAircraftParts(cs, p);
interpolator.addAircraftParts(p);
}
// make sure signals are processed, if the interpolator depends on those signals
QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
// check if all situations / parts have been received
QVERIFY2(provider->remoteAircraftSituations(cs).size() == IRemoteAircraftProvider::MaxSituationsPerCallsign, "Missing situations");
QVERIFY2(provider->remoteAircraftParts(cs).size() == partsCount, "Missing parts");
// interpolation functional check
IInterpolator::InterpolationStatus status;
const CInterpolationHints hints;