+ applied patch avoid_extent from rcoup

This commit is contained in:
Artem Pavlenko 2008-11-19 21:50:12 +00:00
parent f1c1e475d7
commit 6062f42bbe
3 changed files with 35 additions and 20 deletions

View file

@ -110,28 +110,31 @@ namespace mapnik
if (ds)
{
Envelope<double> const& ext=m_.getCurrentExtent();
Envelope<double> bbox(ext);
projection proj1(lay.srs());
proj_transform prj_trans(proj0,proj1);
Envelope<double> layer_ext = lay.envelope();
double lx0 = layer_ext.minx();
double ly0 = layer_ext.miny();
double lz0 = 0.0;
double lx1 = layer_ext.maxx();
double ly1 = layer_ext.maxy();
double lz1 = 0.0;
// back project layers extent into main map projection
prj_trans.backward(lx0,ly0,lz0);
prj_trans.backward(lx1,ly1,lz1);
// clip query bbox
lx0 = std::max(ext.minx(),lx0);
ly0 = std::max(ext.miny(),ly0);
lx1 = std::min(ext.maxx(),lx1);
ly1 = std::min(ext.maxy(),ly1);
prj_trans.forward(lx0,ly0,lz0);
prj_trans.forward(lx1,ly1,lz1);
Envelope<double> bbox(lx0,ly0,lx1,ly1);
if (proj0 != proj1) {
Envelope<double> layer_ext = lay.envelope();
double lx0 = layer_ext.minx();
double ly0 = layer_ext.miny();
double lz0 = 0.0;
double lx1 = layer_ext.maxx();
double ly1 = layer_ext.maxy();
double lz1 = 0.0;
// back project layers extent into main map projection
prj_trans.backward(lx0,ly0,lz0);
prj_trans.backward(lx1,ly1,lz1);
// clip query bbox
lx0 = std::max(ext.minx(),lx0);
ly0 = std::max(ext.miny(),ly0);
lx1 = std::min(ext.maxx(),lx1);
ly1 = std::min(ext.maxy(),ly1);
prj_trans.forward(lx0,ly0,lz0);
prj_trans.forward(lx1,ly1,lz1);
bbox = Envelope<double>(lx0,ly0,lx1,ly1);
}
double resolution = m_.getWidth()/bbox.width();
query q(bbox,resolution); //BBOX query

View file

@ -57,6 +57,8 @@ namespace mapnik {
~projection();
projection& operator=(projection const& rhs);
bool operator==(const projection& other) const;
bool operator!=(const projection& other) const;
bool is_initialized() const;
bool is_geographic() const;
std::string const& params() const;

View file

@ -52,7 +52,17 @@ namespace mapnik {
swap(tmp);
return *this;
}
bool projection::operator==(const projection& other) const
{
return (params_ == other.params_);
}
bool projection::operator!=(const projection& other) const
{
return !(*this == other);
}
bool projection::is_initialized() const
{
return proj_ ? true : false;