UpdateCurve.hpp
1 #pragma once
2 #include <Curve/Commands/CurveCommandFactory.hpp>
3 #include <Curve/Segment/CurveSegmentData.hpp>
4 
5 #include <score/command/Command.hpp>
6 #include <score/model/path/Path.hpp>
7 #include <score/tools/Unused.hpp>
8 
9 #include <vector>
10 
11 namespace Curve
12 {
13 class Model;
14 
15 class SCORE_PLUGIN_CURVE_EXPORT UpdateCurve final : public score::Command
16 {
17  SCORE_COMMAND_DECL(CommandFactoryName(), UpdateCurve, "Update Curve")
18 public:
19  UpdateCurve(const Model& model, std::vector<SegmentData>&& segments);
20 
21  void undo(const score::DocumentContext& ctx) const override;
22  void redo(const score::DocumentContext& ctx) const override;
23 
24  void update(unused_t, std::vector<SegmentData>&& segments)
25  {
26  m_newCurveData = std::move(segments);
27  }
28 
29 protected:
30  void serializeImpl(DataStreamInput& s) const override;
31  void deserializeImpl(DataStreamOutput& s) override;
32 
33 private:
34  Path<Model> m_model;
35  std::vector<SegmentData> m_oldCurveData;
36  std::vector<SegmentData> m_newCurveData;
37 };
38 }
Definition: CurveModel.hpp:25
Definition: UpdateCurve.hpp:16
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
Definition: Unused.hpp:3