Skip to content

Commit

Permalink
msExtentsOverlap(): optimize when layer and map projections are the same
Browse files Browse the repository at this point in the history
We can avoid costly reprojection to lon/lat
  • Loading branch information
rouault committed Oct 12, 2017
1 parent 6a5cad3 commit 8501873
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions maputil.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) );
Expand Down

0 comments on commit 8501873

Please sign in to comment.