Visual Servoing Platform  version 3.6.1 under development (2024-10-14)
vpPlot.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2024 by Inria. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
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 https://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 
39 #ifndef VP_PLOT_H
40 #define VP_PLOT_H
41 
42 #include <visp3/core/vpConfig.h>
43 #include <visp3/core/vpDisplay.h>
44 #include <visp3/gui/vpPlotGraph.h>
45 
46 #if defined(VISP_HAVE_DISPLAY)
47 
48 BEGIN_VISP_NAMESPACE
49 
111 class VISP_EXPORT vpPlot
112 {
113 public:
115 
116 private:
117  vpDisplay *display;
118 
119  unsigned int graphNbr;
120  vpPlotGraph *graphList;
121 
122  unsigned int margei;
123  unsigned int margej;
124 
125  float factori;
126  float factorj;
127 
128  // private:
129  //#ifndef DOXYGEN_SHOULD_SKIP_THIS
130  // vpPlot(const vpPlot &)
131  // : I(), display(nullptr), graphNbr(0), graphList(nullptr), margei(0),
132  // margej(0),
133  // factori(0), factorj(0)
134  // {
135  // throw vpException(vpException::functionNotImplementedError, "Not
136  // implemented!");
137  // }
138  // vpPlot &operator=(const vpPlot &){
139  // throw vpException(vpException::functionNotImplementedError, "Not
140  // implemented!"); return *this;
141  // }
142  //#endif
143 
144 public:
145  vpPlot();
146  vpPlot(unsigned int nbGraph, unsigned int height = 700, unsigned int width = 700, int x = -1, int y = -1,
147  const std::string &title = "");
148  virtual ~vpPlot();
149  void getPixelValue(bool block);
150  void init(unsigned int nbGraph, unsigned int height = 700, unsigned int width = 700, int x = -1, int y = -1,
151  const std::string &title = "");
152  void initGraph(unsigned int graphNum, unsigned int curveNbr);
153 
154  void initRange(unsigned int graphNum, double xmin, double xmax, double ymin, double ymax);
155  void initRange(unsigned int graphNum, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
156  void navigate(void);
157 
158  void plot(unsigned int graphNum, unsigned int curveNum, double x, double y);
159  void plot(unsigned int graphNum, double x, const vpColVector &v_y);
160  void plot(unsigned int graphNum, double x, const vpRowVector &v_y);
161  void plot(unsigned int graphNum, double x, const vpPoseVector &v_y);
162  void plot(unsigned int graphNum, double x, const vpTranslationVector &v_y);
163  void plot(unsigned int graphNum, double x, const vpRotationVector &v_y);
164  vpMouseButton::vpMouseButtonType plot(unsigned int graphNum, unsigned int curveNum, double x, double y, double z);
165  vpMouseButton::vpMouseButtonType plot(unsigned int graphNum, double x, const vpColVector &v_y,
166  const vpColVector &v_z);
167 
168  void resetPointList(unsigned int graphNum);
169  void resetPointList(unsigned int graphNum, unsigned int curveNum);
170 
171  void saveData(unsigned int graphNum, const std::string &dataFile, const std::string &title_prefix = "");
172  void setColor(unsigned int graphNum, unsigned int curveNum, vpColor color);
173  void setGraphThickness(unsigned int graphNum, unsigned int thickness);
174  void setGridThickness(unsigned int graphNum, unsigned int thickness);
175 
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 
199 END_VISP_NAMESPACE
200 #endif
201 
202 #endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:191
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:157
Class that defines generic functionalities for display.
Definition: vpDisplay.h:178
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:112
void setFont(const std::string &font)
Definition: vpPlot.h:182
vpImage< unsigned char > I
Definition: vpPlot.h:114
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:203
Implementation of a generic rotation vector.
Implementation of row vector and the associated operations.
Definition: vpRowVector.h:124
Class that consider the case of a translation vector.