Permalink
Browse files

msExtentsOverlap(): optimize when layer and map projections are the same

We can avoid costly reprojection to lon/lat
  • Loading branch information...
rouault committed Oct 12, 2017
1 parent 6a5cad3 commit 8501873362d8db024221869eb4a9bacef1c04690
Showing with 8 additions and 0 deletions.
  1. +8 −0 maputil.c
View
@@ -2260,6 +2260,14 @@ int msExtentsOverlap(mapObj *map, layerObj *layer)
if( ! (layer->projection.numargs > 0) )
return msRectOverlap( &(map->extent), &(layer->extent) );
/* In the case where map and layer projections are identical, and the */
/* bounding boxes don't cross the dateline, do simple rectangle comparison */
if( map->extent.minx < map->extent.maxx &&
layer->extent.minx < layer->extent.maxx &&
!msProjectionsDiffer(&(map->projection), &(layer->projection)) ) {
return msRectOverlap( &(map->extent), &(layer->extent) );
}
/* We need to transform our rectangles for comparison,
** so we will work with copies and leave the originals intact. */
MS_COPYRECT(&map_extent, &(map->extent) );

0 comments on commit 8501873

Please sign in to comment.