ACADO Toolkit  1.2.0beta
Toolkit for Automatic Control and Dynamic Optimization
Public Member Functions | Protected Attributes | Friends

Allows to manage sub-windows of user-specified plot windows for algorithmic outputs (for internal use). More...

#include <plot_window_subplot.hpp>

List of all members.

Public Member Functions

 PlotWindowSubplot ()
 Default constructor.
 PlotWindowSubplot (const Expression &_expression, const char *const _title="", const char *const _xLabel="", const char *const _yLabel="", PlotMode _plotMode=PM_UNKNOWN, double _xRangeLowerLimit=INFTY, double _xRangeUpperLimit=INFTY, double _yRangeLowerLimit=INFTY, double _yRangeUpperLimit=INFTY)
 Constructor which takes the symbolic expression to be plotted along with settings defining the output format of the subplot.
 PlotWindowSubplot (const Expression &_expressionX, const Expression &_expressionY, const char *const _title="", const char *const _xLabel="", const char *const _yLabel="", PlotMode _plotMode=PM_UNKNOWN, double _xRangeLowerLimit=INFTY, double _xRangeUpperLimit=INFTY, double _yRangeLowerLimit=INFTY, double _yRangeUpperLimit=INFTY)
 Constructor which takes symbolic expressions to be plotted along with settings defining the output format of the subplot.
 PlotWindowSubplot (PlotName _name, const char *const _title="", const char *const _xLabel="", const char *const _yLabel="", PlotMode _plotMode=PM_UNKNOWN, double _xRangeLowerLimit=INFTY, double _xRangeUpperLimit=INFTY, double _yRangeLowerLimit=INFTY, double _yRangeUpperLimit=INFTY)
 Constructor which takes the internal name of pre-defined information to be plotted along with settings defining the output format of the subplot.
 PlotWindowSubplot (const VariablesGrid &_plotVariable, const char *const _title="", const char *const _xLabel="", const char *const _yLabel="", PlotMode _plotMode=PM_UNKNOWN, double _xRangeLowerLimit=INFTY, double _xRangeUpperLimit=INFTY, double _yRangeLowerLimit=INFTY, double _yRangeUpperLimit=INFTY, BooleanType _plot3D=BT_FALSE)
 Constructor which takes discrete data to be plotted along with settings defining the output format of the subplot.
 PlotWindowSubplot (const Curve &_curve, double _xRangeLowerLimit=0.0, double _xRangeUpperLimit=1.0, const char *const _title="", const char *const _xLabel="", const char *const _yLabel="", PlotMode _plotMode=PM_UNKNOWN, double _yRangeLowerLimit=INFTY, double _yRangeUpperLimit=INFTY)
 Constructor which takes ...
 PlotWindowSubplot (const PlotWindowSubplot &rhs)
 Copy constructor (deep copy).
 ~PlotWindowSubplot ()
 Destructor.
PlotWindowSubplotoperator= (const PlotWindowSubplot &rhs)
 Assignment operator (deep copy).
returnValue setTitle (const char *const _title)
 Sets title of the subplot.
returnValue setXLabel (const char *const _xLabel)
 Sets label of x-axis of the subplot.
returnValue setYLabel (const char *const _yLabel)
 Sets label of y-axis of the subplot.
returnValue setPlotMode (PlotMode _plotMode)
 Sets plot mode of the subplot, defining how the data points are to be plotted.
returnValue setPlotFormat (PlotFormat _plotFormat)
 Sets plot format of the axes of the subplot.
returnValue setRanges (double _xRangeLowerLimit, double _xRangeUpperLimit, double _yRangeLowerLimit, double _yRangeUpperLimit)
 Sets ranges of the axes of the subplot.
returnValue addLine (double _lineValue)
 Adds an additional horizontal lines to be plotted within the subplot.
returnValue addData (const VariablesGrid &_newData)
 Adds an additional discrete data points to be plotted within the subplot.
returnValue getTitle (char **_title)
 Returns current title of the subplot.
returnValue getXLabel (char **_xLabel)
 Returns current label of x-axis of the subplot.
