/** * Simulation for Movement * $Id$ * $HeadURL$ * $Author$ * Created by gr, SLSE, 2017-12-13 */ #pragma once #include #include #include #include #include #include #include namespace CentralEffectSimulationBasic { class SimulationMovement : public QObject { Q_OBJECT public: SimulationMovement(const std::shared_ptr &ddsHandler, const std::shared_ptr &db, const std::shared_ptr &participantHandler, const CentralEffectSimulation::SimulatedMovement &sml, QObject *parent = nullptr); ~SimulationMovement(); void setSimulatedMovementRequest(const CentralEffectSimulation::SimulatedMovement &sml); int id() const { return m_simMovement.id(); } void setId(int id) { m_simMovement.id(id); } int participantId() const { return m_simMovement.participantId(); } void setJump(bool jump); void setnextPoint(int nextPoint) { m_simMovement.nextPoint(nextPoint); } int getNextPoint() const { return m_simMovement.nextPoint(); } void publishSimulatedMovement(); const CentralEffectSimulation::SimulatedMovement &simMovementData() const { return m_simMovement; } static CentralEffectSimulation::Database::CesSimulatedMovement toDb(const CentralEffectSimulation::SimulatedMovement &ddsSimMovement); protected Q_SLOTS: void publishNewPos(); void startNewSegment(); void move(); protected: void updateNextPointInDb(); private: std::shared_ptr m_ddsHandler; ///< Pointer to VOM DDS handler std::shared_ptr m_db; std::shared_ptr m_handlerParticipant; // Input Data QVector m_points; QVector m_segSpeed; QVector m_segDelay; // Dynamic Data int m_moveTime; /// Time starts for each segment new QLineF m_actSegment; QPointF m_newPos; bool m_simStart; /// Start of simulation int m_zone; QTimer *m_segTimer; QTimer *m_moveTimer; CentralEffectSimulation::SimulatedMovement m_simMovement; CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility }; }