2010-03-18 20:04:35 +00:00
|
|
|
#include <boost/python.hpp>
|
2010-03-22 11:21:17 +00:00
|
|
|
|
|
|
|
#include <mapnik/glyph_symbolizer.hpp>
|
|
|
|
#include "mapnik_enumeration.hpp"
|
2010-03-18 20:04:35 +00:00
|
|
|
#include <boost/tuple/tuple.hpp>
|
|
|
|
|
|
|
|
using mapnik::glyph_symbolizer;
|
|
|
|
using mapnik::position;
|
2010-03-22 11:21:17 +00:00
|
|
|
using mapnik::enumeration_;
|
|
|
|
using mapnik::angle_mode_e;
|
|
|
|
using mapnik::AZIMUTH;
|
|
|
|
using mapnik::TRIGONOMETRIC;
|
2010-03-18 20:04:35 +00:00
|
|
|
using namespace boost::python;
|
|
|
|
|
2010-12-14 00:24:34 +00:00
|
|
|
namespace {
|
|
|
|
using namespace boost::python;
|
|
|
|
|
|
|
|
tuple get_displacement(const glyph_symbolizer& s)
|
|
|
|
{
|
|
|
|
boost::tuple<double,double> pos = s.get_displacement();
|
|
|
|
return boost::python::make_tuple(boost::get<0>(pos),boost::get<1>(pos));
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_displacement(glyph_symbolizer & s, boost::python::tuple arg)
|
2010-03-18 20:04:35 +00:00
|
|
|
{
|
2010-12-14 00:24:34 +00:00
|
|
|
s.set_displacement(extract<double>(arg[0]),extract<double>(arg[1]));
|
|
|
|
}
|
|
|
|
|
2010-03-18 20:04:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void export_glyph_symbolizer()
|
|
|
|
{
|
2010-03-22 11:21:17 +00:00
|
|
|
enumeration_<angle_mode_e>("angle_mode")
|
|
|
|
.value("AZIMUTH", AZIMUTH)
|
|
|
|
.value("TRIGONOMETRIC", TRIGONOMETRIC)
|
|
|
|
;
|
|
|
|
|
2010-03-18 20:04:35 +00:00
|
|
|
class_<glyph_symbolizer>("GlyphSymbolizer",
|
2010-03-18 20:04:51 +00:00
|
|
|
init<std::string,mapnik::expression_ptr>())
|
2010-03-18 20:04:35 +00:00
|
|
|
.add_property("face_name",
|
2010-03-18 20:04:51 +00:00
|
|
|
make_function(&glyph_symbolizer::get_face_name,
|
2010-06-02 11:03:30 +00:00
|
|
|
return_value_policy<copy_const_reference>()),
|
2010-03-18 20:04:51 +00:00
|
|
|
&glyph_symbolizer::set_face_name,
|
|
|
|
"Get/Set the name of the font face (eg:\"DejaVu Sans "
|
|
|
|
"Book\") which contains the glyph"
|
2010-06-02 11:03:30 +00:00
|
|
|
)
|
2010-03-18 20:04:35 +00:00
|
|
|
.add_property("char",
|
2010-03-18 20:04:51 +00: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-06-02 11:03:30 +00:00
|
|
|
)
|
2010-03-18 20:04:35 +00:00
|
|
|
.add_property("allow_overlap",
|
2010-03-18 20:04:51 +00: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-06-02 11:03:30 +00:00
|
|
|
)
|
2010-03-18 20:04:35 +00:00
|
|
|
.add_property("avoid_edges",
|
2010-03-18 20:04:51 +00: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-06-02 11:03:30 +00:00
|
|
|
)
|
2010-12-14 00:24:34 +00:00
|
|
|
.add_property("displacement",
|
|
|
|
&get_displacement,
|
|
|
|
&set_displacement)
|
|
|
|
|
2010-03-18 20:04:35 +00:00
|
|
|
.add_property("halo_fill",
|
|
|
|
make_function(&glyph_symbolizer::get_halo_fill,
|
2010-03-18 20:04:51 +00:00
|
|
|
return_value_policy<copy_const_reference>()),
|
2010-03-18 20:04:35 +00:00
|
|
|
&glyph_symbolizer::set_halo_fill)
|
2010-12-14 00:24:34 +00:00
|
|
|
|
2010-03-18 20:04:35 +00:00
|
|
|
.add_property("halo_radius",
|
|
|
|
&glyph_symbolizer::get_halo_radius,
|
|
|
|
&glyph_symbolizer::set_halo_radius)
|
2010-12-14 00:24:34 +00:00
|
|
|
|
2010-03-18 20:04:51 +00:00
|
|
|
.add_property("size",
|
|
|
|
&glyph_symbolizer::get_size,
|
|
|
|
&glyph_symbolizer::set_size,
|
|
|
|
"Get/Set the size expression used to size the glyph."
|
2010-06-02 11:03:30 +00:00
|
|
|
)
|
2010-12-14 00:24:34 +00:00
|
|
|
|
2010-03-18 20:04:51 +00:00
|
|
|
.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-06-02 11:03:30 +00:00
|
|
|
)
|
2010-03-22 11:21:17 +00: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-06-02 11:03:30 +00:00
|
|
|
)
|
2010-03-18 20:04:51 +00: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."
|
2010-06-02 11:03:30 +00:00
|
|
|
)
|
2010-03-18 20:04:51 +00:00
|
|
|
.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-06-02 11:03:30 +00:00
|
|
|
)
|
2010-03-18 20:04:35 +00:00
|
|
|
.add_property("colorizer",
|
|
|
|
&glyph_symbolizer::get_colorizer,
|
|
|
|
&glyph_symbolizer::set_colorizer,
|
2010-03-18 20:04:51 +00: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-06-02 11:03:30 +00:00
|
|
|
)
|
2010-03-18 20:04:35 +00:00
|
|
|
;
|
|
|
|
}
|