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

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Nov 8 13:22:17 EST 2010


Author: NormOlsen
Date: 2010-11-08 10:22:17 -0800 (Mon, 08 Nov 2010)
New Revision: 5377

Modified:
   trunk/MgDev/Common/CoordinateSystem/CoordSysDictionaryBase.h
   trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.cpp
   trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.h
   trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.cpp
   trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.h
   trunk/MgDev/Common/CoordinateSystem/MentorDictionary.h
Log:
This submission corrects Trac # 1519.

The traditional CS_MAP protection criteria has been applied to the Geodetic Transformation dictionary, thus preventing users from modifying the grid interpolation files in a distribution system. As these specification were in user editable Geodetic Data Catalog (.gdc) files in previous releases, this amounts to a regression. 

The protection system embedded in the CoordinateSystem? Dictionary facility (templatized) was adjusted to allow users to modify distribution and user protected transformation definitions.  An extra parameter has been added to the standard dictionary template functions which enables the calling module to turn off protection.  These template functions are only used internal to the API.  No changes to the exposed API.

Restriction of editing only the grid interpolation file names, directions, and order thereof is accomplished inside of CS-MAP.  Thus, for all transformations other than those of the Grid Interpolation type remains in effect within the MapGuide CoordinateSystem API.



Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysDictionaryBase.h
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysDictionaryBase.h	2010-11-08 14:40:03 UTC (rev 5376)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysDictionaryBase.h	2010-11-08 18:22:17 UTC (rev 5377)
@@ -80,11 +80,11 @@
 
 #define DICTIONARY_BASE_TEMPLATE template <class T /* dictionary entries */, class U /* CS_MAP C type*/, \
     DefinitionAccess<T, U>* definitionAccess, \
-    bool cacheDictionaryEntries, INT32 defaultMagicNumber, const wchar_t* defaultFileName>
+    bool cacheDictionaryEntries, bool checkProtectedOnUpdate, INT32 defaultMagicNumber, const wchar_t* defaultFileName>
 
