[mapguide-commits] r5478 - in trunk/MgDev/Common: CoordinateSystem Geometry/CoordinateSystem

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun Dec 19 13:44:30 EST 2010


Author: baertelchen
Date: 2010-12-19 10:44:30 -0800 (Sun, 19 Dec 2010)
New Revision: 5478

Modified:
   trunk/MgDev/Common/CoordinateSystem/CoordSys.cpp
   trunk/MgDev/Common/Geometry/CoordinateSystem/CoordinateSystem.h
Log:
Fix for ticket 1576 "Values set via MgCoordinateSystem::SetLonLatBounds() are not written back to CsMap's dictionary for user defined systems" (http://trac.osgeo.org/mapguide/ticket/1576)

The MgCoordinateSystem class has an API "SetLonLatBounds". This allows for dynamically setting a range in which coordinates are valid for the respective system. If switched on (by default, or by calling this method with a set of valid parameters), CsMap will fail or at least set a warning, when a coordinate transformation is done with input values that do not fall within the range specified.

The API did only set the values passed in on the internally held [cs_Csprm_] struct (that's being used for conversion) - and not on the coordinate system definition, that's being saved to disk. Since CsMap 13.00, most of the default dictionary entries have valid ranges set. Before this submission, it was simply not possible to store valid ranges with a custom coordinate system definition.

There's only 1 code change in [CCoordinateSystem::SetLonLatBounds()]: The min/max lat/long values are now also set on the [m_csprm.csdef.ll_*] struct so that this information also gets written to disk when the (custom) coordinate system definition is stored. I've also added a documentation for the methods in [MgCoordinateSystem] that deal with the min/max lat/long stuff.

Modified: trunk/MgDev/Common/CoordinateSystem/CoordSys.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSys.cpp	2010-12-17 17:29:46 UTC (rev 5477)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSys.cpp	2010-12-19 18:44:30 UTC (rev 5478)
@@ -2399,6 +2399,12 @@
     m_csprm.max_ll[0] = dLonMax - m_csprm.cent_mer;
     m_csprm.max_ll[1] = dLatMax;
 
+    m_csprm.csdef.ll_min[0] = m_csprm.min_ll[0];
+    m_csprm.csdef.ll_min[1] = m_csprm.min_ll[1];
+    
+    m_csprm.csdef.ll_max[0] = m_csprm.max_ll[0];
+    m_csprm.csdef.ll_max[1] = m_csprm.max_ll[1];
+
     MG_CATCH_AND_THROW(L"MgCoordinateSystem.SetLonLatBounds")
 }
 
@@ -2415,6 +2421,8 @@
         throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystem.CancelLonLatBounds", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
     }
 
+    //it will only be set on CsMap's transformation struct, i.e.
+    //not on [m_csprm.csdef.ll_*]
     m_csprm.min_ll[0] = 0.0;
     m_csprm.min_ll[1] = 0.0;
     m_csprm.max_ll[0] = 0.0;

Modified: trunk/MgDev/Common/Geometry/CoordinateSystem/CoordinateSystem.h
===================================================================
--- trunk/MgDev/Common/Geometry/CoordinateSystem/CoordinateSystem.h	2010-12-17 17:29:46 UTC (rev 5477)
+++ trunk/MgDev/Common/Geometry/CoordinateSystem/CoordinateSystem.h	2010-12-19 18:44:30 UTC (rev 5478)
@@ -24,6 +24,9 @@
 class MgCoordinateSystemMeasure;
 class MgCoordinateSystemEnumInteger32;
 
+/// \defgroup MgCoordinateSystem MgCoordinateSystem
+/// \ingroup Coordinate_System_classes
+/// \{
 class MgCoordinateSystem : public MgGuardDisposable
 {
     DECLARE_CLASSNAME(MgCoordinateSystem)
@@ -112,12 +115,83 @@
     virtual double GetZeroX()=0;
     virtual double GetZeroY()=0;
     virtual void SetZeroes(double dXZero, double dYZero)=0;
+    
+    
+    ///////////////////////////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns this system's minimum longitude value in degrees. If not set in the dictionary, 
+    /// the value returned here has been calculated by the underlying coordinate system
+    /// transformation engine. 
+    /// \return
+    /// Returns this system's minimum longitude value in degrees. Only returns 0 (if it's not the
+    /// actual value) if explicitely set via SetLonLatBounds or CancelLonLatBounds.
     virtual double GetLonMin()=0;
+    
+    ///////////////////////////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns this system's maximum longitude value in degrees. If not set in the dictionary, 
+    /// the value returned here has been calculated by the underlying coordinate system
+    /// transformation engine. 
+    /// \return
+    /// Returns this system's minimum longitude value in degrees. Only returns 0 (if it's not the
+    /// actual value) if explicitely set via SetLonLatBounds or CancelLonLatBounds.
     virtual double GetLonMax()=0;
+    
+    ///////////////////////////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns this system's minimum latitude value in degrees. If not set in the dictionary, 
+    /// the value returned here has been calculated by the underlying coordinate system
+    /// transformation engine. 
+    /// \return
+    /// Returns this system's minimum longitude value in degrees. Only returns 0 (if it's not the
+    /// actual value) if explicitely set via SetLonLatBounds or CancelLonLatBounds.
     virtual double GetLatMin()=0;
+    
+    ///////////////////////////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Returns this system's maximum latitude value in degrees. If not set in the dictionary, 
+    /// the value returned here has been calculated by the underlying coordinate system
+    /// transformation engine. 
+    /// \return
+    /// Returns this system's minimum longitude value in degrees. Only returns 0 (if it's not the
+    /// actual value) if explicitely set via SetLonLatBounds or CancelLonLatBounds.
     virtual double GetLatMax()=0;
+    
+    ///////////////////////////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Allows to set the min/max longitude and latitude values in degrees this coordinate system is valid in.
+    /// This method must only be called on systems that are not protected.
+    /// When setting these values, the coordinate system API will perform the following actions:
+    ///
+    /// \li (Re-)enable valid range checking: When converting coordinates, the values are checked to fall
+    ///     in the valid range as specified here
+    /// \li Save the values for later storage: When eventually writing this coordinate system to the
+    ///     dictionary, the values will be written, too.
+    ///
+    /// \param dLonMin
+    /// The minimum longitude value
+    /// \param dLatMin
+    /// The minimum latitude value
+    /// \param dLonMax
+    /// The maximum longitude value
+    /// \param dLatMax
+    /// The maximum latitude value
+    ///    
+    /// \return
+    /// Nothing
     virtual void SetLonLatBounds(double dLonMin, double dLatMin, double dLonMax, double dLatMax)=0;
+    
+    ///////////////////////////////////////////////////////////////////////////////////////////////
+    /// \brief
+    /// Cancels only the range checking for coordinate transformations, if it has been enabled
+    /// via SetLonLatBounds before. Specifically, calling this method does not reset the
+    /// min/max values on the coordinate system definition itself. That is, when eventually writing
+    /// this object to the dictionary, the min/max values will be written, too.
+    ///
+    /// \return
+    /// Nothing
     virtual void CancelLonLatBounds()=0;
+    
     virtual void SetXYBounds(double dXMin, double dYMin, double dXMax, double dYMax)=0;
     virtual void CancelXYBounds()=0;
     virtual INT16 GetQuadrant()=0;
@@ -266,4 +340,6 @@
     static const INT32 m_cls_id = CoordinateSystem_CoordinateSystem;
 };
 
+/// \}
+
 #endif //_MGCOORDINATESYSTEM_H_



More information about the mapguide-commits mailing list