Tulip  4.4.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlRegularPolygon.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 #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,
42  const Size &size,
43  unsigned int numberOfSides,
44  const Color &outlineColor = Color(255, 0 , 0 , 255),
45  const Color &fillColor = Color (0, 0, 255,255),
46  bool filled = true,
47  bool outlined =true,
48  const std::string &textureName="",
49  float outlineSize=1.);
50  /**
51  * @brief Destructor
52  */
53  virtual ~GlRegularPolygon();
54 
55  /**
56  * @brief Set the start angle in degree
57  *
58  * If the start angle is 0 : the regular polygon begin at the top middle point
59  */
60  void setStartAngle(float angle);
61 
62  /**
63  * @brief Get the number of Sides
64  */
65  unsigned int getNumberOfSides();
66 
67  /**
68  * @brief Set the number of sides (use setNumberOfSides)
69  */
70  void resizePoints(const unsigned int number);
71 
72  /**
73  * @brief Set the number of sides
74  */
75  void setNumberOfSides(unsigned int number);
76 
77 protected :
78 
79  void computePolygon();
80 
81 
82  Coord position;
83  Size size;
84  unsigned int numberOfSides;
85  float startAngle;
86 
87 };
88 
89 }
90 #endif