Changeset 789

Show
Ignore:
Timestamp:
01/12/09 19:35:45 (19 months ago)
Author:
artem
Message:

+ applied intersection patch from randomjunk - #127

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/include/mapnik/feature_style_processor.hpp

    r770 r789  
    126126                  prj_trans.backward(lx0,ly0,lz0); 
    127127                  prj_trans.backward(lx1,ly1,lz1); 
     128 
     129                  // if no intersection then nothing to do for layer 
     130                  if ( lx0 > ext.maxx() || lx1 < ext.minx() || ly0 > ext.maxy() || ly1 < ext.miny() ) 
     131                  { 
     132                     return; 
     133                  } 
     134                   
    128135                  // clip query bbox 
    129136                  lx0 = std::max(ext.minx(),lx0); 
  • trunk/src/envelope.cpp

    r603 r789  
    240240    Envelope<T> Envelope<T>::intersect(const EnvelopeType& other) const 
    241241    { 
    242  
    243         T x0=std::max(minx_,other.minx_); 
    244         T y0=std::max(miny_,other.miny_); 
    245  
    246         T x1=std::min(maxx_,other.maxx_); 
    247         T y1=std::min(maxy_,other.maxy_); 
    248  
    249         return Envelope<T>(x0,y0,x1,y1); 
     242        if (intersects(other)) { 
     243            T x0=std::max(minx_,other.minx_); 
     244            T y0=std::max(miny_,other.miny_); 
     245 
     246            T x1=std::min(maxx_,other.maxx_); 
     247            T y1=std::min(maxy_,other.maxy_); 
     248 
     249            return Envelope<T>(x0,y0,x1,y1); 
     250        } else { 
     251            return Envelope<T>(); 
     252        } 
    250253    } 
    251254