Loading...
Searching...
No Matches
MovePoint.hpp
1#pragma once
2#include <Curve/Commands/CurveCommandFactory.hpp>
3#include <Curve/Palette/CurvePoint.hpp>
4
5#include <score/command/Command.hpp>
6#include <score/model/Identifier.hpp>
7#include <score/model/path/Path.hpp>
8#include <score/tools/std/Optional.hpp>
9
10#include <score_plugin_curve_export.h>
11struct DataStreamInput;
12struct DataStreamOutput;
13
14namespace Curve
15{
16class Model;
17class PointModel;
18class SegmentModel;
19class SCORE_PLUGIN_CURVE_EXPORT MovePoint final : public score::Command
20{
21 SCORE_COMMAND_DECL(CommandFactoryName(), MovePoint, "Move a point")
22public:
23 MovePoint(const Model& curve, const Id<PointModel>& pointId, Curve::Point newPoint);
24
25 void undo(const score::DocumentContext& ctx) const override;
26 void redo(const score::DocumentContext& ctx) const override;
27
28 void
29 update(const Model& obj, const Id<PointModel>& pointId, const Curve::Point& newPoint);
30
31protected:
32 void serializeImpl(DataStreamInput& s) const override;
33 void deserializeImpl(DataStreamOutput& s) override;
34
35private:
36 Path<Model> m_model;
37 // Point ids are not kept across the rebuilds of the curve: its segments are.
38 OptionalId<SegmentModel> m_previous, m_following;
39 Curve::Point m_newPoint;
40 Curve::Point m_oldPoint;
41};
42}
Definition CurveModel.hpp:26
Definition MovePoint.hpp:20
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
The id_base_t class.
Definition Identifier.hpp:59
The Command class.
Definition Command.hpp:34
Utilities and base classes for 1D curves.
Definition FocusDispatcher.hpp:12
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition DocumentContext.hpp:18