Tulip  5.2.0
Large graphs analysis and drawing
GlRegularPolygon.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 
20 #ifndef GLREGULARPOLYGON_H
21 #define GLREGULARPOLYGON_H
22 
23 #include <tulip/GlPolygon.h>
24 #include <tulip/Size.h>
25 
26 namespace tlp {
27 
28 /**
29  * @ingroup OpenGL
30  * @brief class to create a regular polygon
31  */
32 class TLP_GL_SCOPE GlRegularPolygon : public GlPolygon {
33 public:
34  /**
35  * @brief Constructor
36  *
37  * The outline is the border of the regular polygon
38  *
39  * The fill is inside the regular polygon
40  */
41  GlRegularPolygon(const Coord &position, const Size &size, unsigned int numberOfSides,
42  const Color &outlineColor = Color(255, 0, 0, 255),
43  const Color &fillColor = Color(0, 0, 255, 255), bool filled = true,
44  bool outlined = true, const std::string &textureName = "",
45  float outlineSize = 1.);
46  /**
47  * @brief Destructor
48  */
49  ~GlRegularPolygon() override;
50 
51  /**
52  * @brief Set the start angle in radian
53  *
54  * If the start angle is 0 : the regular polygon begin at the top middle point
55  */
56  void setStartAngle(float angle);
57 
58  /**
59  * @brief Get the number of Sides
60  */
61  unsigned int getNumberOfSides();
62 
63  /**
64  * @brief Set the number of sides (use setNumberOfSides)
65  */
66  void resizePoints(const unsigned int number) override;
67 
68  /**
69  * @brief Set the number of sides
70  */
71  void setNumberOfSides(unsigned int number);
72 
73 protected:
74  void computePolygon();
75 
76  Coord position;
77  Size size;
78  unsigned int numberOfSides;
79  float startAngle;
80 };
81 }
82 #endif
class to create a regular polygon
Class to create a polygon GlEntity.
Definition: GlPolygon.h:36