[mapguide-commits] r6016 - in trunk/Tools/Maestro: Maestro.Editors/MapDefinition OSGeo.MapGuide.MaestroAPI/ObjectModels

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Aug 1 06:11:19 EDT 2011


Author: jng
Date: 2011-08-01 03:11:19 -0700 (Mon, 01 Aug 2011)
New Revision: 6016

Modified:
   trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.Designer.cs
   trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
   trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.resx
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs
Log:
#1761: Add support changing the logical presentation order of Map Groups in Map Definition editor


Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.Designer.cs	2011-07-29 05:56:35 UTC (rev 6015)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.Designer.cs	2011-08-01 10:11:19 UTC (rev 6016)
@@ -41,6 +41,9 @@
             this.btnGRPAddLayer = new System.Windows.Forms.ToolStripButton();
             this.btnGRPRemoveLayer = new System.Windows.Forms.ToolStripButton();
             this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
+            this.btnMoveGroupUp = new System.Windows.Forms.ToolStripButton();
+            this.btnMoveGroupDown = new System.Windows.Forms.ToolStripButton();
+            this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
             this.btnConvertLayerGroupToBaseGroup = new System.Windows.Forms.ToolStripButton();
             this.TAB_DRAWING_ORDER = new System.Windows.Forms.TabPage();
             this.trvLayerDrawingOrder = new Aga.Controls.Tree.TreeViewAdv();
@@ -148,6 +151,9 @@
             this.btnGRPAddLayer,
             this.btnGRPRemoveLayer,
             this.toolStripSeparator3,
+            this.btnMoveGroupUp,
+            this.btnMoveGroupDown,
+            this.toolStripSeparator7,
             this.btnConvertLayerGroupToBaseGroup});
             resources.ApplyResources(this.toolStrip1, "toolStrip1");
             this.toolStrip1.Name = "toolStrip1";
@@ -194,6 +200,27 @@
             this.toolStripSeparator3.Name = "toolStripSeparator3";
             resources.ApplyResources(this.toolStripSeparator3, "toolStripSeparator3");
             // 
+            // btnMoveGroupUp
+            // 
+            this.btnMoveGroupUp.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+            this.btnMoveGroupUp.Image = global::Maestro.Editors.Properties.Resources.arrow_090;
+            resources.ApplyResources(this.btnMoveGroupUp, "btnMoveGroupUp");
+            this.btnMoveGroupUp.Name = "btnMoveGroupUp";
+            this.btnMoveGroupUp.Click += new System.EventHandler(this.btnMoveGroupUp_Click);
+            // 
+            // btnMoveGroupDown
+            // 
+            this.btnMoveGroupDown.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+            this.btnMoveGroupDown.Image = global::Maestro.Editors.Properties.Resources.arrow_270;
+            resources.ApplyResources(this.btnMoveGroupDown, "btnMoveGroupDown");
+            this.btnMoveGroupDown.Name = "btnMoveGroupDown";
+            this.btnMoveGroupDown.Click += new System.EventHandler(this.btnMoveGroupDown_Click);
+            // 
+            // toolStripSeparator7
+            // 
+            this.toolStripSeparator7.Name = "toolStripSeparator7";
+            resources.ApplyResources(this.toolStripSeparator7, "toolStripSeparator7");
+            // 
             // btnConvertLayerGroupToBaseGroup
             // 
             this.btnConvertLayerGroupToBaseGroup.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
@@ -446,9 +473,8 @@
             // MapLayersSectionCtrl
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
-            this.HeaderText = "Layers";
+            resources.ApplyResources(this, "$this");
             this.Name = "MapLayersSectionCtrl";
-            resources.ApplyResources(this, "$this");
             this.contentPanel.ResumeLayout(false);
             this.tabControl1.ResumeLayout(false);
             this.TAB_GROUP.ResumeLayout(false);
@@ -510,5 +536,8 @@
         private Aga.Controls.Tree.TreeViewAdv trvBaseLayers;
         private Aga.Controls.Tree.NodeControls.NodeIcon nodeIcon1;
         private Aga.Controls.Tree.NodeControls.NodeTextBox nodeTextBox1;
