2010-03-18 21:04:35 +01:00
|
|
|
#include <boost/python.hpp>
|
2010-03-22 12:21:17 +01:00
|
|
|
|
|
|
|
#include <mapnik/glyph_symbolizer.hpp>
|
|
|
|
#include "mapnik_enumeration.hpp"
|
2010-03-18 21:04:35 +01:00
|
|
|
#include <boost/tuple/tuple.hpp>
|
|
|
|
|
|
|
|
using mapnik::glyph_symbolizer;
|
|
|
|
using mapnik::position;
|
2010-03-22 12:21:17 +01:00
|
|
|
using mapnik::enumeration_;
|
|
|
|
using mapnik::angle_mode_e;
|
|
|
|
using mapnik::AZIMUTH;
|
|
|
|
using mapnik::TRIGONOMETRIC;
|
2010-03-18 21:04:35 +01:00
|
|
|
using namespace boost::python;
|
|
|
|
|
|
|
|
list get_displacement_list(const glyph_symbolizer& t)
|
|
|
|
{
|
|
|
|
position pos = t.get_displacement();
|
|
|
|
double dx = boost::get<0>(pos);
|
|
|
|
double dy = boost::get<1>(pos);
|
|
|
|
boost::python::list disp;
|
|
|
|
disp.append(dx);
|
|
|
|
disp.append(dy);
|
|
|
|
return disp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void export_glyph_symbolizer()
|
|
|
|
{
|
2010-03-22 12:21:17 +01:00
|
|
|
enumeration_<angle_mode_e>("angle_mode")
|
|
|
|
.value("AZIMUTH", AZIMUTH)
|
|
|
|
.value("TRIGONOMETRIC", TRIGONOMETRIC)
|
|
|
|
;
|
|
|
|
|
2010-03-18 21:04:35 +01:00
|
|
|
class_<glyph_symbolizer>("GlyphSymbolizer",
|
2010-03-18 21:04:51 +01:00
|
|
|
init<std::string,mapnik::expression_ptr>())
|
2010-03-18 21:04:35 +01:00
|
|
|
.add_property("face_name",
|
2010-03-18 21:04:51 +01:00
|
|
|
make_function(&glyph_symbolizer::get_face_name,
|
|
|
|
return_value_policy<copy_const_reference>()),
|
|
|
|
&glyph_symbolizer::set_face_name,
|
|
|
|
"Get/Set the name of the font face (eg:\"DejaVu Sans "
|
|
|
|
"Book\") which contains the glyph"
|
|
|
|
)
|
2010-03-18 21:04:35 +01:00
|
|
|
.add_property("char",
|
2010-03-18 21:04:51 +01:00
|
|
|
&glyph_symbolizer::get_char,
|
|
|
|
&glyph_symbolizer::set_char,
|
|
|
|
"Get/Set the char expression. The char is the unicode "
|
|
|
|
"character indexing the glyph in the font referred by "
|
|
|
|
"face_name."
|
|
|
|
)
|
2010-03-18 21:04:35 +01:00
|
|
|
.add_property("allow_overlap",
|
2010-03-18 21:04:51 +01:00
|
|
|
&glyph_symbolizer::get_allow_overlap,
|
|
|
|
&glyph_symbolizer::set_allow_overlap,
|
|
|
|
"Get/Set the flag which controls if glyphs should "
|
|
|
|
"overlap any symbols previously rendered"
|
|
|
|
)
|
2010-03-18 21:04:35 +01:00
|
|
|
.add_property("avoid_edges",
|
2010-03-18 21:04:51 +01:00
|
|
|
&glyph_symbolizer::get_avoid_edges,
|
|
|
|
&glyph_symbolizer::set_avoid_edges,
|
|
|
|
"Get/Set the flag which controls if glyphs should be "
|
|
|
|
"partially drawn beside the edge of a tile."
|
|
|
|
)
|
2010-03-18 21:04:35 +01:00
|
|
|
.def("get_displacement", get_displacement_list)
|
|
|
|
.def("set_displacement", &glyph_symbolizer::set_displacement)
|
|
|
|
.add_property("halo_fill",
|
|
|
|
make_function(&glyph_symbolizer::get_halo_fill,
|
2010-03-18 21:04:51 +01:00
|
|
|
return_value_policy<copy_const_reference>()),
|
2010-03-18 21:04:35 +01:00
|
|
|
&glyph_symbolizer::set_halo_fill)
|
|
|
|
.add_property("halo_radius",
|
|
|
|
&glyph_symbolizer::get_halo_radius,
|
|
|
|
&glyph_symbolizer::set_halo_radius)
|
2010-03-18 21:04:51 +01:00
|
|
|
.add_property("size",
|
|
|
|
&glyph_symbolizer::get_size,
|
|
|
|
&glyph_symbolizer::set_size,
|
|
|
|
"Get/Set the size expression used to size the glyph."
|
|
|
|
)
|
|
|
|
.add_property("angle",
|
|
|
|
&glyph_symbolizer::get_angle,
|
|
|
|
&glyph_symbolizer::set_angle,
|
|
|
|
"Get/Set the angle expression used to rotate the glyph "
|
|
|
|
"along its center."
|
|
|
|
)
|
2010-03-22 12:21:17 +01:00
|
|
|
.add_property("angle_mode",
|
|
|
|
&glyph_symbolizer::get_angle_mode,
|
|
|
|
&glyph_symbolizer::set_angle_mode,
|
|
|
|
"Get/Set the angle_mode property. This controls how the "
|
|
|
|
"angle is interpreted. Valid values are AZIMUTH and "
|
|
|
|
"TRIGONOMETRIC."
|
|
|
|
)
|
2010-03-18 21:04:51 +01:00
|
|
|
.add_property("value",
|
|
|
|
&glyph_symbolizer::get_value,
|
|
|
|
&glyph_symbolizer::set_value,
|
|
|
|
"Get/set the value expression which will be used to "
|
|
|
|
"retrieve a a value for the colorizer to use to choose "
|
|
|
|
"a color."
|
|
|
|
)
|
|
|
|
.add_property("color",
|
|
|
|
&glyph_symbolizer::get_color,
|
|
|
|
&glyph_symbolizer::set_color,
|
|
|
|
"Get/Set the color expression used to color the glyph. "
|
|
|
|
"(See also the 'colorizer' attribute)"
|
|
|
|
|
|
|
|
)
|
2010-03-18 21:04:35 +01:00
|
|
|
.add_property("colorizer",
|
|
|
|
&glyph_symbolizer::get_colorizer,
|
|
|
|
&glyph_symbolizer::set_colorizer,
|
2010-03-18 21:04:51 +01:00
|
|
|
"Get/Set the RasterColorizer used to color the glyph "
|
|
|
|
"depending on the 'value' expression (which must be "
|
|
|
|
"defined).\n"
|
|
|
|
"Only needed if no explicit color is provided"
|
2010-03-18 21:04:35 +01:00
|
|
|
)
|
|
|
|
;
|
|
|
|
}
|