regularpolygon.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PAPYRUSREGULARPOLYGON_H
00021 #define PAPYRUSREGULARPOLYGON_H
00022
00023 #include <papyrus/polygon.h>
00024
00067 namespace Papyrus
00068 {
00069
00073 class RegularPolygon : public Polygon
00074 {
00075 public:
00076 typedef enum Style {ZERO_RADIUS, ZERO_APOTHEM} Style;
00077
00078 protected:
00079
00080 RegularPolygon ( const Glib::ustring& id,
00081 unsigned int sides,
00082 double radius,
00083 Style style,
00084 Fill::pointer fill,
00085 Stroke::pointer stroke );
00086
00087 public:
00088 PAPYRUS_DRAWABLE(RegularPolygon);
00089
00090 static RegularPolygon::pointer create ( unsigned int sides=3,
00091 double radius=1.0,
00092 Style style=ZERO_RADIUS,
00093 Fill::pointer fill=Fill::pointer(),
00094 Stroke::pointer stroke = Stroke::pointer() );
00095
00096 static RegularPolygon::pointer create ( const Glib::ustring& id,
00097 unsigned int sides=3,
00098 double radius=1.0,
00099 Style style=ZERO_RADIUS,
00100 Fill::pointer fill=Fill::pointer(),
00101 Stroke::pointer stroke = Stroke::pointer() );
00102
00103 virtual ~RegularPolygon();
00104
00105 unsigned int sides();
00106
00107 void set_sides ( unsigned int s );
00108
00109 double radius();
00110 void set_radius ( double r );
00111 void set_sides_radius ( unsigned int s, double r );
00112
00113 double edge_length();
00114 void set_edge_length ( double e );
00115 void set_sides_edge_length ( unsigned int s, double e );
00116
00117 double apothem_length();
00118 void set_apothem_length ( double a );
00119 void set_sides_apothem_length ( unsigned int s, double a );
00120
00121 Style style();
00122 void set_style ( Style );
00123
00125 sigc::signal<void> signal_sides();
00126
00128 sigc::signal<void> signal_size();
00129
00131 sigc::signal<void> signal_style();
00132
00133 protected:
00134 unsigned int m_sides;
00135 double m_radius;
00136 Style m_style;
00137
00138 void create_vertices();
00139
00140 sigc::signal<void> m_signal_sides;
00141
00142 sigc::signal<void> m_signal_size;
00143
00144 sigc::signal<void> m_signal_style;
00145
00146 };
00147
00148 }
00149
00150 #endif