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

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Dec 7 19:00:49 EST 2010


Author: NormOlsen
Date: 2010-12-07 16:00:49 -0800 (Tue, 07 Dec 2010)
New Revision: 5446

Modified:
   trunk/MgDev/Common/CoordinateSystem/CoordSys.cpp
Log:
Trac # 1555  -- Some special processing is required for SRID numbers.  The slot in the CS-MAP structure is a signed short and there are some SRID values which are greater than 32767.  SO we play some games to make the signed short the equivalent of an unsigned short.

Modified: trunk/MgDev/Common/CoordinateSystem/CoordSys.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSys.cpp	2010-12-07 22:14:25 UTC (rev 5445)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSys.cpp	2010-12-08 00:00:49 UTC (rev 5446)
@@ -1319,7 +1319,24 @@
 /// </summary>
 INT32 CCoordinateSystem::GetEpsgCode (void)
 {
-     return static_cast<INT32>(m_csprm.csdef.epsgNbr);
+    short sEpsg;
+    INT32 iEpsg;
+
+    sEpsg = m_csprm.csdef.epsgNbr;
+    if (sEpsg > 0)
+    {
+        iEpsg = sEpsg;
+    }
+    else if (sEpsg < 0)
+    {
+        sEpsg = -sEpsg;
+        iEpsg = 32768 + sEpsg;
+    }
+    else
+    {
+        iEpsg = 0;
+    }
+    return iEpsg;
 }
 /////////////////////////////////////////////////////////////////
 /// <summary>
@@ -1327,7 +1344,24 @@
 /// </summary>
 INT32 CCoordinateSystem::GetSridCode (void)
 {
-     return static_cast<INT32>(m_csprm.csdef.srid);
+    short sSrid;
+    INT32 iSrid;
+
+    sSrid = m_csprm.csdef.srid;
+    if (sSrid > 0)
+    {
+        iSrid = sSrid;
+    }
+    else if (sSrid < 0)
+    {
+        sSrid = -sSrid;
+        iSrid = 32768 + sSrid;
+    }
+    else
+    {
+        iSrid = 0;
+    }
+    return iSrid;
 }
 /////////////////////////////////////////////////////////////////
 /// <summary>



More information about the mapguide-commits mailing list