ViSP  2.6.2
vpPlot.h
1 /****************************************************************************
2  *
3  * $Id: vpPlot.h 3821 2012-06-27 13:50:37Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2012 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Plot curves.
36  *
37  * Authors:
38  * Nicolas Melchior
39  *
40  *****************************************************************************/
41 
47 #ifndef vpPlot_H
48 #define vpPlot_H
49 
50 #include <visp/vpPlotGraph.h>
51 
52 #include <visp/vpDisplay.h>
53 
117 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV)
118 
119 class VISP_EXPORT vpPlot
120 {
121  public:
123 
124  private:
125  vpDisplay *display;
126 
127  unsigned int graphNbr;
128  vpPlotGraph* graphList;
129 
130  unsigned int margei;
131  unsigned int margej;
132 
133  float factori;
134  float factorj;
135 
136  public:
137  vpPlot();
138  vpPlot(const unsigned int nbGraph,
139  const unsigned int height=700,
140  const unsigned int width=700,
141  const int x=-1, const int y=-1, const char *title=NULL);
142  ~vpPlot();
143  void init(const unsigned int nbGraph,
144  const unsigned int height=700,
145  const unsigned int width=700,
146  const int x=-1, const int y=-1, const char *title=NULL);
147  void initGraph (unsigned int graphNum, unsigned int curveNbr);
148 
149  void initRange (const unsigned int graphNum, double xmin, double xmax, double ymin, double ymax);
150  void initRange (const unsigned int graphNum, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
151  void setColor (const unsigned int graphNum, const unsigned int curveNum, vpColor color);
157  void setFont(const char *font)
158  {
159  if (display->isInitialised())
160  vpDisplay::setFont(I, font);
161  }
162  void setTitle (const unsigned int graphNum, const char *title);
163  void setUnitX (const unsigned int graphNum, const char *unitx);
164  void setUnitY (const unsigned int graphNum, const char *unity);
165  void setUnitZ (const unsigned int graphNum, const char *unitz);
166  void setLegend (const unsigned int graphNum, const unsigned int curveNum, const char *legend);
167  void setThickness (const unsigned int graphNum, const unsigned int curveNum, const unsigned int thickness);
168 
169  void plot (const unsigned int graphNum, const unsigned int curveNum, const double x, const double y);
170  void plot(const unsigned int graphNum, const double x, const vpColVector &v_y);
171  void plot (const unsigned int graphNum, const unsigned int curveNum, const double x, const double y, const double z);
172  void plot(const unsigned int graphNum, const double x, const vpColVector &v_y, const vpColVector &v_z);
173 
174  void navigate (void);
175 
176  void getPixelValue(const bool block);
177 
178  void resetPointList (const unsigned int graphNum);
179  void resetPointList (const unsigned int graphNum, const unsigned int curveNum);
180 
181  void saveData(const unsigned int graphNum, const char* dataFile);
182 
183  private:
184  void initNbGraph (unsigned int nbGraph);
185  void displayGrid();
186 };
187 #endif
188 
189 #endif
bool isInitialised()
Definition: vpDisplay.h:434
Class that defines generic functionnalities for display.
Definition: vpDisplay.h:167
vpImage< unsigned char > I
Definition: vpPlot.h:122
Class to define colors available for display functionnalities.
Definition: vpColor.h:123
void setFont(const char *font)
Definition: vpPlot.h:157
virtual void setFont(const char *font)=0
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
This class enables real time drawing of 2D or 3D graphics. An instance of the class open a window whi...
Definition: vpPlot.h:119