AGX Dynamics  2.37.2.0
Curve.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXPLOT_CURVE_H
18 #define AGXPLOT_CURVE_H
19 
20 #include <agxPlot/DataSeries.h>
21 
22 #include <agx/String.h>
23 #include <agx/Vec4.h>
24 #include <agx/Vec2.h>
25 
26 namespace agxPlot
27 {
30  typedef agx::UInt CurveID;
31 
32  class System;
33 
35  {
36  public:
37  enum Line
38  {
39  LINE_SOLID = 0,
40  LINE_DASHED = 1,
41  LINE_NONE = 2
42  };
43  enum Symbol
44  {
45  SYMBOL_CROSS = 0,
46  SYMBOL_CIRCLE = 1,
47  SYMBOl_DOT = 2,
48  SYMBOl_NONE = 3
49  };
50  Curve(agxPlot::DataSeries* xValues, agxPlot::DataSeries* yValues, const agx::String& name = "");
51 
52 
57  CurvePointVector getAllValues() const;
58 
63  CurvePointVector getNewValues() const;
64 
69  CurvePointVector getOldValues() const;
70 
74  void setName(const agx::String& name);
75  const agx::String& getName() const;
76 
80  void setColor(const agx::Vec4& color);
81  const agx::Vec4& getColor() const;
82 
86  void setLineType(Line line);
87  Line getLineType() const;
88 
92  void setSymbol(Symbol symbol);
93  Symbol getSymbol() const;
94 
98  void setLineWidth(agx::Real lineWidth);
99  agx::Real getLineWidth() const;
100 
104  CurveID getCurveID() const;
105 
121  void getDescription(agxJson::Value& root) const;
126  // Send system to be able to fetch DataSeries by ID
127  void setFromDescription(const agxJson::Value& root, System* system);
128 
129  // INTERNAL
130 
131  agxPlot::DataSeries* getDataSeriesX() const;
132  agxPlot::DataSeries* getDataSeriesY() const;
133 
135  private:
136  CurvePointVector getValuesFrom(size_t index) const;
137  CurvePointVector getValuesTo(size_t index) const;
138 
139  void setID(CurveID id);
140  private:
141  agxPlot::DataSeriesRef m_xValues;
142  agxPlot::DataSeriesRef m_yValues;
143 
144  agx::Vec4 m_color;
145  agx::String m_name;
146  Line m_lineType;
147  Symbol m_symbol;
148  agx::Real m_lineWidth;
149  CurveID m_id;
150 
151  agx::Event::CallbackType m_dataSeriesRepresentationChangedCallback;
152  };
155 }
156 
157 #endif
agx::Event representationChanged
Definition: Curve.h:134
Namespace contains functionality related to plotting.
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:34
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
Base class providing referencing counted objects.
Definition: Referenced.h:119
agx::Vec2 CurvePoint
Definition: Curve.h:28
Templated vector class.
Definition: Vector.h:52
uint32_t UInt
Definition: Integer.h:34
Callback CallbackType
Definition: Event.h:37
agx::Vector< CurvePoint > CurvePointVector
Definition: Curve.h:29
double Real
Definition: Real.h:42
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
AGXCORE_EXPORT Component * root()
agx::UInt CurveID
Definition: Curve.h:30
An event with no arguments.
Definition: Event.h:89