[mapguide-commits] r7575 - branches/2.5/MgDev/Desktop/MapViewer

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jun 7 02:00:51 PDT 2013


Author: jng
Date: 2013-06-07 02:00:51 -0700 (Fri, 07 Jun 2013)
New Revision: 7575

Modified:
   branches/2.5/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs
Log:
#2248: The mg-desktop legend will still infinite loop on a background thread if we have groups not set to display in the legend. This submission handles this particular case.

Modified: branches/2.5/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs
===================================================================
--- branches/2.5/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs	2013-06-07 08:59:34 UTC (rev 7574)
+++ branches/2.5/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs	2013-06-07 09:00:51 UTC (rev 7575)
@@ -519,34 +519,40 @@
                             node.Expand();
                     }
                 }
+            }
 
-                while (remainingLayers.Count > 0)
+            while (remainingLayers.Count > 0)
+            {
+                List<MgLayerBase> toRemove = new List<MgLayerBase>();
+                for (int j = remainingLayers.Count - 1; j >= 0; j--)
                 {
-                    List<MgLayerBase> toRemove = new List<MgLayerBase>();
-                    for (int j = remainingLayers.Count - 1; j >= 0; j--)
+                    var parentGroup = remainingLayers[j].Group;
+                    var parentId = parentGroup.GetObjectId();
+                    if (nodesById.ContainsKey(parentId))
                     {
-                        var parentId = remainingLayers[j].Group.GetObjectId();
-                        if (nodesById.ContainsKey(parentId))
+                        var node = CreateLayerNode(remainingLayers[j]);
+                        if (node != null)
                         {
-                            var node = CreateLayerNode(remainingLayers[j]);
-                            if (node != null)
-                            {
-                                nodesById[parentId].Nodes.Insert(0, node);
-                                if (remainingLayers[j].ExpandInLegend)
-                                    node.Expand();
-                            }
-                            toRemove.Add(remainingLayers[j]);
+                            nodesById[parentId].Nodes.Insert(0, node);
+                            if (remainingLayers[j].ExpandInLegend)
+                                node.Expand();
                         }
+                        toRemove.Add(remainingLayers[j]);
                     }
-                    //Whittle down this list
-                    if (toRemove.Count > 0)
+                    else
                     {
-                        foreach (var g in toRemove)
-                        {
-                            remainingLayers.Remove(g);
-                        }
+                        if (!parentGroup.GetDisplayInLegend())
+                            toRemove.Add(remainingLayers[j]);
                     }
                 }
+                //Whittle down this list
+                if (toRemove.Count > 0)
+                {
+                    foreach (var g in toRemove)
+                    {
+                        remainingLayers.Remove(g);
+                    }
+                }
             }
 
             //Now expand any relevant groups



More information about the mapguide-commits mailing list