ViSP  2.9.0
vpPlotGraph.h
1 
2 /****************************************************************************
3  *
4  * $Id: vpPlotGraph.h 4574 2014-01-09 08:48:51Z fspindle $
5  *
6  * This file is part of the ViSP software.
7  * Copyright (C) 2005 - 2014 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 scaleInitialized;
83  bool firstPoint;
84 
85  int nbDivisionx;
86  int nbDivisiony;
87 
88  //Graph complet
89  vpImagePoint topLeft;
90  unsigned int width;
91  unsigned int height;
92  vpRect graphZone;
93 
94  //Zone d'affichage
95  vpImagePoint dTopLeft;
96  unsigned int dWidth;
97  unsigned int dHeight;
98  vpRect dGraphZone;
99 
100  //Zone d'affichage
101  vpImagePoint dTopLeft3D;
102 // int dWidth;
103 // int dHeight;
104  vpRect dGraphZone3D;
105 
106  //3D part
107  vpCameraParameters cam;
110  double w_xval;
111  double w_xsize;
112  double w_yval;
113  double w_ysize;
114  double w_zval;
115  double w_zsize;
116  double ptXorg;
117  double ptYorg;
118  double ptZorg;
119  double zoomx_3D;
120  double zoomy_3D;
121  double zoomz_3D;
122 
123  int nbDivisionz;
124 
125  double zorg;
126  double zoomz;
127  double zmax;
128  double zmin;
129  double zdelt;
130  char unitz[256];
131  vpImagePoint old_iPr;
132  vpImagePoint old_iPz;
133  bool blockedr;
134  bool blockedz;
135  bool blocked;
136 
137  unsigned int epsi;
138  unsigned int epsj;
139 
140  bool dispUnit;
141  bool dispTitle;
142  bool dispLegend;
143 
144  unsigned int gridThickness;
145 
146  public:
147  vpPlotGraph();
148  ~vpPlotGraph();
149 
150  bool check3Dline(vpImagePoint &iP1, vpImagePoint &iP2);
151  bool check3Dpoint(vpImagePoint &iP);
152  void clearGraphZone(vpImage<unsigned char> &I);
153  void computeGraphParameters();
154  void computeGraphParameters3D();
155 
156  void initGraph (unsigned int nbCurve);
157  void initSize (vpImagePoint topLeft, unsigned int width, unsigned int height, unsigned int margei, unsigned int margej);
158  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);
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 double zmin, const double zmax, const int nbDivz, const bool gx, const bool gy);
160 
161  void displayGrid (vpImage<unsigned char> &I);
162  void displayUnit (vpImage<unsigned char> &I);
163  void displayTitle (vpImage<unsigned char> &I);
164  void displayLegend (vpImage<unsigned char> &I);
165  void displayGrid3D (vpImage<unsigned char> &I);
166 
167  void findPose();
168 
169  bool getPixelValue(vpImage<unsigned char> &I, vpImagePoint &iP);
170 
171  bool move(const vpImage<unsigned char> &I);
172  vpHomogeneousMatrix navigation(const vpImage<unsigned char> &I, bool &changed);
173 
174  void plot (vpImage<unsigned char> &I, const unsigned int curveNb, const double x, const double y);
175  void plot (vpImage<unsigned char> &I, const unsigned int curveNb, const double x, const double y, const double z);
176  void replot (vpImage<unsigned char> &I);
177  void replot3D (vpImage<unsigned char> &I);
178 
179  void rescalex(unsigned int side, double extremity);
180  void rescaley(unsigned int side, double extremity);
181  void rescalez(unsigned int side, double extremity);
182  //void rescale(double &min, double &max, double &delta, const int nbDiv, int side);
183  void resetPointList(const unsigned int curveNum);
184 
185  void setCurveColor(const unsigned int curveNum, const vpColor color);
186  void setCurveThickness(const unsigned int curveNum, const unsigned int thickness);
187  void setGridThickness (const unsigned int thickness) {
188  this->gridThickness = thickness;
189  };
190  void setLegend (const unsigned int curveNum, const char *legend);
191  void setTitle (const char *title);
192  void setUnitX (const char *unitx);
193  void setUnitY (const char *unity);
194  void setUnitZ (const char *unitz);
195 };
196 
197 #endif
198 #endif
199 #endif
200 
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:85
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:92