[mapguide-commits] r5477 - trunk/MgDev/Common/CoordinateSystem
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Dec 17 12:29:46 EST 2010
Author: baertelchen
Date: 2010-12-17 09:29:46 -0800 (Fri, 17 Dec 2010)
New Revision: 5477
Modified:
trunk/MgDev/Common/CoordinateSystem/CoordSysMathComparator.cpp
Log:
Fix for ticket 1577 (http://trac.osgeo.org/mapguide/ticket/1577)
The CCoordinateSystemMathComparator::SameCoordinateSystem incorrectly returned false for 2 systems, if both weren't referencing a datum or an ellipsoid.
This is a valid definition though - coordinate systems with projection type non-earth (NERTH) don't have either set.
Modified the [SameCoordinateSystem] method so it does also check the case where both systems neither reference a datum nor an ellipsoid. If the projection type is then NERTH, the method will do the remaining checks, e.g. check the x/y offsets on equality + the unit.
Reviewed by Hugues.
Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysMathComparator.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysMathComparator.cpp 2010-12-15 21:50:27 UTC (rev 5476)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysMathComparator.cpp 2010-12-17 17:29:46 UTC (rev 5477)
@@ -316,6 +316,7 @@
if (def1.dat_knm [0] != '\0' && def2.dat_knm [0] != '\0')
{
+ //both systems reference a datum - make sure, these are equal
Ptr<MgCoordinateSystemDatum> pDatum1 = pDefinition1->GetDatumDefinition ();
Ptr<MgCoordinateSystemDatum> pDatum2 = pDefinition2->GetDatumDefinition ();
if (!SameDatum (pDatum1,pDatum2))
@@ -326,6 +327,7 @@
else if ((def1.dat_knm [0] == '\0' && def2.dat_knm [0] == '\0') &&
(def1.elp_knm [0] != '\0' && def2.elp_knm [0] != '\0'))
{
+ //else: both systems reference an ellipsoid - make sure, these are equal
Ptr<MgCoordinateSystemEllipsoid> pEllipsoid1 = pDefinition1->GetEllipsoidDefinition ();
Ptr<MgCoordinateSystemEllipsoid> pEllipsoid2 = pDefinition2->GetEllipsoidDefinition ();
if (!SameEllipsoid (pEllipsoid1,pEllipsoid2))
@@ -335,8 +337,21 @@
}
else
{
- // Type of reference differs.
- return false;
+ if (! ((def1.dat_knm [0] == '\0' && def2.dat_knm [0] == '\0') &&
+ (def1.elp_knm [0] == '\0' && def2.elp_knm [0] == '\0')))
+ {
+ //mishmash... don't compare
+ // Type of reference differs.
+ return false;
+ }
+
+ //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())
+ {
+ return false;
+ }
}
//??// It is true that the unitsmust always match, but not necessarily
More information about the mapguide-commits
mailing list