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

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Oct 22 19:33:37 EDT 2009


Author: NormOlsen
Date: 2009-10-22 19:33:35 -0400 (Thu, 22 Oct 2009)
New Revision: 4314

Modified:
   trunk/MgDev/Common/CoordinateSystem/CoordSysMgrs.cpp
   trunk/MgDev/Common/CoordinateSystem/CoordSysMgrsZone.cpp
Log:
Additional submission with respect to trac ticket #1124.  Corrects a problem where the GetRegions function of the CoordinateSystemMgrs object would return regions in which the destination member was empty (i.e. a blank string).

This defect was caused by the incorrect calculation of an index into a constant array of characters which at times would produce an index of -1, which would in turn produce a region object with a blank designation member.  Additionally, the CoordinateSystemMgrsZone object was modified so that it would not create or returnm a region object if the calculated designation was empty.  Thus, in any case where this calculation failes, no label eill appear (rather than a possibly incorrect label).

Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysMgrs.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysMgrs.cpp	2009-10-21 18:49:30 UTC (rev 4313)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysMgrs.cpp	2009-10-22 23:33:35 UTC (rev 4314)
@@ -946,7 +946,8 @@
         northIndex = static_cast<INT32>(iNorthing) / 100000;
         if (eastIndex < 9 && northIndex < 21)
         {
-            seriesIndex = abs (utmZoneNbr) % 6 - 1;
+//          seriesIndex = abs (utmZoneNbr) % 6 - 1;                 //BOGUS:: This does not work!!!!!
+            seriesIndex = (abs (utmZoneNbr) - 1) % 6;
             if (letteringScheme == MgCoordinateSystemMgrsLetteringScheme::Alternative)
             {
                 squareDesignation [0] = MgrsSeriesBessel[seriesIndex].easting[eastIndex];

Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysMgrsZone.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysMgrsZone.cpp	2009-10-21 18:49:30 UTC (rev 4313)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysMgrsZone.cpp	2009-10-22 23:33:35 UTC (rev 4314)
@@ -243,15 +243,17 @@
                 gridZoneLetter = CCoordinateSystemMgrs::GridZoneDesignationLetter (gridZoneIndex);
                 swprintf (wcBufr,128,L"%d%c",utmZoneNbr,gridZoneLetter);
                 STRING designation (wcBufr);
-
-                // Construct the region object and add it to the region collection.
-                pMjrRegion = new CCoordinateSystemGridRegion (designation,frameBoundary,
-                                                                          toFrameTransform,
-                                                                          southwest,
-                                                                          northeast,
-                                                                          curvePrecision,
-                                                                          maxPoints);
-                m_RegionCollection->Add (pMjrRegion);
+                if (!designation.empty ())
+                {
+                    // Construct the region object and add it to the region collection.
+                    pMjrRegion = new CCoordinateSystemGridRegion (designation,frameBoundary,
+                                                                              toFrameTransform,
+                                                                              southwest,
+                                                                              northeast,
+                                                                              curvePrecision,
+                                                                              maxPoints);
+                    m_RegionCollection->Add (pMjrRegion);
+                }
             }
         }
         else if (m_UtmZone == 61)
@@ -320,21 +322,24 @@
                 northeast->SetX (static_cast<double>(eastIndex + 100000));
                 northeast->SetY (static_cast<double>(northIndex + 100000));
 
-                // Now we need the designation.  The comes from the MgCoordinateSystemMgrs object that knows about the lettering scheme.
-                // Unfortunately, we don't have a reference to the host Mgrs object, so we're going to have to know
+                // Now we need the designation.  The comes from the MgCoordinateSystemMgrs
+                // object that knows about the lettering scheme.  Unfortunately, we don't
+                // have a reference to the host Mgrs object, so we're going to have to know
                 // about the lettering scheme.
                 STRING designation = CCoordinateSystemMgrs::GridSquareDesignation (m_UtmZone,static_cast<double>(eastIndex + 1),
                                                                                              static_cast<double>(northIndex + 1),
                                                                                              m_LetteringScheme);
-
-                // Construct the region object and add it to the region collection.
-                pMnrRegion = new CCoordinateSystemGridRegion (designation,frameBoundary,
-                                                                          gridToFrameXfrom,
-                                                                          southwest,
-                                                                          northeast,
-                                                                          curvePrecision,
-                                                                          maxPoints);
-                m_RegionCollection->Add (pMnrRegion);
+                if (!designation.empty ())
+                {
+                    // Construct the region object and add it to the region collection.
+                    pMnrRegion = new CCoordinateSystemGridRegion (designation,frameBoundary,
+                                                                              gridToFrameXfrom,
+                                                                              southwest,
+                                                                              northeast,
+                                                                              curvePrecision,
+                                                                              maxPoints);
+                    m_RegionCollection->Add (pMnrRegion);
+                }
             }
         }
     MG_CATCH_AND_THROW(L"MgCoordinateSystemOneGrid::BuildMinorRegions")



More information about the mapguide-commits mailing list