Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
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(const unsigned int nbGraph, const unsigned int height = 700, const unsigned int width = 700, const int x = -1,
151  const int y = -1, const std::string &title = "");
152  virtual ~vpPlot();
153  void getPixelValue(const bool block);
154  void init(const unsigned int nbGraph, const unsigned int height = 700, const unsigned int width = 700,
155  const int x = -1, const int y = -1, const std::string &title = "");
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,
160  double zmax);
161  void navigate(void);
162 
163  void plot(const unsigned int graphNum, const unsigned int curveNum, const double x, const double y);
164  void plot(const unsigned int graphNum, const double x, const vpColVector &v_y);
165  void plot(const unsigned int graphNum, const double x, const vpRowVector &v_y);
166  void plot(const unsigned int graphNum, const double x, const vpPoseVector &v_y);
167  void plot(const unsigned int graphNum, const double x, const vpTranslationVector &v_y);
168  void plot(const unsigned int graphNum, const double x, const vpRotationVector &v_y);
169  vpMouseButton::vpMouseButtonType plot(const unsigned int graphNum, const unsigned int curveNum, const double x,
170  const double y, const double z);
171  vpMouseButton::vpMouseButtonType plot(const unsigned int graphNum, const double x, const vpColVector &v_y,
172  const vpColVector &v_z);
173 
174  void resetPointList(const unsigned int graphNum);
175  void resetPointList(const unsigned int graphNum, const unsigned int curveNum);
176 
177  void saveData(const unsigned int graphNum, const std::string &dataFile, const std::string &title_prefix = "");
178  void setColor(const unsigned int graphNum, const unsigned int curveNum, vpColor color);
179  void setGraphThickness(const unsigned int graphNum, const unsigned int thickness);
180  void setGridThickness(const unsigned int graphNum, const 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(const unsigned int graphNum, const unsigned int curveNum, const std::string &legend);
193  void setTitle(const unsigned int graphNum, const std::string &title);
194  void setUnitX(const unsigned int graphNum, const std::string &unitx);
195  void setUnitY(const unsigned int graphNum, const std::string &unity);
196  void setUnitZ(const unsigned int graphNum, const std::string &unitz);
197  void setThickness(const unsigned int graphNum, const unsigned int curveNum, const 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:257
Implementation of a generic rotation vector.
Class that defines generic functionnalities for display.
Definition: vpDisplay.h:171
vpImage< unsigned char > I
Definition: vpPlot.h:118
Implementation of row vector and the associated operations.
Definition: vpRowVector.h:72
Class to define colors available for display functionnalities.
Definition: vpColor.h:120
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:72
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:92
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.