mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
It was planned to do all interpolation calculations at once in background, this concept is not used anymore
68 lines
2.0 KiB
C++
68 lines
2.0 KiB
C++
/* Copyright (C) 2015
|
|
* swift project Community / Contributors
|
|
*
|
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
|
* contained in the LICENSE file.
|
|
*/
|
|
|
|
#include "interpolator.h"
|
|
#include "blackmisc/logmessage.h"
|
|
#include <functional>
|
|
|
|
using namespace BlackMisc;
|
|
using namespace BlackMisc::Aviation;
|
|
using namespace BlackMisc::Simulation;
|
|
|
|
|
|
namespace BlackCore
|
|
{
|
|
|
|
IInterpolator::IInterpolator(IRemoteAircraftProvider *provider, const QString &objectName, QObject *parent) :
|
|
QObject(parent),
|
|
CRemoteAircraftAware(provider)
|
|
{
|
|
Q_ASSERT_X(provider, Q_FUNC_INFO, "missing provider");
|
|
this->setObjectName(objectName);
|
|
}
|
|
|
|
CAircraftPartsList IInterpolator::getPartsBeforeTime(const CCallsign &callsign, qint64 cutoffTime, BlackCore::IInterpolator::PartsStatus &partsStatus)
|
|
{
|
|
static const CAircraftPartsList empty;
|
|
Q_ASSERT_X(!callsign.isEmpty(), Q_FUNC_INFO, "empty callsign");
|
|
partsStatus.reset();
|
|
|
|
partsStatus.supportsParts = this->isRemoteAircraftSupportingParts(callsign);
|
|
if (!partsStatus.supportsParts) { return empty; }
|
|
return this->remoteAircraftParts(callsign, cutoffTime);
|
|
}
|
|
|
|
void IInterpolator::enableDebugMessages(bool enabled)
|
|
{
|
|
this->m_withDebugMsg = enabled;
|
|
}
|
|
|
|
bool IInterpolator::InterpolationStatus::allTrue() const
|
|
{
|
|
return interpolationSucceeded && changedPosition;
|
|
}
|
|
|
|
void IInterpolator::InterpolationStatus::reset()
|
|
{
|
|
changedPosition = false;
|
|
interpolationSucceeded = false;
|
|
}
|
|
|
|
bool IInterpolator::PartsStatus::allTrue() const
|
|
{
|
|
return supportsParts;
|
|
}
|
|
|
|
void IInterpolator::PartsStatus::reset()
|
|
{
|
|
supportsParts = false;
|
|
}
|
|
|
|
} // namespace
|