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