[mapguide-commits] r7013 - in branches/maestro-4.0.x: Maestro Maestro.Editors/MapDefinition
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Sep 13 09:42:05 PDT 2012
Author: jng
Date: 2012-09-13 09:42:05 -0700 (Thu, 13 Sep 2012)
New Revision: 7013
Modified:
branches/maestro-4.0.x/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
branches/maestro-4.0.x/Maestro/changelog.txt
Log:
#2115: Prevent drops of groups into child groups. Similarly, prevent drops of groups onto child layers. Also fix inability to move tiled layers between different base layer groups
Modified: branches/maestro-4.0.x/Maestro/changelog.txt
===================================================================
--- branches/maestro-4.0.x/Maestro/changelog.txt 2012-09-13 16:34:42 UTC (rev 7012)
+++ branches/maestro-4.0.x/Maestro/changelog.txt 2012-09-13 16:42:05 UTC (rev 7013)
@@ -2,6 +2,8 @@
-----
- Use UNIQUE() for fetching distinct values in Expression Editor
- Fix: Duplicating vector scale ranges not creating true clones
+ - Fix: Prevent Map Definition groups from being dragged and dropped into its child groups/layers
+ - Fix: Allow tiled layers to be moved between different tiled layer groups
4.0.2
-----
Modified: branches/maestro-4.0.x/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
===================================================================
--- branches/maestro-4.0.x/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs 2012-09-13 16:34:42 UTC (rev 7012)
+++ branches/maestro-4.0.x/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs 2012-09-13 16:42:05 UTC (rev 7013)
@@ -275,8 +275,11 @@
private void btnAddGroup_Click(object sender, EventArgs e)
{
- var selGroup = GetSelectedLayerGroupItem() as IMapLayerGroup;
- var newGroup = CreateNewGroup(selGroup);
+ var selGroup = GetSelectedLayerGroupItem() as GroupItem;
+ IMapLayerGroup parent = null;
+ if (selGroup != null)
+ parent = selGroup.Tag;
+ var newGroup = CreateNewGroup(parent);
_grpLayerModel.Invalidate();
RestoreGroupSelection(newGroup);
@@ -1040,9 +1043,17 @@
var gi = node.Tag as GroupItem;
var li = node.Tag as LayerItem;
if (gi != null)
+ {
+ if (TargetIsDescendant(nodes, gi))
+ return;
+
parent = gi.Tag;
+ }
else if (li != null)
- parent = _map.GetGroupByName(li.Tag.Group);
+ {
+ return;
+ //parent = _map.GetGroupByName(li.Tag.Group);
+ }
}
int moved = 0;
@@ -1076,6 +1087,27 @@
}
}
+ private bool TargetIsDescendant(TreeNodeAdv[] nodes, GroupItem target)
+ {
+ foreach (var n in nodes)
+ {
+ var gi = n.Tag as GroupItem;
+ if (gi != null)
+ {
+ var grp = target.Tag;
+ while (!string.IsNullOrEmpty(grp.Group))
+ {
+ var parent = _map.GetGroupByName(grp.Group);
+ if (parent == gi.Tag)
+ return true;
+
+ grp = parent;
+ }
+ }
+ }
+ return false;
+ }
+
private void trvLayersGroup_DragOver(object sender, DragEventArgs e)
{
var data = e.Data.GetData(typeof(TreeNodeAdv[])) as TreeNodeAdv[];
@@ -1094,6 +1126,7 @@
}
else
{
+
e.Effect = DragDropEffects.Move;
}
}
@@ -1293,9 +1326,21 @@
targetGroup = tlg.Tag;
}
- if (sourceLayer != null && targetLayer != null && sourceLayer != targetLayer)
+ if (sourceLayer != null && targetGroup != null && targetGroup.GetIndex(sourceLayer) < 0) //Dropping to a different base layer group
{
var srcGroup = _map.BaseMap.GetGroupForLayer(sourceLayer);
+ srcGroup.RemoveBaseMapLayer(sourceLayer);
+ targetGroup.InsertLayer(0, sourceLayer);
+
+ _tiledLayerModel.Invalidate();
+
+ //Keep group expanded
+ if (tli != null)
+ RestoreBaseLayerSelection(sourceLayer);
+ }
+ else if (sourceLayer != null && targetLayer != null && sourceLayer != targetLayer)
+ {
+ var srcGroup = _map.BaseMap.GetGroupForLayer(sourceLayer);
var dstGroup = _map.BaseMap.GetGroupForLayer(targetLayer);
if (srcGroup != null)
More information about the mapguide-commits
mailing list