Tulip  4.7.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlRect.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 
21 #ifndef GL_RECT_H
22 #define GL_RECT_H
23 
24 #include <tulip/GlPolygon.h>
25 #include <tulip/Size.h>
26 
27 namespace tlp {
28 
29 /**
30  * @ingroup OpenGL
31  * \brief This is a general class for the rendering of 2D rectangles.
32  *
33  * This class is used as a 2D HUD for the rendering of 2D rectangles.
34  */
35 
36 class TLP_GL_SCOPE GlRect : public GlPolygon {
37 protected:
38 
39 public:
40  /**
41  * Constructor : with topLeft/bottomRight coords, topLeft/bottomRight colors and if GlRect is filled/outlined
42  */
43  GlRect(const Coord &topLeftPos, const Coord &bottomRightPos, const Color &topLeftCol, const Color &bottomRightCol, bool filled=true, bool outlined=false);
44 
45  /**
46  * Constructor : with center coords and size, fill color and outline color
47  */
48  GlRect(const Coord &center, const float width, const float height, const Color &fillColor, const Color &outlineColor);
49 
50 
51  /**
52  * Constructor : with GlRect is filled/outlined
53  */
54  GlRect(bool filled=true, bool outlined=false);
55 
56  /**
57  * Destructor
58  */
59  virtual ~GlRect();
60 
61  /**
62  * Accessor in reading to the Top Left Corner of the rectangle
63  */
64  virtual Coord getCenter();
65 
66  /**
67  * Set the center and the size of the GlRect
68  */
69  void setCenterAndSize(const Coord &center, const Size &size);
70 
71  /**
72  * Accessor in reading to the Top Left Corner of the rectangle
73  */
74  virtual Coord getTopLeftPos();
75 
76  /**
77  * Accessor in reading to the Bottom Right Corner of the rectangle
78  */
79  virtual Coord getBottomRightPos();
80 
81  /**
82  * Accessor in reading to the Top Left Corner Color of the rectangle
83  */
84  virtual Color getTopLeftColor();
85 
86  /**
87  * Accessor in reading to the Bottom Right Corner Color of the Rectangle
88  */
89  virtual Color getBottomRightColor();
90 
91  /**
92  * Accessor in writing to the Top Left Corner of the rectangle
93  */
94  virtual void setTopLeftPos(const Coord &topLeftPos);
95 
96  /**
97  * Accessor in writing to the Bottom Right Corner Color of the rectangle
98  */
99  virtual void setBottomRightPos(const Coord &bottomRightPos);
100 
101  /**
102  * Accessor in writing to the Top Left Corner of the rectangle
103  */
104  virtual void setTopLeftColor(const Color &topLeftCol);
105 
106  /**
107  * Accessor in writing to the Bottom Right Corner Color of the rectangle
108  */
109  virtual void setBottomRightColor(const Color &bottomRightCol);
110 
111  /**
112  * Is the point in the rectangle ?
113  */
114  bool inRect(double x, double y);
115 
116  virtual void draw(float lod,Camera *camera);
117 
118 };
119 
120 }
121 #endif
Tulip OpenGL camera object.
Definition: Camera.h:45
This is a general class for the rendering of 2D rectangles.
Definition: GlRect.h:36
Class to create a polygon GlEntity.
Definition: GlPolygon.h:37