properly support tolerance in shape filter_at_point - refs #1640

This commit is contained in:
Dane Springmeyer 2012-12-11 14:46:52 -08:00
parent 1acdb1ad3e
commit e928c483bf
2 changed files with 15 additions and 4 deletions

View File

@ -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_);
}
}
};

View File

@ -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();