papyrus logo

path_element.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_ELEMENTS_H
00021 #define PAPYRUSPATH_ELEMENTS_H
00022 
00023 #include <papyrus/enums.h>
00024 #include <papyrus/renderable.h>
00025 
00026 namespace Papyrus
00027 {
00031   class PathElement : public Renderable
00032   {
00033     protected:
00034       PathElement ( const Glib::ustring& id, PathElementType type, double x, double y, double x1, double y1, double x2, double y2 );
00035 
00036     public:
00037       PAPYRUS_RENDERABLE(PathElement);
00038 
00039       static pointer create ( 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 );
00040 
00041       static pointer create ( const Glib::ustring& id, 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 );
00042 
00043       ~PathElement();
00044 
00045       PathElementType type();
00046 
00047       void set_type ( PathElementType type );
00048 
00049       double x();
00050 
00051       double y();
00052 
00053       void set_x ( double x );
00054 
00055       void set_y ( double y );
00056 
00057       void set_xy ( double x, double y );
00058 
00059       double x1();
00060 
00061       double y1();
00062 
00063       void set_x1 ( double x1 );
00064 
00065       void set_y1 ( double y1 );
00066 
00067       void set_x1y1 ( double x1, double y1 );
00068 
00069       double x2();
00070 
00071       double y2();
00072 
00073       void set_x2 ( double x2 );
00074 
00075       void set_y2 ( double y2 );
00076 
00077       void set_x2y2 ( double x2, double y2 );
00078 
00079       void set_xyx1y1x2y2 ( double x, double y, double x1, double y1, double x2, double y2 );
00080 
00081       virtual void render ( Context& cairo ) const;
00082 
00083       virtual void render ( Context& cairo, pointer previous ) const;
00084 
00085       virtual Glib::ustring svg(unsigned depth=0);
00086 
00087     protected:
00088       PathElementType m_type;
00089       weak_pointer m_self;
00090       double m_x, m_y;
00091       mutable double m_x1, m_y1, m_x2, m_y2;
00092 //       pointer m_previous;
00093   };
00094 
00095 }
00096 
00097 #endif

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