/home/andreas/src/svn/mapnik/include/mapnik/text_symbolizer.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * 
00003  * This file is part of Mapnik (c++ mapping toolkit)
00004  *
00005  * Copyright (C) 2006 Artem Pavlenko
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020  *
00021  *****************************************************************************/
00022 
00023 //$Id$
00024 
00025 #ifndef TEXT_SYMBOLIZER_HPP
00026 #define TEXT_SYMBOLIZER_HPP
00027 // stl
00028 #include <string>
00029 // boost
00030 #include <boost/tuple/tuple.hpp>
00031 // mapnik
00032 #include <mapnik/color.hpp>
00033 
00034 namespace mapnik
00035 {
00036    enum label_placement_e {
00037       point_placement=1,
00038       line_placement=2
00039    };
00040         
00041    typedef boost::tuple<double,double> position;
00042     
00043    struct MAPNIK_DECL text_symbolizer
00044    {            
00045          text_symbolizer(std::string const& name,std::string const& face_name, 
00046                          unsigned size,Color const& fill);      
00047          text_symbolizer(text_symbolizer const& rhs);
00048          text_symbolizer& operator=(text_symbolizer const& rhs);
00049          std::string const& get_name() const;
00050          unsigned get_text_ratio() const; // target ratio for text bounding box in pixels
00051          void set_text_ratio(unsigned ratio);
00052          unsigned get_wrap_width() const; // width to wrap text at, or trigger ratio
00053          void set_wrap_width(unsigned ratio);
00054          unsigned get_label_spacing() const; // spacing between repeated labels on lines
00055          void set_label_spacing(unsigned spacing);
00056          unsigned get_label_position_tolerance() const; //distance the label can be moved on the line to fit, if 0 the default is used
00057          void set_label_position_tolerance(unsigned tolerance);
00058          bool get_force_odd_labels() const; // try render an odd amount of labels
00059          void set_force_odd_labels(bool force);
00060          double get_max_char_angle_delta() const; // maximum change in angle between adjacent characters
00061          void set_max_char_angle_delta(double angle);
00062          unsigned get_text_size() const;
00063          std::string const& get_face_name() const;
00064          Color const& get_fill() const;
00065          void set_halo_fill(Color const& fill);
00066          Color const& get_halo_fill() const;
00067          void set_halo_radius(unsigned radius);
00068          unsigned get_halo_radius() const;
00069          void set_label_placement(label_placement_e label_p);
00070          label_placement_e get_label_placement() const;
00071          void set_anchor(double x, double y);   
00072          position const& get_anchor() const;    
00073          void set_displacement(double x, double y);
00074          position const& get_displacement() const;
00075 
00076          void set_avoid_edges(bool avoid);
00077          bool get_avoid_edges() const;
00078       private:
00079          std::string name_;
00080          std::string face_name_;
00081          unsigned size_;
00082          unsigned text_ratio_;
00083          unsigned wrap_width_;
00084          unsigned label_spacing_;
00085          unsigned label_position_tolerance_;
00086          bool force_odd_labels_;
00087          double max_char_angle_delta_;
00088          Color fill_;
00089          Color halo_fill_;
00090          unsigned halo_radius_;
00091          label_placement_e label_p_;
00092          position anchor_;
00093          position displacement_;
00094          bool avoid_edges_;
00095    };
00096 }
00097 
00098 #endif //TEXT_SYMBOLIZER_HPP

Generated on Thu Jul 19 17:59:27 2007 for Mapnik by  doxygen 1.4.7