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

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jan 5 05:31:34 EST 2011


Author: baertelchen
Date: 2011-01-05 02:31:34 -0800 (Wed, 05 Jan 2011)
New Revision: 5489

Modified:
   trunk/MgDev/Common/CoordinateSystem/CoordSysMathComparator.cpp
Log:
Follow up submission for ticket #1577 (http://trac.osgeo.org/mapguide/ticket/1577)

While the original fix itself was correct it was missing the Nrthsrt ("Nerth with scale and rotation") projection type.

Modified the code in CoordSysMathComparator.cpp so it does now also checks for [MgCoordinateSystemProjectionCode::Nrthsrt] in case a coordinate system does neither reference a datum nor an ellipsoid.

At the moment, the check will still return false, if the 2 systems being compared are of projection type [Nerth] and [Nrthsrt] but have equal scale and rotation parameters set. This is due to the fact, that the code does also compare the projection code itself on equality: This is already commented in the code before this submission. So, I won't change that now. This requires some more effort that's not related to ticket 1577.

Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysMathComparator.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysMathComparator.cpp	2011-01-05 05:57:31 UTC (rev 5488)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysMathComparator.cpp	2011-01-05 10:31:34 UTC (rev 5489)
@@ -346,9 +346,19 @@
         }
 
         //else: both neither reference a datum nor an ellipsoid (all key names have been '\0')
-        //we only allow them to be of projection type "Non-earth" then
-        if (MgCoordinateSystemProjectionCode::Nerth != pDefinition1->GetProjectionCode()
-            || MgCoordinateSystemProjectionCode::Nerth != pDefinition2->GetProjectionCode())
+        //we only allow them to be of projection type "Non-earth (with scale and rotation)" then
+        const INT32 projectionCode1 = pDefinition1->GetProjectionCode();
+        const INT32 projectionCode2 = pDefinition2->GetProjectionCode();
+
+        const bool isNonEarth1 = MgCoordinateSystemProjectionCode::Nerth == projectionCode1 ||
+            MgCoordinateSystemProjectionCode::Nrthsrt == projectionCode1;
+
+        const bool isNonEarth2 = MgCoordinateSystemProjectionCode::Nerth == projectionCode2 ||
+            MgCoordinateSystemProjectionCode::Nrthsrt == projectionCode2;
+
+        //if one was Nerth and the other was Nrthsrt, we don't return false here for now;
+        //it will be checked below for it's projection code; this will fail if they aren't the same
+        if (!isNonEarth1 || !isNonEarth2) //don't accept if at least one is not "non-earth"
         {
             return false;
         }



More information about the mapguide-commits mailing list