arc.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 PAPYRUSARC_H
00020 #define PAPYRUSARC_H
00021 
00022 #include <cmath>
00023 
00024 #include <papyrus/shape.h>
00025 
00043 namespace Papyrus
00044 {
00045 
00054   class Arc : public Shape
00055   {
00056     protected:
00057 
00058       Arc( double radius,
00059            double angle_start,
00060            double angle_end,
00061            Cairo::RefPtr<Cairo::Pattern> fill
00062          );
00063 
00064       Arc( double radius,
00065            double angle_start,
00066            double angle_end,
00067            Cairo::RefPtr<Cairo::Pattern> fill,
00068            const LineStyle& outline
00069          );
00070 
00071     public:
00072       typedef PapyrusSmartPointer<Arc> pointer;
00073 
00075       static Arc::pointer create( double radius = 1.0,
00076                                   double angle_start = 0.0,
00077                                   double angle_end = M_PI / 2.0,
00078                                   Cairo::RefPtr<Cairo::Pattern> fill = Cairo::RefPtr<Cairo::Pattern>()
00079                                 );
00080 
00082       static Arc::pointer create( double radius,
00083                                   double angle_start,
00084                                   double angle_end,
00085                                   Cairo::RefPtr<Cairo::Pattern> fill,
00086                                   const LineStyle& outline
00087                                 );
00088 
00090       ~Arc();
00091 
00093       double radius();
00094 
00096       void set_radius( double r );
00097 
00099       double start_angle();
00100 
00102       double end_angle();
00103 
00105       void set_angles( double start, double end );
00106 
00108       virtual void draw_shape( Cairo::RefPtr<Cairo::Context> cairo );
00109 
00114       virtual void draw_outline( Cairo::RefPtr<Cairo::Context> cairo );
00115 
00117       sigc::signal<void> signal_radius();
00118 
00120       sigc::signal<void> signal_angle();
00121 
00122       PAPYRUS_CLASS_NAME("Arc");
00123 
00124       PAPYRUS_CLONE_METHOD( Arc );
00125 
00126     protected:
00127 
00129       double m_radius;
00130 
00131       double m_angle_start;
00132 
00133       double m_angle_end;
00134 
00139       virtual void need_redraw();
00140 
00141       void calculate_extents();
00142 
00144       sigc::signal<void> m_signal_radius;
00145 
00147       sigc::signal<void> m_signal_angle;
00148 
00149   };
00150 
00151 }
00152 
00153 #endif

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