Tulip  5.1.0
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  /**
39  * @brief Don't use this constructor
40  */
41  GlBox();
42 
43  /**
44  * @brief Constructor
45  *
46  * @param position The center of the box.
47  * @param size The length of each dimension of the box.
48  * @param fillColor The fill color of the box.
49  * @param outlineColor The outline color of the box
50  * @param filled Fill the box ?
51  * @param outlined outline the box ?
52  * @param outlineSize The size of the outline
53  */
54  GlBox(const Coord& position, const Size &size, const Color& fillColor, const Color &outlineColor,bool filled=true, bool outlined=true, const std::string &textureName="",float outlineSize=1.);
55 
56  /**
57  * @brief Destructor.
58  */
59  virtual ~GlBox();
60 
61  virtual void draw(float lod,Camera *camera);
62 
63  /**
64  * @brief Accessor in reading to the size.
65  */
66  Size getSize() const;
67 
68  /**
69  * @brief Accessor in writing to the size of the box
70  */
71  void setSize(const Size& size);
72 
73  /**
74  * @brief Accessor in reading to the position.
75  */
76  Coord* getPosition() const;
77 
78  /**
79  * @brief Accessor in writing to the position.
80  */
81  void setPosition(const Coord& position);
82 
83  /**
84  * @brief Accessor in reading to the fill color.
85  */
86  Color getFillColor() const;
87 
88  /**
89  * @brief Accessor in writing to the fill color of the box
90  */
91  void setFillColor(const Color& color);
92 
93  /**
94  * @brief Accessor in reading to the outline color.
95  */
96  Color getOutlineColor() const;
97 
98  /**
99  * @brief Accessor in writing to the outline color of the box
100  */
101  void setOutlineColor(const Color& color);
102 
103  /**
104  * @brief Accessor in reading to the outline size.
105  */
106  float getOutlineSize() const;
107 
108  /**
109  * @brief Accessor in writing to the outline size of the box
110  */
111  void setOutlineSize(float size);
112 
113  /**
114  * @brief Accessor in reading to the texture name.
115  */
116  std::string getTextureName() const;
117 
118  /**
119  * @brief Accessor in writing to the texture name of the box
120  */
121  void setTextureName(const std::string& textureName);
122 
123  /**
124  * @brief Translate entity
125  */
126  virtual void translate(const Coord& mouvement);
127 
128  /**
129  * @brief Function to export data in outString (in XML format)
130  */
131  virtual void getXML(std::string &outString);
132 
133  /**
134  * @brief Function to set data with inString (in XML format)
135  */
136  virtual void setWithXML(const std::string &inString, unsigned int &currentPosition);
137 
138 protected:
139 
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 
156 }
157 #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:45
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