AGX Dynamics  2.38.0.2
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 #pragma once
18 
19 #include <agxPlot/DataSeries.h>
20 
21 #include <agx/String.h>
22 #include <agx/Vec4.h>
23 #include <agx/Vec2.h>
24 
25 namespace agxPlot
26 {
29  typedef agx::UInt CurveID;
30 
31  class System;
32 
37  {
38  public:
39  enum Line
40  {
41  LINE_SOLID = 0,
42  LINE_DASHED = 1,
43  LINE_NONE = 2
44  };
45  enum Symbol
46  {
47  SYMBOL_CROSS = 0,
48  SYMBOL_CIRCLE = 1,
49  SYMBOl_DOT = 2,
50  SYMBOl_NONE = 3
51  };
52  Curve(agxPlot::DataSeries* xValues, agxPlot::DataSeries* yValues, const agx::String& name = "");
53 
54 
59  CurvePointVector getAllValues() const;
60 
65  CurvePointVector getNewValues() const;
66 
71  CurvePointVector getOldValues() const;
72 
76  void setName(const agx::String& name);
77  const agx::String& getName() const;
78 
82  void setColor(const agx::Vec4f& color);
83  const agx::Vec4f& getColor() const;
84 
88  void setLineType(Line line);
89  Line getLineType() const;
90 
94  void setSymbol(Symbol symbol);
95  Symbol getSymbol() const;
96 
100  void setLineWidth(agx::Real lineWidth);
101  agx::Real getLineWidth() const;
102 
106  CurveID getCurveID() const;
107 
123  void getDescription(agxJson::Value& root) const;
124 
130  void setFromDescription(const agxJson::Value& root, System* system);
131 
132 
134  agxPlot::DataSeries* getDataSeriesX() const;
135 
137  agxPlot::DataSeries* getDataSeriesY() const;
138 
141  private:
142  CurvePointVector getValuesFrom(size_t index) const;
143  CurvePointVector getValuesTo(size_t index) const;
144 
145  void setID(CurveID id);
146  private:
147  agxPlot::DataSeriesRef m_xValues;
148  agxPlot::DataSeriesRef m_yValues;
149 
150  agx::Vec4f m_color;
151  agx::String m_name;
152  Line m_lineType;
153  Symbol m_symbol;
154  agx::Real m_lineWidth;
155  CurveID m_id;
156 
157  agx::Event::CallbackType m_dataSeriesRepresentationChangedCallback;
158  };
161 }
agx::UInt
uint64_t UInt
Definition: Integer.h:27
agx::Real
double Real
Definition: Real.h:42
agx::Vector
Templated vector class.
Definition: Vector.h:52
agxPlot
Namespace contains functionality related to plotting.
agx::Vec4T
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:34
agxPlot::Curve::Symbol
Symbol
Definition: Curve.h:45
agx::EventT< Callback >::CallbackType
Callback CallbackType
Definition: Event.h:37
DataSeries.h
agxPlot::Curve::Line
Line
Definition: Curve.h:39
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
Vec4.h
AGX_DECLARE_VECTOR_TYPES
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
Vec2.h
agx::ref_ptr< DataSeries >
agxPlot::CurvePoint
agx::Vec2 CurvePoint
Definition: Curve.h:27
agx::Vec2T< Real >
agxPlot::System
System that manages the plotting system.
Definition: System.h:38
agxPlot::CurvePointVector
agx::Vector< CurvePoint > CurvePointVector
Definition: Curve.h:28
agx::root
AGXCORE_EXPORT Component * root()
agx::Line
LineT< Vec3 > Line
Definition: Line.h:39
agxPlot::DataSeries
Class that encapsulates data to be plotted, including methods for accessing the data,...
Definition: DataSeries.h:44
agx::Referenced
Base class providing referencing counted objects.
Definition: Referenced.h:119
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
agxPlot::CurveID
agx::UInt CurveID
Definition: Curve.h:29
agxPlot::Curve
Definition of a plot curve.
Definition: Curve.h:36
String.h
agx::AgXString< std::string >
agxPlot::Curve::representationChanged
agx::Event representationChanged
Definition: Curve.h:140
agx::Event
An event with no arguments.
Definition: Event.h:89