2 #include <Process/ExpandMode.hpp>
3 #include <Process/TimeValue.hpp>
5 #include <Scenario/Application/ScenarioValidity.hpp>
6 #include <Scenario/Commands/Scenario/Displacement/SerializableMoveEvent.hpp>
7 #include <Scenario/Commands/ScenarioCommandFactory.hpp>
8 #include <Scenario/Process/Algorithms/StandardDisplacementPolicy.hpp>
9 #include <Scenario/Process/ScenarioModel.hpp>
10 #include <Scenario/Tools/dataStructures.hpp>
11 #include <Scenario/Tools/elementFindingHelper.hpp>
13 #include <score/model/Identifier.hpp>
14 #include <score/model/path/Path.hpp>
15 #include <score/model/path/PathSerialization.hpp>
17 struct ElementsProperties;
19 #include <tests/helpers/ForwardDeclaration.hpp>
32 template <
class DisplacementPolicy>
40 return CommandFactoryName();
42 const CommandKey& key()
const noexcept
override
44 static const QByteArray name
45 = QString{
"MoveEvent_%1"}.arg(DisplacementPolicy::name()).toLatin1();
46 static const CommandKey kagi{name.constData()};
49 QString description()
const override
51 return QObject::tr(
"Move an event with %1").arg(DisplacementPolicy::name());
69 const TimeVal& newDate, ExpandMode mode, LockMode lock)
76 DisplacementPolicy::init(s, {scenario.event(eventId).timeSync()});
84 m_initialDate = getDate(scenario, eventId);
86 update(s, eventId, newDate, 0, m_mode, lock);
91 const TimeVal& newDate,
double, ExpandMode, LockMode)
override
96 TimeVal deltaDate = newDate - m_initialDate;
100 QVector<Id<TimeSyncModel>> draggedElements;
101 draggedElements.push_back(
102 scenario.events.at(eventId).timeSync());
107 DisplacementPolicy::computeDisplacement(
108 scenario, draggedElements, deltaDate, m_savedElementsProperties);
113 auto& scenario = m_path.find(ctx);
116 DisplacementPolicy::revertPositions(
121 m_savedElementsProperties);
128 auto& scenario = m_path.find(ctx);
131 DisplacementPolicy::updatePositions(
136 m_savedElementsProperties);
144 s << m_savedElementsProperties << m_path << m_eventId << m_initialDate
151 s >> m_savedElementsProperties >> m_path >> m_eventId >> m_initialDate >> mode;
153 m_mode =
static_cast<ExpandMode
>(mode);
157 ElementsProperties m_savedElementsProperties;
160 ExpandMode m_mode{ExpandMode::Scale};
161 LockMode m_lock{LockMode::Free};
The Process class.
Definition: score-lib-process/Process/Process.hpp:61
void setParentDuration(ExpandMode mode, const TimeVal &t) noexcept
Definition: score-lib-process/Process/Process.cpp:123
Definition: MoveEvent.hpp:34
MoveEvent(const Scenario::ProcessModel &scenario, const Id< EventModel > &eventId, const TimeVal &newDate, ExpandMode mode, LockMode lock)
MoveEvent.
Definition: MoveEvent.hpp:67
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
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Definition: DataStreamHelpers.hpp:103
Definition: TimeValue.hpp:21
Definition: DocumentContext.hpp:18