Loading...
Searching...
No Matches
MoveEventMeta.hpp
1#pragma once
2
3#include "MoveEventFactoryInterface.hpp"
4
5#include <Process/ExpandMode.hpp>
6#include <Process/TimeValue.hpp>
7
8#include <Scenario/Commands/Scenario/Displacement/SerializableMoveEvent.hpp>
9#include <Scenario/Commands/ScenarioCommandFactory.hpp>
10
11#include <score/command/AggregateCommand.hpp>
12#include <score/model/Identifier.hpp>
13#include <score/model/path/Path.hpp>
14
15namespace Scenario
16{
17class EventModel;
18class ProcessModel;
19class StateModel;
20namespace Command
21{
22
23class SCORE_PLUGIN_SCENARIO_EXPORT MoveEventMeta final : public SerializableMoveEvent
24{
25 SCORE_COMMAND_DECL(CommandFactoryName(), MoveEventMeta, "Move an event")
26
27public:
29 const Scenario::ProcessModel& scenarioPath, Id<EventModel> eventId,
30 TimeVal newDate, double y, ExpandMode mode, LockMode lock);
31
33 const Scenario::ProcessModel& scenarioPath, Id<EventModel> eventId,
34 TimeVal newDate, double y, ExpandMode mode, LockMode lock, Id<StateModel>);
35
37 void undo(const score::DocumentContext& ctx) const override;
38 void redo(const score::DocumentContext& ctx) const override;
39
40 const Path<Scenario::ProcessModel>& path() const override;
41
42 void update(
43 Scenario::ProcessModel& scenar, const Id<EventModel>& eventId,
44 const TimeVal& newDate, double y, ExpandMode mode, LockMode lock) override;
45 void update(
46 Scenario::ProcessModel& scenar, const Id<EventModel>& eventId,
47 const TimeVal& newDate, double y, ExpandMode mode, LockMode lock,
48 const Id<StateModel>& st);
49
50protected:
51 void serializeImpl(DataStreamInput&) const override;
52 void deserializeImpl(DataStreamOutput&) override;
53
54private:
55 void updateY(Scenario::ProcessModel&, double y) const;
56 // TODO : make a UI to change that
58 Id<EventModel> m_eventId;
59 std::optional<Id<StateModel>> m_stateId;
60 ExpandMode m_expand{};
61 LockMode m_lock{};
62 double m_oldY{};
63 double m_newY{};
64
65 std::unique_ptr<SerializableMoveEvent> m_moveEventImplementation{};
66};
67
68class SCORE_PLUGIN_SCENARIO_EXPORT MoveTopEventMeta final : public SerializableMoveEvent
69{
70 SCORE_COMMAND_DECL(CommandFactoryName(), MoveTopEventMeta, "Move an event")
71
72public:
74 const Scenario::ProcessModel& scenarioPath, Id<EventModel> eventId,
75 TimeVal newDate, double y, ExpandMode mode, LockMode lock);
77 const Scenario::ProcessModel& scenarioPath, Id<EventModel> eventId,
78 TimeVal newDate, double y, ExpandMode mode, LockMode lock, Id<StateModel>)
79 : MoveTopEventMeta{scenarioPath, eventId, newDate, y, mode, lock}
80 {
81 }
82
83 void undo(const score::DocumentContext& ctx) const override;
84 void redo(const score::DocumentContext& ctx) const override;
85
86 const Path<Scenario::ProcessModel>& path() const override;
87
88 void update(
89 Scenario::ProcessModel&, const Id<EventModel>& eventId, const TimeVal& newDate,
90 double y, ExpandMode mode, LockMode) override;
91 void update(
92 Scenario::ProcessModel& s, const Id<EventModel>& eventId, const TimeVal& newDate,
93 double y, ExpandMode mode, LockMode, const Id<StateModel>&)
94 {
95 update(s, eventId, newDate, y, mode, LockMode::Free);
96 }
97
98protected:
99 void serializeImpl(DataStreamInput&) const override;
100 void deserializeImpl(DataStreamOutput&) override;
101
102private:
103 // TODO : make a UI to change that
105 Id<EventModel> m_eventId;
106 std::unique_ptr<SerializableMoveEvent> m_moveEventImplementation{};
107};
108
110{
111 SCORE_COMMAND_DECL(CommandFactoryName(), MoveIntervalMacro, "Move an interval")
112};
113
115{
116 SCORE_COMMAND_DECL(CommandFactoryName(), MoveStateMacro, "Move a state")
117};
118}
119}
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
Definition MoveEventMeta.hpp:24
Definition MoveEventMeta.hpp:110
Definition MoveEventMeta.hpp:115
Definition MoveEventMeta.hpp:69
Definition SerializableMoveEvent.hpp:20
The core hierarchical and temporal process of score.
Definition ScenarioModel.hpp:37
The id_base_t class.
Definition Identifier.hpp:57
Allows for grouping of multiple commands in a single one.
Definition AggregateCommand.hpp:15
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition TimeValue.hpp:21
Definition DocumentContext.hpp:18