[mapguide-commits] r7511 - branches/2.5/MgDev/Desktop/MapViewer
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue May 21 08:05:39 PDT 2013
Author: jng
Date: 2013-05-21 08:05:39 -0700 (Tue, 21 May 2013)
New Revision: 7511
Modified:
branches/2.5/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs
Log:
mg-desktop: The fix for #2248 was not the proper fix. This is the right one.
Modified: branches/2.5/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs
===================================================================
--- branches/2.5/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs 2013-05-21 15:03:29 UTC (rev 7510)
+++ branches/2.5/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs 2013-05-21 15:05:39 UTC (rev 7511)
@@ -384,35 +384,36 @@
nodesById.Add(group.GetObjectId(), node);
groupsById.Add(group.GetObjectId(), node);
}
+ }
- //Process child groups
- while (remainingNodes.Count > 0)
+ //Process child groups
+ while (remainingNodes.Count > 0)
+ {
+ List<MgLayerGroup> toRemove = new List<MgLayerGroup>();
+ //Establish parent-child relationship for any child groups here
+ for (int j = 0; j < remainingNodes.Count; j++)
{
- List<MgLayerGroup> toRemove = new List<MgLayerGroup>();
- //Establish parent-child relationship for any child groups here
- for (int j = 0; j < remainingNodes.Count; j++)
+ var parentId = remainingNodes[j].Group.GetObjectId();
+ if (nodesById.ContainsKey(parentId))
{
- var parentId = remainingNodes[j].Group.GetObjectId();
- if (nodesById.ContainsKey(parentId))
- {
- var node = CreateGroupNode(remainingNodes[j]);
- nodesById[parentId].Nodes.Add(node);
+ MgLayerGroup grp = remainingNodes[j];
+ var node = CreateGroupNode(grp);
+ nodesById[parentId].Nodes.Add(node);
- //Got to add this group node too, otherwise we could infinite
- //loop looking for a parent that's not registered
- nodesById.Add(group.GetObjectId(), node);
- groupsById.Add(group.GetObjectId(), node);
+ //Got to add this group node too, otherwise we could infinite
+ //loop looking for a parent that's not registered
+ nodesById.Add(grp.GetObjectId(), node);
+ groupsById.Add(grp.GetObjectId(), node);
- toRemove.Add(remainingNodes[j]);
- }
+ toRemove.Add(grp);
}
- //Whittle down this list
- if (toRemove.Count > 0)
+ }
+ //Whittle down this list
+ if (toRemove.Count > 0)
+ {
+ foreach (var g in toRemove)
{
- foreach (var g in toRemove)
- {
- remainingNodes.Remove(g);
- }
+ remainingNodes.Remove(g);
}
}
}
More information about the mapguide-commits
mailing list