diff --git a/bindings/python/mapnik_text_placement.cpp b/bindings/python/mapnik_text_placement.cpp index c52da1f31..ef49ae259 100644 --- a/bindings/python/mapnik_text_placement.cpp +++ b/bindings/python/mapnik_text_placement.cpp @@ -106,7 +106,6 @@ struct NodeWrap: formating::node, wrapper struct TextNodeWrap: formating::text_node, wrapper { - TextNodeWrap(expression_ptr text) : formating::text_node(text), wrapper() { @@ -128,7 +127,26 @@ struct TextNodeWrap: formating::text_node, wrapper { formating::text_node::apply(p, feature, output); } +}; +struct FormatNodeWrap: formating::format_node, wrapper +{ + virtual void apply(char_properties const& p, Feature const& feature, processed_text &output) const + { + if(override func_apply = this->get_override("apply")) + { + func_apply(ptr(&p), ptr(&feature), ptr(&output)); + } + else + { + formating::format_node::apply(p, feature, output); + } + } + + void default_apply(char_properties const& p, Feature const& feature, processed_text &output) const + { + formating::format_node::apply(p, feature, output); + } }; struct TextPlacementsWrap: text_placements, wrapper @@ -361,4 +379,16 @@ void export_text_placement() ; register_ptr_to_python >(); + + class_, + bases, + boost::noncopyable> + ("FormatingFormatNode") + .def("apply", &formating::format_node::apply, &FormatNodeWrap::default_apply) + .add_property("child", + &formating::format_node::get_child, + &formating::format_node::set_child) + ; + register_ptr_to_python >(); }