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. More... | |
void | readStateFromTree (TreeNode *) override |
Reads the object state from the children of the given parent node. More... | |
ML_SET_ADDSTATE_VERSION (1) | |
CurveData * | deepCopy () const override |
Create a deep copy of the CurveDate. More... | |
Initialization, destructor | |
CurveData () | |
Default constructor. More... | |
CurveData (const CurveData &curveData) | |
Copy constructor, series data is copied. More... | |
~CurveData () override | |
Destructor: More... | |
CurveData & | operator= (const CurveData &srcCurve) |
Assignment operator, series data is copied. More... | |
Set curve data | |
void | clearData () |
Clear curve data. More... | |
void | clear () |
Clear curve data and reset curve properties. More... | |
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. More... | |
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. More... | |
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. More... | |
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). More... | |
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). More... | |
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). More... | |
void | resizeX (MLssize_t nPoints) |
Change length of X-series. New values are initialized to zero. More... | |
void | resizeY (MLssize_t nPoints) |
Change length of first Y-series. New values are initialized to zero. More... | |
void | resizeY (MLssize_t iSeries, MLssize_t nPoints) |
Change length of iSeries-th Y-series. New values are initialized to zero. More... | |
Get curve data | |
MLssize_t | getPoints () |
Get number of data points (i.e. minimum length of all X- and Y-series) More... | |
MLssize_t | getNumSeries () |
Get number of Y-series. More... | |
double | getXValue (MLssize_t iPoint) |
Get X-value at index iPoint, return 0 if index is out of range. More... | |
double | getYValue (MLssize_t iSeries, MLssize_t iPoint) |
Get Y value at index iPoint in iSeries-th Y series, 0 if out of range. More... | |
double | getYValue (MLssize_t iPoint) |
Get Y value at index iPoint in first Y series, 0 if out of range. More... | |
Set curve properties | |
void | setXRange (double xMin, double xMax) |
Explicitly set X value range to xMin ... xMax. More... | |
void | setAutoXRange () |
Set X value range to 'automatic', i.e. dependent on X series data. More... | |
void | setYRange (double yMin, double yMax) |
Explicitly set Y value range to yMin ... yMax. More... | |
void | setAutoYRange () |
Set Y value range to 'automatic', i.e. dependent on Y series data. More... | |
void | setCurveType (int type) |
Set curve type (use cty* curve type constants) More... | |
void | setCurveStyle (int style) |
Set curve style (= index into a style palette used for drawing) More... | |
void | setTitle (std::string title) |
Set curve title. More... | |
void | setUnit (std::string unit) |
Set curve unit. More... | |
void | setSymbol (std::string symbol) |
Set curve symbol. More... | |
Get curve properties | |
bool | isAutoX () |
Return true if X data is generated automatically (numbered 0, 1, ...) More... | |
double | getXMin () |
Get minimum X data value. More... | |
double | getXMax () |
Get maximum X data value. More... | |
double | getYMin () |
Get minimum Y data value. More... | |
double | getYMax () |
Get maximum Y data value. More... | |
void | getXYRange (double *xMin, double *xMax, double *yMin, double *yMax) |
Get X and Y value ranges (NULL pointers are allowed) More... | |
int | getCurveType () |
Get curve type (equal to one of the cty* curve type constants) More... | |
int | getCurveStyle () |
Get curve style (= index into a style palette used for drawing) More... | |
std::string | getTitle () |
Get curve title. More... | |
std::string | getUnit () |
Get curve unit. More... | |
std::string | getSymbol () |
Get curve symbol. More... | |
Public Member Functions inherited from ml::Base | |
Base () | |
Constructor. More... | |
virtual | ~Base () |
Destructor. More... | |
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. More... | |
virtual bool | isRefCountedBase () const |
Returns if the instance is derived from RefCountedBase. More... | |
virtual std::string | detailString () const |
Return a string describing this object. More... | |
virtual bool | implementsPersistence (PersistenceInterface) const |
Override this method to declare which persistence interfaces are implemented by your derived class. More... | |
virtual std::string | persistentState () const |
Returns a string describing the object's internal state. More... | |
virtual void | setPersistentState (const std::string &state) |
Restores the object's internal state from a string that had been previously generated using persistentState() . More... | |
virtual void | writeTo (AbstractPersistenceOutputStream *) const |
Write the objects state to the data stream object. More... | |
virtual void | readFrom (AbstractPersistenceInputStream *, int) |
Read the objects state from the data stream object. More... | |
Protected Member Functions | |
void | setXChanged () |
Invalidate automatic X series properties. More... | |
void | setYChanged () |
Invalidate automatic Y series properties. More... | |
void | setSeries (CurveSeries &v, MLssize_t nPoints, const double *data, MLssize_t step) |
Set series data (double) More... | |
void | setSeries (CurveSeries &v, MLssize_t nPoints, const float *data, MLssize_t step) |
Set series data (float) More... | |
void | updateAutoX () |
Update automatically generated X data. More... | |
void | updateXRange () |
Update automatically generated X range. More... | |
void | updateYRange () |
Update automatically generated Y range. More... | |
Protected Member Functions inherited from ml::Base | |
virtual char * | getPersistentState () const |
Returns a C string describing the object's internal state. More... | |
virtual void | setPersistentState (const char *) |
Restores the object's internal state from a string that had been previously generated using getPersistentState() . More... | |
virtual void | clearPersistentState (char *) const |
Disposes a string previously allocated by getPersistentState() . More... | |
Protected Attributes | |
CurveSeries | _xData |
X series data. More... | |
std::vector< CurveSeries > | _yData |
Y series data. More... | |
bool | _autoX |
Flag for automatically generated X data. More... | |
bool | _autoXRange |
Flag for automatic X value ranges. More... | |
bool | _autoYRange |
Flag for automatic Y value ranges. More... | |
bool | _validXRange |
Flag indicating up-to-date X range values. More... | |
bool | _validYRange |
Flag indicating up-to-date Y range values. More... | |
int | _curveType |
Curve type (equal to one of the cty* curve type constants) More... | |
int | _curveStyle |
Curve style (= index into a style palette used for drawing) More... | |
std::string | _title |
Curve title. More... | |
std::string | _unit |
Curve unit. More... | |
std::string | _symbol |
Curve symbol. More... | |
X/Y range values | |
double | _xMin |
double | _xMax |
double | _yMin |
double | _yMax |
Friends | |
bool | operator== (const CurveData &x, const CurveData &y) |
bool | operator!= (const CurveData &x, const CurveData &y) |
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.
anonymous enum |
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 60 of file mlCurveData.h.
ml::CurveData::CurveData | ( | ) |
Default constructor.
ml::CurveData::CurveData | ( | const CurveData & | curveData | ) |
Copy constructor, series data is copied.
|
inlineoverride |
Destructor:
Definition at line 79 of file mlCurveData.h.
|
overridevirtual |
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 234 of file mlCurveData.h.
int ml::CurveData::getCurveStyle | ( | ) |
Get curve style (= index into a style palette used for drawing)
int ml::CurveData::getCurveType | ( | ) |
Get curve type (equal to one of the cty* curve type constants)
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 | ( | ) |
Get curve symbol.
std::string ml::CurveData::getTitle | ( | ) |
Get curve title.
std::string ml::CurveData::getUnit | ( | ) |
Get curve unit.
double ml::CurveData::getXMax | ( | ) |
Get maximum X data value.
double ml::CurveData::getXMin | ( | ) |
Get minimum X data value.
double ml::CurveData::getXValue | ( | MLssize_t | iPoint | ) |
Get X-value at index iPoint, return 0 if index is out of range.
void ml::CurveData::getXYRange | ( | double * | xMin, |
double * | xMax, | ||
double * | yMin, | ||
double * | yMax | ||
) |
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.
double ml::CurveData::getYValue | ( | MLssize_t | iPoint | ) |
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 197 of file mlCurveData.h.
ml::CurveData::ML_SET_ADDSTATE_VERSION | ( | 1 | ) |
Assignment operator, series data is copied.
|
overridevirtual |
Reads the object state from the children of the given parent node.
Reimplemented from ml::Base.
void ml::CurveData::resizeX | ( | MLssize_t | nPoints | ) |
Change length of X-series. New values are initialized to zero.
Change length of iSeries-th Y-series. New values are initialized to zero.
void ml::CurveData::resizeY | ( | MLssize_t | nPoints | ) |
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.
void ml::CurveData::setCurveStyle | ( | int | style | ) |
Set curve style (= index into a style palette used for drawing)
void ml::CurveData::setCurveType | ( | int | type | ) |
Set curve type (use cty* curve type constants)
|
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.
void ml::CurveData::setXRange | ( | double | xMin, |
double | xMax | ||
) |
Explicitly set X value range to xMin ... xMax.
void ml::CurveData::setXValue | ( | double | value, |
MLssize_t | iPoint | ||
) |
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.
void ml::CurveData::setYRange | ( | double | yMin, |
double | yMax | ||
) |
Explicitly set Y value range to yMin ... yMax.
void ml::CurveData::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).
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 285 of file mlCurveData.h.
|
protected |
Flag for automatic X value ranges.
Definition at line 288 of file mlCurveData.h.
|
protected |
Flag for automatic Y value ranges.
Definition at line 290 of file mlCurveData.h.
|
protected |
Curve style (= index into a style palette used for drawing)
Definition at line 305 of file mlCurveData.h.
|
protected |
Curve type (equal to one of the cty* curve type constants)
Definition at line 303 of file mlCurveData.h.
|
protected |
Curve symbol.
Definition at line 312 of file mlCurveData.h.
|
protected |
Curve title.
Definition at line 308 of file mlCurveData.h.
|
protected |
Curve unit.
Definition at line 310 of file mlCurveData.h.
|
protected |
Flag indicating up-to-date X range values.
Definition at line 293 of file mlCurveData.h.
|
protected |
Flag indicating up-to-date Y range values.
Definition at line 295 of file mlCurveData.h.
|
protected |
X series data.
Definition at line 280 of file mlCurveData.h.
|
protected |
Definition at line 298 of file mlCurveData.h.
|
protected |
Definition at line 298 of file mlCurveData.h.
|
protected |
Y series data.
Definition at line 282 of file mlCurveData.h.
|
protected |
Definition at line 299 of file mlCurveData.h.
|
protected |
Definition at line 299 of file mlCurveData.h.