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       PAPYRUS_DRAWABLE(Path);
00049       
00050       typedef std::list<PathElement::pointer> Elements;
00051       typedef Elements::iterator iterator;
00052       typedef Elements::const_iterator const_iterator;
00053       typedef Elements::reverse_iterator reverse_iterator;
00054       typedef Elements::const_reverse_iterator const_reverse_iterator;
00055       typedef Elements::size_type size_type;
00056       typedef Elements::reference reference;
00057       typedef Elements::const_reference const_reference;
00058 
00059       static pointer create ( const char* path=NULL, Fill::pointer fill = Fill::pointer(), Stroke::pointer stroke = Stroke::pointer() );
00060 
00061       static pointer create ( const Glib::ustring& path, Fill::pointer fill = Fill::pointer(), Stroke::pointer stroke = Stroke::pointer() );
00062 
00063       static pointer create ( const Glib::ustring& id, const char* path, Fill::pointer fill = Fill::pointer(), Stroke::pointer stroke = Stroke::pointer() );
00064 
00065       static pointer create ( const Glib::ustring& id, const Glib::ustring& path, Fill::pointer fill = Fill::pointer(), Stroke::pointer stroke = Stroke::pointer() );
00066 
00067       static pointer create( const AttributeValueMap& avmap );
00068       
00069       ~Path();
00070 
00071       virtual void draw_shape ( Context& cairo ) const;
00072 
00073       iterator begin();
00074 
00075       iterator end();
00076 
00077       const_iterator begin() const;
00078 
00079       const_iterator end() const;
00080 
00081       reverse_iterator rbegin();
00082 
00083       reverse_iterator rend();
00084 
00085       const_reverse_iterator rbegin() const;
00086 
00087       const_reverse_iterator rend() const;
00088 
00089       size_type size() const;
00090 
00091       size_type max_size() const;
00092 
00093       bool empty() const;
00094 
00095       reference front();
00096 
00097       const_reference front() const;
00098 
00099       reference back();
00100 
00101       const_reference back() const;
00102 
00103       void push_front ( PathElement::pointer element );
00104 
00105       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 );
00106 
00107       void push_back ( PathElement::pointer element );
00108 
00109       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 );
00110 
00111       void pop_front();
00112 
00113       void pop_back();
00114 
00115       iterator insert ( iterator pos, PathElement::pointer element );
00116 
00117       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 );
00118 
00119 //       iterator insert( iterator pos, size_type n, PathElement::pointer element );
00120 
00121       iterator erase ( iterator pos );
00122 
00123       iterator erase ( iterator first, iterator last );
00124 
00126       void set( const char* path );
00127 
00129       void set( const Glib::ustring& path );
00130 
00131       virtual void set( const AttributeValueMap& avmap );
00132 
00133       void clear();
00134 
00135       void remove ( PathElement::pointer element );
00136 
00137       void reverse();
00138 
00139       virtual Glib::ustring svg(unsigned depth=0);
00140 
00141     protected:
00142       Elements m_elements;
00143 
00144   };
00145 
00146 }
00147 
00148 #endif

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