add ignore-placement to MarkersSymbolizer

This commit is contained in:
ldp 2012-03-18 22:35:02 +01:00
parent cdc6376719
commit 1542e3e513
4 changed files with 20 additions and 1 deletions

View file

@ -56,6 +56,8 @@ public:
explicit markers_symbolizer(); explicit markers_symbolizer();
markers_symbolizer(path_expression_ptr filename); markers_symbolizer(path_expression_ptr filename);
markers_symbolizer(markers_symbolizer const& rhs); markers_symbolizer(markers_symbolizer const& rhs);
void set_ignore_placement(bool ignore_placement);
bool get_ignore_placement() const;
void set_allow_overlap(bool overlap); void set_allow_overlap(bool overlap);
bool get_allow_overlap() const; bool get_allow_overlap() const;
void set_spacing(double spacing); void set_spacing(double spacing);
@ -76,6 +78,7 @@ public:
marker_type_e get_marker_type() const; marker_type_e get_marker_type() const;
private: private:
bool ignore_placement_;
bool allow_overlap_; bool allow_overlap_;
color fill_; color fill_;
double spacing_; double spacing_;

View file

@ -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()))); ren.color(agg::rgba8(s_r, s_g, s_b, int(s_a*stroke_.get_opacity())));
agg::render_scanlines(*ras_ptr, sl_line, ren); 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); if (writer.first) writer.first->add_box(label_ext, *feature, t_, writer.second);
} }
} }

View file

@ -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"); optional<double> max_error = sym.get_opt_attr<double>("max-error");
if (max_error) symbol.set_max_error(*max_error); if (max_error) symbol.set_max_error(*max_error);
optional<boolean> allow_overlap = sym.get_opt_attr<boolean>("allow-overlap"); 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 (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> w = sym.get_opt_attr<double>("width");
optional<double> h = sym.get_opt_attr<double>("height"); optional<double> h = sym.get_opt_attr<double>("height");

View file

@ -47,6 +47,7 @@ markers_symbolizer::markers_symbolizer()
: symbolizer_with_image(path_expression_ptr(new path_expression)), : symbolizer_with_image(path_expression_ptr(new path_expression)),
symbolizer_base(), symbolizer_base(),
allow_overlap_(false), allow_overlap_(false),
ignore_placement_(false),
fill_(color(0,0,255)), fill_(color(0,0,255)),
spacing_(100.0), spacing_(100.0),
max_error_(0.2), max_error_(0.2),
@ -60,6 +61,7 @@ markers_symbolizer::markers_symbolizer(path_expression_ptr filename)
: symbolizer_with_image(filename), : symbolizer_with_image(filename),
symbolizer_base(), symbolizer_base(),
allow_overlap_(false), allow_overlap_(false),
ignore_placement_(false),
fill_(color(0,0,255)), fill_(color(0,0,255)),
spacing_(100.0), spacing_(100.0),
max_error_(0.2), max_error_(0.2),
@ -73,6 +75,7 @@ markers_symbolizer::markers_symbolizer(markers_symbolizer const& rhs)
: symbolizer_with_image(rhs), : symbolizer_with_image(rhs),
symbolizer_base(rhs), symbolizer_base(rhs),
allow_overlap_(rhs.allow_overlap_), allow_overlap_(rhs.allow_overlap_),
ignore_placement_(rhs.ignore_placement_),
fill_(rhs.fill_), fill_(rhs.fill_),
spacing_(rhs.spacing_), spacing_(rhs.spacing_),
max_error_(rhs.max_error_), max_error_(rhs.max_error_),
@ -82,6 +85,16 @@ markers_symbolizer::markers_symbolizer(markers_symbolizer const& rhs)
marker_p_(rhs.marker_p_), marker_p_(rhs.marker_p_),
marker_type_(rhs.marker_type_) {} 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) void markers_symbolizer::set_allow_overlap(bool overlap)
{ {
allow_overlap_ = overlap; allow_overlap_ = overlap;