papyrus logo

regularpolygon.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the papyrus library.                             *
00006  *                                                                         *
00007  *   papyrus is free software; you can redistribute it and/or modify       *
00008  *   it under the terms of the GNU Lesser General Public License           *
00009  *   version 3.0 as published by the Free Software Foundation.             *
00010  *                                                                         *
00011  *   papyrus is distributed in the hope that it will be useful,            *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Lesser General Public License version 3.0 for more details.       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with the papyrus library. If not, see                   *
00018  *   <http://www.gnu.org/licenses/>.                                       *
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

Generated on Fri Apr 16 12:40:11 2010 for papyrus by doxygen 1.6.1