+        private System.Windows.Forms.ToolStripButton btnMoveGroupUp;
+        private System.Windows.Forms.ToolStripButton btnMoveGroupDown;
+        private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
     }
 }

Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs	2011-07-29 05:56:35 UTC (rev 6015)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs	2011-08-01 10:11:19 UTC (rev 6016)
@@ -412,6 +412,13 @@
             }
         }
 
+        private void RestoreGroupSelection(GroupItem item)
+        {
+            //The node tag will probably be different, but the wrapped
+            //instance is what we're checking for
+            RestoreSelection<GroupItem>(trvLayersGroup, (tag) => { return tag.Tag == item.Tag; });
+        }
+
         private void RestoreBaseLayerSelection(BaseLayerItem item)
         {
             //The node tag will probably be different, but the wrapped
@@ -638,6 +645,34 @@
             }
         }
 
+        private void btnMoveGroupUp_Click(object sender, EventArgs e)
+        {
+            var group = GetSelectedLayerGroupItem() as GroupItem;
+            if (group != null)
+            {
+                var mdf = group.Tag.Parent;
+                mdf.MoveUpGroup(group.Tag);
+
+                _grpLayerModel.Invalidate();
+
+                RestoreGroupSelection(group);
+            }
+        }
+
+        private void btnMoveGroupDown_Click(object sender, EventArgs e)
+        {
+            var group = GetSelectedLayerGroupItem() as GroupItem;
+            if (group != null)
+            {
+                var mdf = group.Tag.Parent;
+                mdf.MoveDownGroup(group.Tag);
+
+                _grpLayerModel.Invalidate();
+
+                RestoreGroupSelection(group);
+            }
+        }
+
         private void btnMoveBaseLayerDown_Click(object sender, EventArgs e)
         {
             var layer = GetSelectedTiledLayerItem() as BaseLayerItem;

Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.resx	2011-07-29 05:56:35 UTC (rev 6015)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.resx	2011-08-01 10:11:19 UTC (rev 6016)
@@ -193,7 +193,7 @@
     <value>0</value>
   </data>
   <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>17, 17</value>
+    <value>3, 3</value>
   </metadata>
   <data name="btnAddGroup.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
     <value>Magenta</value>
@@ -237,6 +237,27 @@
   <data name="toolStripSeparator3.Size" type="System.Drawing.Size, System.Drawing">
     <value>6, 25</value>
   </data>
+  <data name="btnMoveGroupUp.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+    <value>Magenta</value>
+  </data>
+  <data name="btnMoveGroupUp.Size" type="System.Drawing.Size, System.Drawing">
+    <value>23, 22</value>
+  </data>
+  <data name="btnMoveGroupUp.Text" xml:space="preserve">
+    <value>Move the selected group up the logical order</value>
+  </data>
+  <data name="btnMoveGroupDown.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+    <value>Magenta</value>
+  </data>
+  <data name="btnMoveGroupDown.Size" type="System.Drawing.Size, System.Drawing">
+    <value>23, 22</value>
+  </data>
+  <data name="btnMoveGroupDown.Text" xml:space="preserve">
+    <value>Move the selected group down the logical order</value>
+  </data>
+  <data name="toolStripSeparator7.Size" type="System.Drawing.Size, System.Drawing">
+    <value>6, 25</value>
+  </data>
   <data name="btnConvertLayerGroupToBaseGroup.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
     <value>Magenta</value>
   </data>
@@ -325,7 +346,7 @@
     <value>0</value>
   </data>
   <metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>116, 17</value>
+    <value>3, 3</value>
   </metadata>
   <data name="btnDLAddLayer.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
     <value>Magenta</value>
@@ -466,7 +487,7 @@
     <value>0</value>
   </data>
   <metadata name="toolStrip3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>221, 17</value>
+    <value>3, 3</value>
   </metadata>
   <data name="btnNewBaseLayerGroup.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
     <value>Magenta</value>
@@ -621,6 +642,9 @@
   <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <data name="$this.HeaderText" xml:space="preserve">
+    <value>Layers</value>
+  </data>
   <data name="$this.Size" type="System.Drawing.Size, System.Drawing">
     <value>610, 319</value>
   </data>
@@ -672,6 +696,24 @@
   <data name="&gt;&gt;toolStripSeparator3.Type" xml:space="preserve">
     <value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
+  <data name="&gt;&gt;btnMoveGroupUp.Name" xml:space="preserve">
+    <value>btnMoveGroupUp</value>
+  </data>
+  <data name="&gt;&gt;btnMoveGroupUp.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="&gt;&gt;btnMoveGroupDown.Name" xml:space="preserve">
+    <value>btnMoveGroupDown</value>
+  </data>
+  <data name="&gt;&gt;btnMoveGroupDown.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="&gt;&gt;toolStripSeparator7.Name" xml:space="preserve">
+    <value>toolStripSeparator7</value>
+  </data>
+  <data name="&gt;&gt;toolStripSeparator7.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
   <data name="&gt;&gt;btnConvertLayerGroupToBaseGroup.Name" xml:space="preserve">
     <value>btnConvertLayerGroupToBaseGroup</value>
   </data>
@@ -802,6 +844,6 @@
     <value>MapLayersSectionCtrl</value>
   </data>
   <data name="&gt;&gt;$this.Type" xml:space="preserve">
-    <value>Maestro.Editors.Common.EditorBindableCollapsiblePanel, Maestro.Editors, Version=3.0.0.5334, Culture=neutral, PublicKeyToken=null</value>
+    <value>Maestro.Editors.Common.EditorBindableCollapsiblePanel, Maestro.Editors, Version=3.5.0.5977, Culture=neutral, PublicKeyToken=null</value>
   </data>
 </root>
\ No newline at end of file

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs	2011-07-29 05:56:35 UTC (rev 6015)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinition.cs	2011-08-01 10:11:19 UTC (rev 6016)
@@ -526,6 +526,58 @@
             return -1;
         }
 
