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