[mapguide-commits] r7587 - trunk/MgDev/Desktop/MapViewer
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sun Jun 9 06:45:17 PDT 2013
Author: jng
Date: 2013-06-09 06:45:16 -0700 (Sun, 09 Jun 2013)
New Revision: 7587
Modified:
trunk/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs
Log:
Copy entire updated MgLegendControlPresenter to trunk, this includes the fix for #2288 and the fixes for draw ordering and infinite loops.
Modified: trunk/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs
===================================================================
--- trunk/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs 2013-06-09 13:23:35 UTC (rev 7586)
+++ trunk/MgDev/Desktop/MapViewer/MgLegendControlPresenter.cs 2013-06-09 13:45:16 UTC (rev 7587)
@@ -494,7 +494,7 @@
for (int i = layerCount - 1; i >= 0; i--)
{
var layer = layers.GetItem(i);
-
+
bool display = layer.DisplayInLegend;
bool visible = _provider.IsLayerPotentiallyVisibleAtScale(layer, false);
if (!display)
@@ -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
@@ -882,7 +888,7 @@
{
base.IsGroup = false;
this.Layer = layer;
- this.Checkable = (layer.Group != null && layer.Group.LayerGroupType == MgLayerGroupType.Normal);
+ this.Checkable = (layer.LayerType != MgLayerType.BaseMap);
this.IsSelectable = (layer != null) ? layer.Selectable : false;
this.DrawSelectabilityIcon = (layer != null && bInitiallySelectable);
this.WasInitiallySelectable = bInitiallySelectable;
@@ -1083,4 +1089,4 @@
}
}
}
-}
+}
\ No newline at end of file
More information about the mapguide-commits
mailing list