00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef TEXT_SYMBOLIZER_HPP
00026 #define TEXT_SYMBOLIZER_HPP
00027
00028 #include <mapnik/enumeration.hpp>
00029 #include <mapnik/color.hpp>
00030 #include <mapnik/font_set.hpp>
00031 #include <mapnik/graphics.hpp>
00032
00033 #include <boost/tuple/tuple.hpp>
00034 #include <boost/shared_ptr.hpp>
00035
00036 #include <string>
00037
00038 namespace mapnik
00039 {
00040 enum label_placement_enum {
00041 POINT_PLACEMENT,
00042 LINE_PLACEMENT,
00043 label_placement_enum_MAX
00044 };
00045 DEFINE_ENUM( label_placement_e, label_placement_enum );
00046
00047 typedef boost::tuple<double,double> position;
00048
00049 struct MAPNIK_DECL text_symbolizer
00050 {
00051 text_symbolizer(std::string const& name,std::string const& face_name,
00052 unsigned size, Color const& fill);
00053 text_symbolizer(std::string const& name, unsigned size, Color const& fill);
00054 text_symbolizer(text_symbolizer const& rhs);
00055 text_symbolizer& operator=(text_symbolizer const& rhs);
00056 std::string const& get_name() const;
00057 unsigned get_text_ratio() const;
00058 void set_text_ratio(unsigned ratio);
00059 unsigned get_wrap_width() const;
00060 void set_wrap_width(unsigned ratio);
00061 unsigned get_label_spacing() const;
00062 void set_label_spacing(unsigned spacing);
00063 unsigned get_label_position_tolerance() const;
00064 void set_label_position_tolerance(unsigned tolerance);
00065 bool get_force_odd_labels() const;
00066 void set_force_odd_labels(bool force);
00067 double get_max_char_angle_delta() const;
00068 void set_max_char_angle_delta(double angle);
00069 unsigned get_text_size() const;
00070 std::string const& get_face_name() const;
00071 void set_face_name(std::string face_name);
00072 FontSet const& get_fontset() const;
00073 void set_fontset(FontSet fontset);
00074 Color const& get_fill() const;
00075 void set_halo_fill(Color const& fill);
00076 Color const& get_halo_fill() const;
00077 void set_halo_radius(unsigned radius);
00078 unsigned get_halo_radius() const;
00079 void set_label_placement(label_placement_e label_p);
00080 label_placement_e get_label_placement() const;
00081 void set_anchor(double x, double y);
00082 position const& get_anchor() const;
00083 void set_displacement(double x, double y);
00084 position const& get_displacement() const;
00085 void set_avoid_edges(bool avoid);
00086 bool get_avoid_edges() const;
00087 void set_minimum_distance(double distance);
00088 double get_minimum_distance() const;
00089 void set_allow_overlap(bool overlap);
00090 bool get_allow_overlap() const;
00091 private:
00092 std::string name_;
00093 std::string face_name_;
00094 FontSet fontset_;
00095 unsigned size_;
00096 unsigned text_ratio_;
00097 unsigned wrap_width_;
00098 unsigned label_spacing_;
00099 unsigned label_position_tolerance_;
00100 bool force_odd_labels_;
00101 double max_char_angle_delta_;
00102 Color fill_;
00103 Color halo_fill_;
00104 unsigned halo_radius_;
00105 label_placement_e label_p_;
00106 position anchor_;
00107 position displacement_;
00108 bool avoid_edges_;
00109 double minimum_distance_;
00110 bool overlap_;
00111 };
00112 }
00113
00114 #endif //TEXT_SYMBOLIZER_HPP