Visual Servoing Platform  version 3.0.0
vpPlot.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2015 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See http://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Plot curves.
32  *
33  * Authors:
34  * Nicolas Melchior
35  *
36  *****************************************************************************/
37 
43 #ifndef vpPlot_H
44 #define vpPlot_H
45 
46 #include <visp3/core/vpConfig.h>
47 #include <visp3/core/vpDisplay.h>
48 #include <visp3/gui/vpPlotGraph.h>
49 
111 #if defined(VISP_HAVE_DISPLAY)
112 
113 class VISP_EXPORT vpPlot
114 {
115  public:
117 
118  private:
119  vpDisplay *display;
120 
121  unsigned int graphNbr;
122  vpPlotGraph* graphList;
123 
124  unsigned int margei;
125  unsigned int margej;
126 
127  float factori;
128  float factorj;
129 
130 //private:
131 //#ifndef DOXYGEN_SHOULD_SKIP_THIS
132 // vpPlot(const vpPlot &)
133 // : I(), display(NULL), graphNbr(0), graphList(NULL), margei(0), margej(0),
134 // factori(0), factorj(0)
135 // {
136 // throw vpException(vpException::functionNotImplementedError, "Not implemented!");
137 // }
138 // vpPlot &operator=(const vpPlot &){
139 // throw vpException(vpException::functionNotImplementedError, "Not implemented!");
140 // return *this;
141 // }
142 //#endif
143 
144 public:
145  vpPlot();
146  vpPlot(const unsigned int nbGraph,
147  const unsigned int height=700,
148  const unsigned int width=700,
149  const int x=-1, const int y=-1, const char *title=NULL);
150  ~vpPlot();
151  void getPixelValue(const bool block);
152  void init(const unsigned int nbGraph,
153  const unsigned int height=700,
154  const unsigned int width=700,
155  const int x=-1, const int y=-1, const char *title=NULL);
156  void initGraph (unsigned int graphNum, unsigned int curveNbr);
157 
158  void initRange (const unsigned int graphNum, double xmin, double xmax, double ymin, double ymax);
159  void initRange (const unsigned int graphNum, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
160  void navigate (void);
161 
162  void plot (const unsigned int graphNum, const unsigned int curveNum, const double x, const double y);
163  void plot(const unsigned int graphNum, const double x, const vpColVector &v_y);
164  void plot(const unsigned int graphNum, const double x, const vpRowVector &v_y);
165  void plot(const unsigned int graphNum, const double x, const vpPoseVector &v_y);
166  void plot(const unsigned int graphNum, const double x, const vpTranslationVector &v_y);
167  void plot(const unsigned int graphNum, const double x, const vpRotationVector &v_y);
168  vpMouseButton::vpMouseButtonType plot (const unsigned int graphNum, const unsigned int curveNum, const double x, const double y, const double z);
169  vpMouseButton::vpMouseButtonType plot(const unsigned int graphNum, const double x, const vpColVector &v_y, const vpColVector &v_z);
170 
171  void resetPointList (const unsigned int graphNum);
172  void resetPointList (const unsigned int graphNum, const unsigned int curveNum);
173 
174  void saveData(const unsigned int graphNum, const char* dataFile);
175  void setColor (const unsigned int graphNum, const unsigned int curveNum, vpColor color);
176  void setGraphThickness (const unsigned int graphNum, const unsigned int thickness);
177  void setGridThickness (const unsigned int graphNum, const unsigned int thickness);
183  void setFont(const char *font)
184  {
185  if (display->isInitialised())
186  vpDisplay::setFont(I, font);
187  }
188  void setLegend (const unsigned int graphNum, const unsigned int curveNum, const char *legend);
189  void setTitle (const unsigned int graphNum, const char *title);
190  void setUnitX (const unsigned int graphNum, const char *unitx);
191  void setUnitY (const unsigned int graphNum, const char *unity);
192  void setUnitZ (const unsigned int graphNum, const char *unitz);
193  void setThickness (const unsigned int graphNum, const unsigned int curveNum, const unsigned int thickness);
194 
195  private:
196  void initNbGraph (unsigned int nbGraph);
197  void displayGrid();
198 };
199 #endif
200 
201 #endif
bool isInitialised()
Definition: vpDisplay.h:618
Implementation of a generic rotation vector.
Class that defines generic functionnalities for display.
Definition: vpDisplay.h:170
vpImage< unsigned char > I
Definition: vpPlot.h:116
Implementation of row vector and the associated operations.
Definition: vpRowVector.h:70
Class to define colors available for display functionnalities.
Definition: vpColor.h:121
void setFont(const char *font)
Definition: vpPlot.h:183
virtual void setFont(const char *font)=0
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:93
This class enables real time drawing of 2D or 3D graphics. An instance of the class open a window whi...
Definition: vpPlot.h:113
Class that consider the case of a translation vector.