diff --git a/src/blackcore/context/contextsimulatorimpl.cpp b/src/blackcore/context/contextsimulatorimpl.cpp index 0ebd63783..1d03b580c 100644 --- a/src/blackcore/context/contextsimulatorimpl.cpp +++ b/src/blackcore/context/contextsimulatorimpl.cpp @@ -317,7 +317,7 @@ namespace BlackCore 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); + m_simulatorPlugin.second->setInterpolationSetupGlobal(setup); } CTime CContextSimulator::getTimeSynchronizationOffset() const diff --git a/src/blackcore/simulator.cpp b/src/blackcore/simulator.cpp index b53196a95..d7af7ed78 100644 --- a/src/blackcore/simulator.cpp +++ b/src/blackcore/simulator.cpp @@ -140,6 +140,31 @@ namespace BlackCore } } + bool ISimulator::setInterpolationSetupGlobal(const CInterpolationAndRenderingSetupGlobal &setup) + { + if (!IInterpolationSetupProvider::setInterpolationSetupGlobal(setup)) { return false; } + const bool r = setup.isRenderingRestricted(); + const bool e = setup.isRenderingEnabled(); + + emit this->interpolationAndRenderingSetupChanged(); + emit this->renderRestrictionsChanged(r, e, setup.getMaxRenderedAircraft(), setup.getMaxRenderedDistance()); + return true; + } + + bool ISimulator::setInterpolationSetupsPerCallsign(const CInterpolationSetupList &setups, bool ignoreSameAsGlobal) + { + if (!IInterpolationSetupProvider::setInterpolationSetupsPerCallsign(setups, ignoreSameAsGlobal)) { return false; } + emit this->interpolationAndRenderingSetupChanged(); + return true; + } + + bool ISimulator::setInterpolationSetupPerCallsign(const CInterpolationAndRenderingSetupPerCallsign &setup, const CCallsign &callsign, bool removeGlobalSetup) + { + if (!IInterpolationSetupProvider::setInterpolationSetupPerCallsign(setup, callsign, removeGlobalSetup)) { return false; } + emit this->interpolationAndRenderingSetupChanged(); + return true; + } + ISimulatorListener::ISimulatorListener(const CSimulatorPluginInfo &info) : QObject(), m_info(info) { diff --git a/src/blackcore/simulator.h b/src/blackcore/simulator.h index 1833c315f..c1037ae26 100644 --- a/src/blackcore/simulator.h +++ b/src/blackcore/simulator.h @@ -145,14 +145,6 @@ namespace BlackCore //! Time synchronization offset virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const = 0; - //! Consolidate setup with other data like from BlackMisc::Simulation::IRemoteAircraftProvider - //! \threadsafe - BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign getInterpolationSetupConsolidated(const BlackMisc::Aviation::CCallsign &callsign) const; - - //! Enable debugging messages etc. - //! \threadsafe - virtual void setInterpolationAndRenderingSetup(const BlackMisc::Simulation::CInterpolationAndRenderingSetupGlobal &setup) = 0; - //! Is the aircraft rendered (displayed in simulator)? //! This shall only return true if the aircraft is really visible in the simulator virtual bool isPhysicallyRenderedAircraft(const BlackMisc::Aviation::CCallsign &callsign) const = 0; @@ -216,6 +208,16 @@ namespace BlackCore //! Parse command line virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) = 0; + //! Consolidate setup with other data like from BlackMisc::Simulation::IRemoteAircraftProvider + //! \threadsafe + BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign getInterpolationSetupConsolidated(const BlackMisc::Aviation::CCallsign &callsign) const; + + //! \copydoc BlackMisc::Simulation::IInterpolationSetupProvider::setInterpolationSetupGlobal + virtual bool setInterpolationSetupGlobal(const BlackMisc::Simulation::CInterpolationAndRenderingSetupGlobal &setup) override; + + //! \copydoc BlackMisc::Simulation::IInterpolationSetupProvider::setInterpolationSetupsPerCallsign + virtual bool setInterpolationSetupsPerCallsign(const BlackMisc::Simulation::CInterpolationSetupList &setups, bool ignoreSameAsGlobal = true) override; + //! Register help static void registerHelp(); @@ -287,6 +289,9 @@ namespace BlackCore //! A requested elevation has been received virtual void callbackReceivedRequestedElevation(const BlackMisc::Geo::CElevationPlane &plane, const BlackMisc::Aviation::CCallsign &callsign); + //! \copydoc BlackMisc::Simulation::IInterpolationSetupProvider::setInterpolationSetupPerCallsign + virtual bool setInterpolationSetupPerCallsign(const BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign &setup, const BlackMisc::Aviation::CCallsign &callsign, bool removeGlobalSetup) override; + //! Emit the combined status //! \param oldStatus optionally one can capture and provide the old status for comparison. In case of equal status values no signal will be sent //! \sa simulatorStatusChanged; diff --git a/src/blackcore/simulatorcommon.cpp b/src/blackcore/simulatorcommon.cpp index 423cbe16c..1db5be05e 100644 --- a/src/blackcore/simulatorcommon.cpp +++ b/src/blackcore/simulatorcommon.cpp @@ -401,16 +401,6 @@ namespace BlackCore return renderedOnes.intersection(disabledOnes); } - void CSimulatorCommon::setInterpolationAndRenderingSetup(const CInterpolationAndRenderingSetupGlobal &setup) - { - if (!this->setInterpolationSetupGlobal(setup)) { return; } - const bool r = setup.isRenderingRestricted(); - const bool e = setup.isRenderingEnabled(); - - emit this->interpolationAndRenderingSetupChanged(); - emit this->renderRestrictionsChanged(r, e, setup.getMaxRenderedAircraft(), setup.getMaxRenderedDistance()); - } - void CSimulatorCommon::highlightAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const BlackMisc::PhysicalQuantities::CTime &displayTime) { const CCallsign cs(aircraftToHighlight.getCallsign()); @@ -558,10 +548,6 @@ namespace BlackCore { const CCallsign cs(parser.part(2)); const bool changed = this->setInterpolationMode(part1, cs); - if (changed) - { - emit this->interpolationAndRenderingSetupChanged(); - } CLogMessage(this).info(changed ? "Changed interpolation mode for '%1'" : "Unchanged interpolation mode for '%1'") << cs.asString(); return true; } @@ -569,7 +555,7 @@ namespace BlackCore { CInterpolationAndRenderingSetupGlobal setup = this->getInterpolationSetupGlobal(); const bool changed = setup.setInterpolatorMode(part1); - if (changed) { this->setInterpolationAndRenderingSetup(setup); } + if (changed) { this->setInterpolationSetupGlobal(setup); } CLogMessage(this).info(changed ? "Changed interpolation mode globally" : "Unchanged interpolation mode"); return true; } diff --git a/src/blackcore/simulatorcommon.h b/src/blackcore/simulatorcommon.h index e61ef2f24..ecafe3f20 100644 --- a/src/blackcore/simulatorcommon.h +++ b/src/blackcore/simulatorcommon.h @@ -71,7 +71,6 @@ namespace BlackCore virtual ~CSimulatorCommon(); // --------- ISimulator implementations ------------ - virtual void setInterpolationAndRenderingSetup(const BlackMisc::Simulation::CInterpolationAndRenderingSetupGlobal &setup) override; virtual void highlightAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const BlackMisc::PhysicalQuantities::CTime &displayTime) override; virtual bool followAircraft(const BlackMisc::Aviation::CCallsign &callsign) override; virtual const BlackMisc::Simulation::CSimulatorInternals &getSimulatorInternals() const override; diff --git a/src/blackmisc/simulation/interpolationsetupprovider.h b/src/blackmisc/simulation/interpolationsetupprovider.h index 04c29388b..7121812b6 100644 --- a/src/blackmisc/simulation/interpolationsetupprovider.h +++ b/src/blackmisc/simulation/interpolationsetupprovider.h @@ -61,11 +61,11 @@ namespace BlackMisc protected: //! Set the global setup //! \threadsafe - bool setInterpolationSetupGlobal(const CInterpolationAndRenderingSetupGlobal &setup); + virtual bool setInterpolationSetupGlobal(const CInterpolationAndRenderingSetupGlobal &setup); //! Insert specialized setup //! \threadsafe - bool setInterpolationSetupPerCallsign(const CInterpolationAndRenderingSetupPerCallsign &setup, const Aviation::CCallsign &callsign, bool removeGlobalSetup = true); + virtual bool setInterpolationSetupPerCallsign(const CInterpolationAndRenderingSetupPerCallsign &setup, const Aviation::CCallsign &callsign, bool removeGlobalSetup = true); //! Log/un-log given callsign //! \threadsafe