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};
MoveEvent(const Scenario::ProcessModel &scenario, const Id< EventModel > &eventId, const TimeVal &newDate, ExpandMode mode, LockMode lock)
MoveEvent.
Definition MoveEvent.hpp:67
Definition DocumentContext.hpp:18