returnValue getYLabel (char **_yLabel)
 Returns current label of y-axis of the subplot.
PlotMode getPlotMode () const
 Returns current plot mode of the subplot.
PlotFormat getPlotFormat () const
 Returns current plot format of the subplot.
returnValue getRanges (double &_xRangeLowerLimit, double &_xRangeUpperLimit, double &_yRangeLowerLimit, double &_yRangeUpperLimit) const
 Returns current ranges of the axes of the subplot.
uint getNumLines () const
 Returns number of additional horizontal lines of the subplot.
uint getNumData () const
 Returns number of additional discrete data grids of the subplot.
SubPlotType getSubPlotType () const
 Returns internal type of the subplot.
VariableType getXVariableType () const
 Returns type of the variable on the x-axis of the subplot.
VariableType getYVariableType () const
 Returns type of the variable on the y-axis of the subplot.
ExpressiongetXPlotExpression () const
 Returns pointer to the expression on the x-axis of the subplot.
ExpressiongetYPlotExpression () const
 Returns pointer to the expression on the y-axis of the subplot.
PlotName getPlotEnum () const
 Returns name of pre-defined information to be plotted in the subplot.
returnValue setNext (PlotWindowSubplot *const _next)
 Assigns pointer to next SubPlotWindow within a PlotWindow.
PlotWindowSubplotgetNext () const
 Returns pointer to next SubPlotWindow within a PlotWindow.

Protected Attributes

ExpressionplotVariableX
 Continuous variable on x-axis to be plotted.
ExpressionplotVariableY
 Continuous variable on y-axis to be plotted.
VariablesGridplotVariablesGrid
 Discrete data to be plotted (time on x-axis, data on y-axis).
ExpressionplotExpressionX
 Continuous expression on x-axis to be plotted.
ExpressionplotExpressionY
 Continuous expression on x-axis to be plotted.
PlotName plotEnum
 Pre-defined information to be plotted (on y-axis).
char * title
 Title of the subplot.
char * xLabel
 Label of x-axis of the subplot.
char * yLabel
 Label of y-axis of the subplot.
PlotMode plotMode
 Plot mode defining how the data points are to be plotted.
PlotFormat plotFormat
 Plot format of the axes of the subplot.
double xRangeLowerLimit
 Lower limit of the x-axis.
double xRangeUpperLimit
 Upper limit of the x-axis.
double yRangeLowerLimit
 Lower limit of the y-axis.
double yRangeUpperLimit
 Upper limit of the y-axis.
BooleanType plot3D
 Flag indicating whether data is to be plotted in 3D.
uint nLines
 Number of additional horizontal lines to be plotted.
double * lineValues
 Values of additional horizontal lines to be plotted.
uint nData
 Number of additional discrete data points to be plotted.
VariablesGrid ** data
 Values of additional discrete data points to be plotted.
PlotWindowSubplotnext
 Pointer to next subplot within a PlotWindow.

Friends

class GnuplotWindow

Detailed Description

The class PlotWindowSubplot allows to manage sub-windows of user-specified plot windows for algorithmic outputs to be plotted during runtime. It is intended for internal use only and is used by the class PlotWindow.

The class stores the internal name or the symbolic expression to be plotted within one sub-plot of a figure. Moreover, output settings like title, axis labels or ranges of the sub-plot are stored.

Note that PlotWindowSubplot is always stored in a basic singly-linked list within a PlotWindow. Thus, also a pointer to the next subplot is stored. Also the actual numerical data to be plotted is stored centrally for each PlotWindow.

Author:
Hans Joachim Ferreau, Boris Houska

Constructor & Destructor Documentation

