2 #include <Curve/Palette/CurvePoint.hpp>
3 #include <Curve/Segment/CurveSegmentData.hpp>
5 #include <score/model/IdentifiedObject.hpp>
6 #include <score/model/Identifier.hpp>
7 #include <score/plugins/SerializableInterface.hpp>
8 #include <score/selection/Selectable.hpp>
9 #include <score/serialization/VisitorInterface.hpp>
10 #include <score/tools/std/Optional.hpp>
12 #include <ossia/editor/curve/curve_segment.hpp>
14 #include <boost/align/aligned_allocator_adaptor.hpp>
19 #include <score_plugin_curve_export.h>
35 SCORE_SERIALIZE_FRIENDS
37 using data_vector = std::vector<
38 QPointF, boost::alignment::aligned_allocator_adaptor<std::allocator<QPointF>, 32>>;
46 Curve::Point s, Curve::Point e,
const Id<SegmentModel>&
id, QObject* parent);
53 virtual void updateData(
int numInterp)
const = 0;
54 virtual double valueAt(
double x)
const = 0;
56 const data_vector& data()
const {
return m_data; }
58 void setStart(
const Curve::Point& pt);
59 Curve::Point start()
const {
return m_start; }
61 void setEnd(
const Curve::Point& pt);
62 Curve::Point end()
const {
return m_end; }
64 void setPrevious(
const OptionalId<SegmentModel>& previous);
65 const OptionalId<SegmentModel>& previous()
const {
return m_previous; }
67 void setFollowing(
const OptionalId<SegmentModel>& following);
68 const OptionalId<SegmentModel>& following()
const {
return m_following; }
71 virtual void setVerticalParameter(
double p);
72 virtual void setHorizontalParameter(
double p);
73 virtual std::optional<double> verticalParameter()
const;
74 virtual std::optional<double> horizontalParameter()
const;
76 virtual ossia::curve_segment<double> makeDoubleFunction()
const = 0;
77 virtual ossia::curve_segment<float> makeFloatFunction()
const = 0;
78 virtual ossia::curve_segment<int> makeIntFunction()
const = 0;
88 toSegmentSpecificData()};
92 void dataChanged() E_SIGNAL(SCORE_PLUGIN_CURVE_EXPORT, dataChanged)
93 void previousChanged() E_SIGNAL(SCORE_PLUGIN_CURVE_EXPORT, previousChanged)
94 void followingChanged() E_SIGNAL(SCORE_PLUGIN_CURVE_EXPORT, followingChanged)
95 void startChanged() E_SIGNAL(SCORE_PLUGIN_CURVE_EXPORT, startChanged)
96 void endChanged() E_SIGNAL(SCORE_PLUGIN_CURVE_EXPORT, endChanged)
99 virtual void on_startChanged() = 0;
100 virtual void on_endChanged() = 0;
102 virtual QVariant toSegmentSpecificData()
const = 0;
104 mutable data_vector m_data;
105 mutable bool m_valid{};
108 Curve::Point m_start, m_end;
111 OptionalId<SegmentModel> m_previous, m_following;
115 struct PowerSegmentData;
117 using DefaultCurveSegmentModel = PowerSegment;
118 using DefaultCurveSegmentData = PowerSegmentData;
126 W_REGISTER_ARGTYPE(const
Curve::SegmentModel*)
127 W_REGISTER_ARGTYPE(
Id<
Curve::SegmentModel>)
Definition: CurveSegmentModel.hpp:32
Definition: DataStreamVisitor.hpp:202
The IdentifiedObject class.
Definition: IdentifiedObject.hpp:19
Definition: JSONVisitor.hpp:423
The Selectable class.
Definition: Selectable.hpp:14
The id_base_t class.
Definition: Identifier.hpp:57
Generic serialization method for abstract classes.
Definition: SerializableInterface.hpp:21
Utilities and base classes for 1D curves.
Definition: FocusDispatcher.hpp:12
Definition: CurveSegmentData.hpp:63