mirror of
https://github.com/mapnik/mapnik.git
synced 2025-12-08 20:13:09 +00:00
properly support tolerance in shape filter_at_point - refs #1640
This commit is contained in:
parent
1acdb1ad3e
commit
e928c483bf
@ -212,11 +212,22 @@ struct filter_in_box
|
||||
struct filter_at_point
|
||||
{
|
||||
coord2d pt_;
|
||||
explicit filter_at_point(const coord2d& pt)
|
||||
: pt_(pt) {}
|
||||
double tol_;
|
||||
explicit filter_at_point(const coord2d& pt, double tol=0)
|
||||
: pt_(pt),
|
||||
tol_(tol) {}
|
||||
bool pass(const box2d<double>& extent) const
|
||||
{
|
||||
return extent.contains(pt_);
|
||||
if (tol_ == 0)
|
||||
{
|
||||
return extent.contains(pt_);
|
||||
}
|
||||
else
|
||||
{
|
||||
box2d<double> extent2 = extent;
|
||||
extent2.pad(tol_);
|
||||
return extent2.contains(pt_);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -296,7 +296,7 @@ featureset_ptr shape_datasource::features_at_point(coord2d const& pt, double tol
|
||||
mapnik::progress_timer __stats__(std::clog, "shape_datasource::features_at_point");
|
||||
#endif
|
||||
|
||||
filter_at_point filter(pt);
|
||||
filter_at_point filter(pt,tol);
|
||||
// collect all attribute names
|
||||
std::vector<attribute_descriptor> const& desc_vector = desc_.get_descriptors();
|
||||
std::vector<attribute_descriptor>::const_iterator itr = desc_vector.begin();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user