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