-#define DICTIONARY_BASE_TEMPLATE_METHOD CCoordinateSystemDictionaryBase<T, U, definitionAccess, cacheDictionaryEntries, defaultMagicNumber, defaultFileName>
-#define DICTIONARY_BASE_TEMPLATE_OBJECT CCoordinateSystemDictionaryBase<T, U, definitionAccess, cacheDictionaryEntries, defaultMagicNumber, defaultFileName>
-#define DICTIONARY_BASE_ENUM_TEMPLATE_METHOD DictionaryBaseEnum<T, U, definitionAccess, cacheDictionaryEntries, defaultMagicNumber, defaultFileName>
+#define DICTIONARY_BASE_TEMPLATE_METHOD CCoordinateSystemDictionaryBase<T, U, definitionAccess, cacheDictionaryEntries, checkProtectedOnUpdate, defaultMagicNumber, defaultFileName>
+#define DICTIONARY_BASE_TEMPLATE_OBJECT CCoordinateSystemDictionaryBase<T, U, definitionAccess, cacheDictionaryEntries, checkProtectedOnUpdate, defaultMagicNumber, defaultFileName>
+#define DICTIONARY_BASE_ENUM_TEMPLATE_METHOD DictionaryBaseEnum<T, U, definitionAccess, cacheDictionaryEntries, checkProtectedOnUpdate, defaultMagicNumber, defaultFileName>
 
 namespace CSLibrary
 {

Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.cpp	2010-11-08 14:40:03 UTC (rev 5376)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.cpp	2010-11-08 18:22:17 UTC (rev 5377)
@@ -59,7 +59,7 @@
     : m_pDictionary(NULL)
 {
     this->m_pDictionary = new CCoordinateSystemDictionaryBase<CCoordinateSystemGeodeticPath, cs_GeodeticPath_,
-        &definitionAccess, true, cs_GPDEF_MAGIC, DICTIONARY_FILE_NAME(GeodeticPath)>(pCatalog);
+        &definitionAccess, true, true, cs_GPDEF_MAGIC, DICTIONARY_FILE_NAME(GeodeticPath)>(pCatalog);
 }
 
 CCoordinateSystemGeodeticPathDictionary::~CCoordinateSystemGeodeticPathDictionary()

Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.h
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.h	2010-11-08 14:40:03 UTC (rev 5376)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticPathDictionary.h	2010-11-08 18:22:17 UTC (rev 5377)
@@ -64,7 +64,7 @@
 
     protected:
 
-        CCoordinateSystemDictionaryBase<CCoordinateSystemGeodeticPath, cs_GeodeticPath_, &definitionAccess, true, cs_GPDEF_MAGIC, DICTIONARY_FILE_NAME(GeodeticPath)>* m_pDictionary;
+        CCoordinateSystemDictionaryBase<CCoordinateSystemGeodeticPath, cs_GeodeticPath_, &definitionAccess, true, true, cs_GPDEF_MAGIC, DICTIONARY_FILE_NAME(GeodeticPath)>* m_pDictionary;
 
     public:
 

Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.cpp
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.cpp	2010-11-08 14:40:03 UTC (rev 5376)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.cpp	2010-11-08 18:22:17 UTC (rev 5377)
@@ -58,7 +58,7 @@
     : m_pDictionary(NULL)
 {
     this->m_pDictionary = new CCoordinateSystemDictionaryBase<CCoordinateSystemGeodeticTransformDef, cs_GeodeticTransform_,
-        &transformDefinitionAccess, true, cs_GXDEF_MAGIC, DICTIONARY_FILE_NAME(GeodeticTransformation)>(pCatalog);
+        &transformDefinitionAccess, true, false, cs_GXDEF_MAGIC, DICTIONARY_FILE_NAME(GeodeticTransformation)>(pCatalog);
 }
 
 CCoordinateSystemGeodeticTransformDefDictionary::~CCoordinateSystemGeodeticTransformDefDictionary()

Modified: trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.h
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.h	2010-11-08 14:40:03 UTC (rev 5376)
+++ trunk/MgDev/Common/CoordinateSystem/CoordSysGeodeticTransformDefDictionary.h	2010-11-08 18:22:17 UTC (rev 5377)
@@ -59,7 +59,7 @@
 
     protected:
 
-        CCoordinateSystemDictionaryBase<CCoordinateSystemGeodeticTransformDef, cs_GeodeticTransform_, &transformDefinitionAccess, true, cs_GXDEF_MAGIC, DICTIONARY_FILE_NAME(GeodeticTransformation)>* m_pDictionary;
+        CCoordinateSystemDictionaryBase<CCoordinateSystemGeodeticTransformDef, cs_GeodeticTransform_, &transformDefinitionAccess, true, false, cs_GXDEF_MAGIC, DICTIONARY_FILE_NAME(GeodeticTransformation)>* m_pDictionary;
 
     public:
 

Modified: trunk/MgDev/Common/CoordinateSystem/MentorDictionary.h
===================================================================
--- trunk/MgDev/Common/CoordinateSystem/MentorDictionary.h	2010-11-08 14:40:03 UTC (rev 5376)
+++ trunk/MgDev/Common/CoordinateSystem/MentorDictionary.h	2010-11-08 18:22:17 UTC (rev 5377)
@@ -123,6 +123,22 @@
         Tinterface *kpDef,
         bool bAlreadyExists)
     {
+        return UpdateDef(pmapSystemNameDescription, key, description, isValid, CS_Tdef, CS_Tupd, BuildDefFromInterface, kpDef, bAlreadyExists, true);
+    }
+
+    template <class T, class Tinterface>
+    void UpdateDef(
+        CSystemNameDescriptionMap *pmapSystemNameDescription,
+        const char * (*key)(const T&),
+        const char * (*description)(const T&),
+        bool (Tinterface::*isValid)(),
+        T * (*CS_Tdef)(const char *),
+        int (*CS_Tupd)(T *, int),
+        bool (*BuildDefFromInterface)(Tinterface *, T&),
+        Tinterface *kpDef,
+        bool bAlreadyExists,
+        bool verifyNotProtected)
+    {
         assert(NULL != kpDef);
         if (NULL == kpDef)
         {
@@ -185,10 +201,13 @@
             throw new MgCoordinateSystemLoadFailedException(L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, &arguments, L"", NULL);
         }
 
-        //If it already exists, make sure it's not protected.
-        if ((bAlreadyExists) && (IsReallyProtected(sProtect)))
+        if (verifyNotProtected)
         {
-            throw new MgCoordinateSystemInitializationFailedException(L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+            //If it already exists, make sure it's not protected.
+            if ((bAlreadyExists) && (IsReallyProtected(sProtect)))
+            {
+                throw new MgCoordinateSystemInitializationFailedException(L"MentorDictionary.UpdateDef", __LINE__, __WFILE__, NULL, L"MgCoordinateSystemProtectedException", NULL);
+            }
         }
 
         //Find out whether it's encrypted



More information about the mapguide-commits mailing list