Tulip  4.1.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlGrid.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 
20 
21 #ifndef _Tulip_GLGRID_H_
22 #define _Tulip_GLGRID_H_
23 
24 #include <vector>
25 
26 #include <tulip/Coord.h>
27 #include <tulip/Color.h>
28 #include <tulip/Size.h>
29 
30 #include <tulip/GlSimpleEntity.h>
31 
32 namespace tlp {
33 /**
34  * @ingroup OpenGL
35  * @brief General class used to render grids as GlSimpleEntity.
36  *
37  */
38 class TLP_GL_SCOPE GlGrid : public GlSimpleEntity {
39 
40 public:
41 
42  /**
43  * @brief Constructor
44  * @warning Don't use this constructor : see other constructor
45  */
46  GlGrid() {}
47 
48  /**
49  * @brief Constructor
50  *
51  * @param frontTopLeft The minimum of the bounding box of the grid.
52  * @param backBottomRight The maximum of the bounding box of the grid.
53  * @param cell The size of a single cell of the grid.
54  * @param color The color of the lines of the grid.
55  * @param displays The dimensions of the grid to display.
56  * @param hollowGrid Indicates if the grid chould be hollowed.
57  */
58  GlGrid(const Coord& frontTopLeft, const Coord& backBottomRight,
59  const Size& cell, const Color& color, bool displays[3]);
60  /**
61  * @brief Virtual function used to draw the grid.
62  */
63  virtual void draw(float lod,Camera *camera);
64  /**
65  * @brief Accessor in reading to the dimensions to display.
66  */
67  void getDisplayDim(bool displayDim[3]) const;
68  /**
69  * @brief Accessor in writing to the dimensions to display.
70  */
71  void setDisplayDim(bool displayDim[3]);
72 
73  /**
74  * @brief Translate entity
75  */
76  virtual void translate(const Coord& mouvement);
77 
78  /**
79  * @brief Function to export data in outString (in XML format)
80  */
81  virtual void getXML(std::string &outString);
82 
83  /**
84  * @brief Function to set data with inString (in XML format)
85  */
86  virtual void setWithXML(const std::string &inString, unsigned int &currentPosition);
87 
88 
89 protected:
90  bool displayDim[3]; /**< Which dimensions should be displayed ? Note that only one dimension at most should be disabled*/
91  bool hollowGrid; /**< Should the grid be hollowed ?*/
92  Coord frontTopLeft; /**< Front top left point of the grid, the "minimum" */
93  Coord backBottomRight; /**< Back bottom right point of the grid, the "maximum" */
94  Color color; /**< The color of the grid */
95  Size cell; /**< The size of a cell of the grid */
96 };
97 
98 }
99 #endif