[mapguide-commits] r7388 - in trunk/Tools/Maestro: MaestroAPITests OSGeo.MapGuide.MaestroAPI/Mapping OSGeo.MapGuide.MaestroAPI.Local

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Feb 22 08:39:18 PST 2013


Author: jng
Date: 2013-02-22 08:39:18 -0800 (Fri, 22 Feb 2013)
New Revision: 7388

Modified:
   trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalRuntimeMap.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapGroup.cs
Log:
#2220: Fix group parentage not being assigned when creating RuntimeMap. Patch by Gunter Becker, test cases by me, which exposed the same shortcoming in the LocalRuntimeMapGroup, which is also fixed as well.

Modified: trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs	2013-02-22 15:55:09 UTC (rev 7387)
+++ trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs	2013-02-22 16:39:18 UTC (rev 7388)
@@ -115,6 +115,28 @@
 
         protected abstract IServerConnection CreateTestConnection();
 
+        public virtual void TestGroupAssignment()
+        {
+            var resSvc = _conn.ResourceService;
+            var mdf = resSvc.GetResource("Library://UnitTests/Maps/Sheboygan.MapDefinition") as IMapDefinition;
+            Assert.NotNull(mdf);
+            var gdf1 = mdf.AddGroup("Group1");
+            var gdf2 = mdf.AddGroup("Group2");
+            gdf2.Group = gdf1.Name;
+            resSvc.SaveResourceAs(mdf, "Session:" + _conn.SessionID + "//TestGroupAssignment.MapDefinition");
+            mdf.ResourceID = "Session:" + _conn.SessionID + "//TestGroupAssignment.MapDefinition";
+
+            var mapSvc = _conn.GetService((int)ServiceType.Mapping) as IMappingService;
+            Assert.NotNull(mapSvc);
+
+            var map = mapSvc.CreateMap("Session:" + _conn.SessionID + "//TestGroupAssignment.Map", mdf, 1.0);
+            foreach(var grp in mdf.MapLayerGroup)
+            {
+                var rtGrp = mapSvc.CreateMapGroup(map, grp);
+                Assert.AreEqual(rtGrp.Group, grp.Group);
+            }
+        }
+
         public virtual void TestExtentSerialization()
         {
             var resSvc = _conn.ResourceService;
@@ -1159,6 +1181,12 @@
         }
 
         [Test]
+        public override void TestGroupAssignment()
+        {
+            base.TestGroupAssignment();
+        }
+
+        [Test]
         public override void TestExtentSerialization()
         {
             base.TestExtentSerialization();
@@ -1257,6 +1285,12 @@
         }
 
         [Test]
+        public override void TestGroupAssignment()
+        {
+            base.TestGroupAssignment();
+        }
+
+        [Test]
         public override void TestExtentSerialization()
         {
             base.TestExtentSerialization();
@@ -1350,6 +1384,12 @@
             }
         }
 
+        [Test]
+        public override void TestGroupAssignment()
+        {
+            base.TestGroupAssignment();
+        }
+
         /*
         [Test]
         public override void TestExtentSerialization()

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapGroup.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapGroup.cs	2013-02-22 15:55:09 UTC (rev 7387)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMapGroup.cs	2013-02-22 16:39:18 UTC (rev 7388)
@@ -68,6 +68,7 @@
         {
             _disableChangeTracking = true;
 
+            this.Group = group.Group;
             this.ExpandInLegend = group.ExpandInLegend;
             this.LegendLabel = group.LegendLabel;
             this.ShowInLegend = group.ShowInLegend;

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs	2013-02-22 15:55:09 UTC (rev 7387)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs	2013-02-22 16:39:18 UTC (rev 7388)
@@ -1120,6 +1120,18 @@
             rtGroup.LegendLabel = group.LegendLabel;
             rtGroup.Visible = group.Visible;
 
+            var implMap = impl.GetWrappedInstance();
+            var groups = implMap.GetLayerGroups();
+            if (!string.IsNullOrEmpty(group.Group))
+            {
+                int idx = groups.IndexOf(group.Group);
+                if (idx >= 0)
+                {
+                    var parentGrp = groups.GetItem(idx);
+                    rtGroup.Group = parentGrp;
+                }
+            }
+
             return new LocalRuntimeMapGroup(impl, rtGroup);
         }
 

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalRuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalRuntimeMap.cs	2013-02-22 15:55:09 UTC (rev 7387)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalRuntimeMap.cs	2013-02-22 16:39:18 UTC (rev 7388)
@@ -324,7 +324,7 @@
                 var grp = _impl.Group;
                 if (grp != null)
                     return grp.Name;
-                return null;
+                return string.Empty;
             }
             set
             {



More information about the mapguide-commits mailing list