Tulip  5.2.1
Large graphs analysis and drawing
GlBox.h
1 /*
2  *
3  * This file is part of Tulip (http://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_GLBOX_H
21 #define Tulip_GLBOX_H
22 
23 #include <tulip/OpenGlIncludes.h>
24 
25 #include <tulip/Color.h>
26 #include <tulip/Size.h>
27 #include <tulip/GlSimpleEntity.h>
28 
29 namespace tlp {
30 /**
31  * @ingroup OpenGL
32  * @brief General class used to render boxes as GlSimpleEntity.
33  */
34 class TLP_GL_SCOPE GlBox : public GlSimpleEntity {
35 
36 public:
37  /**
38  * @brief Don't use this constructor
39  */
40  GlBox();
41 
42  /**
43  * @brief Constructor
44  *
45  * @param position The center of the box.
46  * @param size The length of each dimension of the box.
47  * @param fillColor The fill color of the box.
48  * @param outlineColor The outline color of the box
49  * @param filled Fill the box ?
50  * @param outlined outline the box ?
51  * @param outlineSize The size of the outline
52  */
53  GlBox(const Coord &position, const Size &size, const Color &fillColor, const Color &outlineColor,
54  bool filled = true, bool outlined = true, const std::string &textureName = "",
55  float outlineSize = 1.);
56 
57  /**
58  * @brief Destructor.
59  */
60  ~GlBox() override;
61 
62  void draw(float lod, Camera *camera) override;
63 
64  /**
65  * @brief Accessor in reading to the size.
66  */
67  Size getSize() const;
68 
69  /**
70  * @brief Accessor in writing to the size of the box
71  */
72  void setSize(const Size &size);
73 
74  /**
75  * @brief Accessor in reading to the position.
76  */
77  Coord *getPosition() const;
78 
79  /**
80  * @brief Accessor in writing to the position.
81  */
82  void setPosition(const Coord &position);
83 
84  /**
85  * @brief Accessor in reading to the fill color.
86  */
87  Color getFillColor() const;
88 
89  /**
90  * @brief Accessor in writing to the fill color of the box
91  */
92  void setFillColor(const Color &color);
93 
94  /**
95  * @brief Accessor in reading to the outline color.
96  */
97  Color getOutlineColor() const;
98 
99  /**
100  * @brief Accessor in writing to the outline color of the box
101  */
102  void setOutlineColor(const Color &color);
103 
104  /**
105  * @brief Accessor in reading to the outline size.
106  */
107  float getOutlineSize() const;
108 
109  /**
110  * @brief Accessor in writing to the outline size of the box
111  */
112  void setOutlineSize(float size);
113 
114  /**
115  * @brief Accessor in reading to the texture name.
116  */
117  std::string getTextureName() const;
118 
119  /**
120  * @brief Accessor in writing to the texture name of the box
121  */
122  void setTextureName(const std::string &textureName);
123 
124  /**
125  * @brief Translate entity
126  */
127  void translate(const Coord &mouvement) override;
128 
129  /**
130  * @brief Function to export data in outString (in XML format)
131  */
132  void getXML(std::string &outString) override;
133 
134  /**
135  * @brief Function to set data with inString (in XML format)
136  */
137  void setWithXML(const std::string &inString, unsigned int &currentPosition) override;
138 
139 protected:
140  virtual void clearGenerated();
141 
142  Coord position; /**< The position of the center of the box*/
143  Size size; /**< size is the "radius" of the box */
144  std::vector<Color> fillColors; /**< fillColor of the box */
145  std::vector<Color> outlineColors; /**< outlineColor of the box */
146  bool filled; /**< the box is filled ? */
147  bool outlined; /**< the box is outlined ? */
148  std::string textureName;
149  float outlineSize; /**< size of the ouline */
150 
151  float *newCubeCoordArrays;
152  bool generated;
153  GLuint buffers[5];
154 };
155 } // namespace tlp
156 #endif
General class used to render boxes as GlSimpleEntity.
Definition: GlBox.h:34
Base class for all Tulip OpenGL entities.
float outlineSize
Definition: GlBox.h:149
Size size
Definition: GlBox.h:143
std::vector< Color > outlineColors
Definition: GlBox.h:145
Tulip OpenGL camera object.
Definition: Camera.h:47
bool outlined
Definition: GlBox.h:147
Coord position
Definition: GlBox.h:142
std::vector< Color > fillColors
Definition: GlBox.h:144
bool filled
Definition: GlBox.h:146