PlotWindowSubplot::PlotWindowSubplot ( const Expression _expression,
const char *const  _title = "",
const char *const  _xLabel = "",
const char *const  _yLabel = "",
PlotMode  _plotMode = PM_UNKNOWN,
double  _xRangeLowerLimit = INFTY,
double  _xRangeUpperLimit = INFTY,
double  _yRangeLowerLimit = INFTY,
double  _yRangeUpperLimit = INFTY 
)
Parameters:
[in]_expressionSymbolic expression to be plotted on the y-axis.
[in]_titleTitle of the subplot.
[in]_xLabelLabel of x-axis of the subplot.
[in]_yLabelLabel of y-axis of the subplot.
[in]_plotModePlot mode, see the PlotMode documentation for details.
[in]_xRangeLowerLimitLower limit of the x-axis.
[in]_xRangeUpperLimitUpper limit of the x-axis.
[in]_yRangeLowerLimitLower limit of the y-axis.
[in]_yRangeUpperLimitUpper limit of the y-axis.

References BT_FALSE, BT_TRUE, data, Expression::isVariable(), lineValues, nData, next, nLines, PF_PLAIN, plot3D, PLOT_NOTHING, plotEnum, plotExpressionX, plotExpressionY, plotVariablesGrid, plotVariableX, plotVariableY, setPlotFormat(), setPlotMode(), setRanges(), setTitle(), setXLabel(), setYLabel(), title, xLabel, and yLabel.

PlotWindowSubplot::PlotWindowSubplot ( const Expression _expressionX,
const Expression _expressionY,
const char *const  _title = "",
const char *const  _xLabel = "",
const char *const  _yLabel = "",
PlotMode  _plotMode = PM_UNKNOWN,
double  _xRangeLowerLimit = INFTY,
double  _xRangeUpperLimit = INFTY,
double  _yRangeLowerLimit = INFTY,
double  _yRangeUpperLimit = INFTY 
)
Parameters:
[in]_expressionXSymbolic expression to be plotted on the x-axis.
[in]_expressionYSymbolic expression to be plotted on the y-axis.
[in]_titleTitle of the subplot.
[in]_xLabelLabel of x-axis of the subplot.
[in]_yLabelLabel of y-axis of the subplot.
[in]_plotModePlot mode, see the PlotMode documentation for details.
[in]_xRangeLowerLimitLower limit of the x-axis.
[in]_xRangeUpperLimitUpper limit of the x-axis.
[in]_yRangeLowerLimitLower limit of the y-axis.
[in]_yRangeUpperLimitUpper limit of the y-axis.

References BT_FALSE, BT_TRUE, data, Expression::isVariable(), lineValues, nData, next, nLines, PF_PLAIN, plot3D, PLOT_NOTHING, plotEnum, plotExpressionX, plotExpressionY, plotVariablesGrid, plotVariableX, plotVariableY, setPlotFormat(), setPlotMode(), setRanges(), setTitle(), setXLabel(), setYLabel(), title, xLabel, and yLabel.

PlotWindowSubplot::PlotWindowSubplot ( PlotName  _name,
const char *const  _title = "",
const char *const  _xLabel = "",
const char *const  _yLabel = "",
PlotMode  _plotMode = PM_UNKNOWN,
double  _xRangeLowerLimit = INFTY,
double  _xRangeUpperLimit = INFTY,
double  _yRangeLowerLimit = INFTY,
double  _yRangeUpperLimit = INFTY 
)
Parameters:
[in]_nameInternal name of pre-defined information to be plotted.
[in]_titleTitle of the subplot.
[in]_xLabelLabel of x-axis of the subplot.
[in]_yLabelLabel of y-axis of the subplot.
[in]_plotModePlot mode, see the PlotMode documentation for details.
[in]_xRangeLowerLimitLower limit of the x-axis.
[in]_xRangeUpperLimitUpper limit of the x-axis.
[in]_yRangeLowerLimitLower limit of the y-axis.
[in]_yRangeUpperLimitUpper limit of the y-axis.

References BT_FALSE, data, lineValues, nData, next, nLines, PF_PLAIN, plot3D, plotEnum, plotExpressionX, plotExpressionY, plotVariablesGrid, plotVariableX, plotVariableY, setPlotFormat(), setPlotMode(), setRanges(), setTitle(), setXLabel(), setYLabel(), title, xLabel, and yLabel.

