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