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