Tulip  5.7.4
Large graphs analysis and drawing
GlGrid.h
1 /*
2  *
3  * This file is part of Tulip (https://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
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 #ifndef _Tulip_GLGRID_H_
21 #define _Tulip_GLGRID_H_
22 
23 #include <tulip/Coord.h>
24 #include <tulip/Color.h>
25 #include <tulip/Size.h>
26 
27 #include <tulip/GlSimpleEntity.h>
28 
29 namespace tlp {
30 /**
31  * @ingroup OpenGL
32  * @brief General class used to render grids as GlSimpleEntity.
33  *
34  */
35 class TLP_GL_SCOPE GlGrid : public GlSimpleEntity {
36 
37 public:
38  /**
39  * @brief Constructor
40  * @warning Don't use this constructor : see other constructor
41  */
42  GlGrid() {}
43 
44  /**
45  * @brief Constructor
46  *
47  * @param frontTopLeft The minimum of the bounding box of the grid.
48  * @param backBottomRight The maximum of the bounding box of the grid.
49  * @param cell The size of a single cell of the grid.
50  * @param color The color of the lines of the grid.
51  * @param displays The dimensions of the grid to display.
52  * @param hollowGrid Indicates if the grid should be hollowed.
53  */
54  GlGrid(const Coord &frontTopLeft, const Coord &backBottomRight, const Size &cell,
55  const Color &color, bool displays[3]);
56  /**
57  * @brief Virtual function used to draw the grid.
58  */
59  void draw(float lod, Camera *camera) override;
60  /**
61  * @brief Accessor in reading to the dimensions to display.
62  */
63  void getDisplayDim(bool displayDim[3]) const;
64  /**
65  * @brief Accessor in writing to the dimensions to display.
66  */
67  void setDisplayDim(bool displayDim[3]);
68 
69  /**
70  * @brief Translate entity
71  */
72  void translate(const Coord &mouvement) override;
73 
74  /**
75  * @brief Function to export data in outString (in XML format)
76  */
77  void getXML(std::string &outString) override;
78 
79  /**
80  * @brief Function to set data with inString (in XML format)
81  */
82  void setWithXML(const std::string &inString, unsigned int &currentPosition) override;
83 
84 protected:
85  bool displayDim[3]; /**< Which dimensions should be displayed ? Note that only one dimension at
86  most should be disabled*/
87  bool hollowGrid; /**< Should the grid be hollowed ?*/
88  Coord frontTopLeft; /**< Front top left point of the grid, the "minimum" */
89  Coord backBottomRight; /**< Back bottom right point of the grid, the "maximum" */
90  Color color; /**< The color of the grid */
91  Size cell; /**< The size of a cell of the grid */
92 };
93 } // namespace tlp
94 #endif
Tulip OpenGL camera object.
Definition: Camera.h:47
General class used to render grids as GlSimpleEntity.
Definition: GlGrid.h:35
GlGrid()
Constructor.
Definition: GlGrid.h:42
void draw(float lod, Camera *camera) override
Virtual function used to draw the grid.
GlGrid(const Coord &frontTopLeft, const Coord &backBottomRight, const Size &cell, const Color &color, bool displays[3])
Constructor.
Coord backBottomRight
Definition: GlGrid.h:89
void setWithXML(const std::string &inString, unsigned int &currentPosition) override
Function to set data with inString (in XML format)
void setDisplayDim(bool displayDim[3])
Accessor in writing to the dimensions to display.
bool hollowGrid
Definition: GlGrid.h:87
Color color
Definition: GlGrid.h:90
Size cell
Definition: GlGrid.h:91
Coord frontTopLeft
Definition: GlGrid.h:88
void translate(const Coord &mouvement) override
Translate entity.
void getXML(std::string &outString) override
Function to export data in outString (in XML format)
void getDisplayDim(bool displayDim[3]) const
Accessor in reading to the dimensions to display.
Base class for all Tulip OpenGL entities.