papyrus logo

marker.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 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 PAPYRUSMARKER_H
00021 #define PAPYRUSMARKER_H
00022 
00023 #include <papyrus/shape.h>
00024 
00025 namespace Papyrus
00026 {
00027 
00034   class Marker : public Shape
00035   {
00036     public:
00037       typedef enum Style {
00038           FIRST_STYLE,
00039           NONE=FIRST_STYLE,
00040           LINES,
00041           TRIANGLE,
00042           DIAMOND,
00043           HALF_DIAMOND,
00044           HALF_HEAD_UPPER,
00045           HALF_HEAD_LOWER,
00046           SLASHED_CROSS,
00047           ELLIPSE,
00048           DOT,
00049           DOUBLE_TRIANGLE,
00050           DOT_AND_TRIANGLE,
00051           BOX,
00052           CROW_FOOT,
00053           CROSS,
00054           ONE_OR_MANY,
00055           ZERO_OR_MANY,
00056           ONE_OR_ZERO,
00057           ONE_EXACTLY,
00058           CONCAVE,
00059           ROUND,
00060           OPEN_ROUND,
00061           BACKSLASH,
00062           LAST_STYLE=BACKSLASH
00063     } Style;
00064 
00065     static const char* style_strings[];
00066 
00067       typedef enum Facing {
00068           LEFT,
00069           RIGHT
00070     } Facing;
00071 
00072     protected:
00073 
00075       Marker ( const Glib::ustring& id,
00076                Style style,
00077                double width,
00078                double height,
00079                Facing facing,
00080                Fill::pointer fill,
00081                Stroke::pointer stroke );
00082 
00083     public:
00084       PAPYRUS_DRAWABLE(Marker);
00085 
00087       static pointer create ( Style style=NONE,
00088                               double width = 20.0,
00089                               double height = 20.0,
00090                               Facing facing = RIGHT,
00091                               Fill::pointer fill=Fill::pointer(),
00092                               Stroke::pointer stroke = Stroke::pointer() );
00093 
00095       static pointer create ( const Glib::ustring& id,
00096                               Style style=NONE,
00097                               double width = 20.0,
00098                               double height = 20.0,
00099                               Facing facing = RIGHT,
00100                               Fill::pointer fill=Fill::pointer(),
00101                               Stroke::pointer stroke = Stroke::pointer() );
00102 
00104       virtual ~Marker();
00105 
00107       Style style() const;
00108 
00110       void set_style ( Style style );
00111 
00113       double width() const;
00114 
00116       void set_width ( double width );
00117 
00119       double height() const;
00120 
00122       void set_height ( double height );
00123 
00125       void width_height ( double& width, double& height ) const;
00126 
00128       void set_width_height ( double width, double height );
00129 
00135       Facing facing() const;
00136 
00138       void set_facing ( Facing facing );
00139 
00141       virtual void draw_shape ( Context& cairo ) const;
00142 
00143     protected:
00144       Style m_style;
00145 
00146       double m_width;
00147 
00148       double m_height;
00149 
00150       Facing m_facing;
00151 
00152   };
00153 
00154 }
00155 
00156 #endif

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