PlotWindowSubplot::PlotWindowSubplot ( const VariablesGrid _plotVariable,
const char *const  _title = "",
const char *const  _xLabel = "",
const char *const  _yLabel = "",
PlotMode  _plotMode = PM_UNKNOWN,
double  _xRangeLowerLimit = INFTY,
double  _xRangeUpperLimit = INFTY,
double  _yRangeLowerLimit = INFTY,
double  _yRangeUpperLimit = INFTY,
BooleanType  _plot3D = BT_FALSE 
)
Parameters:
[in]_variableDiscrete data to be plotted on the y-axis.
[in]_titleTitle of the subplot.
[in]_xLabelLabel of x-axis of the subplot.
[in]_yLabelLabel of y-axis of the subplot.
[in]_plotModePlot mode, see the PlotMode documentation for details.
[in]_xRangeLowerLimitLower limit of the x-axis.
[in]_xRangeUpperLimitUpper limit of the x-axis.
[in]_yRangeLowerLimitLower limit of the y-axis.
[in]_yRangeUpperLimitUpper limit of the y-axis.

References data, lineValues, nData, next, nLines, PF_PLAIN, plot3D, PLOT_NOTHING, plotEnum, plotExpressionX, plotExpressionY, plotVariablesGrid, plotVariableX, plotVariableY, setPlotFormat(), setPlotMode(), setRanges(), setTitle(), setXLabel(), setYLabel(), title, xLabel, and yLabel.

PlotWindowSubplot::PlotWindowSubplot ( const Curve _curve,
double  _xRangeLowerLimit = 0.0,
double  _xRangeUpperLimit = 1.0,
const char *const  _title = "",
const char *const  _xLabel = "",
const char *const  _yLabel = "",
PlotMode  _plotMode = PM_UNKNOWN,
double  _yRangeLowerLimit = INFTY,
double  _yRangeUpperLimit = INFTY 
)

Member Function Documentation

Parameters:
[in]_newDataAdditional discrete data points.
Returns:
SUCCESSFUL_RETURN

References data, nData, and SUCCESSFUL_RETURN.

Referenced by PlotWindow::addData(), operator=(), and PlotWindowSubplot().

returnValue PlotWindowSubplot::addLine ( double  _lineValue)
Parameters:
[in]_lineValueY-value of the additional horizontal line.
Returns:
SUCCESSFUL_RETURN

References lineValues, nLines, and SUCCESSFUL_RETURN.

Referenced by PlotWindow::addLine().

Returns:
Pointer to next subplot (or NULL iff subplot is terminal element).

References next.

Referenced by PlotWindow::clearAllSubplots(), PlotWindow::operator()(), PlotWindow::operator=(), and PlotWindow::PlotWindow().

uint PlotWindowSubplot::getNumData ( ) const [inline]
Returns:
Number of additional discrete data grids

References nData.

Returns:
Number of additional horizontal lines

References nLines.

Returns:
Name of pre-defined information to be plotted

References plotEnum.

Referenced by PlotWindow::addSubplot().

Returns:
Current plot format

References plotFormat.

Returns:
Current plot mode

References plotMode.

returnValue PlotWindowSubplot::getRanges ( double &  _xRangeLowerLimit,
double &  _xRangeUpperLimit,
double &  _yRangeLowerLimit,
double &  _yRangeUpperLimit 
) const [inline]
Parameters:
[out]_xRangeLowerLimitCurrent lower limit of the x-axis.
[out]_xRangeUpperLimitCurrent upper limit of the x-axis.
[out]_yRangeLowerLimitCurrent lower limit of the y-axis.
[out]_yRangeUpperLimitCurrent upper limit of the y-axis.
Returns:
SUCCESSFUL_RETURN

References SUCCESSFUL_RETURN, xRangeLowerLimit, xRangeUpperLimit, yRangeLowerLimit, and yRangeUpperLimit.

returnValue PlotWindowSubplot::getTitle ( char **  _title) [inline]
Parameters:
[out]_titleCurrent title.
Returns:
SUCCESSFUL_RETURN

References acadoAssignString(), and title.

returnValue PlotWindowSubplot::getXLabel ( char **  _xLabel) [inline]
Parameters:
[out]_xLabelCurrent label of x-axis.
Returns:
SUCCESSFUL_RETURN

