Tulip  5.2.1
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  * Constructor
41  */
42  GlQuad();
43 
44  /**
45  * Constructor
46  *
47  * Initializes a quadrilateral with 4 points winding in clockwise order and a single color.
48  *
49  * \param p1 the first quad vertex
50  * \param p2 the second quad vertex
51  * \param p3 the third quad vertex
52  * \param p4 the fourth quad vertex
53  * \param color A single color indicating the color for every point of the quadrilateral.
54  */
55  GlQuad(const Coord &p1, const Coord &p2, const Coord &p3, const Coord &p4, const Color &color);
56 
57  /* Constructor
58  *
59  * Initializes a quadrilateral with 4 points winding in clockwise order and a color attached to
60  * each point.
61  *
62  * \param p1 the first quad vertex
63  * \param p2 the second quad vertex
64  * \param p3 the third quad vertex
65  * \param p4 the fourth quad vertex
66  * \param c1 the color of the first quad vertex
67  * \param c2 the color of the second quad vertex
68  * \param c3 the color of the third quad vertex
69  * \param c4 the color of the fourth quad vertex
70  */
71  GlQuad(const Coord &p1, const Coord &p2, const Coord &p3, const Coord &p4, const Color &c1,
72  const Color &c2, const Color &c3, const Color &c4);
73 
74  /**
75  * Destructor
76  */
77  ~GlQuad() override;
78 
79  /**
80  * Accessor in writing to the position.
81  * \param idPosition Indicates which point we want to move.
82  */
83  void setPosition(const int idPosition, const Coord &position);
84 
85  /**
86  * Accessor in writing to the color.
87  * \param idColor Indicates which point we want to colorize.
88  */
89  void setColor(const int idColor, const Color &color);
90 
91  /**
92  * Accessor in writing to the basic color of GlAugmentedDisplay
93  */
94  void setColor(const Color &color);
95 
96  /**
97  * Accessor in reading to the position.
98  * \param idPosition Indicates which point we want to get the position.
99  */
100  const Coord &getPosition(const int idPosition) const;
101 
102  /**
103  * Accessor in reading to the color.
104  * \param idColor Indicates which point we want to get the color.
105  */
106  const Color &getColor(const int idColor) const;
107 
108  /**
109  * Function to export data in outString (in XML format)
110  */
111  void getXML(std::string &outString) override;
112 
113  /**
114  * Function to set data with inString (in XML format)
115  */
116  void setWithXML(const std::string &inString, unsigned int &currentPosition) override;
117 };
118 } // namespace tlp
119 #endif
120 ///@endcond