Visual Servoing Platform  version 3.5.1 under development (2023-09-22)
vpPlot.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2023 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 https://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 *****************************************************************************/
35 
41 #ifndef vpPlot_H
42 #define vpPlot_H
43 
44 #include <visp3/core/vpConfig.h>
45 #include <visp3/core/vpDisplay.h>
46 #include <visp3/gui/vpPlotGraph.h>
47 
110 #if defined(VISP_HAVE_DISPLAY)
111 
112 class VISP_EXPORT vpPlot
113 {
114 public:
116 
117 private:
118  vpDisplay *display;
119 
120  unsigned int graphNbr;
121  vpPlotGraph *graphList;
122 
123  unsigned int margei;
124  unsigned int margej;
125 
126  float factori;
127  float factorj;
128 
129  // private:
130  //#ifndef DOXYGEN_SHOULD_SKIP_THIS
131  // vpPlot(const vpPlot &)
132  // : I(), display(NULL), graphNbr(0), graphList(NULL), margei(0),
133  // margej(0),
134  // factori(0), factorj(0)
135  // {
136  // throw vpException(vpException::functionNotImplementedError, "Not
137  // implemented!");
138  // }
139  // vpPlot &operator=(const vpPlot &){
140  // throw vpException(vpException::functionNotImplementedError, "Not
141  // implemented!"); return *this;
142  // }
143  //#endif
144 
145 public:
146  vpPlot();
147  vpPlot(unsigned int nbGraph, unsigned int height = 700, unsigned int width = 700, int x = -1, int y = -1,
148  const std::string &title = "");
149  virtual ~vpPlot();
150  void getPixelValue(bool block);
151  void init(unsigned int nbGraph, unsigned int height = 700, unsigned int width = 700, int x = -1, int y = -1,
152  const std::string &title = "");
153  void initGraph(unsigned int graphNum, unsigned int curveNbr);
154 
155  void initRange(unsigned int graphNum, double xmin, double xmax, double ymin, double ymax);
156  void initRange(unsigned int graphNum, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
157  void navigate(void);
158 
159  void plot(unsigned int graphNum, unsigned int curveNum, double x, double y);
160  void plot(unsigned int graphNum, double x, const vpColVector &v_y);
161  void plot(unsigned int graphNum, double x, const vpRowVector &v_y);
162  void plot(unsigned int graphNum, double x, const vpPoseVector &v_y);
163  void plot(unsigned int graphNum, double x, const vpTranslationVector &v_y);
164  void plot(unsigned int graphNum, double x, const vpRotationVector &v_y);
165  vpMouseButton::vpMouseButtonType plot(unsigned int graphNum, unsigned int curveNum, double x, double y, double z);
166  vpMouseButton::vpMouseButtonType plot(unsigned int graphNum, double x, const vpColVector &v_y,
167  const vpColVector &v_z);
168 
169  void resetPointList(unsigned int graphNum);
170  void resetPointList(unsigned int graphNum, unsigned int curveNum);
171 
172  void saveData(unsigned int graphNum, const std::string &dataFile, const std::string &title_prefix = "");
173  void setColor(unsigned int graphNum, unsigned int curveNum, vpColor color);
174  void setGraphThickness(unsigned int graphNum, unsigned int thickness);
175  void setGridThickness(unsigned int graphNum, unsigned int thickness);
182  void setFont(const std::string &font)
183  {
184  if (display->isInitialised())
185  vpDisplay::setFont(I, font.c_str());
186  }
187  void setLegend(unsigned int graphNum, unsigned int curveNum, const std::string &legend);
188  void setTitle(unsigned int graphNum, const std::string &title);
189  void setUnitX(unsigned int graphNum, const std::string &unitx);
190  void setUnitY(unsigned int graphNum, const std::string &unity);
191  void setUnitZ(unsigned int graphNum, const std::string &unitz);
192  void setThickness(unsigned int graphNum, unsigned int curveNum, unsigned int thickness);
193 
194 private:
195  void initNbGraph(unsigned int nbGraph);
196  void displayGrid();
197 };
198 #endif
199 
200 #endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:167
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:152
Class that defines generic functionalities for display.
Definition: vpDisplay.h:173
static void setFont(const vpImage< unsigned char > &I, const std::string &font)
This class enables real time drawing of 2D or 3D graphics. An instance of the class open a window whi...
Definition: vpPlot.h:113
void setFont(const std::string &font)
Definition: vpPlot.h:182
vpImage< unsigned char > I
Definition: vpPlot.h:115
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:192
Implementation of a generic rotation vector.
Implementation of row vector and the associated operations.
Definition: vpRowVector.h:111
Class that consider the case of a translation vector.