[mapguide-commits] r1054 - trunk/MgDev/Common/MapGuideCommon/MapLayer

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Jan 16 13:35:22 EST 2007


Author: waltweltonlair
Date: 2007-01-16 13:35:22 -0500 (Tue, 16 Jan 2007)
New Revision: 1054

Modified:
   trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp
   trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.h
Log:
In MgMap::Save the map object is serialized (the call to SerializeToRepository)
and then the code calls PackLayersAndGroups.  But MgMap::Serialize also calls
PackLayersAndGroups, so it ends up getting called twice.  Fixed the code so it
only calls the method once.

Also updated the serialization version in MgMap.  My previous submission (r1053)
introduced a breaking change into the serialization, so this should be reflected
in the version.


Modified: trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp	2007-01-16 13:57:15 UTC (rev 1053)
+++ trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp	2007-01-16 18:35:22 UTC (rev 1054)
@@ -717,17 +717,25 @@
     }
 
     // Serialize Layers and Groups as a blob.
-    Ptr<MgMemoryStreamHelper> streamHelper = PackLayersAndGroups();
-    if (m_inSave || NULL == (MgMemoryStreamHelper*) streamHelper)
+    if (m_inSave)
     {
-        // Data has not changed.  Do not serialize.  And never serialize blob when saving.
+        // Never serialize blob when saving.
         stream->WriteInt32(0);
     }
     else
     {
-        stream->WriteInt32(streamHelper->GetLength());
-        Ptr<MgStreamHelper> helper = stream->GetStreamHelper();
-        helper->WriteBytes((const unsigned char*) streamHelper->GetBuffer(), streamHelper->GetLength());
+        Ptr<MgMemoryStreamHelper> streamHelper = PackLayersAndGroups();
+        if (NULL == (MgMemoryStreamHelper*) streamHelper)
+        {
+           // Data has not changed.  Do not serialize.
+           stream->WriteInt32(0);
+        }
+        else
+        {
+           stream->WriteInt32(streamHelper->GetLength());
+           Ptr<MgStreamHelper> helper = stream->GetStreamHelper();
+           helper->WriteBytes((const unsigned char*) streamHelper->GetBuffer(), streamHelper->GetLength());
+        }
     }
 }
 

Modified: trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.h	2007-01-16 13:57:15 UTC (rev 1053)
+++ trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.h	2007-01-16 18:35:22 UTC (rev 1054)
@@ -471,7 +471,7 @@
 private:
 
     // Version for serialization 
-    static const int m_serializeVersion = (2<<16) + 0;
+    static const int m_serializeVersion = (3<<16) + 0;
 
     static STRING m_layerGroupTag;
     Ptr<MgMemoryStreamHelper> m_layerGroupHelper;



More information about the mapguide-commits mailing list