+ applied intersection patch from randomjunk - #127
This commit is contained in:
parent
a97bbb52af
commit
a11cc119e4
2 changed files with 16 additions and 6 deletions
|
@ -125,6 +125,13 @@ namespace mapnik
|
||||||
// back project layers extent into main map projection
|
// back project layers extent into main map projection
|
||||||
prj_trans.backward(lx0,ly0,lz0);
|
prj_trans.backward(lx0,ly0,lz0);
|
||||||
prj_trans.backward(lx1,ly1,lz1);
|
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
|
// clip query bbox
|
||||||
lx0 = std::max(ext.minx(),lx0);
|
lx0 = std::max(ext.minx(),lx0);
|
||||||
ly0 = std::max(ext.miny(),ly0);
|
ly0 = std::max(ext.miny(),ly0);
|
||||||
|
|
|
@ -239,14 +239,17 @@ namespace mapnik
|
||||||
#endif
|
#endif
|
||||||
Envelope<T> Envelope<T>::intersect(const EnvelopeType& other) const
|
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 x1=std::min(maxx_,other.maxx_);
|
||||||
T y0=std::max(miny_,other.miny_);
|
T y1=std::min(maxy_,other.maxy_);
|
||||||
|
|
||||||
T x1=std::min(maxx_,other.maxx_);
|
return Envelope<T>(x0,y0,x1,y1);
|
||||||
T y1=std::min(maxy_,other.maxy_);
|
} else {
|
||||||
|
return Envelope<T>();
|
||||||
return Envelope<T>(x0,y0,x1,y1);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
Loading…
Reference in a new issue