[mapguide-commits] r6299 - in trunk/Tools/Maestro: Maestro.Base/UI OSGeo.MapGuide.MaestroAPI OSGeo.MapGuide.MaestroAPI/Mapping

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Dec 6 09:30:49 EST 2011


Author: jng
Date: 2011-12-06 06:30:49 -0800 (Tue, 06 Dec 2011)
New Revision: 6299

Modified:
   trunk/Tools/Maestro/Maestro.Base/UI/ProfilingDialog.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SiteVersion.cs
Log:
#1881: The problem was that AIMS 2012 introduced new fields (WatermarkUsage) that require serialization to the runtime map state blob. Because the current RuntimeMap knew nothing about this, it was MgInvalidStreamHeaderException galore as the blob we save back lacks this value. Also it seems AIMS 2012 also required the Map Definition of a runtime map state blob to actually exist. This submission updates the profiling code and the RuntimeMap class to address these two issues. The version number of AIMS 2012 has also been included to KnownSiteVersions as we have to do a site version check to determine if WatermarkUsage requires serialization/deserialization

Modified: trunk/Tools/Maestro/Maestro.Base/UI/ProfilingDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Base/UI/ProfilingDialog.cs	2011-12-06 11:07:58 UTC (rev 6298)
+++ trunk/Tools/Maestro/Maestro.Base/UI/ProfilingDialog.cs	2011-12-06 14:30:49 UTC (rev 6299)
@@ -98,7 +98,8 @@
                 m.CoordinateSystem = @"LOCAL_CS[""*XY-M*"", LOCAL_DATUM[""*X-Y*"", 10000], UNIT[""Meter"", 1], AXIS[""X"", EAST], AXIS[""Y"", NORTH]]";
                 m.SetExtents(-1, -1, 1, 1);
 
-                m.ResourceID = "Library://non-existing.MapDefinition";
+                //AIMS 2012 demands this checks out. Can't flub it anymore
+                m.ResourceID = "Session:" + m_connection.SessionID + "//non-existing.MapDefinition";
                 var mpsvc = (IMappingService)m_connection.GetService((int)ServiceType.Mapping);
                 var rid = new ResourceIdentifier(Guid.NewGuid().ToString(), ResourceTypes.RuntimeMap, m_connection.SessionID);
 
@@ -125,7 +126,9 @@
                 try
                 {
                     IMapDefinition mdef = ObjectFactory.CreateMapDefinition(m_connection, "");
-                    mdef.ResourceID = "Library://ProfileTest.MapDefinition"; //Flub it
+                    //We cannot flub this anymore. AIMS 2012 demands the Map Definition id specified checks out
+                    mdef.ResourceID = "Session:" + m_connection.SessionID + "//ProfileTest.MapDefinition";
+                    m_connection.ResourceService.SaveResource(mdef);
                     IMapLayer layer = mdef.AddLayer(null, "Test Layer", ldef.ResourceID);
                     layer.Visible = false;
                     layer.Selectable = false;
@@ -209,8 +212,9 @@
                                 SetTempLayer(mdf, tmp1);
                                 
                                 var mpsvc = (IMappingService)m_connection.GetService((int)ServiceType.Mapping);
-
-                                mdf.ResourceID = "Library://ProfileTest.MapDefinition"; //Flub it
+                                //We cannot flub this anymore. AIMS 2012 demands the Map Definition id specified checks out
+                                mdf.ResourceID = "Session:" + m_connection.SessionID + "//ProfileTest.MapDefinition";
+                                m_connection.ResourceService.SaveResource(mdf);
                                 var rtmap = mpsvc.CreateMap(mdf);
 
                                 if (m_connection.ResourceService.ResourceExists(rtmap.ResourceID))
@@ -332,8 +336,9 @@
                 if (backgroundWorker.CancellationPending)
                     return;
 
-                //Flub for runtime map creation
-                mdef.ResourceID = "Library://ProfilingTest.MapDefinition";
+                //We cannot flub this anymore. AIMS 2012 demands the Map Definition id specified checks out
+                mdef.ResourceID = "Session:" + m_connection.SessionID + "//ProfilingTest.MapDefinition";
+                m_connection.ResourceService.SaveResource(mdef);
 
                 var rtmap = mpsvc.CreateMap(mdef);
 

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs	2011-12-06 11:07:58 UTC (rev 6298)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs	2011-12-06 14:30:49 UTC (rev 6299)
@@ -152,7 +152,8 @@
         internal RuntimeMap(IServerConnection conn)
         {
             _disableChangeTracking = true;
-            
+
+            this.WatermarkUsage = (int)WatermarkUsageType.Viewer;
             this.SiteVersion = conn.SiteVersion;
             this.SessionId = conn.SessionID;
             this.ObjectId = Guid.NewGuid().ToString();
@@ -585,6 +586,15 @@
         }
 
         /// <summary>
+        /// Gets the watermark usage. Not applicable for version of MapGuide older than 2.3
+        /// </summary>
+        public int WatermarkUsage
+        {
+            get;
+            private set;
+        }
+
+        /// <summary>
         /// MapGuide internal value
         /// </summary>
         protected const int MgBinaryVersion = 262144; //1;
@@ -643,6 +653,10 @@
             if (s.SiteVersion >= SiteVersions.GetVersion(KnownSiteVersions.MapGuideOS1_2))
             {
                 SerializeChangeMap(s);
+                if (s.SiteVersion >= new Version(2, 3)) //SiteVersions.GetVersion(KnownSiteVersions.MapGuideEP2012))
+                {
+                    s.Write(this.WatermarkUsage);
+                }
                 s.Write((int)0);
             }
             else
@@ -652,6 +666,12 @@
             }
         }
 
+        enum WatermarkUsageType
+        {
+            WMS = 1,
+            Viewer = 2
+        }
+
         private static void SerializeExtent(IEnvelope env, MgBinarySerializer s)
         {
             if (s.SiteVersion <= SiteVersions.GetVersion(KnownSiteVersions.MapGuideEP1_1))
@@ -817,6 +837,11 @@
                 m_changeList = DeserializeChangeMap(d);
             }
 
+            if (d.SiteVersion >= SiteVersions.GetVersion(KnownSiteVersions.MapGuideEP2012))
+            {
+                this.WatermarkUsage = d.ReadInt32();
+            }
+
             _disableChangeTracking = false;
         }
 

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SiteVersion.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SiteVersion.cs	2011-12-06 11:07:58 UTC (rev 6298)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/SiteVersion.cs	2011-12-06 14:30:49 UTC (rev 6299)
@@ -90,6 +90,10 @@
         /// MapGuide Open Source 2.2.0
         /// </summary>
         MapGuideOS2_2,
+        /// <summary>
+        /// Autodesk Infrastructure Map Server 2012
+        /// </summary>
+        MapGuideEP2012,
 	}
 
     /// <summary>
@@ -118,6 +122,7 @@
             new Version(2,2,0,5305),    //MGE 2011
             new Version(2,2,0,6001),    //MGE 2011 Update 1
             new Version(2,2,0,5703),    //MGOS 2.2.0
+            new Version(2,3,0,4202),    //AIMS 2012
 		};
 
         /// <summary>



More information about the mapguide-commits mailing list