Loading...
Searching...
No Matches
LinearSegment.hpp
1#pragma once
2#include <Curve/Segment/CurveSegmentModel.hpp>
3
5
6namespace Curve
7{
8class LinearSegment;
9}
10
11CURVE_SEGMENT_METADATA(
12 SCORE_PLUGIN_CURVE_EXPORT, Curve::LinearSegment,
13 "a8bd14e2-d7e4-47cd-b76a-6a88fa11f0d2", "Linear", "Linear", "")
14
15namespace Curve
16{
17struct SCORE_PLUGIN_CURVE_EXPORT LinearSegmentData
18{
19 bool operator==(const LinearSegmentData&) const noexcept = default;
20};
21
22class SCORE_PLUGIN_CURVE_EXPORT LinearSegment final : public SegmentModel
23{
24 MODEL_METADATA_IMPL(LinearSegment)
25public:
26 using data_type = LinearSegmentData;
27 using SegmentModel::SegmentModel;
28
29 LinearSegment(const LinearSegment& other, const id_type& id, QObject* parent);
30
31 LinearSegment(DataStream::Deserializer& vis, QObject* parent)
32 : SegmentModel{vis, parent}
33 {
34 vis.writeTo(*this);
35 }
36
37 LinearSegment(JSONObject::Deserializer& vis, QObject* parent)
38 : SegmentModel{vis, parent}
39 {
40 vis.writeTo(*this);
41 }
42
43 void on_startChanged() override;
44 void on_endChanged() override;
45
46 void updateData(int numInterp) const override;
47 double valueAt(double x) const override;
48
49 QVariant toSegmentSpecificData() const override;
50
51 ossia::curve_segment<double> makeDoubleFunction() const override;
52 ossia::curve_segment<float> makeFloatFunction() const override;
53 ossia::curve_segment<int> makeIntFunction() const override;
54};
55}
56
57SCORE_SERIALIZE_DATASTREAM_DECLARE(SCORE_PLUGIN_CURVE_EXPORT, Curve::LinearSegmentData)
58Q_DECLARE_METATYPE(Curve::LinearSegmentData)
59W_REGISTER_ARGTYPE(Curve::LinearSegmentData)
Definition DataStreamVisitor.hpp:202
Definition JSONVisitor.hpp:423
Utilities and base classes for 1D curves.
Definition FocusDispatcher.hpp:12