[mapserver-commits] r10536 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Wed Sep 29 14:20:48 EDT 2010
Author: warmerdam
Date: 2010-09-29 18:20:48 +0000 (Wed, 29 Sep 2010)
New Revision: 10536
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapwmslayer.c
Log:
Restrict cascaded WMS requests based on EXTENT (#3543)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2010-09-29 18:18:31 UTC (rev 10535)
+++ trunk/mapserver/HISTORY.TXT 2010-09-29 18:20:48 UTC (rev 10536)
@@ -14,6 +14,8 @@
Current Version (SVN trunk):
----------------------------
+- Restrict cascaded WMS requests based on EXTENT (#3543)
+
- Avoid EPSG lookups for WMS client layers if possible (#3533)
- RFC-60: Add ability to skip ANGLE FOLLOW labels with too much character overlap (#3523)
Modified: trunk/mapserver/mapwmslayer.c
===================================================================
--- trunk/mapserver/mapwmslayer.c 2010-09-29 18:18:31 UTC (rev 10535)
+++ trunk/mapserver/mapwmslayer.c 2010-09-29 18:20:48 UTC (rev 10536)
@@ -471,7 +471,6 @@
return MS_FAILURE;
}
-
/* ------------------------------------------------------------------
* Find out request version
* ------------------------------------------------------------------ */
@@ -620,7 +619,7 @@
}
/* ------------------------------------------------------------------
- * Set layer SRS and reproject map extents to the layer's SRS
+ * Set layer SRS.
* ------------------------------------------------------------------ */
/* No need to set lp->proj if it's already set to the right EPSG code */
if ((pszTmp = msOWSGetEPSGProj(&(lp->projection), NULL, "MO", MS_TRUE)) == NULL ||
@@ -685,10 +684,8 @@
&& (strcasecmp(nonsquare_ok,"no") == 0
|| strcasecmp(nonsquare_ok,"false") == 0) )
{
-
double cellsize_x = (bbox.maxx-bbox.minx) / bbox_width;
double cellsize_y = (bbox.maxy-bbox.miny) / bbox_height;
-
if( cellsize_x < cellsize_y * 0.999999 )
{
@@ -723,6 +720,48 @@
}
/* -------------------------------------------------------------------- */
+/* If the layer has predefined extents, and a predefined */
+/* projection that matches the request projection, then */
+/* consider restricting the BBOX to match the limits. */
+/* -------------------------------------------------------------------- */
+ if( bbox_width != 0 )
+ {
+ const char *ows_srs;
+ rectObj layer_rect;
+
+ ows_srs = msOWSGetEPSGProj(NULL,&(lp->metadata), "MO", MS_FALSE);
+
+ if( strchr(ows_srs,' ') == NULL
+ && msOWSGetLayerExtent( map, lp, "MO", &layer_rect) == MS_SUCCESS )
+ {
+ /* fulloverlap */
+ if( msRectContained( &bbox, &layer_rect ) )
+ {
+ /* no changes */
+ }
+
+ /* no overlap */
+ else if( !msRectOverlap( &layer_rect, &bbox ) )
+ {
+ bbox_width = 0;
+ bbox_height = 0;
+ }
+
+ else
+ {
+ double cellsize_x = (bbox.maxx-bbox.minx) / bbox_width;
+ double cellsize_y = (bbox.maxy-bbox.miny) / bbox_height;
+ double cellsize = MIN(cellsize_x,cellsize_y);
+
+ msRectIntersect( &bbox, &layer_rect );
+
+ bbox_width = ceil((bbox.maxx - bbox.minx) / cellsize);
+ bbox_height = ceil((bbox.maxy - bbox.miny) / cellsize);
+ }
+ }
+ }
+
+/* -------------------------------------------------------------------- */
/* Potentially return the bbox. */
/* -------------------------------------------------------------------- */
if (bbox_ret != NULL)
@@ -925,6 +964,16 @@
}
/* ------------------------------------------------------------------
+ * Check if the request is empty, perhaps due to reprojection problems
+ * or wms_extents restrictions.
+ * ------------------------------------------------------------------ */
+ if( bbox_width == 0 || bbox_height == 0 )
+ {
+ msFreeWmsParamsObj(&sThisWMSParams);
+ return MS_SUCCESS; /* No overlap. */
+ }
+
+/* ------------------------------------------------------------------
* Check if layer overlaps current view window (using wms_latlonboundingbox)
* ------------------------------------------------------------------ */
if ((pszTmp = msOWSLookupMetadata(&(lp->metadata),
More information about the mapserver-commits
mailing list