File: mapnik_text_symbolizer.cpp

package info (click to toggle)
mapnik 0.5.1-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 19,136 kB
  • ctags: 14,550
  • sloc: cpp: 68,887; python: 24,895; xml: 1,534; makefile: 503; sh: 79
file content (85 lines) | stat: -rw-r--r-- 3,723 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*****************************************************************************
 * 
 * This file is part of Mapnik (c++ mapping toolkit)
 *
 * Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *****************************************************************************/
//$Id$

#include <boost/python.hpp>

#include <mapnik/text_symbolizer.hpp>
#include "mapnik_enumeration.hpp"

void export_text_symbolizer()
{
   using namespace boost::python;
   using namespace mapnik;

   using mapnik::text_symbolizer;
   using mapnik::Color;
 
   enumeration_<label_placement_e>("label_placement")
      .value("LINE_PLACEMENT",LINE_PLACEMENT)
      .value("POINT_PLACEMENT",POINT_PLACEMENT)
      ;
    
   class_<text_symbolizer>("TextSymbolizer",
                           init<std::string const&,std::string const&, unsigned,Color const&>())
      .add_property("halo_fill",make_function(
                       &text_symbolizer::get_halo_fill,
                       return_value_policy<copy_const_reference>()),
                    &text_symbolizer::set_halo_fill)
      .add_property("halo_radius",
                    &text_symbolizer::get_halo_radius, 
                    &text_symbolizer::set_halo_radius)
      .add_property("wrap_width",
                    &text_symbolizer::get_wrap_width,
                    &text_symbolizer::set_wrap_width)
      .add_property("text_ratio",
                    &text_symbolizer::get_text_ratio,
                    &text_symbolizer::set_text_ratio)
      .add_property("label_spacing",
                    &text_symbolizer::get_label_spacing,
                    &text_symbolizer::set_label_spacing)
      .add_property("label_position_tolerance",
                    &text_symbolizer::get_label_position_tolerance,
                    &text_symbolizer::set_label_position_tolerance)
      .add_property("force_odd_labels",
                    &text_symbolizer::get_force_odd_labels,
                    &text_symbolizer::set_force_odd_labels)
      .add_property("max_char_angle_delta",
                    &text_symbolizer::get_max_char_angle_delta,
                    &text_symbolizer::set_max_char_angle_delta)
      .add_property("avoid_edges",
                    &text_symbolizer::get_avoid_edges,
                    &text_symbolizer::set_avoid_edges)
      .add_property("minimum_distance",
                    &text_symbolizer::get_minimum_distance,
                    &text_symbolizer::set_minimum_distance)
      .def("displacement",&text_symbolizer::set_displacement)
      .add_property("label_placement",
                    &text_symbolizer::get_label_placement,
                    &text_symbolizer::set_label_placement,
                    "Set/get the placement of the label")
      .add_property("allow_overlap",
                    &text_symbolizer::get_allow_overlap,
                    &text_symbolizer::set_allow_overlap,
                    "Set/get the allow_overlap property of the label")
      ;
}