[mapguide-commits] r6476 - sandbox/adsk/2.4j/Common/CoordinateSystem

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Feb 2 16:49:12 EST 2012


Author: baertelchen
Date: 2012-02-02 13:49:12 -0800 (Thu, 02 Feb 2012)
New Revision: 6476

Modified:
   sandbox/adsk/2.4j/Common/CoordinateSystem/CoordSysTransform.cpp
   sandbox/adsk/2.4j/Common/CoordinateSystem/CoordSysTransform.h
Log:
Fix ticket 1945 "CCoordinateSystemTransform::Transform methods might return incorrect transformation results for geographic coordinate systems"

The various CCoordinateSystemTransform::Transform methods changed the input coordinates if the source coordinate system had been geographic and if the IgnoreOutsideDomainWarning flag was set to true.

This resulted in Mg returning incorrect transformation results compared to CSMAP (e.g. have the MG API process CSMAP's TEST.DAT file...)

Also, it makes no sense to have the MG API trimming the LL coordinates but not XY. And, the transformation engine behaves totally different when just a single flag is switched.
The IgnoreOutsideDomainWarning flag is checked again anyway after CSMAP has been called.

In this submission, I'm removing the private method [GeographicAdjust] and all calls to it in [CCoordinateSystemTransform].
All values are now passed on to CSMAP without touching them (no checking against Min / Max LL nor any checking of any central meridian value).
Also, the dev comment for [GeographicAdjust] was a bit vague.

Processed CSMAP's TEST.DAT file through the Mg API with the IgnoreOutsideDomainWarning / IgnoreDatumShiftWarning enabled and disabled.
Checked, that no errors were reported.

Changes reviewed by Hugues.

Modified: sandbox/adsk/2.4j/Common/CoordinateSystem/CoordSysTransform.cpp
===================================================================
--- sandbox/adsk/2.4j/Common/CoordinateSystem/CoordSysTransform.cpp	2012-02-02 02:45:38 UTC (rev 6475)
+++ sandbox/adsk/2.4j/Common/CoordinateSystem/CoordSysTransform.cpp	2012-02-02 21:49:12 UTC (rev 6476)
@@ -166,10 +166,6 @@
     }
     else
     {
-        if (m_bIgnoreOutsideDomainWarning && m_bSrcIsGeographic)
-        {
-            GeographicAdjust (dCoords);
-        }
         if (m_bIsReentrant)
         {
             status = TransformPoint2D (dCoords);
@@ -235,10 +231,6 @@
     }
     else
     {
-        if (m_bIgnoreOutsideDomainWarning && m_bSrcIsGeographic)
-        {
-            GeographicAdjust (dCoords);
-        }
         if (m_bIsReentrant)
         {
             status = TransformPoint2D (dCoords);
@@ -302,10 +294,6 @@
     }
     else
     {
-        if (m_bIgnoreOutsideDomainWarning && m_bSrcIsGeographic)
-        {
-            GeographicAdjust (dCoords);
-        }
         if (m_bIsReentrant)
         {
             status = TransformPoint3D (dCoords);
@@ -370,10 +358,6 @@
     }
     else
     {
-        if (m_bIgnoreOutsideDomainWarning && m_bSrcIsGeographic)
-        {
-            GeographicAdjust (dCoords);
-        }
         if (m_bIsReentrant)
         {
             status = TransformPoint3D (dCoords);
@@ -1065,10 +1049,6 @@
     //Convert the point
     INT32 status;
     double dCoords [3] = {*x, *y, 0.0};
-    if (m_bIgnoreOutsideDomainWarning && m_bSrcIsGeographic)
-    {
-        GeographicAdjust (dCoords);
-    }
     if (m_bIsReentrant)
     {
         status = TransformPoint2D (dCoords);
@@ -1142,10 +1122,6 @@
         dCoords [0] = x [idx];
         dCoords [1] = y [idx];
 
-        if (m_bIgnoreOutsideDomainWarning && m_bSrcIsGeographic)
-        {
-            GeographicAdjust (dCoords);
-        }
         status = TransformPoint2D (dCoords);
         x [idx] = dCoords [0];
         y [idx] = dCoords [1];
@@ -1195,10 +1171,6 @@
     //Convert the point
     INT32 status;
     double dCoords [3] = {*x, *y, 0.0};
-    if (m_bIgnoreOutsideDomainWarning && m_bSrcIsGeographic)
-    {
-        GeographicAdjust (dCoords);
-    }
     if (m_bIsReentrant)
     {
         status = TransformPoint2D (dCoords);
@@ -1273,10 +1245,6 @@
         dCoords [0] = x [idx];
         dCoords [1] = y [idx];
 
-        if (m_bIgnoreOutsideDomainWarning && m_bSrcIsGeographic)
-        {
-            GeographicAdjust (dCoords);
-        }
         status = TransformPoint2D (dCoords);
         x [idx] = dCoords [0];
         y [idx] = dCoords [1];
@@ -1329,10 +1297,6 @@
 
     //Convert the point
     double dCoords [3] = {*x, *y, *z};
-    if (m_bIgnoreOutsideDomainWarning && m_bSrcIsGeographic)
-    {
-        GeographicAdjust (dCoords);
-    }
     if (m_bIsReentrant)
     {
         status = TransformPoint3D (dCoords);
@@ -1408,10 +1372,6 @@
         dCoords [1] = y [idx];
         dCoords [2] = z [idx];
 
-        if (m_bIgnoreOutsideDomainWarning && m_bSrcIsGeographic)
-        {
-            GeographicAdjust (dCoords);
-        }
         status = TransformPoint2D (dCoords);
         x [idx] = dCoords [0];
         y [idx] = dCoords [1];
@@ -1464,10 +1424,6 @@
 
     //Convert the point
     double dCoords [3] = {*x, *y, *z};
-    if (m_bIgnoreOutsideDomainWarning && m_bSrcIsGeographic)
-    {
-        GeographicAdjust (dCoords);
-    }
     if (m_bIsReentrant)
     {
         status = TransformPoint2D (dCoords);
@@ -1543,11 +1499,6 @@
         dCoords [1] = y [idx];
         dCoords [2] = z [idx];
 
-        if (m_bIgnoreOutsideDomainWarning && m_bSrcIsGeographic)
-        {
-            GeographicAdjust (dCoords);
-        }
-
         status = TransformPoint2D (dCoords);
         x [idx] = dCoords [0];
         y [idx] = dCoords [1];
@@ -1616,10 +1567,6 @@
     pDblXY = xy [0];
     for (idx = 0;idx < pointCount;idx++)
     {
-        if (m_bIgnoreOutsideDomainWarning && m_bSrcIsGeographic)
-        {
-            GeographicAdjust (pDblXY);
-        }
         status = TransformPoint2D (pDblXY);
         
         // Warning status values will have already been counted.  We only need
@@ -1684,10 +1631,6 @@
     pDblXYZ = xyz [0];
     for (idx = 0;idx < pointCount;idx++)
     {
-        if (m_bIgnoreOutsideDomainWarning && m_bSrcIsGeographic)
-        {
-            GeographicAdjust (pDblXYZ);
-        }
         status = TransformPoint3D (pDblXYZ);
         
         // Warning status values will have already been counted.  We only need
@@ -2261,30 +2204,7 @@
     }
     return status;
 }
-/* Not sure that I understand why this is here.  It was in previous code,
-   so we keep it to eliminate possible regressions. */
-void CCoordinateSystemTransform::GeographicAdjust (double dCoords[3])
-{
-    if(dCoords[0] < m_src.cent_mer + m_src.min_ll[0])
-    {
-        dCoords[0] = m_src.cent_mer + m_src.min_ll[0];
-    }
 
-    if(dCoords[0] > m_src.cent_mer + m_src.max_ll[0])
-    {
-        dCoords[0] = m_src.cent_mer + m_src.max_ll[0];
-    }
-
-    if(dCoords[1] > m_src.max_ll[1])
-    {
-        dCoords[1] = m_src.max_ll[1];
-    }
-
-    if(dCoords[1] < m_src.min_ll[1])
-    {
-        dCoords[1] = m_src.max_ll[1];
-    }
-}
 // For performance reasons, this function is, usually, called only in the event
 // of a non-zero status value.  Note that exceptions are usually thrown should
 // status be non-zero.

Modified: sandbox/adsk/2.4j/Common/CoordinateSystem/CoordSysTransform.h
===================================================================
--- sandbox/adsk/2.4j/Common/CoordinateSystem/CoordSysTransform.h	2012-02-02 02:45:38 UTC (rev 6475)
+++ sandbox/adsk/2.4j/Common/CoordinateSystem/CoordSysTransform.h	2012-02-02 21:49:12 UTC (rev 6476)
@@ -361,7 +361,6 @@
     int TransformInverse (double& xx,double& yy);
     INT32 TransformPoint2D (double dCoords [3]);        /* 2D conversion without Critical Section */
     INT32 TransformPoint3D (double dCoords [3]);        /* 3D conversion without Critical Section */
-    void GeographicAdjust (double dCoords [3]);
     void InterpretStatus (INT32 status);
 };
 



More information about the mapguide-commits mailing list