feature_at_point

+ use 'tol' where possible
This commit is contained in:
artemp 2013-05-22 11:07:55 +01:00
parent 126d1b73d6
commit a3eaebd5e1
3 changed files with 7 additions and 11 deletions

View file

@ -535,13 +535,11 @@ featureset_ptr ogr_datasource::features_at_point(coord2d const& pt, double tol)
}
else
{
OGRPoint point;
point.setX (pt.x);
point.setY (pt.y);
mapnik::box2d<double> bbox(pt, pt);
bbox.pad(tol);
return featureset_ptr(new ogr_featureset (ctx,
*layer,
point,
bbox,
desc_.get_encoding()));
}
}

View file

@ -288,7 +288,7 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
if (boost::filesystem::exists(mapnik::utf8_to_utf16(index_db)))
#else
if (boost::filesystem::exists(index_db))
#endif
#endif
{
dataset_->execute("attach database '" + index_db + "' as " + index_table_);
}
@ -639,9 +639,8 @@ featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt, double to
if (dataset_)
{
// TODO - need tolerance
mapnik::box2d<double> const e(pt.x, pt.y, pt.x, pt.y);
mapnik::box2d<double> e(pt.x, pt.y, pt.x, pt.y);
e.pad(tol);
std::ostringstream s;
mapnik::context_ptr ctx = boost::make_shared<mapnik::context_type>();

View file

@ -90,9 +90,8 @@ featureset_ptr memory_datasource::features(const query& q) const
featureset_ptr memory_datasource::features_at_point(coord2d const& pt, double tol) const
{
box2d<double> box = box2d<double>(pt.x, pt.y, pt.x, pt.y);
box.pad(tol);
MAPNIK_LOG_DEBUG(memory_datasource) << "memory_datasource: Box=" << box << ", Point x=" << pt.x << ",y=" << pt.y;
return boost::make_shared<memory_featureset>(box,*this);
}