mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
* access via provider, access now possible also beyond the scope of interpolator * will be used in (to be written airpace analyzer) * renamed some member functions as required * fixed some asserts / Doxygen comments * adjusted unit tests * added vtolAircraft flag for interpolator, not fully used everywhere remarks: update signals for parts / situation still only needed in XP driver
88 lines
2.8 KiB
C++
88 lines
2.8 KiB
C++
/* Copyright (C) 2014
|
|
* 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.
|
|
*/
|
|
|
|
//! \file
|
|
|
|
#ifndef BLACKCORE_INTERPOLATOR_H
|
|
#define BLACKCORE_INTERPOLATOR_H
|
|
|
|
#include "blackcoreexport.h"
|
|
#include "blackmisc/aviation/aircraftsituation.h"
|
|
#include "blackmisc/simulation/remoteaircraftprovider.h"
|
|
#include "blackmisc/worker.h"
|
|
#include <QHash>
|
|
#include <QList>
|
|
|
|
namespace BlackCore
|
|
{
|
|
//! Interpolator, calculation inbetween positions
|
|
class BLACKCORE_EXPORT IInterpolator :
|
|
public BlackMisc::CContinuousWorker,
|
|
public BlackMisc::Simulation::CRemoteAircraftAwareReadOnly
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
//! Virtual destructor
|
|
virtual ~IInterpolator() {}
|
|
|
|
//! Log category
|
|
static QString getMessageCategory() { return "swift.interpolator"; }
|
|
|
|
//! Status of interpolation
|
|
struct BLACKCORE_EXPORT InterpolationStatus
|
|
{
|
|
public:
|
|
bool changedPosition = false; //!< position was changed
|
|
bool interpolationSucceeded = false; //!< interpolation succeeded (means enough values, etc.)
|
|
|
|
//! all OK
|
|
bool allTrue() const;
|
|
|
|
//! Reset to default values
|
|
void reset();
|
|
};
|
|
|
|
//! Status regarding parts
|
|
struct PartsStatus
|
|
{
|
|
bool supportsParts = false; //!< supports parts for given callsign
|
|
|
|
//! all OK
|
|
bool allTrue() const;
|
|
|
|
//! Reset to default values
|
|
void reset();
|
|
};
|
|
|
|
//! Current interpolated situation
|
|
//! \threadsafe
|
|
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
|
const BlackMisc::Aviation::CCallsign &callsign, qint64 currentTimeSinceEpoc, bool isVtolAircraft, InterpolationStatus &status) const = 0;
|
|
|
|
//! Parts before given offset time (aka pending parts)
|
|
//! \threadsafe
|
|
virtual BlackMisc::Aviation::CAircraftPartsList getPartsBeforeTime(const BlackMisc::Aviation::CCallsign &callsign, qint64 cutoffTime, PartsStatus &partsStatus);
|
|
|
|
//! Enable debug messages
|
|
void enableDebugMessages(bool enabled);
|
|
|
|
static const qint64 TimeOffsetMs = 6000; //!< offset for interpolation
|
|
|
|
protected:
|
|
//! Constructor
|
|
IInterpolator(BlackMisc::Simulation::IRemoteAircraftProviderReadOnly *provider, const QString &workerName, QObject *parent = nullptr);
|
|
|
|
bool m_withDebugMsg = false; //!< allows to disable debug messages
|
|
};
|
|
|
|
} // namespace
|
|
|
|
#endif // guard
|