Loading...
Searching...
No Matches
SetSegmentParameters.hpp
1#pragma once
2#include <Curve/Commands/CurveCommandFactory.hpp>
3
4#include <score/command/Command.hpp>
5#include <score/model/Identifier.hpp>
6#include <score/model/path/Path.hpp>
7#include <score/tools/Unused.hpp>
8#include <score/tools/std/Optional.hpp>
9
10#include <ossia/detail/flat_map.hpp>
11
12#include <score_plugin_curve_export.h>
13
14struct DataStreamInput;
15struct DataStreamOutput;
16
17namespace Curve
18{
19class Model;
20class SegmentModel;
21using SegmentParameterMap = ossia::flat_map<Id<SegmentModel>, std::pair<double, double>>;
22class SCORE_PLUGIN_CURVE_EXPORT SetSegmentParameters final : public score::Command
23{
24 SCORE_COMMAND_DECL(
25 CommandFactoryName(), SetSegmentParameters, "Set segment parameters")
26public:
27 SetSegmentParameters(const Model& model, SegmentParameterMap&& parameters);
28
29 void undo(const score::DocumentContext& ctx) const override;
30 void redo(const score::DocumentContext& ctx) const override;
31
32 void update(unused_t, SegmentParameterMap&& segments) { m_new = std::move(segments); }
33
34protected:
35 void serializeImpl(DataStreamInput& s) const override;
36 void deserializeImpl(DataStreamOutput& s) override;
37
38private:
39 Path<Model> m_model;
40 SegmentParameterMap m_new;
41 ossia::flat_map<
42 Id<SegmentModel>, std::pair<std::optional<double>, std::optional<double>>>
43 m_old;
44};
45}
Definition CurveModel.hpp:25
Definition SetSegmentParameters.hpp:23
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
The id_base_t class.
Definition Identifier.hpp:57
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