mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
refs #796, allow to toggle full interpolation
* add setup class, metadata registration, property index ... * removed enableDebugMessages, added setInterpolatorSetup * adjusted contexts * used in interolator
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackmisc/aviation/airportlist.h"
|
||||
#include "blackmisc/identifier.h"
|
||||
#include "blackmisc/interpolationsetup.h"
|
||||
#include "blackmisc/pixmap.h"
|
||||
#include "blackmisc/pq/length.h"
|
||||
#include "blackmisc/pq/time.h"
|
||||
@@ -187,6 +188,9 @@ namespace BlackCore
|
||||
//! Rendering enabled at all
|
||||
virtual bool isRenderingEnabled() const = 0;
|
||||
|
||||
//! Set interpolation and rendering
|
||||
virtual void setInterpolationAndRenderingSetup(const BlackMisc::CInterpolationAndRenderingSetup &setup) = 0;
|
||||
|
||||
//! Time synchronization offset
|
||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const = 0;
|
||||
|
||||
@@ -199,9 +203,6 @@ namespace BlackCore
|
||||
//! Icon representing the model
|
||||
virtual BlackMisc::CPixmap iconForModel(const QString &modelString) const = 0;
|
||||
|
||||
//! Enable debugging
|
||||
virtual void enableDebugMessages(bool driver, bool interpolator) = 0;
|
||||
|
||||
//! Get mapping messages
|
||||
virtual BlackMisc::CStatusMessageList getMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign) const = 0;
|
||||
|
||||
|
||||
@@ -154,6 +154,13 @@ namespace BlackCore
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
}
|
||||
|
||||
//! \copydoc ISimulator::setInterpolationAndRenderingSetup
|
||||
virtual void setInterpolationAndRenderingSetup(const BlackMisc::CInterpolationAndRenderingSetup &setup) override
|
||||
{
|
||||
Q_UNUSED(setup);
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::setMaxRenderedDistance
|
||||
virtual void deleteAllRenderingRestrictions() override
|
||||
{
|
||||
@@ -234,14 +241,6 @@ namespace BlackCore
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
}
|
||||
|
||||
//! \copydoc ISimulator::enableDebugMessages
|
||||
virtual void enableDebugMessages(bool driver, bool interpolator) override
|
||||
{
|
||||
Q_UNUSED(driver);
|
||||
Q_UNUSED(interpolator);
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::getMatchingMessages
|
||||
virtual BlackMisc::CStatusMessageList getMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign) const override
|
||||
{
|
||||
|
||||
@@ -236,6 +236,14 @@ namespace BlackCore
|
||||
m_simulatorPlugin.second->setMaxRenderedDistance(distance);
|
||||
}
|
||||
|
||||
void CContextSimulator::setInterpolationAndRenderingSetup(const CInterpolationAndRenderingSetup &setup)
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << setup; }
|
||||
if (m_simulatorPlugin.first.isUnspecified()) { return; }
|
||||
Q_ASSERT(m_simulatorPlugin.second);
|
||||
m_simulatorPlugin.second->setInterpolationAndRenderingSetup(setup);
|
||||
}
|
||||
|
||||
QString CContextSimulator::getRenderRestrictionText() const
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
@@ -620,13 +628,6 @@ namespace BlackCore
|
||||
return pm;
|
||||
}
|
||||
|
||||
void CContextSimulator::enableDebugMessages(bool driver, bool interpolator)
|
||||
{
|
||||
if (m_simulatorPlugin.first.isUnspecified()) { return; }
|
||||
Q_ASSERT_X(m_simulatorPlugin.second, Q_FUNC_INFO, "Missing simulator");
|
||||
return m_simulatorPlugin.second->enableDebugMessages(driver, interpolator);
|
||||
}
|
||||
|
||||
CStatusMessageList CContextSimulator::getMatchingMessages(const CCallsign &callsign) const
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace BlackCore
|
||||
void gracefulShutdown();
|
||||
|
||||
public slots:
|
||||
//! \name Interface overrides
|
||||
//! \name Interface implementations
|
||||
//! @{
|
||||
virtual BlackMisc::Simulation::CSimulatorPluginInfo getSimulatorPluginInfo() const override;
|
||||
virtual BlackMisc::Simulation::CSimulatorPluginInfoList getAvailableSimulatorPlugins() const override;
|
||||
@@ -91,6 +91,7 @@ namespace BlackCore
|
||||
virtual void setMaxRenderedAircraft(int number) override;
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getMaxRenderedDistance() const override;
|
||||
virtual void setMaxRenderedDistance(const BlackMisc::PhysicalQuantities::CLength &distance) override;
|
||||
virtual void setInterpolationAndRenderingSetup(const BlackMisc::CInterpolationAndRenderingSetup &setup) override;
|
||||
virtual QString getRenderRestrictionText() const override;
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getRenderedDistanceBoundary() const override;
|
||||
virtual void deleteAllRenderingRestrictions() override;
|
||||
@@ -101,7 +102,6 @@ namespace BlackCore
|
||||
virtual void highlightAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const BlackMisc::PhysicalQuantities::CTime &displayTime) override;
|
||||
virtual bool resetToModelMatchingAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual void requestWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier) override;
|
||||
virtual void enableDebugMessages(bool driver, bool interpolator) override;
|
||||
virtual BlackMisc::CStatusMessageList getMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
virtual bool isMatchingMessagesEnabled() const override;
|
||||
virtual void enableMatchingMessages(bool enabled) override;
|
||||
|
||||
@@ -139,6 +139,11 @@ namespace BlackCore
|
||||
m_dBusInterface->callDBus(QLatin1Literal("setMaxRenderedDistance"), distance);
|
||||
}
|
||||
|
||||
void CContextSimulatorProxy::setInterpolationAndRenderingSetup(const CInterpolationAndRenderingSetup &setup)
|
||||
{
|
||||
m_dBusInterface->callDBus(QLatin1Literal("setInterpolationAndRenderingSetup"), setup);
|
||||
}
|
||||
|
||||
void CContextSimulatorProxy::deleteAllRenderingRestrictions()
|
||||
{
|
||||
m_dBusInterface->callDBus(QLatin1Literal("deleteAllRenderingRestrictions"));
|
||||
@@ -209,11 +214,6 @@ namespace BlackCore
|
||||
m_dBusInterface->callDBus(QLatin1Literal("requestWeatherGrid"), weatherGrid, identifier);
|
||||
}
|
||||
|
||||
void CContextSimulatorProxy::enableDebugMessages(bool driver, bool interpolator)
|
||||
{
|
||||
m_dBusInterface->callDBus(QLatin1Literal("enableDebugMessages"), driver, interpolator);
|
||||
}
|
||||
|
||||
CStatusMessageList CContextSimulatorProxy::getMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign) const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<BlackMisc::CStatusMessageList>(QLatin1Literal("getMatchingMessages"), callsign);
|
||||
|
||||
@@ -70,6 +70,7 @@ namespace BlackCore
|
||||
virtual int getMaxRenderedAircraft() const override;
|
||||
virtual void setMaxRenderedAircraft(int number) override;
|
||||
virtual void setMaxRenderedDistance(const BlackMisc::PhysicalQuantities::CLength &distance) override;
|
||||
virtual void setInterpolationAndRenderingSetup(const BlackMisc::CInterpolationAndRenderingSetup &setup) override;
|
||||
virtual void deleteAllRenderingRestrictions() override;
|
||||
virtual bool isRenderingRestricted() const override;
|
||||
virtual bool isRenderingEnabled() const override;
|
||||
@@ -81,7 +82,6 @@ namespace BlackCore
|
||||
virtual void highlightAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const BlackMisc::PhysicalQuantities::CTime &displayTime) override;
|
||||
virtual bool resetToModelMatchingAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual void requestWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier) override;
|
||||
virtual void enableDebugMessages(bool driver, bool interpolator) override;
|
||||
virtual BlackMisc::CStatusMessageList getMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
virtual bool isMatchingMessagesEnabled() const override;
|
||||
virtual void enableMatchingMessages(bool enabled) override;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "blackmisc/identifiable.h"
|
||||
#include "blackmisc/identifier.h"
|
||||
#include "blackmisc/pixmap.h"
|
||||
#include "blackmisc/interpolationsetup.h"
|
||||
#include "blackmisc/pq/length.h"
|
||||
#include "blackmisc/pq/time.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
@@ -153,8 +154,8 @@ namespace BlackCore
|
||||
//! Delete all restrictions (if any) -> unlimited number of aircraft
|
||||
virtual void deleteAllRenderingRestrictions() = 0;
|
||||
|
||||
//! Enable debugging messages
|
||||
virtual void enableDebugMessages(bool driver, bool interpolator) = 0;
|
||||
//! Enable debugging messages etc.
|
||||
virtual void setInterpolationAndRenderingSetup(const BlackMisc::CInterpolationAndRenderingSetup &setup) = 0;
|
||||
|
||||
//! Is the aircraft rendered (displayed in simulator)?
|
||||
//! This shall only return true if the aircraft is really visible in the simulator
|
||||
|
||||
@@ -314,10 +314,10 @@ namespace BlackCore
|
||||
return !m_maxRenderedDistance.isNull();
|
||||
}
|
||||
|
||||
void CSimulatorCommon::enableDebugMessages(bool driverMessages, bool interpolatorMessages)
|
||||
void CSimulatorCommon::setInterpolationAndRenderingSetup(const CInterpolationAndRenderingSetup &setup)
|
||||
{
|
||||
this->m_debugMessages = driverMessages;
|
||||
Q_UNUSED(interpolatorMessages);
|
||||
this->m_interpolationRenderingSetup = setup;
|
||||
this->m_interpolator->setInterpolatorSetup(setup);
|
||||
}
|
||||
|
||||
void CSimulatorCommon::highlightAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const BlackMisc::PhysicalQuantities::CTime &displayTime)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "blackcore/aircraftmatcher.h"
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackmisc/interpolationsetup.h"
|
||||
#include "blackmisc/aviation/callsignset.h"
|
||||
#include "blackmisc/connectionguard.h"
|
||||
#include "blackmisc/pq/length.h"
|
||||
@@ -75,7 +76,7 @@ namespace BlackCore
|
||||
virtual BlackMisc::PhysicalQuantities::CLength getRenderedDistanceBoundary() const override;
|
||||
virtual bool isMaxAircraftRestricted() const override;
|
||||
virtual bool isMaxDistanceRestricted() const override;
|
||||
virtual void enableDebugMessages(bool driverMessages, bool interpolatorMessages) override;
|
||||
virtual void setInterpolationAndRenderingSetup(const BlackMisc::CInterpolationAndRenderingSetup &setup) override;
|
||||
virtual void highlightAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const BlackMisc::PhysicalQuantities::CTime &displayTime) override;
|
||||
virtual bool isRenderingEnabled() const override;
|
||||
virtual bool isRenderingRestricted() const override;
|
||||
@@ -148,7 +149,6 @@ namespace BlackCore
|
||||
void ps_allSwiftDataRead();
|
||||
|
||||
private:
|
||||
bool m_debugMessages = false; //!< Display debug messages
|
||||
bool m_blinkCycle = false; //!< use for highlighting
|
||||
qint64 m_highlightEndTimeMsEpoch = 0; //!< end highlighting
|
||||
int m_timerCounter = 0; //!< allows to calculate n seconds
|
||||
@@ -159,6 +159,7 @@ namespace BlackCore
|
||||
BlackMisc::Aviation::CCallsignSet m_callsignsToBeRendered; //!< callsigns which will be rendered
|
||||
BlackMisc::PhysicalQuantities::CLength m_maxRenderedDistance { 0.0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit()}; //!< max.distance for rendering
|
||||
BlackMisc::CConnectionGuard m_remoteAircraftProviderConnections; //!< connected signal/slots
|
||||
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
71
src/blackmisc/interpolationsetup.cpp
Normal file
71
src/blackmisc/interpolationsetup.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
/* Copyright (C) 2016
|
||||
* 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 "blackmisc/interpolationsetup.h"
|
||||
#include "stringutils.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
CInterpolationAndRenderingSetup::CInterpolationAndRenderingSetup()
|
||||
{ }
|
||||
|
||||
QString CInterpolationAndRenderingSetup::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
QString s("Setup: debug sim: ");
|
||||
s += boolToYesNo(this->m_simulatorDebugMessages);
|
||||
s += " debug interpolator: ";
|
||||
s += boolToYesNo(this->m_interpolatorDebugMessage);
|
||||
s += " force full interpolation: ";
|
||||
s += boolToYesNo(this->m_forceFullInterpolation);
|
||||
return s;
|
||||
}
|
||||
|
||||
CVariant CInterpolationAndRenderingSetup::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexInterpolatorDebugMessages:
|
||||
return CVariant::fromValue(m_interpolatorDebugMessage);
|
||||
case IndexSimulatorDebugMessages:
|
||||
return CVariant::fromValue(m_simulatorDebugMessages);
|
||||
case IndexForceFullInterpolation:
|
||||
return CVariant::fromValue(m_forceFullInterpolation);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CInterpolationAndRenderingSetup::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
{
|
||||
if (index.isMyself())
|
||||
{
|
||||
*this = variant.value<CInterpolationAndRenderingSetup>();
|
||||
return;
|
||||
}
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexInterpolatorDebugMessages:
|
||||
this->m_interpolatorDebugMessage = variant.toBool();
|
||||
break;
|
||||
case IndexSimulatorDebugMessages:
|
||||
this->m_simulatorDebugMessages = variant.toBool();
|
||||
break;
|
||||
case IndexForceFullInterpolation:
|
||||
this->m_forceFullInterpolation = variant.toBool();
|
||||
break;
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
83
src/blackmisc/interpolationsetup.h
Normal file
83
src/blackmisc/interpolationsetup.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/* Copyright (C) 2016
|
||||
* 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 BLACKMISC_INTERPOLATION_SETUP_H
|
||||
#define BLACKMISC_INTERPOLATION_SETUP_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/propertyindex.h"
|
||||
#include "blackmisc/valueobject.h"
|
||||
#include <QString>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
/*!
|
||||
* Value object for interpolator and rendering
|
||||
*/
|
||||
class BLACKMISC_EXPORT CInterpolationAndRenderingSetup :
|
||||
public CValueObject<CInterpolationAndRenderingSetup>
|
||||
{
|
||||
public:
|
||||
//! Properties by index
|
||||
enum ColumnIndex
|
||||
{
|
||||
IndexInterpolatorDebugMessages = BlackMisc::CPropertyIndex::GloablIndexInterpolatorSetup,
|
||||
IndexSimulatorDebugMessages,
|
||||
IndexForceFullInterpolation
|
||||
};
|
||||
|
||||
//! Constructor.
|
||||
CInterpolationAndRenderingSetup();
|
||||
|
||||
//! Debugging messages
|
||||
bool showInterpolatorDebugMessages() const { return m_interpolatorDebugMessage; }
|
||||
|
||||
//! Debugging messages
|
||||
void setInterpolatorDebuggingMessages(bool debug) { m_interpolatorDebugMessage = debug; }
|
||||
|
||||
//! Debugging messages
|
||||
bool showSimulatorDebugMessages() const { return m_simulatorDebugMessages; }
|
||||
|
||||
//! Debugging messages
|
||||
void setDriverDebuggingMessages(bool debug) { m_simulatorDebugMessages = debug; }
|
||||
|
||||
//! Full interpolation
|
||||
bool forceFullInterpolation() const { return m_forceFullInterpolation; }
|
||||
|
||||
//! Force full interpolation
|
||||
void setForceFullInterpolation(bool force) { m_forceFullInterpolation = force; }
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
private:
|
||||
bool m_interpolatorDebugMessage = false; //! Debug messages in interpolator
|
||||
bool m_simulatorDebugMessages = false; //! Debug messages of simulator (aka plugin)
|
||||
bool m_forceFullInterpolation = false; //! always do a full interpolation, even if aircraft is not moving
|
||||
|
||||
BLACK_METACLASS(
|
||||
CInterpolationAndRenderingSetup,
|
||||
BLACK_METAMEMBER(interpolatorDebugMessage),
|
||||
BLACK_METAMEMBER(simulatorDebugMessages),
|
||||
BLACK_METAMEMBER(forceFullInterpolation)
|
||||
);
|
||||
};
|
||||
} // namespace
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::CInterpolationAndRenderingSetup)
|
||||
|
||||
#endif // guard
|
||||
@@ -25,7 +25,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
BlackMisc::Aviation::CAircraftSituation IInterpolator::getInterpolatedSituation(const BlackMisc::Aviation::CCallsign &callsign, qint64 currentTimeSinceEpoc,
|
||||
bool isVtolAircraft, InterpolationStatus &status) const
|
||||
bool isVtolAircraft, InterpolationStatus &status) const
|
||||
{
|
||||
// has to be thread safe
|
||||
|
||||
@@ -56,9 +56,16 @@ namespace BlackMisc
|
||||
return this->remoteAircraftParts(callsign, cutoffTime);
|
||||
}
|
||||
|
||||
void IInterpolator::enableDebugMessages(bool enabled)
|
||||
void IInterpolator::setInterpolatorSetup(const CInterpolationAndRenderingSetup &setup)
|
||||
{
|
||||
this->m_withDebugMsg = enabled;
|
||||
QWriteLocker l(&m_lock);
|
||||
m_setup = setup;
|
||||
}
|
||||
|
||||
CInterpolationAndRenderingSetup IInterpolator::getInterpolatorSetup() const
|
||||
{
|
||||
QReadLocker l(&m_lock);
|
||||
return m_setup;
|
||||
}
|
||||
|
||||
bool IInterpolator::InterpolationStatus::allTrue() const
|
||||
@@ -81,5 +88,4 @@ namespace BlackMisc
|
||||
{
|
||||
supportsParts = false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define BLACKMISC_INTERPOLATOR_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/interpolationsetup.h"
|
||||
#include "blackmisc/aviation/aircraftpartslist.h"
|
||||
#include "blackmisc/aviation/aircraftsituation.h"
|
||||
#include "blackmisc/simulation/remoteaircraftprovider.h"
|
||||
@@ -65,18 +66,19 @@ namespace BlackMisc
|
||||
void reset();
|
||||
};
|
||||
|
||||
//! Current interpolated situation
|
||||
//! \threadsafe
|
||||
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
||||
const BlackMisc::Aviation::CAircraftSituationList &situations, qint64 currentTimeSinceEpoc,
|
||||
bool isVtolAircraft, InterpolationStatus &status) const = 0;
|
||||
|
||||
//! Current interpolated situation
|
||||
//! \threadsafe
|
||||
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
||||
const BlackMisc::Aviation::CCallsign &callsign, qint64 currentTimeSinceEpoc,
|
||||
bool isVtolAircraft, InterpolationStatus &status) const;
|
||||
|
||||
//! Current interpolated situation, to be implemented by subclass
|
||||
//! \threadsafe
|
||||
//! \remark public only for XP driver
|
||||
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(
|
||||
const BlackMisc::Aviation::CAircraftSituationList &situations, qint64 currentTimeSinceEpoc,
|
||||
bool isVtolAircraft, InterpolationStatus &status) const = 0;
|
||||
|
||||
//! Parts before given offset time (aka pending parts)
|
||||
//! \threadsafe
|
||||
virtual BlackMisc::Aviation::CAircraftPartsList getPartsBeforeTime(
|
||||
@@ -89,16 +91,21 @@ namespace BlackMisc
|
||||
const BlackMisc::Aviation::CCallsign &callsign, qint64 cutoffTime,
|
||||
PartsStatus &partsStatus) const;
|
||||
|
||||
//! Enable debug messages
|
||||
void enableDebugMessages(bool enabled);
|
||||
//! Enable debug messages etc.
|
||||
//! \threadsafe
|
||||
void setInterpolatorSetup(const BlackMisc::CInterpolationAndRenderingSetup &setup);
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
IInterpolator(BlackMisc::Simulation::IRemoteAircraftProvider *provider, const QString &objectName, QObject *parent);
|
||||
|
||||
bool m_withDebugMsg = false; //!< allows to disable debug messages
|
||||
};
|
||||
//! Enable debug messages etc.
|
||||
//! \threadsafe
|
||||
BlackMisc::CInterpolationAndRenderingSetup getInterpolatorSetup() const;
|
||||
|
||||
BlackMisc::CInterpolationAndRenderingSetup m_setup; //!< allows to disable debug messages
|
||||
mutable QReadWriteLock m_lock; //!< lock interpolator
|
||||
};
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace BlackMisc
|
||||
CAircraftSituation CInterpolatorLinear::getInterpolatedSituation(const BlackMisc::Aviation::CAircraftSituationList &situations, qint64 currentTimeMsSinceEpoc, bool vtolAiracraft, InterpolationStatus &status) const
|
||||
{
|
||||
// has to be thread safe
|
||||
|
||||
const CInterpolationAndRenderingSetup setup = this->getInterpolatorSetup();
|
||||
status.reset();
|
||||
|
||||
// any data at all?
|
||||
@@ -107,7 +107,7 @@ namespace BlackMisc
|
||||
double simulationTimeFraction = 1 - (distanceToSplitTime / deltaTime);
|
||||
if (simulationTimeFraction > 2.0)
|
||||
{
|
||||
if (this->m_withDebugMsg)
|
||||
if (setup.showInterpolatorDebugMessages())
|
||||
{
|
||||
CLogMessage(this).warning("Extrapolation, fraction > 1: %1 for callsign: %2") << simulationTimeFraction << oldSituation.getCallsign();
|
||||
}
|
||||
@@ -132,7 +132,7 @@ namespace BlackMisc
|
||||
+ oldAlt,
|
||||
oldAlt.getReferenceDatum()));
|
||||
|
||||
if (!vtolAiracraft && newVec == oldVec && oldAlt == newAlt)
|
||||
if (!setup.forceFullInterpolation() && !vtolAiracraft && newVec == oldVec && oldAlt == newAlt)
|
||||
{
|
||||
// stop interpolation here, does not work for VTOL aircraft. We need a flag for VTOL aircraft
|
||||
return currentSituation;
|
||||
|
||||
@@ -35,11 +35,12 @@ namespace BlackMisc
|
||||
IInterpolator(provider, "CInterpolatorLinear", parent)
|
||||
{}
|
||||
|
||||
// public base class signature
|
||||
using IInterpolator::getInterpolatedSituation;
|
||||
|
||||
//! \copydoc IInterpolator::getInterpolatedSituation
|
||||
virtual BlackMisc::Aviation::CAircraftSituation getInterpolatedSituation(const BlackMisc::Aviation::CAircraftSituationList &situations, qint64 currentTimeSinceEpoc, bool vtolAiracraft, InterpolationStatus &status) const override;
|
||||
|
||||
using IInterpolator::getInterpolatedSituation;
|
||||
|
||||
//! Log category
|
||||
static QString getLogCategory() { return "swift.interpolatorlinear"; }
|
||||
};
|
||||
|
||||
@@ -110,21 +110,21 @@ namespace BlackMisc
|
||||
GlobalIndexICoordinateWithRelativePosition = 5100,
|
||||
GlobalIndexCCoordinateGeodetic = 5200,
|
||||
GlobalIndexCClient = 6000,
|
||||
GlobalIndexClientCapabilities = 6050, //!< used with map key
|
||||
GlobalIndexCUser = 6100,
|
||||
GlobalIndexCAuthenticatedUser = 6200,
|
||||
GlobalIndexCRole = 6300,
|
||||
GlobalIndexCServer = 6400,
|
||||
GlobalIndexCFsdSetup = 6500,
|
||||
GlobalIndexCUrl = 6600,
|
||||
GlobalIndexCAircraftModel = 6700,
|
||||
GlobalIndexCSimulatedAircraft = 6800,
|
||||
GlobalIndexCTextMessage = 6900,
|
||||
GlobalIndexCSimulatorSetup = 7000,
|
||||
GlobalIndexCSimulatorSettings = 7100,
|
||||
GlobalIndexCSimulatorMessageSettings = 7200,
|
||||
GlobalIndexCAircraftCfgEntries = 7300,
|
||||
GlobalIndexCDistributor = 7400,
|
||||
GlobalIndexClientCapabilities = 6100, //!< used with map key
|
||||
GlobalIndexCUser = 6200,
|
||||
GlobalIndexCAuthenticatedUser = 6300,
|
||||
GlobalIndexCRole = 6400,
|
||||
GlobalIndexCServer = 6500,
|
||||
GlobalIndexCFsdSetup = 6600,
|
||||
GlobalIndexCUrl = 6700,
|
||||
GlobalIndexCAircraftModel = 6800,
|
||||
GlobalIndexCSimulatedAircraft = 6900,
|
||||
GlobalIndexCTextMessage = 7000,
|
||||
GlobalIndexCSimulatorSetup = 7100,
|
||||
GlobalIndexCSimulatorSettings = 7200,
|
||||
GlobalIndexCSimulatorMessageSettings = 7300,
|
||||
GlobalIndexCAircraftCfgEntries = 7400,
|
||||
GlobalIndexCDistributor = 7500,
|
||||
GlobalIndexCVPilotModelRule = 8000,
|
||||
GlobalIndexCVoiceRoom = 9000,
|
||||
GlobalIndexCSettingKeyboardHotkey = 10000,
|
||||
@@ -139,6 +139,7 @@ namespace BlackMisc
|
||||
GlobalIndexCDockWidgetSettings = 14200,
|
||||
GlobalIndexCNavigatorSettings = 14300,
|
||||
GlobalIndexCSettingsReaders = 14400,
|
||||
GloablIndexInterpolatorSetup = 15000,
|
||||
GlobalIndexLineNumber = 20000, //!< pseudo index for line numbers
|
||||
};
|
||||
|
||||
|
||||
@@ -34,12 +34,10 @@
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
class CPropertyIndexVariantMap;
|
||||
|
||||
namespace Mixin
|
||||
{
|
||||
|
||||
/*!
|
||||
* CRTP class template from which a derived class can inherit property indexing functions.
|
||||
*
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "blackmisc/iconlist.h"
|
||||
#include "blackmisc/identifier.h"
|
||||
#include "blackmisc/identifierlist.h"
|
||||
#include "blackmisc/interpolationsetup.h"
|
||||
#include "blackmisc/input/registermetadatainput.h"
|
||||
#include "blackmisc/logcategory.h"
|
||||
#include "blackmisc/logcategorylist.h"
|
||||
@@ -88,6 +89,7 @@ namespace BlackMisc
|
||||
CVariant::registerMetadata();
|
||||
CVariantList::registerMetadata();
|
||||
CVariantMap::registerMetadata();
|
||||
CInterpolationAndRenderingSetup::registerMetadata();
|
||||
|
||||
// sub namespaces
|
||||
Audio::registerMetadata();
|
||||
|
||||
@@ -88,14 +88,5 @@ namespace BlackSimPlugin
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSimulatorFsCommon::enableDebugMessages(bool driver, bool interpolator)
|
||||
{
|
||||
if (this->m_interpolator)
|
||||
{
|
||||
this->m_interpolator->enableDebugMessages(interpolator);
|
||||
}
|
||||
CSimulatorCommon::enableDebugMessages(driver, interpolator);
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace BlackSimPlugin
|
||||
virtual BlackMisc::Aviation::CAirportList getAirportsInRange() const override;
|
||||
virtual bool changeRemoteAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft) override;
|
||||
virtual bool changeRemoteAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft) override;
|
||||
virtual void enableDebugMessages(bool driver, bool interpolator) override;
|
||||
//! @}
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user