+        int IMapDefinition.MoveUpGroup(IMapLayerGroup group)
+        {
+            Check.NotNull(group, "group");
+            var grp = group as MapLayerGroupType;
+            if (grp != null)
+            {
+                var idx = this.MapLayerGroup.IndexOf(grp);
+                if (idx > 0)
+                {
+                    int idst = idx - 1;
+
+                    var src = this.MapLayerGroup[idx];
+                    var dst = this.MapLayerGroup[idst];
+
+                    this.MapLayerGroup[idx] = dst;
+                    this.MapLayerGroup[idst] = src;
+
+                    OnPropertyChanged("MapLayerGroup");
+
+                    return idst;
+                }
+            }
+
+            return -1;
+        }
+
+        int IMapDefinition.MoveDownGroup(IMapLayerGroup group)
+        {
+            Check.NotNull(group, "group");
+            var grp = group as MapLayerGroupType;
+            if (grp != null)
+            {
+                var idx = this.MapLayerGroup.IndexOf(grp);
+                if (idx < this.MapLayerGroup.Count - 1)
+                {
+                    int idst = idx + 1;
+
+                    var src = this.MapLayerGroup[idx];
+                    var dst = this.MapLayerGroup[idst];
+
+                    this.MapLayerGroup[idx] = dst;
+                    this.MapLayerGroup[idst] = src;
+
+                    OnPropertyChanged("MapLayerGroup");
+
+                    return idst;
+                }
+            }
+
+            return -1;
+        }
+
         int IMapDefinition.GetIndex(IMapLayerGroup group)
         {
             Check.NotNull(group, "group");

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs	2011-07-29 05:56:35 UTC (rev 6015)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs	2011-08-01 10:11:19 UTC (rev 6016)
@@ -211,6 +211,18 @@
         /// <param name="idx"></param>
         /// <param name="layer"></param>
         void InsertLayer(int idx, IMapLayer layer);
+
+        /// <summary>
+        /// Moves a Map Group down the presentation order
+        /// </summary>
+        /// <param name="group"></param>
+        int MoveDownGroup(IMapLayerGroup group);
+
+        /// <summary>
+        /// Moves a Map Group up the presentation order
+        /// </summary>
+        /// <param name="group"></param>
+        int MoveUpGroup(IMapLayerGroup group);
     }
 
     /// <summary>



More information about the mapguide-commits mailing list