MeVisLab Toolbox Reference
|
Base object class representing a single curve object, consisting of zero or one X- and any number of Y-data series. More...
#include <mlCurveData.h>
Public Types | |
enum | { ctyLine , ctyArea , ctyDeltaArea , ctyLineDeltaArea , ctyErrorBar } |
Curve type constants. More... | |
Public Types inherited from ml::Base | |
enum | PersistenceInterface { PersistenceByString , PersistenceByTreeNode , PersistenceByStream } |
This enum describes the different persistence interfaces available. More... | |
Public Member Functions | |
void | addStateToTree (TreeNode *) const override |
Attaches the object state as children of the given parent node. | |
void | readStateFromTree (TreeNode *) override |
Reads the object state from the children of the given parent node. | |
ML_SET_ADDSTATE_VERSION (1) | |
CurveData * | deepCopy () const override |
Create a deep copy of the CurveDate. | |
Initialization, destructor | |
CurveData () | |
Default constructor. | |
CurveData (const CurveData &curveData) | |
Copy constructor, series data is copied. | |
CurveData & | operator= (const CurveData &srcCurve) |
Assignment operator, series data is copied. | |
Set curve data | |
void | clearData () |
Clear curve data. | |
void | clear () |
Clear curve data and reset curve properties. | |
void | setX (MLssize_t nPoints=0, const double *data=nullptr, MLssize_t step=1) |
Set X-series to nPoints double values copied from the source array data. | |
void | setX (MLssize_t nPoints, const float *data, MLssize_t step=1) |
void | setY (MLssize_t nPoints, const double *data, MLssize_t step=1) |
Set Y data to a single series of nPoints double values copied from the source array data. | |
void | setY (MLssize_t nPoints, const float *data, MLssize_t step=1) |
void | setY (MLssize_t iSeries, MLssize_t nPoints, const double *data, MLssize_t step=1) |
Set the iSeries-th Y-series to nPoints double values copied from the source array data. | |
void | setY (MLssize_t iSeries, MLssize_t nPoints, const float *data, MLssize_t step=1) |
void | setXValue (double value, MLssize_t iPoint) |
Set X-series value at index iPoint to value (ignored if index is out of range). | |
void | setYValue (double value, MLssize_t iSeries, MLssize_t iPoint) |
Set Y value at index iPoint in iSeries-th Y series to value (ignored if indices are out of range). | |
void | setYValue (double value, MLssize_t iPoint) |
Set Y value at index iPoint in first Y series to value (ignored if index is out of range). | |
void | resizeX (MLssize_t nPoints) |
Change length of X-series. New values are initialized to zero. | |
void | resizeY (MLssize_t nPoints) |
Change length of first Y-series. New values are initialized to zero. | |
void | resizeY (MLssize_t iSeries, MLssize_t nPoints) |
Change length of iSeries-th Y-series. New values are initialized to zero. | |
Get curve data | |
MLssize_t | getPoints () |
Get number of data points (i.e. minimum length of all X- and Y-series) | |
MLssize_t | getNumSeries () |
Get number of Y-series. | |
double | getXValue (MLssize_t iPoint) |
Get X-value at index iPoint, return 0 if index is out of range. | |
double | getYValue (MLssize_t iSeries, MLssize_t iPoint) |
Get Y value at index iPoint in iSeries-th Y series, 0 if out of range. | |
double | getYValue (MLssize_t iPoint) |
Get Y value at index iPoint in first Y series, 0 if out of range. | |
Set curve properties | |
void | setXRange (double xMin, double xMax) |
Explicitly set X value range to xMin ... xMax. | |
void | setAutoXRange () |
Set X value range to 'automatic', i.e. dependent on X series data. | |
void | setYRange (double yMin, double yMax) |
Explicitly set Y value range to yMin ... yMax. | |
void | setAutoYRange () |
Set Y value range to 'automatic', i.e. dependent on Y series data. | |
void | setCurveType (int type) |
Set curve type (use cty* curve type constants) | |
void | setCurveStyle (int style) |
Set curve style (= index into a style palette used for drawing) | |
void | setId (MLssize_t id) |
Set (numeric) id. | |
void | setTitle (std::string title) |
Set curve title. | |
void | setUnit (std::string unit) |
Set curve unit. | |
void | setSymbol (std::string symbol) |
Set curve symbol. | |
Get curve properties | |
bool | isAutoX () const |
Return true if X data is generated automatically (numbered 0, 1, ...) | |
double | getXMin () |
Get minimum X data value. | |
double | getXMax () |
Get maximum X data value. | |
double | getYMin () |
Get minimum Y data value. | |
double | getYMax () |
Get maximum Y data value. | |
void | getXYRange (double *xMin, double *xMax, double *yMin, double *yMax) |
Get X and Y value ranges (NULL pointers are allowed) | |
int | getCurveType () const |
Get curve type (equal to one of the cty* curve type constants) | |
int | getCurveStyle () const |
Get curve style (= index into a style palette used for drawing) | |
MLssize_t | getId () const |
Get numeric id. | |
std::string | getTitle () const |
Get curve title. | |
std::string | getUnit () const |
Get curve unit. | |
std::string | getSymbol () const |
Get curve symbol. | |
Public Member Functions inherited from ml::RefCountedBase | |
RefCountedBase () | |
Constructor. | |
RefCountedBase (const RefCountedBase &) | |
Explicit copy constructor. | |
virtual void | incRefCount () const |
Increase reference count. | |
virtual void | decRefCount () const |
Decrease ref count (object will be deleted if ref count is decremented to 0) | |
bool | isRefCountedBase () const override |
Returns if the instance is derived from RefCountedBase. | |
Public Member Functions inherited from ml::EventSource | |
EventSource () | |
EventSource (const EventSource &evSource) | |
~EventSource () override | |
void | addEventListener (BaseEventCallback *cb, void *userData) |
add event listener callback to this Base object - the userData will be the first argument when the callback is called | |
void | removeEventListener (BaseEventCallback *cb, void *userData) |
remove event listener callback from this Base object - arguments must be the same as for the addEventListener call | |
bool | hasEventListeners () const |
check if any event listeners have been added to this Base object; this can be used to skip the sendEvent call (and the potentially expensive building of the event object) altogether | |
Public Member Functions inherited from ml::Base | |
Base () | |
Constructor. | |
virtual | ~Base () |
Destructor. | |
bool | isOfAllowedType (const std::vector< const RuntimeType * > &types) const |
Check if this object's type is equal to or derived from one of the types given in the argument. | |
virtual std::string | detailString () const |
Return a string describing this object. | |
virtual bool | implementsPersistence (PersistenceInterface) const |
Override this method to declare which persistence interfaces are implemented by your derived class. | |
virtual std::string | persistentState () const |
Returns a string describing the object's internal state. | |
virtual void | setPersistentState (const std::string &state) |
Restores the object's internal state from a string that had been previously generated using persistentState() . | |
virtual void | writeTo (AbstractPersistenceOutputStream *) const |
Write the objects state to the data stream object. | |
virtual void | readFrom (AbstractPersistenceInputStream *, int) |
Read the objects state from the data stream object. | |
Protected Member Functions | |
~CurveData () override=default | |
Destructor shouldn't be called directly anymore, always use the CurveDataPtr smart-pointer. | |
void | setXChanged () |
Invalidate automatic X series properties. | |
void | setYChanged () |
Invalidate automatic Y series properties. | |
void | setSeries (CurveSeries &v, MLssize_t nPoints, const double *data, MLssize_t step) |
Set series data (double) | |
void | setSeries (CurveSeries &v, MLssize_t nPoints, const float *data, MLssize_t step) |
Set series data (float) | |
void | updateAutoX () |
Update automatically generated X data. | |
void | updateXRange () |
Update automatically generated X range. | |
void | updateYRange () |
Update automatically generated Y range. | |
Protected Member Functions inherited from ml::RefCountedBase | |
~RefCountedBase () override | |
Macro for the declaration of the runtime type system methods, defined in mlRuntimeSubClass.h. | |
Protected Member Functions inherited from ml::EventSource | |
void | sendEvent (BaseEvent *event, void *skipListener=nullptr) |
Macro for the declaration of the runtime type system methods, defined in mlRuntimeSubClass.h. | |
Protected Attributes | |
CurveSeries | _xData |
X series data. | |
std::vector< CurveSeries > | _yData |
Y series data. | |
bool | _autoX |
Flag for automatically generated X data. | |
bool | _autoXRange |
Flag for automatic X value ranges. | |
bool | _autoYRange |
Flag for automatic Y value ranges. | |
bool | _validXRange |
Flag indicating up-to-date X range values. | |
bool | _validYRange |
Flag indicating up-to-date Y range values. | |
int | _curveType |
Curve type (equal to one of the cty* curve type constants) | |
int | _curveStyle |
Curve style (= index into a style palette used for drawing) | |
MLssize_t | _id |
Curve id. | |
std::string | _title |
Curve title. | |
std::string | _unit |
Curve unit. | |
std::string | _symbol |
Curve symbol. | |
X/Y range values | |
double | _xMin |
double | _xMax |
double | _yMin |
double | _yMax |
Protected Attributes inherited from ml::RefCountedBase | |
MLint32 | _refCount |
Reference count. | |
Friends | |
bool | operator== (const CurveData &x, const CurveData &y) |
bool | operator!= (const CurveData &x, const CurveData &y) |
Additional Inherited Members | |
Static Public Member Functions inherited from ml::RefCountedBase | |
static void | updateReferenceCountingIfSupported (Base *oldValue, Base *newValue, bool &isRefCountedBase) |
Helper method that handles inc/dec of ref count if base instances support it. | |
Base object class representing a single curve object, consisting of zero or one X- and any number of Y-data series.
All X- and Y-series should have the same number of elements. Together, they represent a series of (x, y1, y2, ...) tupels. If no X-series is specified, an automatic series (0, 1, ...) is generated automatically. The expected number and the meaning of the different Y-series depends on the curve type: For curve types requiring a single Y-series (e.g. ctyLine), all Y-series are considered as independent curves defined over the same set of X-coordinates. For curve types requiring pairs or triples of Y-series (e.g. ctyDeltaArea, ctyErrorBar), consecutive Y-series are grouped to pairs or triples, resp. The X- and Y-series data stored in a CurveData object are owned by the object.
Definition at line 55 of file mlCurveData.h.
Curve type constants.
Enumerator | |
---|---|
ctyLine | Single line, represented by a single Y-series. |
ctyArea | Shaded area under/above single line. |
ctyDeltaArea | Shaded area between two lines, represented by a pair of Y-series. |
ctyLineDeltaArea | Line and shaded area between two lines, represented by a triple of Y-series. |
ctyErrorBar | Line and error bars, represented by a triple of Y-series. |
Definition at line 64 of file mlCurveData.h.
|
overrideprotecteddefault |
Destructor shouldn't be called directly anymore, always use the CurveDataPtr smart-pointer.
ml::CurveData::CurveData | ( | ) |
Default constructor.
Attaches the object state as children of the given parent node.
Reimplemented from ml::Base.
void ml::CurveData::clear | ( | ) |
Clear curve data and reset curve properties.
void ml::CurveData::clearData | ( | ) |
Clear curve data.
|
inlineoverridevirtual |
Create a deep copy of the CurveDate.
Reimplemented from ml::Base.
Definition at line 239 of file mlCurveData.h.
int ml::CurveData::getCurveStyle | ( | ) | const |
Get curve style (= index into a style palette used for drawing)
int ml::CurveData::getCurveType | ( | ) | const |
Get curve type (equal to one of the cty* curve type constants)
MLssize_t ml::CurveData::getId | ( | ) | const |
Get numeric id.
MLssize_t ml::CurveData::getNumSeries | ( | ) |
Get number of Y-series.
MLssize_t ml::CurveData::getPoints | ( | ) |
Get number of data points (i.e. minimum length of all X- and Y-series)
std::string ml::CurveData::getSymbol | ( | ) | const |
Get curve symbol.
std::string ml::CurveData::getTitle | ( | ) | const |
Get curve title.
std::string ml::CurveData::getUnit | ( | ) | const |
Get curve unit.
double ml::CurveData::getXMax | ( | ) |
Get maximum X data value.
double ml::CurveData::getXMin | ( | ) |
Get minimum X data value.
Get X-value at index iPoint, return 0 if index is out of range.
Get X and Y value ranges (NULL pointers are allowed)
double ml::CurveData::getYMax | ( | ) |
Get maximum Y data value.
double ml::CurveData::getYMin | ( | ) |
Get minimum Y data value.
Get Y value at index iPoint in first Y series, 0 if out of range.
Get Y value at index iPoint in iSeries-th Y series, 0 if out of range.
|
inline |
Return true if X data is generated automatically (numbered 0, 1, ...)
Definition at line 200 of file mlCurveData.h.
ml::CurveData::ML_SET_ADDSTATE_VERSION | ( | 1 | ) |
Assignment operator, series data is copied.
Reads the object state from the children of the given parent node.
Reimplemented from ml::Base.
Change length of X-series. New values are initialized to zero.
Change length of iSeries-th Y-series. New values are initialized to zero.
Change length of first Y-series. New values are initialized to zero.
void ml::CurveData::setAutoXRange | ( | ) |
Set X value range to 'automatic', i.e. dependent on X series data.
void ml::CurveData::setAutoYRange | ( | ) |
Set Y value range to 'automatic', i.e. dependent on Y series data.
Set curve style (= index into a style palette used for drawing)
|
protected |
Set series data (double)
|
protected |
Set series data (float)
void ml::CurveData::setSymbol | ( | std::string | symbol | ) |
Set curve symbol.
void ml::CurveData::setTitle | ( | std::string | title | ) |
Set curve title.
void ml::CurveData::setUnit | ( | std::string | unit | ) |
Set curve unit.
void ml::CurveData::setX | ( | MLssize_t | nPoints = 0, |
const double * | data = nullptr, | ||
MLssize_t | step = 1 ) |
Set X-series to nPoints double values copied from the source array data.
The optional step value specifies the array index difference between two consecutive X-series values. Hence, the data array is expected to contain at least (nPoints-1)*step+1 values. If no X data is specified, the X values are generated automatically as numbers 0, 1, ...
|
protected |
Invalidate automatic X series properties.
Explicitly set X value range to xMin ... xMax.
Set X-series value at index iPoint to value (ignored if index is out of range).
void ml::CurveData::setY | ( | MLssize_t | iSeries, |
MLssize_t | nPoints, | ||
const double * | data, | ||
MLssize_t | step = 1 ) |
Set the iSeries-th Y-series to nPoints double values copied from the source array data.
If this series does not yet exist, it is created. The optional step value specifies the array index difference between two consecutive Y-series values. Hence, the data array is expected to contain at least (nPoints-1)*step+1 values.
void ml::CurveData::setY | ( | MLssize_t | iSeries, |
MLssize_t | nPoints, | ||
const float * | data, | ||
MLssize_t | step = 1 ) |
Set Y data to a single series of nPoints double values copied from the source array data.
All previous Y-series are replaced by the new series. The optional step value specifies the array index difference between two consecutive Y-series values. Hence, the data array is expected to contain at least (nPoints-1)*step+1 values.
|
protected |
Invalidate automatic Y series properties.
Explicitly set Y value range to yMin ... yMax.
Set Y value at index iPoint in first Y series to value (ignored if index is out of range).
Set Y value at index iPoint in iSeries-th Y series to value (ignored if indices are out of range).
|
protected |
Update automatically generated X data.
|
protected |
Update automatically generated X range.
|
protected |
Update automatically generated Y range.
|
protected |
Flag for automatically generated X data.
Definition at line 269 of file mlCurveData.h.
|
protected |
Flag for automatic X value ranges.
Definition at line 272 of file mlCurveData.h.
|
protected |
Flag for automatic Y value ranges.
Definition at line 274 of file mlCurveData.h.
|
protected |
Curve style (= index into a style palette used for drawing)
Definition at line 289 of file mlCurveData.h.
|
protected |
Curve type (equal to one of the cty* curve type constants)
Definition at line 287 of file mlCurveData.h.
|
protected |
Curve id.
Definition at line 291 of file mlCurveData.h.
|
protected |
Curve symbol.
Definition at line 298 of file mlCurveData.h.
|
protected |
Curve title.
Definition at line 294 of file mlCurveData.h.
|
protected |
Curve unit.
Definition at line 296 of file mlCurveData.h.
|
protected |
Flag indicating up-to-date X range values.
Definition at line 277 of file mlCurveData.h.
|
protected |
Flag indicating up-to-date Y range values.
Definition at line 279 of file mlCurveData.h.
|
protected |
X series data.
Definition at line 264 of file mlCurveData.h.
|
protected |
Definition at line 282 of file mlCurveData.h.
|
protected |
Definition at line 282 of file mlCurveData.h.
|
protected |
Y series data.
Definition at line 266 of file mlCurveData.h.
|
protected |
Definition at line 283 of file mlCurveData.h.
|
protected |
Definition at line 283 of file mlCurveData.h.