Merge pull request #1135 from novldp/master
MarkersSymbolizer ignore-placement
This commit is contained in:
commit
0a5765fab8
6 changed files with 31 additions and 3 deletions
|
@ -60,7 +60,8 @@ struct markers_symbolizer_pickle_suite : boost::python::pickle_suite
|
|||
static boost::python::tuple
|
||||
getstate(markers_symbolizer const& p)
|
||||
{
|
||||
return boost::python::make_tuple(p.get_allow_overlap());//,p.get_opacity());
|
||||
return boost::python::make_tuple(p.get_allow_overlap(),
|
||||
p.get_ignore_placement());//,p.get_opacity());
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -77,7 +78,8 @@ struct markers_symbolizer_pickle_suite : boost::python::pickle_suite
|
|||
}
|
||||
|
||||
p.set_allow_overlap(extract<bool>(state[0]));
|
||||
//p.set_opacity(extract<float>(state[1]));
|
||||
p.set_ignore_placement(extract<bool>(state[1]));
|
||||
//p.set_opacity(extract<float>(state[2]));
|
||||
|
||||
}
|
||||
|
||||
|
@ -108,6 +110,9 @@ void export_markers_symbolizer()
|
|||
&markers_symbolizer::get_opacity,
|
||||
&markers_symbolizer::set_opacity,
|
||||
"Set/get the text opacity")
|
||||
.add_property("ignore_placement",
|
||||
&markers_symbolizer::get_ignore_placement,
|
||||
&markers_symbolizer::set_ignore_placement)
|
||||
.add_property("transform",
|
||||
&mapnik::get_svg_transform<markers_symbolizer>,
|
||||
&mapnik::set_svg_transform<markers_symbolizer>)
|
||||
|
|
|
@ -56,6 +56,8 @@ public:
|
|||
explicit markers_symbolizer();
|
||||
markers_symbolizer(path_expression_ptr filename);
|
||||
markers_symbolizer(markers_symbolizer const& rhs);
|
||||
void set_ignore_placement(bool ignore_placement);
|
||||
bool get_ignore_placement() const;
|
||||
void set_allow_overlap(bool overlap);
|
||||
bool get_allow_overlap() const;
|
||||
void set_spacing(double spacing);
|
||||
|
@ -76,6 +78,7 @@ public:
|
|||
marker_type_e get_marker_type() const;
|
||||
|
||||
private:
|
||||
bool ignore_placement_;
|
||||
bool allow_overlap_;
|
||||
color fill_;
|
||||
double spacing_;
|
||||
|
|
|
@ -244,7 +244,8 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
|
|||
ren.color(agg::rgba8(s_r, s_g, s_b, int(s_a*stroke_.get_opacity())));
|
||||
agg::render_scanlines(*ras_ptr, sl_line, ren);
|
||||
}
|
||||
detector_->insert(label_ext);
|
||||
if (!sym.get_ignore_placement())
|
||||
detector_->insert(label_ext);
|
||||
if (writer.first) writer.first->add_box(label_ext, *feature, t_, writer.second);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -896,7 +896,9 @@ void map_parser::parse_markers_symbolizer(rule & rule, xml_node const& sym)
|
|||
optional<double> max_error = sym.get_opt_attr<double>("max-error");
|
||||
if (max_error) symbol.set_max_error(*max_error);
|
||||
optional<boolean> allow_overlap = sym.get_opt_attr<boolean>("allow-overlap");
|
||||
optional<boolean> ignore_placement = sym.get_opt_attr<boolean>("ignore-placement");
|
||||
if (allow_overlap) symbol.set_allow_overlap(*allow_overlap);
|
||||
if (ignore_placement) symbol.set_ignore_placement(*ignore_placement);
|
||||
|
||||
optional<double> w = sym.get_opt_attr<double>("width");
|
||||
optional<double> h = sym.get_opt_attr<double>("height");
|
||||
|
|
|
@ -47,6 +47,7 @@ markers_symbolizer::markers_symbolizer()
|
|||
: symbolizer_with_image(path_expression_ptr(new path_expression)),
|
||||
symbolizer_base(),
|
||||
allow_overlap_(false),
|
||||
ignore_placement_(false),
|
||||
fill_(color(0,0,255)),
|
||||
spacing_(100.0),
|
||||
max_error_(0.2),
|
||||
|
@ -60,6 +61,7 @@ markers_symbolizer::markers_symbolizer(path_expression_ptr filename)
|
|||
: symbolizer_with_image(filename),
|
||||
symbolizer_base(),
|
||||
allow_overlap_(false),
|
||||
ignore_placement_(false),
|
||||
fill_(color(0,0,255)),
|
||||
spacing_(100.0),
|
||||
max_error_(0.2),
|
||||
|
@ -73,6 +75,7 @@ markers_symbolizer::markers_symbolizer(markers_symbolizer const& rhs)
|
|||
: symbolizer_with_image(rhs),
|
||||
symbolizer_base(rhs),
|
||||
allow_overlap_(rhs.allow_overlap_),
|
||||
ignore_placement_(rhs.ignore_placement_),
|
||||
fill_(rhs.fill_),
|
||||
spacing_(rhs.spacing_),
|
||||
max_error_(rhs.max_error_),
|
||||
|
@ -82,6 +85,16 @@ markers_symbolizer::markers_symbolizer(markers_symbolizer const& rhs)
|
|||
marker_p_(rhs.marker_p_),
|
||||
marker_type_(rhs.marker_type_) {}
|
||||
|
||||
void markers_symbolizer::set_ignore_placement(bool ignore_placement)
|
||||
{
|
||||
ignore_placement_ = ignore_placement;
|
||||
}
|
||||
|
||||
bool markers_symbolizer::get_ignore_placement() const
|
||||
{
|
||||
return ignore_placement_;
|
||||
}
|
||||
|
||||
void markers_symbolizer::set_allow_overlap(bool overlap)
|
||||
{
|
||||
allow_overlap_ = overlap;
|
||||
|
|
|
@ -273,6 +273,10 @@ public:
|
|||
{
|
||||
set_attr( sym_node, "allow-overlap", sym.get_allow_overlap() );
|
||||
}
|
||||
if (sym.get_ignore_placement() != dfl.get_ignore_placement() || explicit_defaults_)
|
||||
{
|
||||
set_attr( sym_node, "ignore-placement", sym.get_ignore_placement() );
|
||||
}
|
||||
if (sym.get_spacing() != dfl.get_spacing() || explicit_defaults_)
|
||||
{
|
||||
set_attr( sym_node, "spacing", sym.get_spacing() );
|
||||
|
|
Loading…
Reference in a new issue