diff --git a/bindings/python/mapnik_color.cpp b/bindings/python/mapnik_color.cpp index 744c546d4..c628a5e12 100644 --- a/bindings/python/mapnik_color.cpp +++ b/bindings/python/mapnik_color.cpp @@ -46,7 +46,7 @@ void export_color () using namespace boost::python; class_("Color", init( #if BOOST_VERSION >= 103500 - args("self", "r", "g", "b", "a"), + ( arg("self"), arg("r"), arg("g"), arg("b"), arg("a") ), #endif "Creates a new color from its RGB components\n" "and an alpha value.\n" @@ -54,14 +54,14 @@ void export_color () ) .def(init( #if BOOST_VERSION >= 103500 - args("self", "r", "g", "b"), + ( arg("self"), arg("r"), arg("g"), arg("b") ), #endif "Creates a new color from its RGB components.\n" "All values between 0 and 255.\n") ) .def(init( #if BOOST_VERSION >= 103500 - args("self", "color_string"), + ( arg("self"), arg("color_string") ), #endif "Creates a new color from its CSS string representation.\n" "The string may be a CSS color name (e.g. 'blue')\n" @@ -92,7 +92,7 @@ void export_color () .def("__str__",&color::to_string) .def("to_hex_string",&color::to_hex_string, #if BOOST_VERSION >= 103500 - args("self"), + ( arg("self") ), #endif "Returns the hexadecimal representation of this color.\n" "\n" diff --git a/bindings/python/mapnik_enumeration.hpp b/bindings/python/mapnik_enumeration.hpp index 79d0656ee..4abe35e60 100644 --- a/bindings/python/mapnik_enumeration.hpp +++ b/bindings/python/mapnik_enumeration.hpp @@ -42,6 +42,11 @@ class enumeration_ : { init(); } + enumeration_(const char * python_alias, const char * doc) : + base_type( python_alias, doc ) + { + init(); + } private: struct converter diff --git a/bindings/python/mapnik_map.cpp b/bindings/python/mapnik_map.cpp index 11a765daf..1609d3b8c 100644 --- a/bindings/python/mapnik_map.cpp +++ b/bindings/python/mapnik_map.cpp @@ -148,7 +148,7 @@ void export_map() class_("Map","The map object.",init >( #if BOOST_VERSION >= 103500 - ( args("self"),arg("width"),arg("height"),arg("srs") ), + ( arg("self"),arg("width"),arg("height"),arg("srs") ), #endif "Create a Map with a width and height as integers and, optionally,\n" "an srs string either with a Proj.4 epsg code ('+init=epsg:')\n" diff --git a/bindings/python/mapnik_stroke.cpp b/bindings/python/mapnik_stroke.cpp index 83696f875..9be15e155 100644 --- a/bindings/python/mapnik_stroke.cpp +++ b/bindings/python/mapnik_stroke.cpp @@ -21,8 +21,11 @@ *****************************************************************************/ //$Id$ +// boost #include +#include +// mapnik #include #include "mapnik_enumeration.hpp" @@ -40,7 +43,7 @@ namespace { mapnik::dash_array::const_iterator iter = dash.begin(); mapnik::dash_array::const_iterator end = dash.end(); for (; iter != end; ++iter) { - l.append(make_tuple(iter->first, iter->second)); + l.append(make_tuple(iter->first, iter->second)); } } @@ -77,9 +80,9 @@ struct stroke_pickle_suite : boost::python::pickle_suite ); throw_error_already_set(); } - + s.set_opacity(extract(state[0])); - + if (state[1]) { list dashes = extract(state[1]); @@ -104,29 +107,73 @@ void export_stroke () using namespace boost::python; enumeration_("line_cap") + +/* + enumeration_("line_cap", + "The possible values for a line cap used when drawing\n" + "with a stroke.\n") +*/ .value("BUTT_CAP",BUTT_CAP) .value("SQUARE_CAP",SQUARE_CAP) .value("ROUND_CAP",ROUND_CAP) ; enumeration_("line_join") + +/* + enumeration_("line_join", + "The possible values for the line joining mode\n" + "when drawing with a stroke.\n") +*/ .value("MITER_JOIN",MITER_JOIN) .value("MITER_REVERT_JOIN",MITER_REVERT_JOIN) .value("ROUND_JOIN",ROUND_JOIN) .value("BEVEL_JOIN",BEVEL_JOIN) ; - class_("Stroke",init<>()) - .def(init()) + class_("Stroke",init<>( +#if BOOST_VERSION >= 103400 + ( arg("self") ), +#endif + "Creates a new default black stroke with the width of 1.\n")) + .def(init( +#if BOOST_VERSION >= 103400 + ( arg("self"), arg("color"), arg("width") ), +#endif + "Creates a new stroke object with a specified color and width.\n") + ) .def_pickle(stroke_pickle_suite()) .add_property("color",make_function - (&stroke::get_color,return_value_policy()), - &stroke::set_color) - .add_property("width",&stroke::get_width,&stroke::set_width) - .add_property("opacity",&stroke::get_opacity,&stroke::set_opacity) - .add_property("line_cap",&stroke::get_line_cap,&stroke::set_line_cap) - .add_property("line_join",&stroke::get_line_join,&stroke::set_line_join) - // todo combine into single get/set property - .def("add_dash",&stroke::add_dash) - .def("get_dashes", get_dashes_list) + (&stroke::get_color,return_value_policy()), + &stroke::set_color, + "Gets or sets the stroke color.\n" + "Returns a new Color object on retrieval.\n") + .add_property("width", + &stroke::get_width, + &stroke::set_width, + "Gets or sets the stroke width in pixels.\n") + .add_property("opacity", + &stroke::get_opacity, + &stroke::set_opacity, + "Gets or sets the opacity of this stroke.\n" + "The value is a float between 0 and 1.\n") + .add_property("line_cap", + &stroke::get_line_cap, + &stroke::set_line_cap, + "Gets or sets the line cap of this stroke.\n") + .add_property("line_join", + &stroke::get_line_join, + &stroke::set_line_join, + "Returns the line join mode of this stroke.\n") + // todo consider providing a single get/set property + .def("add_dash",&stroke::add_dash, +#if BOOST_VERSION >= 103400 + ( arg("self"), arg("length"), arg("gap") ), +#endif + "Adds a dash segment to the dash patterns of this stroke.\n") + .def("get_dashes", get_dashes_list, +#if BOOST_VERSION >= 103400 + ( arg("self") ), +#endif + "Returns the list of dash segments for this stroke.\n") ; }