[mapguide-commits] r7577 - trunk/Tools/Maestro/Maestro.MapViewer
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Jun 7 02:07:11 PDT 2013
Author: jng
Date: 2013-06-07 02:07:10 -0700 (Fri, 07 Jun 2013)
New Revision: 7577
Modified:
trunk/Tools/Maestro/Maestro.MapViewer/LegendPresenter.cs
Log:
#2248: The Maestro MapViewer 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: trunk/Tools/Maestro/Maestro.MapViewer/LegendPresenter.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.MapViewer/LegendPresenter.cs 2013-06-07 09:04:00 UTC (rev 7576)
+++ trunk/Tools/Maestro/Maestro.MapViewer/LegendPresenter.cs 2013-06-07 09:07:10 UTC (rev 7577)
@@ -530,36 +530,44 @@
node.Expand();
}
}
+ }
- //Process parented layers
- while (remainingLayers.Count > 0)
+ //Process parented layers
+ while (remainingLayers.Count > 0)
+ {
+ List<RuntimeMapLayer> toRemove = new List<RuntimeMapLayer>();
+ for (int j = remainingLayers.Count - 1; j >= 0; j--)
{
- List<RuntimeMapLayer> toRemove = new List<RuntimeMapLayer>();
- for (int j = remainingLayers.Count - 1; j >= 0; j--)
+ var grpName = remainingLayers[j].Group;
+ var parentGroup = _map.Groups[grpName];
+ if (parentGroup != null)
{
- var grpName = remainingLayers[j].Group;
- var parentGroup = _map.Groups[grpName];
- if (parentGroup != null && nodesById.ContainsKey(parentGroup.ObjectId))
+ if (nodesById.ContainsKey(parentGroup.ObjectId))
{
var node = CreateLayerNode(remainingLayers[j]);
if (node != null)
{
- nodesById[parentGroup.ObjectId].Nodes.Insert(0, node);
+ nodesById[parentGroup.ObjectId].Nodes.Add(node); //.Insert(0, node);
if (remainingLayers[j].ExpandInLegend)
node.Expand();
}
toRemove.Add(remainingLayers[j]);
}
- }
- //Whittle down this list
- if (toRemove.Count > 0)
- {
- foreach (var g in toRemove)
+ else //Group may not even be set to show in legend. Check for this
{
- remainingLayers.Remove(g);
+ if (!parentGroup.ShowInLegend)
+ 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