Visual Servoing Platform
version 3.1.0
|
#include <visp3/gui/vpPlot.h>
Public Member Functions | |
vpPlot () | |
vpPlot (const unsigned int nbGraph, const unsigned int height=700, const unsigned int width=700, const int x=-1, const int y=-1, const std::string &title="") | |
~vpPlot () | |
void | getPixelValue (const bool block) |
void | init (const unsigned int nbGraph, const unsigned int height=700, const unsigned int width=700, const int x=-1, const int y=-1, const std::string &title="") |
void | initGraph (unsigned int graphNum, unsigned int curveNbr) |
void | initRange (const unsigned int graphNum, double xmin, double xmax, double ymin, double ymax) |
void | initRange (const unsigned int graphNum, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) |
void | navigate (void) |
void | plot (const unsigned int graphNum, const unsigned int curveNum, const double x, const double y) |
void | plot (const unsigned int graphNum, const double x, const vpColVector &v_y) |
void | plot (const unsigned int graphNum, const double x, const vpRowVector &v_y) |
void | plot (const unsigned int graphNum, const double x, const vpPoseVector &v_y) |
void | plot (const unsigned int graphNum, const double x, const vpTranslationVector &v_y) |
void | plot (const unsigned int graphNum, const double x, const vpRotationVector &v_y) |
vpMouseButton::vpMouseButtonType | plot (const unsigned int graphNum, const unsigned int curveNum, const double x, const double y, const double z) |
vpMouseButton::vpMouseButtonType | plot (const unsigned int graphNum, const double x, const vpColVector &v_y, const vpColVector &v_z) |
void | resetPointList (const unsigned int graphNum) |
void | resetPointList (const unsigned int graphNum, const unsigned int curveNum) |
void | saveData (const unsigned int graphNum, const std::string &dataFile, const std::string &title_prefix="") |
void | setColor (const unsigned int graphNum, const unsigned int curveNum, vpColor color) |
void | setGraphThickness (const unsigned int graphNum, const unsigned int thickness) |
void | setGridThickness (const unsigned int graphNum, const unsigned int thickness) |
void | setFont (const std::string &font) |
void | setLegend (const unsigned int graphNum, const unsigned int curveNum, const std::string &legend) |
void | setTitle (const unsigned int graphNum, const std::string &title) |
void | setUnitX (const unsigned int graphNum, const std::string &unitx) |
void | setUnitY (const unsigned int graphNum, const std::string &unity) |
void | setUnitZ (const unsigned int graphNum, const std::string &unitz) |
void | setThickness (const unsigned int graphNum, const unsigned int curveNum, const unsigned int thickness) |
Public Attributes | |
vpImage< unsigned char > | I |
This class enables real time drawing of 2D or 3D graphics. An instance of the class open a window which contains between 1 and 4 graphics. Each one contains a desired number of curves.
The example below shows how to use the vpPlot class. An other example provided in tutoral-ibvs-plotter.cpp and described in Tutorial: Real-time curves plotter tool shows how to use this class to plot in real-time some curves during an image-based visual servo.
vpPlot::vpPlot | ( | ) |
vpPlot::vpPlot | ( | const unsigned int | graph_nbr, |
const unsigned int | height = 700 , |
||
const unsigned int | width = 700 , |
||
const int | x = -1 , |
||
const int | y = -1 , |
||
const std::string & | title = "" |
||
) |
This constructor creates a new window where the curves will be drawn. The number of graphics in the window must be set.
graph_nbr | : The number of graph in the window. |
height | : Height of the window. |
width | : Width of the window. |
x,y | : The window is set at position x,y (column index, row index). |
title | : Window title. |
Definition at line 81 of file vpPlot.cpp.
References init().
vpPlot::~vpPlot | ( | ) |
Basic destructor
Definition at line 130 of file vpPlot.cpp.
References vpException::dimensionError, and vpDisplay::display().
void vpPlot::getPixelValue | ( | const bool | block | ) |
This method displays the coordinates of the point pointed by the mouse pointer.
block | : If true, this method waits a click. |
Definition at line 476 of file vpPlot.cpp.
References vpDisplay::getClick(), vpDisplay::getPointerPosition(), and I.
void vpPlot::init | ( | const unsigned int | graph_nbr, |
const unsigned int | height = 700 , |
||
const unsigned int | width = 700 , |
||
const int | x = -1 , |
||
const int | y = -1 , |
||
const std::string & | title = "" |
||
) |
Creates a new window where the curves will be drawn. The number of graphics in the window must be set.
graph_nbr | : The number of graph in the window. |
height | : Height of the window. |
width | : Width of the window. |
x,y | : The window is set at position x,y (column index, row index). |
title | : Window title. |
Definition at line 100 of file vpPlot.cpp.
References vpDisplay::display(), I, vpImage< Type >::init(), and vpDisplayGDI::vpDisplayGDI().
Referenced by vpPlot().
void vpPlot::initGraph | ( | unsigned int | graphNum, |
unsigned int | curveNbr | ||
) |
Function which enables to initialize the number of curves which belongs to a graphic.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
curveNbr | : The number of curves belonging to the graphic |
Definition at line 206 of file vpPlot.cpp.
void vpPlot::initRange | ( | const unsigned int | graphNum, |
double | xmin, | ||
double | xmax, | ||
double | ymin, | ||
double | ymax | ||
) |
This method enables to set the initial range of the selected graphic.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
xmin | : The initial minimum value along the x axis given in the user coordinates. |
xmax | : The initial maximum value along the x axis given in the user coordinates. |
ymin | : The initial minimum value along the y axis given in the user coordinates. |
ymax | : The initial maximum value along the y axis given in the user coordinates. |
Definition at line 228 of file vpPlot.cpp.
References I.
void vpPlot::initRange | ( | const unsigned int | graphNum, |
double | xmin, | ||
double | xmax, | ||
double | ymin, | ||
double | ymax, | ||
double | zmin, | ||
double | zmax | ||
) |
This method enables to set the initial range of the selected graphic.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
xmin | : The initial minimum value along the x axis given in the user coordinates. |
xmax | : The initial maximum value along the x axis given in the user coordinates. |
ymin | : The initial minimum value along the y axis given in the user coordinates. |
ymax | : The initial maximum value along the y axis given in the user coordinates. |
zmin | : The initial minimum value along the z axis given in the user coordinates. |
zmax | : The initial maximum value along the z axis given in the user coordinates. |
Definition at line 247 of file vpPlot.cpp.
References I.
void vpPlot::navigate | ( | void | ) |
This method allows to change the point of view with the mouse if you have a 3D graphic. The navigation is performed using the mouse.
Definition at line 439 of file vpPlot.cpp.
References vpMouseButton::button3, vpDisplay::getPointerPosition(), I, vpImagePoint::inRectangle(), vpMouseButton::none, and vpTime::sleepMs().
void vpPlot::plot | ( | const unsigned int | graphNum, |
const unsigned int | curveNum, | ||
const double | x, | ||
const double | y | ||
) |
This function enables you to add a new point in the curve. This point is drawn with the parameters of the curve.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
curveNum | : The index of the curve in the list of the curves belonging to the graphic. |
x | : The coordinate of the new point along the x axis and given in the user unit system. |
y | : The coordinate of the new point along the y axis and given in the user unit system. |
Definition at line 286 of file vpPlot.cpp.
References I.
Referenced by plot().
void vpPlot::plot | ( | const unsigned int | graphNum, |
const double | x, | ||
const vpColVector & | v_y | ||
) |
This function enables you to add new points in all curves of a plot. These points are drawn with the parameters of the curves.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
x | : The coordinate of the new points along the x axis and given in the user unit system. |
v_y | : y coordinates vector. The coordinates of the new points along the y axis and given in the user unit system. |
Definition at line 302 of file vpPlot.cpp.
References vpArray2D< Type >::getRows(), plot(), and vpTRACE.
void vpPlot::plot | ( | const unsigned int | graphNum, |
const double | x, | ||
const vpRowVector & | v_y | ||
) |
This function enables you to add new points in all curves of a plot. These points are drawn with the parameters of the curves.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
x | : The coordinate of the new points along the x axis and given in the user unit system. |
v_y | : y coordinates vector. The coordinates of the new points along the y axis and given in the user unit system. |
Definition at line 321 of file vpPlot.cpp.
References vpArray2D< Type >::getRows(), plot(), and vpTRACE.
void vpPlot::plot | ( | const unsigned int | graphNum, |
const double | x, | ||
const vpPoseVector & | v_y | ||
) |
This function enables you to add new points in all curves of a plot. These points are drawn with the parameters of the curves.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
x | : The coordinate of the new points along the x axis and given in the user unit system. |
v_y | : y coordinates vector. The coordinates of the new points along the y axis and given in the user unit system. |
Definition at line 341 of file vpPlot.cpp.
References vpArray2D< Type >::getRows(), plot(), and vpTRACE.
void vpPlot::plot | ( | const unsigned int | graphNum, |
const double | x, | ||
const vpTranslationVector & | v_y | ||
) |
This function enables you to add new points in all curves of a plot. These points are drawn with the parameters of the curves.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
x | : The coordinate of the new points along the x axis and given in the user unit system. |
v_y | : y coordinates vector. The coordinates of the new points along the y axis and given in the user unit system. |
Definition at line 360 of file vpPlot.cpp.
References vpArray2D< Type >::getRows(), plot(), and vpTRACE.
void vpPlot::plot | ( | const unsigned int | graphNum, |
const double | x, | ||
const vpRotationVector & | v_y | ||
) |
This function enables you to add new points in all curves of a plot. These points are drawn with the parameters of the curves.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
x | : The coordinate of the new points along the x axis and given in the user unit system. |
v_y | : y coordinates vector. The coordinates of the new points along the y axis and given in the user unit system. |
Definition at line 380 of file vpPlot.cpp.
References plot(), vpArray2D< Type >::size(), and vpTRACE.
vpMouseButton::vpMouseButtonType vpPlot::plot | ( | const unsigned int | graphNum, |
const unsigned int | curveNum, | ||
const double | x, | ||
const double | y, | ||
const double | z | ||
) |
This function enables you to add a new point in the curve. This point is drawn with the parameters of the curve.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
curveNum | : The index of the curve in the list of the curves belonging to the graphic. |
x | : The coordinate of the new point along the x axis and given in the user unit system. |
y | : The coordinate of the new point along the y axis and given in the user unit system. |
z | : The coordinate of the new point along the z axis and given in the user unit system. |
Definition at line 402 of file vpPlot.cpp.
References I.
vpMouseButton::vpMouseButtonType vpPlot::plot | ( | const unsigned int | graphNum, |
const double | x, | ||
const vpColVector & | v_y, | ||
const vpColVector & | v_z | ||
) |
This function enables you to add new points in all curves of a plot. These points are drawn with the parameters of the curves.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
x | : The coordinate of the new points along the x axis and given in the user unit system. |
v_y | : y coordinates vector. The coordinates of the new points along the y axis and given in the user unit system. |
v_z | : z coordinates vector. The coordinates of the new points along the z axis and given in the user unit system. |
Definition at line 420 of file vpPlot.cpp.
References vpArray2D< Type >::getRows(), vpMouseButton::none, plot(), and vpTRACE.
void vpPlot::resetPointList | ( | const unsigned int | graphNum | ) |
This method enables to erase the list of points stored for the graphic number .
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
Definition at line 560 of file vpPlot.cpp.
Referenced by resetPointList().
void vpPlot::resetPointList | ( | const unsigned int | graphNum, |
const unsigned int | curveNum | ||
) |
This method enables to erase the list of points stored for the curve number contained in the graphic number .
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
curveNum | : The index of the curve in the list of the curves belonging to the graphic. |
Definition at line 615 of file vpPlot.cpp.
References resetPointList().
void vpPlot::saveData | ( | const unsigned int | graphNum, |
const std::string & | dataFile, | ||
const std::string & | title_prefix = "" |
||
) |
This function enables to save in a text file all the plotted points of a graphic.
The content of the file is the following:
The columns are delimited thanks to tabulations.
title_prefix | : Prefix introducted in the first line of the saved file. To exploit a posteriori the resulting curves:
|
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
dataFile | : Name of the text file. |
Definition at line 646 of file vpPlot.cpp.
void vpPlot::setColor | ( | const unsigned int | graphNum, |
const unsigned int | curveNum, | ||
vpColor | color | ||
) |
This function enables you to choose the color used to draw a given curve.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
curveNum | : The index of the curve in the list of the curves belonging to the graphic. |
color | : The color you want to use |
Definition at line 261 of file vpPlot.cpp.
References I.
|
inline |
Set the font of the characters. The display should be initialized before.
To know which font are available, on Unix you can use xfontsel or xlsfonts utilities.
Definition at line 187 of file vpPlot.h.
References vpDisplay::isInitialised(), and vpDisplay::setFont().
void vpPlot::setGraphThickness | ( | const unsigned int | graphNum, |
const unsigned int | thickness | ||
) |
This function enables you to choose the thickness used to draw all the curves belonging to a given graphic.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
thickness | : The thickness you want to use |
Definition at line 587 of file vpPlot.cpp.
void vpPlot::setGridThickness | ( | const unsigned int | graphNum, |
const unsigned int | thickness | ||
) |
This function enables you to choose the thickness used to draw the grid and the axis of a given graphic.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
thickness | : The thickness you want to use |
Definition at line 601 of file vpPlot.cpp.
void vpPlot::setLegend | ( | const unsigned int | graphNum, |
const unsigned int | curveNum, | ||
const std::string & | legend | ||
) |
Sets the legend of a curve.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
curveNum | : The index of the curve in the list of the curves belonging to the graphic. |
legend | : The legend of the curve. |
Definition at line 547 of file vpPlot.cpp.
void vpPlot::setThickness | ( | const unsigned int | graphNum, |
const unsigned int | curveNum, | ||
const unsigned int | thickness | ||
) |
This function enables you to choose the thickness used to draw a given curve.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
curveNum | : The index of the curve in the list of the curves belonging to the graphic. |
thickness | : The thickness you want to use |
Definition at line 574 of file vpPlot.cpp.
void vpPlot::setTitle | ( | const unsigned int | graphNum, |
const std::string & | title | ||
) |
Sets the title of a graphic.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
title | : The graphic title. |
Definition at line 498 of file vpPlot.cpp.
void vpPlot::setUnitX | ( | const unsigned int | graphNum, |
const std::string & | unitx | ||
) |
Sets the unit system of the x axis.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
unitx | : The name of the unit of the x axis. |
Definition at line 510 of file vpPlot.cpp.
void vpPlot::setUnitY | ( | const unsigned int | graphNum, |
const std::string & | unity | ||
) |
Sets the unit system of the y axis.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
unity | : The name of the unit of the y axis. |
Definition at line 522 of file vpPlot.cpp.
void vpPlot::setUnitZ | ( | const unsigned int | graphNum, |
const std::string & | unitz | ||
) |
Sets the unit system of the z axis.
graphNum | : The index of the graph in the window. As the number of graphic in a window is less or equal to 4, this parameter is between 0 and 3. |
unitz | : The name of the unit of the z axis. |
Definition at line 534 of file vpPlot.cpp.
vpImage<unsigned char> vpPlot::I |
Definition at line 118 of file vpPlot.h.
Referenced by getPixelValue(), init(), initRange(), navigate(), plot(), and setColor().