[mapguide-commits] r8942 - sandbox/adsk/3.1n/Server/src/Services/Mapping

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun May 8 23:07:55 PDT 2016


Author: hubu
Date: 2016-05-08 23:07:55 -0700 (Sun, 08 May 2016)
New Revision: 8942

Modified:
   sandbox/adsk/3.1n/Server/src/Services/Mapping/MappingUtil.cpp
Log:
Fix the defect that zoom raster image results in server crash.
It is because if the displayed size of image is very small, the width or height may be 0. And we will use the width and height as the parameters of RESAMPLE. FDO Raster provider will crash in this case. I set width or height to 1 if its value is 0 to avoid the error.

Modified: sandbox/adsk/3.1n/Server/src/Services/Mapping/MappingUtil.cpp
===================================================================
--- sandbox/adsk/3.1n/Server/src/Services/Mapping/MappingUtil.cpp	2016-05-07 08:49:54 UTC (rev 8941)
+++ sandbox/adsk/3.1n/Server/src/Services/Mapping/MappingUtil.cpp	2016-05-09 06:07:55 UTC (rev 8942)
@@ -732,6 +732,10 @@
                     double pixelsPerMapUnit = dr->GetMetersPerUnit() / METERS_PER_INCH * dr->GetDpi() / dr->GetMapScale();
                     int width = (int)(extent.width() * pixelsPerMapUnit + 0.5);
                     int height = (int)(extent.height() * pixelsPerMapUnit + 0.5);
+                    // if width or height is 0, raster provider will throw an exception. 
+                    // we set it to 1 to avoid the exception.
+                    if (0 == width) width = 1;
+                    if (0 == height) height = 1;
 
                     //perform the raster query
                     FdoPtr<FdoIFeatureReader> fdoReader;



More information about the mapguide-commits mailing list