add support to PointSymbolizer for 'ignore_placement' - #564
This commit is contained in:
parent
5d13869da1
commit
3011f53205
5 changed files with 26 additions and 5 deletions
|
@ -14,6 +14,8 @@ For a complete change history, see the SVN log.
|
||||||
Mapnik Trunk
|
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)
|
- 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)
|
- TextSymbolizer: Change text_convert to text_transform to better match css naming (r2211)
|
||||||
|
|
|
@ -43,17 +43,17 @@ struct point_symbolizer_pickle_suite : boost::python::pickle_suite
|
||||||
static boost::python::tuple
|
static boost::python::tuple
|
||||||
getstate(const point_symbolizer& p)
|
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
|
static void
|
||||||
setstate (point_symbolizer& p, boost::python::tuple state)
|
setstate (point_symbolizer& p, boost::python::tuple state)
|
||||||
{
|
{
|
||||||
using namespace boost::python;
|
using namespace boost::python;
|
||||||
if (len(state) != 2)
|
if (len(state) != 3)
|
||||||
{
|
{
|
||||||
PyErr_SetObject(PyExc_ValueError,
|
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()
|
% state).ptr()
|
||||||
);
|
);
|
||||||
throw_error_already_set();
|
throw_error_already_set();
|
||||||
|
@ -61,6 +61,7 @@ struct point_symbolizer_pickle_suite : boost::python::pickle_suite
|
||||||
|
|
||||||
p.set_allow_overlap(extract<bool>(state[0]));
|
p.set_allow_overlap(extract<bool>(state[0]));
|
||||||
p.set_opacity(extract<float>(state[1]));
|
p.set_opacity(extract<float>(state[1]));
|
||||||
|
p.set_ignore_placement(extract<bool>(state[3]));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,5 +96,8 @@ void export_point_symbolizer()
|
||||||
.add_property("opacity",
|
.add_property("opacity",
|
||||||
&point_symbolizer::get_opacity,
|
&point_symbolizer::get_opacity,
|
||||||
&point_symbolizer::set_opacity)
|
&point_symbolizer::set_opacity)
|
||||||
|
.add_property("ignore_placement",
|
||||||
|
&point_symbolizer::get_ignore_placement,
|
||||||
|
&point_symbolizer::set_ignore_placement)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,12 @@ struct MAPNIK_DECL point_symbolizer :
|
||||||
point_symbolizer(point_symbolizer const& rhs);
|
point_symbolizer(point_symbolizer const& rhs);
|
||||||
void set_allow_overlap(bool overlap);
|
void set_allow_overlap(bool overlap);
|
||||||
bool get_allow_overlap() const;
|
bool get_allow_overlap() const;
|
||||||
|
void set_ignore_placement(bool ignore_placement);
|
||||||
|
bool get_ignore_placement() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool overlap_;
|
bool overlap_;
|
||||||
|
bool ignore_placement_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,8 @@ void agg_renderer<T>::process(point_symbolizer const& sym,
|
||||||
detector_.has_placement(extent))
|
detector_.has_placement(extent))
|
||||||
{
|
{
|
||||||
svg_renderer.render(*ras_ptr, sl, ren, tr, renb.clip_box(), sym.get_opacity());
|
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();
|
metawriter_with_properties writer = sym.get_metawriter();
|
||||||
if (writer.first)
|
if (writer.first)
|
||||||
{
|
{
|
||||||
|
@ -155,7 +156,8 @@ void agg_renderer<T>::process(point_symbolizer const& sym,
|
||||||
detector_.has_placement(label_ext))
|
detector_.has_placement(label_ext))
|
||||||
{
|
{
|
||||||
pixmap_.set_rectangle_alpha2(*(*data), px, py, sym.get_opacity());
|
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();
|
metawriter_with_properties writer = sym.get_metawriter();
|
||||||
if (writer.first) writer.first->add_box(label_ext, feature, t_, writer.second);
|
if (writer.first) writer.first->add_box(label_ext, feature, t_, writer.second);
|
||||||
}
|
}
|
||||||
|
|
|
@ -754,6 +754,8 @@ void map_parser::parse_point_symbolizer( rule_type & rule, ptree const & sym )
|
||||||
optional<std::string> base = get_opt_attr<string>(sym, "base");
|
optional<std::string> base = get_opt_attr<string>(sym, "base");
|
||||||
optional<boolean> allow_overlap =
|
optional<boolean> allow_overlap =
|
||||||
get_opt_attr<boolean>(sym, "allow_overlap");
|
get_opt_attr<boolean>(sym, "allow_overlap");
|
||||||
|
optional<boolean> ignore_placement =
|
||||||
|
get_opt_attr<boolean>(sym, "ignore_placement");
|
||||||
optional<float> opacity =
|
optional<float> opacity =
|
||||||
get_opt_attr<float>(sym, "opacity");
|
get_opt_attr<float>(sym, "opacity");
|
||||||
|
|
||||||
|
@ -792,6 +794,10 @@ void map_parser::parse_point_symbolizer( rule_type & rule, ptree const & sym )
|
||||||
{
|
{
|
||||||
symbol.set_opacity( * opacity );
|
symbol.set_opacity( * opacity );
|
||||||
}
|
}
|
||||||
|
if (ignore_placement)
|
||||||
|
{
|
||||||
|
symbol.set_ignore_placement( * ignore_placement );
|
||||||
|
}
|
||||||
if (transform_wkt)
|
if (transform_wkt)
|
||||||
{
|
{
|
||||||
agg::trans_affine tr;
|
agg::trans_affine tr;
|
||||||
|
@ -831,6 +837,10 @@ void map_parser::parse_point_symbolizer( rule_type & rule, ptree const & sym )
|
||||||
{
|
{
|
||||||
symbol.set_opacity( * opacity );
|
symbol.set_opacity( * opacity );
|
||||||
}
|
}
|
||||||
|
if (ignore_placement)
|
||||||
|
{
|
||||||
|
symbol.set_ignore_placement( * ignore_placement );
|
||||||
|
}
|
||||||
|
|
||||||
parse_metawriter_in_symbolizer(symbol, sym);
|
parse_metawriter_in_symbolizer(symbol, sym);
|
||||||
rule.append(symbol);
|
rule.append(symbol);
|
||||||
|
|
Loading…
Reference in a new issue