Tulip  5.0.0
Large graphs analysis and drawing
Gl2DRect.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
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_GL2DRECT_H
21 #define Tulip_GL2DRECT_H
22 
23 #include <string>
24 
25 #include <tulip/GlRect.h>
26 
27 namespace tlp {
28 /**
29  * @ingroup OpenGL
30  *
31  * @brief Create a 2D rectangle
32  *
33  * This rect add screen percentage system (for example you can create a rectangle that start on (10%,10%) and finish on (90%90%)
34  * If you whan a simple 2D rectangle with normal coordinates use GlRect class
35  * @see GlRect
36  */
37 class TLP_GL_SCOPE Gl2DRect : public GlRect {
38 
39 public:
40  /**
41  * @brief Don't use this constructor
42  */
43  Gl2DRect();
44 
45  /**
46  * @brief Constructor
47  *
48  * @param top coordinate
49  * @param bottom coordinate
50  * @param left coordinate
51  * @param right coordinate
52  * @param textureName path to a texture
53  * @param inPercent if true : top/bottom/left/right is used as in percent parameters
54  */
55  Gl2DRect(float top,float bottom,float left, float right,
56  const std::string& textureName,
57  bool inPercent=false);
58 
59  /**
60  * @brief Constructor
61  *
62  * @param top coordinate
63  * @param bottom coordinate
64  * @param left coordinate
65  * @param right coordinate
66  * @param textureName path to a texture
67  * @param xInv if true : use viewportX - left and viewportX - right
68  * @param yInv if true : use viewportY - top and viewportY - bottom
69  */
70  Gl2DRect(float bottom,float left,float height, float width,
71  const std::string& textureName,
72  bool xInv, bool yInv);
73 
74  /**
75  * @brief Destructor
76  */
77  virtual ~Gl2DRect() {}
78 
79  virtual BoundingBox getBoundingBox();
80 
81  virtual void draw(float lod,Camera *camera);
82 
83  virtual void translate(const Coord& mouvement);
84 
85  /**
86  * @brief Set texture
87  */
88  virtual void setTexture(const std::string &name);
89 
90  /**
91  * @brief Get texture
92  */
93  virtual std::string getTexture();
94 
95  /**
96  * @brief Set coordinates of rectangle
97  */
98  virtual void setCoordinates(float bottom, float left, float width, float height);
99 
100  virtual void getXML(std::string &outString);
101 
102  virtual void setWithXML(const std::string &inString, unsigned int &currentPosition);
103 
104 protected:
105 
106  float top;
107  float bottom;
108  float left;
109  float right;
110  bool inPercent;
111  bool xInv;
112  bool yInv;
113 
114 };
115 
116 }
117 #endif
Create a 2D rectangle.
Definition: Gl2DRect.h:37
This class represents the 3D bounding box of an object. It is mostly used to determine whether or not...
Definition: BoundingBox.h:63
Tulip OpenGL camera object.
Definition: Camera.h:45
This is a general class for the rendering of 2D rectangles.
Definition: GlRect.h:36
virtual ~Gl2DRect()
Destructor.
Definition: Gl2DRect.h:77