ViSP  2.9.0
vpPlot.h
1 /****************************************************************************
2  *
3  * $Id: vpPlot.h 4574 2014-01-09 08:48:51Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 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/vpConfig.h>
51 #include <visp/vpDisplay.h>
52 #include <visp/vpPlotGraph.h>
53 
115 #if defined(VISP_HAVE_DISPLAY)
116 
117 class VISP_EXPORT vpPlot
118 {
119  public:
121 
122  private:
123  vpDisplay *display;
124 
125  unsigned int graphNbr;
126  vpPlotGraph* graphList;
127 
128  unsigned int margei;
129  unsigned int margej;
130 
131  float factori;
132  float factorj;
133 
134  public:
135  vpPlot();
136  vpPlot(const unsigned int nbGraph,
137  const unsigned int height=700,
138  const unsigned int width=700,
139  const int x=-1, const int y=-1, const char *title=NULL);
140  ~vpPlot();
141  void getPixelValue(const bool block);
142  void init(const unsigned int nbGraph,
143  const unsigned int height=700,
144  const unsigned int width=700,
145  const int x=-1, const int y=-1, const char *title=NULL);
146  void initGraph (unsigned int graphNum, unsigned int curveNbr);
147 
148  void initRange (const unsigned int graphNum, double xmin, double xmax, double ymin, double ymax);
149  void initRange (const unsigned int graphNum, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
150  void navigate (void);
151 
152  void plot (const unsigned int graphNum, const unsigned int curveNum, const double x, const double y);
153  void plot(const unsigned int graphNum, const double x, const vpColVector &v_y);
154  void plot (const unsigned int graphNum, const unsigned int curveNum, const double x, const double y, const double z);
155  void plot(const unsigned int graphNum, const double x, const vpColVector &v_y, const vpColVector &v_z);
156 
157  void resetPointList (const unsigned int graphNum);
158  void resetPointList (const unsigned int graphNum, const unsigned int curveNum);
159 
160  void saveData(const unsigned int graphNum, const char* dataFile);
161  void setColor (const unsigned int graphNum, const unsigned int curveNum, vpColor color);
162  void setGraphThickness (const unsigned int graphNum, const unsigned int thickness);
163  void setGridThickness (const unsigned int graphNum, const unsigned int thickness);
169  void setFont(const char *font)
170  {
171  if (display->isInitialised())
172  vpDisplay::setFont(I, font);
173  }
174  void setLegend (const unsigned int graphNum, const unsigned int curveNum, const char *legend);
175  void setTitle (const unsigned int graphNum, const char *title);
176  void setUnitX (const unsigned int graphNum, const char *unitx);
177  void setUnitY (const unsigned int graphNum, const char *unity);
178  void setUnitZ (const unsigned int graphNum, const char *unitz);
179  void setThickness (const unsigned int graphNum, const unsigned int curveNum, const unsigned int thickness);
180 
181  private:
182  void initNbGraph (unsigned int nbGraph);
183  void displayGrid();
184 };
185 #endif
186 
187 #endif
bool isInitialised()
Definition: vpDisplay.h:564
Class that defines generic functionnalities for display.
Definition: vpDisplay.h:176
vpImage< unsigned char > I
Definition: vpPlot.h:120
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
void setFont(const char *font)
Definition: vpPlot.h:169
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:117