Tulip  4.4.0
Better Visualization Through Research
 All Classes Namespaces 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 <tulip/Coord.h>
25 #include <tulip/Color.h>
26 #include <tulip/Size.h>
27 
28 #include <tulip/GlSimpleEntity.h>
29 
30 namespace tlp {
31 /**
32  * @ingroup OpenGL
33  * @brief General class used to render grids as GlSimpleEntity.
34  *
35  */
36 class TLP_GL_SCOPE GlGrid : public GlSimpleEntity {
37 
38 public:
39 
40  /**
41  * @brief Constructor
42  * @warning Don't use this constructor : see other constructor
43  */
44  GlGrid() {}
45 
46  /**
47  * @brief Constructor
48  *
49  * @param frontTopLeft The minimum of the bounding box of the grid.
50  * @param backBottomRight The maximum of the bounding box of the grid.
51  * @param cell The size of a single cell of the grid.
52  * @param color The color of the lines of the grid.
53  * @param displays The dimensions of the grid to display.
54  * @param hollowGrid Indicates if the grid chould be hollowed.
55  */
56  GlGrid(const Coord& frontTopLeft, const Coord& backBottomRight,
57  const Size& cell, const Color& color, bool displays[3]);
58  /**
59  * @brief Virtual function used to draw the grid.
60  */
61  virtual void draw(float lod,Camera *camera);
62  /**
63  * @brief Accessor in reading to the dimensions to display.
64  */
65  void getDisplayDim(bool displayDim[3]) const;
66  /**
67  * @brief Accessor in writing to the dimensions to display.
68  */
69  void setDisplayDim(bool displayDim[3]);
70 
71  /**
72  * @brief Translate entity
73  */
74  virtual void translate(const Coord& mouvement);
75 
76  /**
77  * @brief Function to export data in outString (in XML format)
78  */
79  virtual void getXML(std::string &outString);
80 
81  /**
82  * @brief Function to set data with inString (in XML format)
83  */
84  virtual void setWithXML(const std::string &inString, unsigned int &currentPosition);
85 
86 
87 protected:
88  bool displayDim[3]; /**< Which dimensions should be displayed ? Note that only one dimension at most should be disabled*/
89  bool hollowGrid; /**< Should the grid be hollowed ?*/
90  Coord frontTopLeft; /**< Front top left point of the grid, the "minimum" */
91  Coord backBottomRight; /**< Back bottom right point of the grid, the "maximum" */
92  Color color; /**< The color of the grid */
93  Size cell; /**< The size of a cell of the grid */
94 };
95 
96 }
97 #endif