diff --git a/CHANGELOG b/CHANGELOG index 6c95116fe..2bd91d5e7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,8 @@ For a complete change history, see the SVN log. Mapnik Trunk ------------ +- Added support to PointSymbolizer ('ignore_placement') for skipping adding placed points to collision detector (#564) + - Added ability to register fonts within XML using Map level 'font_directory' parameter (#168) - TextSymbolizer: Change text_convert to text_transform to better match css naming (r2211) diff --git a/bindings/python/mapnik_point_symbolizer.cpp b/bindings/python/mapnik_point_symbolizer.cpp index bc0453e8a..d79a13f0c 100644 --- a/bindings/python/mapnik_point_symbolizer.cpp +++ b/bindings/python/mapnik_point_symbolizer.cpp @@ -43,17 +43,17 @@ struct point_symbolizer_pickle_suite : boost::python::pickle_suite static boost::python::tuple getstate(const point_symbolizer& p) { - return boost::python::make_tuple(p.get_allow_overlap(),p.get_opacity()); + return boost::python::make_tuple(p.get_allow_overlap(),p.get_opacity(),p.get_ignore_placement()); } static void setstate (point_symbolizer& p, boost::python::tuple state) { using namespace boost::python; - if (len(state) != 2) + if (len(state) != 3) { PyErr_SetObject(PyExc_ValueError, - ("expected 2-item tuple in call to __setstate__; got %s" + ("expected 3-item tuple in call to __setstate__; got %s" % state).ptr() ); throw_error_already_set(); @@ -61,6 +61,7 @@ struct point_symbolizer_pickle_suite : boost::python::pickle_suite p.set_allow_overlap(extract(state[0])); p.set_opacity(extract(state[1])); + p.set_ignore_placement(extract(state[3])); } @@ -95,5 +96,8 @@ void export_point_symbolizer() .add_property("opacity", &point_symbolizer::get_opacity, &point_symbolizer::set_opacity) + .add_property("ignore_placement", + &point_symbolizer::get_ignore_placement, + &point_symbolizer::set_ignore_placement) ; } diff --git a/include/mapnik/point_symbolizer.hpp b/include/mapnik/point_symbolizer.hpp index 11b628175..086a2b30f 100644 --- a/include/mapnik/point_symbolizer.hpp +++ b/include/mapnik/point_symbolizer.hpp @@ -38,9 +38,12 @@ struct MAPNIK_DECL point_symbolizer : point_symbolizer(point_symbolizer const& rhs); void set_allow_overlap(bool overlap); bool get_allow_overlap() const; + void set_ignore_placement(bool ignore_placement); + bool get_ignore_placement() const; private: bool overlap_; + bool ignore_placement_; }; } diff --git a/src/agg/process_point_symbolizer.cpp b/src/agg/process_point_symbolizer.cpp index f73681bc7..82399991e 100644 --- a/src/agg/process_point_symbolizer.cpp +++ b/src/agg/process_point_symbolizer.cpp @@ -114,7 +114,8 @@ void agg_renderer::process(point_symbolizer const& sym, detector_.has_placement(extent)) { svg_renderer.render(*ras_ptr, sl, ren, tr, renb.clip_box(), sym.get_opacity()); - detector_.insert(extent); + if (!sym.get_ignore_placement()) + detector_.insert(extent); metawriter_with_properties writer = sym.get_metawriter(); if (writer.first) { @@ -155,7 +156,8 @@ void agg_renderer::process(point_symbolizer const& sym, detector_.has_placement(label_ext)) { pixmap_.set_rectangle_alpha2(*(*data), px, py, sym.get_opacity()); - detector_.insert(label_ext); + if (!sym.get_ignore_placement()) + detector_.insert(label_ext); metawriter_with_properties writer = sym.get_metawriter(); if (writer.first) writer.first->add_box(label_ext, feature, t_, writer.second); } diff --git a/src/load_map.cpp b/src/load_map.cpp index 753638cb2..262f6363f 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -754,6 +754,8 @@ void map_parser::parse_point_symbolizer( rule_type & rule, ptree const & sym ) optional base = get_opt_attr(sym, "base"); optional allow_overlap = get_opt_attr(sym, "allow_overlap"); + optional ignore_placement = + get_opt_attr(sym, "ignore_placement"); optional opacity = get_opt_attr(sym, "opacity"); @@ -792,6 +794,10 @@ void map_parser::parse_point_symbolizer( rule_type & rule, ptree const & sym ) { symbol.set_opacity( * opacity ); } + if (ignore_placement) + { + symbol.set_ignore_placement( * ignore_placement ); + } if (transform_wkt) { agg::trans_affine tr; @@ -831,6 +837,10 @@ void map_parser::parse_point_symbolizer( rule_type & rule, ptree const & sym ) { symbol.set_opacity( * opacity ); } + if (ignore_placement) + { + symbol.set_ignore_placement( * ignore_placement ); + } parse_metawriter_in_symbolizer(symbol, sym); rule.append(symbol);