References acadoAssignString(), and xLabel.

Returns:
Pointer to the expression on the x-axis of the subplot.

References plotExpressionX.

Referenced by PlotWindow::addSubplot().

Returns:
Type of the variable on the x-axis

References Expression::getVariableType(), plotVariableX, and VT_TIME.

Referenced by PlotWindow::addSubplot().

returnValue PlotWindowSubplot::getYLabel ( char **  _yLabel) [inline]
Parameters:
[out]_yLabelCurrent label of y-axis.
Returns:
SUCCESSFUL_RETURN

References acadoAssignString(), and yLabel.

Returns:
Pointer to the expression on the y-axis of the subplot.

References plotExpressionY.

Referenced by PlotWindow::addSubplot().

PlotWindowSubplot & PlotWindowSubplot::operator= ( const PlotWindowSubplot rhs)
Parameters:
[in]_nextNew pointer to next item.
Returns:
SUCCESSFUL_RETURN

References next, and SUCCESSFUL_RETURN.

Referenced by PlotWindow::addSubplot(), and PlotWindow::addSubplot3D().

Parameters:
[in]_plotFormatNew plot format, see the PlotFormat documentation for details.
Returns:
SUCCESSFUL_RETURN

References plotFormat, and SUCCESSFUL_RETURN.

Referenced by PlotWindow::addSubplot(), operator=(), and PlotWindowSubplot().

Parameters:
[in]_plotModeNew plot mode, see the PlotMode documentation for details.
Returns:
SUCCESSFUL_RETURN

References plotMode, and SUCCESSFUL_RETURN.

Referenced by operator=(), PlotWindowSubplot(), and PlotWindow::setPlotMode().

returnValue PlotWindowSubplot::setRanges ( double  _xRangeLowerLimit,
double  _xRangeUpperLimit,
double  _yRangeLowerLimit,
double  _yRangeUpperLimit 
) [inline]
Parameters:
[in]_xRangeLowerLimitLower limit of the x-axis.
[in]_xRangeUpperLimitUpper limit of the x-axis.
[in]_yRangeLowerLimitLower limit of the y-axis.
[in]_yRangeUpperLimitUpper limit of the y-axis.
Returns:
SUCCESSFUL_RETURN,
RET_INVALID_ARGUMENTS

References ACADOERROR, RET_INVALID_ARGUMENTS, SUCCESSFUL_RETURN, xRangeLowerLimit, xRangeUpperLimit, yRangeLowerLimit, and yRangeUpperLimit.

Referenced by operator=(), PlotWindowSubplot(), and PlotWindow::setRanges().

BEGIN_NAMESPACE_ACADO returnValue PlotWindowSubplot::setTitle ( const char *const  _title) [inline]
Parameters:
[in]_titleNew title.
Returns:
SUCCESSFUL_RETURN

References acadoAssignString(), and title.

Referenced by operator=(), PlotWindowSubplot(), and PlotWindow::setTitle().

returnValue PlotWindowSubplot::setXLabel ( const char *const  _xLabel) [inline]
Parameters:
[in]_xLabelNew label of x-axis.
Returns:
SUCCESSFUL_RETURN

References acadoAssignString(), and xLabel.

Referenced by operator=(), PlotWindowSubplot(), and PlotWindow::setLabelX().

returnValue PlotWindowSubplot::setYLabel ( const char *const  _yLabel) [inline]
Parameters:
[in]_yLabelNew label of y-axis.
Returns:
SUCCESSFUL_RETURN

References acadoAssignString(), and yLabel.

Referenced by operator=(), PlotWindowSubplot(), and PlotWindow::setLabelY().


Friends And Related Function Documentation

friend class GnuplotWindow [friend]

Member Data Documentation

double* PlotWindowSubplot::lineValues [protected]

Referenced by operator=(), and PlotWindowSubplot().

char* PlotWindowSubplot::title [protected]
char* PlotWindowSubplot::xLabel [protected]
char* PlotWindowSubplot::yLabel [protected]

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines