MergeTimeSyncs.hpp
1 #pragma once
2 
3 #include <State/Expression.hpp>
4 
5 #include <Scenario/Commands/Scenario/Displacement/MoveEvent.hpp>
6 #include <Scenario/Commands/ScenarioCommandFactory.hpp>
7 #include <Scenario/Document/TimeSync/TimeSyncModel.hpp>
8 #include <Scenario/Process/Algorithms/GoodOldDisplacementPolicy.hpp>
9 #include <Scenario/Process/Algorithms/StandardDisplacementPolicy.hpp>
10 #include <Scenario/Process/ScenarioModel.hpp>
11 
12 #include <score/command/Command.hpp>
13 #include <score/model/Identifier.hpp>
14 #include <score/model/path/Path.hpp>
15 #include <score/model/path/PathSerialization.hpp>
16 #include <score/model/tree/TreeNode.hpp>
17 #include <score/tools/Unused.hpp>
18 //#include <Scenario/Application/ScenarioValidity.hpp>
20 
21 namespace Scenario
22 {
23 
24 namespace Command
25 {
26 class SCORE_PLUGIN_SCENARIO_EXPORT MergeTimeSyncs final : public score::Command
27 {
28  SCORE_COMMAND_DECL(CommandFactoryName(), MergeTimeSyncs, "Synchronize")
29 public:
31  const ProcessModel& scenario, Id<TimeSyncModel> clickedTn,
32  Id<TimeSyncModel> hoveredTn);
33  ~MergeTimeSyncs() override;
34 
35  void undo(const score::DocumentContext& ctx) const override;
36  void redo(const score::DocumentContext& ctx) const override;
37 
38  void update(
39  unused_t scenar, const Id<TimeSyncModel>& clickedTn,
40  const Id<TimeSyncModel>& hoveredTn);
41 
42 protected:
43  void serializeImpl(DataStreamInput& s) const override;
44  void deserializeImpl(DataStreamOutput& s) override;
45 
46 private:
47  Path<ProcessModel> m_scenarioPath;
48  Id<TimeSyncModel> m_movingTnId;
49  Id<TimeSyncModel> m_destinationTnId;
50 
51  QByteArray m_serializedTimeSync;
52  MoveEvent<GoodOldDisplacementPolicy>* m_moveCommand{};
53  State::Expression m_targetTrigger;
54  bool m_targetTriggerActive{};
55 };
56 }
57 }
Definition: MergeTimeSyncs.hpp:27
Definition: MoveEvent.hpp:34
The core hierarchical and temporal process of score.
Definition: ScenarioModel.hpp:37
The id_base_t class.
Definition: Identifier.hpp:57
The Command class.
Definition: Command.hpp:34
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Definition: DataStreamHelpers.hpp:99
Definition: DataStreamHelpers.hpp:103
Definition: DocumentContext.hpp:18
Definition: Unused.hpp:3