ViSP  2.8.0
vpPlotGraph.h
1 
2 /****************************************************************************
3  *
4  * $Id: vpPlotGraph.h 4151 2013-03-11 06:52:18Z fspindle $
5  *
6  * This file is part of the ViSP software.
7  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
8  *
9  * This software is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.txt at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using ViSP with software that can not be combined with the GNU
16  * GPL, please contact INRIA about acquiring a ViSP Professional
17  * Edition License.
18  *
19  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
20  *
21  * This software was developed at:
22  * INRIA Rennes - Bretagne Atlantique
23  * Campus Universitaire de Beaulieu
24  * 35042 Rennes Cedex
25  * France
26  * http://www.irisa.fr/lagadic
27  *
28  * If you have questions regarding the use of this file, please contact
29  * INRIA at visp@inria.fr
30  *
31  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
32  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
33  *
34  *
35  * Description:
36  * Define a graph for the vpPlot class.
37  *
38  * Authors:
39  * Nicolas Melchior
40  *
41  *****************************************************************************/
42 
43 #ifndef DOXYGEN_SHOULD_SKIP_THIS
44 
45 #ifndef vpPlotGraph_H
46 #define vpPlotGraph_H
47 
48 #include <visp/vpColor.h>
49 #include <visp/vpImage.h>
50 
51 #include <visp/vpPlotCurve.h>
52 
53 #include <visp/vpHomogeneousMatrix.h>
54 #include <visp/vpRect.h>
55 
56 #include <visp/vpCameraParameters.h>
57 #include <visp/vpPoint.h>
58 
59 #if defined(VISP_HAVE_DISPLAY)
60 
61 class vpPlotGraph
62 {
63  public:
64  double xorg;
65  double yorg;
66  double zoomx;
67  double zoomy;
68  double xmax;
69  double ymax;
70  double xmin;
71  double ymin;
72  double xdelt;
73  double ydelt;
74  bool gridx;
75  bool gridy;
76  vpColor gridColor;
77  char title[256];
78  char unitx[256];
79  char unity[256];
80  unsigned int curveNbr;
81  vpPlotCurve* curveList;
82  bool textdispayed;
83  bool scaleInitialized;
84  bool firstPoint;
85 
86  int nbDivisionx;
87  int nbDivisiony;
88 
89  //Graph complet
90  vpImagePoint topLeft;
91  unsigned int width;
92  unsigned int height;
93  vpRect graphZone;
94 
95  //Zone d'affichage
96  vpImagePoint dTopLeft;
97  unsigned int dWidth;
98  unsigned int dHeight;
99  vpRect dGraphZone;
100 
101  //Zone d'affichage
102  vpImagePoint dTopLeft3D;
103 // int dWidth;
104 // int dHeight;
105  vpRect dGraphZone3D;
106 
107  //3D part
108  vpCameraParameters cam;
111  double w_xval;
112  double w_xsize;
113  double w_yval;
114  double w_ysize;
115  double w_zval;
116  double w_zsize;
117  double ptXorg;
118  double ptYorg;
119  double ptZorg;
120  double zoomx_3D;
121  double zoomy_3D;
122  double zoomz_3D;
123 
124  int nbDivisionz;
125 
126  double zorg;
127  double zoomz;
128  double zmax;
129  double zmin;
130  double zdelt;
131  char unitz[256];
132  vpImagePoint old_iPr;
133  vpImagePoint old_iPz;
134  bool blockedr;
135  bool blockedz;
136  bool blocked;
137 
138  unsigned int epsi;
139  unsigned int epsj;
140 
141  bool dispUnit;
142  bool dispTitle;
143  bool dispLegend;
144 
145  unsigned int gridThickness;
146 
147  public:
148  vpPlotGraph();
149  ~vpPlotGraph();
150 
151  bool check3Dline(vpImagePoint &iP1, vpImagePoint &iP2);
152  bool check3Dpoint(vpImagePoint &iP);
153  void clearGraphZone(vpImage<unsigned char> &I);
154  void computeGraphParameters();
155  void computeGraphParameters3D();
156 
157  void initGraph (unsigned int nbCurve);
158  void initSize (vpImagePoint topLeft, unsigned int width, unsigned int height, unsigned int margei, unsigned int margej);
159  void initScale(vpImage<unsigned char> &I, const double xmin, const double xmax, const int nbDivx, const double ymin, const double ymax, const int nbDivy, const bool gx, const bool gy);
160  void initScale(vpImage<unsigned char> &I, const double xmin, const double xmax, const int nbDivx, const double ymin, const double ymax, const int nbDivy, const double zmin, const double zmax, const int nbDivz, const bool gx, const bool gy);
161 
162  void displayGrid (vpImage<unsigned char> &I);
163  void displayUnit (vpImage<unsigned char> &I);
164  void displayTitle (vpImage<unsigned char> &I);
165  void displayLegend (vpImage<unsigned char> &I);
166  void displayGrid3D (vpImage<unsigned char> &I);
167 
168  void findPose();
169 
170  bool getPixelValue(vpImage<unsigned char> &I, vpImagePoint &iP);
171 
172  bool move(const vpImage<unsigned char> &I);
173  vpHomogeneousMatrix navigation(const vpImage<unsigned char> &I, bool &changed);
174 
175  void plot (vpImage<unsigned char> &I, const unsigned int curveNb, const double x, const double y);
176  void plot (vpImage<unsigned char> &I, const unsigned int curveNb, const double x, const double y, const double z);
177  void replot (vpImage<unsigned char> &I);
178  void replot3D (vpImage<unsigned char> &I);
179 
180  void rescalex(unsigned int side, double extremity);
181  void rescaley(unsigned int side, double extremity);
182  void rescalez(unsigned int side, double extremity);
183  //void rescale(double &min, double &max, double &delta, const int nbDiv, int side);
184  void resetPointList(const unsigned int curveNum);
185 
186  void setCurveColor(const unsigned int curveNum, const vpColor color);
187  void setCurveThickness(const unsigned int curveNum, const unsigned int thickness);
188  void setGridThickness (const unsigned int thickness) {
189  this->gridThickness = thickness;
190  };
191  void setLegend (const unsigned int curveNum, const char *legend);
192  void setTitle (const char *title);
193  void setUnitX (const char *unitx);
194  void setUnitY (const char *unity);
195  void setUnitZ (const char *unitz);
196 };
197 
198 #endif
199 #endif
200 #endif
201 
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
Generic class defining intrinsic camera parameters.
Defines a rectangle in the plane.
Definition: vpRect.h:82
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:92