[mapguide-commits] r4313 - trunk/MgDev/Common/CoordinateSystem

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Oct 21 14:49:33 EDT 2009


Author: NormOlsen
Date: 2009-10-21 14:49:30 -0400 (Wed, 21 Oct 2009)
New Revision: 4313

Modified:
   trunk/MgDev/Common/CoordinateSystem/CoordSysMgrs.cpp
Log:
Fixes Trac #1124, the Missing UTM Zone problem.

In determining the UTM zones included in the viewport boundary, simple casts were used to round off longitude values and, therefore, inaccurate results were produced erratically, based on the actual numbers involved.  The static casts were replaced with calls to the floor and ceil functions.

Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysMgrs.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysMgrs.cpp	2009-10-20 22:50:46 UTC (rev 4312)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysMgrs.cpp	2009-10-21 18:49:30 UTC (rev 4313)
@@ -709,8 +709,9 @@
     INT32 zoneNbr;
     INT32 zoneMin;
     INT32 zoneMax;
+    INT32 tmpInt32;
 
-    double cm;                      // central meridian;
+    double cm;                      // central meridian
     double eastLimit, westLimit;    // limits of a UTM zone
     double eastMin, eastMax;        // frame boundary extrema in 'LL84' (or 'LL')
     double northMin, northMax;      // frame boundary extrema in 'LL84' (or 'LL')
@@ -816,8 +817,10 @@
             // A portion of the frame boundary is in the region covered by the
             // normal (i.e. non-polar) UTM zones.  Determine the particular UTM
             // zones we need to generate.
-            zoneMin = ((static_cast<INT32>(eastMin) + 180) / 6) + 1;
-            zoneMax = ((static_cast<INT32>(eastMax) + 180) / 6) + 1;
+            tmpInt32 = static_cast <INT32>(floor (eastMin));
+            zoneMin = ((tmpInt32 + 180) / 6) + 1;
+            tmpInt32 = static_cast <INT32>(ceil (eastMax));
+            zoneMax = ((tmpInt32 + 180) / 6) + 1;
 
             if (northMax > 0.0)
             {



More information about the mapguide-commits mailing list