papyrus logo

path.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007 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 PAPYRUSPATH_H
00021 #define PAPYRUSPATH_H
00022 
00023 #include <list>
00024 #include <map>
00025 #include <papyrus/shape.h>
00026 #include <papyrus/path_element.h>
00027 
00028 namespace Papyrus
00029 {
00030 
00031   /* Forward declaration for svg_transform_parser utility method */
00032   class Path;
00033 
00035   std::list<PathElement::pointer> path_data_parser( const char* src );
00036 
00040   class Path : public Shape
00041   {
00042     protected:
00043       Path ( const Glib::ustring& id, const char* path, Fill::pointer fill, Stroke::pointer stroke );
00044 
00045       Path( const AttributeValueMap& avmap );
00046 
00047     public:
00048       typedef PapyrusPointer<Path> pointer;
00049       typedef std::list<PathElement::pointer> Elements;
00050       typedef Elements::iterator iterator;
00051       typedef Elements::const_iterator const_iterator;
00052       typedef Elements::reverse_iterator reverse_iterator;
00053       typedef Elements::const_reverse_iterator const_reverse_iterator;
00054       typedef Elements::size_type size_type;
00055       typedef Elements::reference reference;
00056       typedef Elements::const_reference const_reference;
00057 
00058       static pointer create ( const char* path=NULL, Fill::pointer fill = Fill::pointer(), Stroke::pointer stroke = Stroke::pointer() );
00059 
00060       static pointer create ( const Glib::ustring& path, Fill::pointer fill = Fill::pointer(), Stroke::pointer stroke = Stroke::pointer() );
00061 
00062       static pointer create ( const Glib::ustring& id, const char* path, Fill::pointer fill = Fill::pointer(), Stroke::pointer stroke = Stroke::pointer() );
00063 
00064       static pointer create ( const Glib::ustring& id, const Glib::ustring& path, Fill::pointer fill = Fill::pointer(), Stroke::pointer stroke = Stroke::pointer() );
00065 
00066       static pointer create( const AttributeValueMap& avmap );
00067       
00068       ~Path();
00069 
00070       virtual void draw_shape ( Cairo::RefPtr< Cairo :: Context > cairo ) const;
00071 
00072       iterator begin();
00073 
00074       iterator end();
00075 
00076       const_iterator begin() const;
00077 
00078       const_iterator end() const;
00079 
00080       reverse_iterator rbegin();
00081 
00082       reverse_iterator rend();
00083 
00084       const_reverse_iterator rbegin() const;
00085 
00086       const_reverse_iterator rend() const;
00087 
00088       size_type size() const;
00089 
00090       size_type max_size() const;
00091 
00092       bool empty() const;
00093 
00094       reference front();
00095 
00096       const_reference front() const;
00097 
00098       reference back();
00099 
00100       const_reference back() const;
00101 
00102       void push_front ( PathElement::pointer element );
00103 
00104       void push_front ( PathElementType type, double x=0.0, double y=0.0, double x1=0.0, double y1=0.0, double x2=0.0, double y2=0.0 );
00105 
00106       void push_back ( PathElement::pointer element );
00107 
00108       void push_back ( PathElementType type, double x=0.0, double y=0.0, double x1=0.0, double y1=0.0, double x2=0.0, double y2=0.0 );
00109 
00110       void pop_front();
00111 
00112       void pop_back();
00113 
00114       iterator insert ( iterator pos, PathElement::pointer element );
00115 
00116       iterator insert ( iterator pos, PathElementType type, double x=0.0, double y=0.0, double x1=0.0, double y1=0.0, double x2=0.0, double y2=0.0 );
00117 
00118 //       iterator insert( iterator pos, size_type n, PathElement::pointer element );
00119 
00120       iterator erase ( iterator pos );
00121 
00122       iterator erase ( iterator first, iterator last );
00123 
00125       void set( const char* path );
00126 
00128       void set( const Glib::ustring& path );
00129 
00130       virtual void set( const AttributeValueMap& avmap );
00131 
00132       void clear();
00133 
00134       void remove ( PathElement::pointer element );
00135 
00136       void reverse();
00137 
00138       virtual Glib::ustring svg(unsigned depth=0);
00139 
00140       PAPYRUS_CLASS_NAME ( "Path" );
00141 
00142       PAPYRUS_CLONE_METHOD ( Path );
00143 
00144     protected:
00145       Elements m_elements;
00146 
00147   };
00148 
00149 }
00150 
00151 #endif

Generated on Wed Mar 18 12:34:04 2009 for papyrus by doxygen 1.5.7.1