regularpolygon.h

00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation version 2.1.                *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Lesser General Public      *
00015  *   License along with this library; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA              *
00018  ***************************************************************************/
00019 #ifndef PAPYRUSREGULARPOLYGON_H
00020 #define PAPYRUSREGULARPOLYGON_H
00021 
00022 #include <papyrus/polygon.h>
00023 
00066 namespace Papyrus {
00067 
00071 class RegularPolygon : public Polygon
00072 {
00073 public:
00074   typedef PapyrusSmartPointer<RegularPolygon> pointer;
00075 
00076   typedef enum Style {ZERO_RADIUS, ZERO_APOTHEM};
00077 
00078     RegularPolygon(unsigned int sides=3, double radius=1.0, Style style=ZERO_RADIUS);
00079 
00080   static RegularPolygon::pointer create(unsigned int sides=3, double radius=1.0, Style style=ZERO_RADIUS );
00081 
00082     ~RegularPolygon();
00083 
00084     unsigned int sides();
00085 
00086     void set_sides(unsigned int s);
00087 
00088     double radius();
00089     void set_radius(double r);
00090     void set_sides_radius(unsigned int s, double r);
00091 
00092     double edge_length();
00093     void set_edge_length(double e);
00094     void set_sides_edge_length(unsigned int s, double e);
00095 
00096     double apothem_length();
00097     void set_apothem_length(double a);
00098     void set_sides_apothem_length(unsigned int s, double a);
00099 
00100     Style style();
00101     void set_style(Style);
00102 
00104    sigc::signal<void> signal_sides();
00105 
00107    sigc::signal<void> signal_size();
00108 
00110    sigc::signal<void> signal_style();
00111 
00112    PAPYRUS_CLASS_NAME("Regular Polygon");
00113 
00114    PAPYRUS_CLONE_METHOD( RegularPolygon );
00115 
00116         protected:
00117     unsigned int m_sides;
00118     double m_radius;
00119     Style m_style;
00120 
00121     void create_vertices();
00122 
00123     sigc::signal<void> m_signal_sides;
00124 
00125     sigc::signal<void> m_signal_size;
00126 
00127     sigc::signal<void> m_signal_style;
00128 
00129 };
00130 
00131 }
00132 
00133 #endif

Generated on Sun Mar 11 10:01:28 2007 by  doxygen 1.5.1