+ applied intersection patch from randomjunk - #127

This commit is contained in:
Artem Pavlenko 2009-01-13 00:35:45 +00:00
parent a97bbb52af
commit a11cc119e4
2 changed files with 16 additions and 6 deletions

View file

@ -125,6 +125,13 @@ namespace mapnik
// back project layers extent into main map projection
prj_trans.backward(lx0,ly0,lz0);
prj_trans.backward(lx1,ly1,lz1);
// if no intersection then nothing to do for layer
if ( lx0 > ext.maxx() || lx1 < ext.minx() || ly0 > ext.maxy() || ly1 < ext.miny() )
{
return;
}
// clip query bbox
lx0 = std::max(ext.minx(),lx0);
ly0 = std::max(ext.miny(),ly0);

View file

@ -239,14 +239,17 @@ namespace mapnik
#endif
Envelope<T> Envelope<T>::intersect(const EnvelopeType& other) const
{
if (intersects(other)) {
T x0=std::max(minx_,other.minx_);
T y0=std::max(miny_,other.miny_);
T x0=std::max(minx_,other.minx_);
T y0=std::max(miny_,other.miny_);
T x1=std::min(maxx_,other.maxx_);
T y1=std::min(maxy_,other.maxy_);
T x1=std::min(maxx_,other.maxx_);
T y1=std::min(maxy_,other.maxy_);
return Envelope<T>(x0,y0,x1,y1);
return Envelope<T>(x0,y0,x1,y1);
} else {
return Envelope<T>();
}
}
template <typename T>