Tulip  5.1.0
Large graphs analysis and drawing
GlQuad.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 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef _GLQUAD_H
22 #define _GLQUAD_H
23 
24 #include <tulip/Coord.h>
25 #include <tulip/Color.h>
26 
27 #include <tulip/GlPolygon.h>
28 
29 namespace tlp {
30 /**
31  * @ingroup OpenGL
32  * \brief Utility class to render a quadrilateral .
33  *
34  * This is an utility class class for rendering a quadrilateral.
35  */
36 class TLP_GL_SCOPE GlQuad : public GlPolygon {
37 
38 public:
39 
40  /**
41  * Constructor
42  */
43  GlQuad();
44 
45 
46  /**
47  * Constructor
48  *
49  * Initializes a quadrilateral with 4 points winding in clockwise order and a single color.
50  *
51  * \param p1 the first quad vertex
52  * \param p2 the second quad vertex
53  * \param p3 the third quad vertex
54  * \param p4 the fourth quad vertex
55  * \param color A single color indicating the color for every point of the quadrilateral.
56  */
57  GlQuad(const Coord &p1, const Coord &p2, const Coord &p3, const Coord &p4,
58  const Color &color);
59 
60  /* Constructor
61  *
62  * Initializes a quadrilateral with 4 points winding in clockwise order and a color attached to each point.
63  *
64  * \param p1 the first quad vertex
65  * \param p2 the second quad vertex
66  * \param p3 the third quad vertex
67  * \param p4 the fourth quad vertex
68  * \param c1 the color of the first quad vertex
69  * \param c2 the color of the second quad vertex
70  * \param c3 the color of the third quad vertex
71  * \param c4 the color of the fourth quad vertex
72  */
73  GlQuad(const Coord &p1, const Coord &p2, const Coord &p3, const Coord &p4,
74  const Color &c1, const Color &c2, const Color &c3, const Color &c4);
75 
76  /**
77  * Destructor
78  */
79  virtual ~GlQuad();
80 
81  /**
82  * Accessor in writing to the position.
83  * \param idPosition Indicates which point we want to move.
84  */
85  void setPosition(const int idPosition, const Coord &position);
86 
87  /**
88  * Accessor in writing to the color.
89  * \param idColor Indicates which point we want to colorize.
90  */
91  void setColor(const int idColor, const Color &color);
92 
93  /**
94  * Accessor in writing to the basic color of GlAugmentedDisplay
95  */
96  void setColor(const Color& color);
97 
98  /**
99  * Accessor in reading to the position.
100  * \param idPosition Indicates which point we want to get the position.
101  */
102  const Coord& getPosition(const int idPosition) const;
103 
104  /**
105  * Accessor in reading to the color.
106  * \param idColor Indicates which point we want to get the color.
107  */
108  const Color& getColor(const int idColor) const;
109 
110  /**
111  * Function to export data in outString (in XML format)
112  */
113  virtual void getXML(std::string &outString);
114 
115  /**
116  * Function to set data with inString (in XML format)
117  */
118  virtual void setWithXML(const std::string &inString, unsigned int &currentPosition);
119 
120 
121 };
122 
123 }
124 #endif
125 ///@endcond