[mapguide-commits] r8562 - in trunk/Tools/Maestro: Maestro.Editors/LayerDefinition/Vector/Scales OSGeo.MapGuide.ObjectModels/LayerDefinition OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_1_0 OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_2_0 OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_3_0 OSGeo.MapGuide.ObjectModels/LayerDefinition/v2_3_0 OSGeo.MapGuide.ObjectModels/LayerDefinition/v2_4_0

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Mar 5 07:35:06 PST 2015


Author: jng
Date: 2015-03-05 07:35:06 -0800 (Thu, 05 Mar 2015)
New Revision: 8562

Modified:
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.Designer.cs
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.cs
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.resx
   trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/LayerDefinitionInterfaces.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_1_0/VectorLayerDefinitionImpl.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_2_0/VectorLayerDefinitionImpl.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_3_0/VectorLayerDefinitionImpl.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v2_3_0/VectorLayerDefinitionImpl.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v2_4_0/VectorLayerDefinitionImpl.cs
Log:
#2546: Support re-ordering of component symbols in composite symbolization editor
#2545: Show the applicable geometry context as part of the label for any component symbol in the composite symbolization editor

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.Designer.cs	2015-03-05 13:30:21 UTC (rev 8561)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.Designer.cs	2015-03-05 15:35:06 UTC (rev 8562)
@@ -48,10 +48,14 @@
             this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
             this.inlineSimpleSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.btnDelete = new System.Windows.Forms.ToolStripButton();
+            this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
+            this.btnUp = new System.Windows.Forms.ToolStripButton();
+            this.btnDown = new System.Windows.Forms.ToolStripButton();
+            this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
             this.btnSaveExternal = new System.Windows.Forms.ToolStripButton();
-            this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
-            this.btnEditInstanceProperties = new System.Windows.Forms.ToolStripButton();
-            this.btnEditComponent = new System.Windows.Forms.ToolStripButton();
+            this.btnEdit = new System.Windows.Forms.ToolStripDropDownButton();
+            this.btnEditInstanceProperties = new System.Windows.Forms.ToolStripMenuItem();
+            this.btnEditComponent = new System.Windows.Forms.ToolStripMenuItem();
             this.grpProperties = new System.Windows.Forms.GroupBox();
             this.grdOverrides = new System.Windows.Forms.DataGridView();
             this.toolStrip2 = new System.Windows.Forms.ToolStrip();
@@ -115,10 +119,12 @@
             this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.btnAdd,
             this.btnDelete,
+            this.toolStripSeparator2,
+            this.btnUp,
+            this.btnDown,
+            this.toolStripSeparator5,
             this.btnSaveExternal,
-            this.toolStripSeparator2,
-            this.btnEditInstanceProperties,
-            this.btnEditComponent});
+            this.btnEdit});
             resources.ApplyResources(this.toolStrip1, "toolStrip1");
             this.toolStrip1.Name = "toolStrip1";
             // 
@@ -222,6 +228,32 @@
             this.btnDelete.Name = "btnDelete";
             this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
             // 
+            // toolStripSeparator2
+            // 
+            this.toolStripSeparator2.Name = "toolStripSeparator2";
+            resources.ApplyResources(this.toolStripSeparator2, "toolStripSeparator2");
+            // 
+            // btnUp
+            // 
+            this.btnUp.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+            resources.ApplyResources(this.btnUp, "btnUp");
+            this.btnUp.Image = global::Maestro.Editors.Properties.Resources.arrow_090;
+            this.btnUp.Name = "btnUp";
+            this.btnUp.Click += new System.EventHandler(this.btnUp_Click);
+            // 
+            // btnDown
+            // 
+            this.btnDown.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
+            resources.ApplyResources(this.btnDown, "btnDown");
+            this.btnDown.Image = global::Maestro.Editors.Properties.Resources.arrow_270;
+            this.btnDown.Name = "btnDown";
+            this.btnDown.Click += new System.EventHandler(this.btnDown_Click);
+            // 
+            // toolStripSeparator5
+            // 
+            this.toolStripSeparator5.Name = "toolStripSeparator5";
+            resources.ApplyResources(this.toolStripSeparator5, "toolStripSeparator5");
+            // 
             // btnSaveExternal
             // 
             resources.ApplyResources(this.btnSaveExternal, "btnSaveExternal");
@@ -229,10 +261,14 @@
             this.btnSaveExternal.Name = "btnSaveExternal";
             this.btnSaveExternal.Click += new System.EventHandler(this.btnSaveExternal_Click);
             // 
-            // toolStripSeparator2
+            // btnEdit
             // 
-            this.toolStripSeparator2.Name = "toolStripSeparator2";
-            resources.ApplyResources(this.toolStripSeparator2, "toolStripSeparator2");
+            this.btnEdit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.btnEditInstanceProperties,
+            this.btnEditComponent});
+            this.btnEdit.Image = global::Maestro.Editors.Properties.Resources.document__pencil;
+            resources.ApplyResources(this.btnEdit, "btnEdit");
+            this.btnEdit.Name = "btnEdit";
             // 
             // btnEditInstanceProperties
             // 
@@ -418,7 +454,6 @@
         private System.Windows.Forms.ToolStripMenuItem refreshToolStripMenuItem;
         private System.Windows.Forms.ToolStripButton btnDeleteProperty;
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
-        private System.Windows.Forms.ToolStripButton btnEditComponent;
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
         private System.Windows.Forms.ToolStripButton btnPropertyInfo;
         private System.Windows.Forms.ToolStripMenuItem inlineSymbolToolStripMenuItem;
@@ -430,10 +465,15 @@
         private System.Windows.Forms.ToolStripMenuItem textLabelLineToolStripMenuItem;
         private System.Windows.Forms.ToolStripMenuItem textLabelPolygonToolStripMenuItem;
         private System.Windows.Forms.ToolStripMenuItem pointToolStripMenuItem;
-        private System.Windows.Forms.ToolStripButton btnEditInstanceProperties;
         private System.Windows.Forms.ToolStripDropDownButton btnEditProperty;
         private System.Windows.Forms.ToolStripMenuItem viaEditorToolStripMenuItem;
         private System.Windows.Forms.ToolStripMenuItem viaExpressionEditorToolStripMenuItem;
         private System.Windows.Forms.ToolStripButton btnSaveExternal;
+        private System.Windows.Forms.ToolStripButton btnUp;
+        private System.Windows.Forms.ToolStripButton btnDown;
+        private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
+        private System.Windows.Forms.ToolStripDropDownButton btnEdit;
+        private System.Windows.Forms.ToolStripMenuItem btnEditInstanceProperties;
+        private System.Windows.Forms.ToolStripMenuItem btnEditComponent;
     }
 }
\ No newline at end of file

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.cs	2015-03-05 13:30:21 UTC (rev 8561)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.cs	2015-03-05 15:35:06 UTC (rev 8562)
@@ -34,6 +34,7 @@
 using OSGeo.MapGuide.ObjectModels.LayerDefinition;
 using OSGeo.MapGuide.ObjectModels.SymbolDefinition;
 using System;
+using System.Linq;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Drawing;
@@ -235,19 +236,38 @@
             var li = new ListViewItem();
             li.Tag = symRef;
 
-            var sym = GetSymbolDefinition(symRef);
-            if (symRef.Reference.Type == SymbolInstanceType.Reference)
-                li.Text = sym.Name + " (" + ((ISymbolInstanceReferenceLibrary)symRef.Reference).ResourceId + ")";
-            else
-                li.Text = sym.Name + " (" + Strings.InlineSymbolDefinition + ")";
+            SetListViewItemLabel(symRef, li);
 
             lstInstances.Items.Add(li);
+            btnUp.Enabled = btnDown.Enabled = (lstInstances.Items.Count > 1);
+
             if (add)
                 _comp.AddSymbolInstance(symRef);
             li.Selected = (lstInstances.Items.Count == 1);
             RenderPreview(symRef, li);
         }
 
+        private void SetListViewItemLabel(ISymbolInstance symRef, ListViewItem li)
+        {
+            var sym = GetSymbolDefinition(symRef);
+            if (symRef.Reference.Type == SymbolInstanceType.Reference)
+            {
+                ISymbolInstance2 symRef2 = symRef as ISymbolInstance2;
+                if (symRef2 != null)
+                    li.Text = sym.Name + " (" + symRef2.GeometryContext + " - " + ((ISymbolInstanceReferenceLibrary)symRef.Reference).ResourceId + ")";
+                else
+                    li.Text = sym.Name + " (" + ((ISymbolInstanceReferenceLibrary)symRef.Reference).ResourceId + ")";
+            }
+            else
+            {
+                ISymbolInstance2 symRef2 = symRef as ISymbolInstance2;
+                if (symRef2 != null)
+                    li.Text = sym.Name + " (" + symRef2.GeometryContext + " - " + Strings.InlineSymbolDefinition + ")";
+                else
+                    li.Text = sym.Name + " (" + Strings.InlineSymbolDefinition + ")";
+            }
+        }
+
         private void referenceToolStripMenuItem_Click(object sender, EventArgs e)
         {
             using (var picker = new ResourcePicker(_edSvc.CurrentConnection, ResourceTypes.SymbolDefinition.ToString(), ResourcePickerMode.OpenResource))
@@ -380,6 +400,7 @@
                 using (var diag = new SymbolInstancePropertiesDialog(symRef, _edSvc, _cls, _featureSourceId, _provider))
                 {
                     diag.ShowDialog();
+                    SetListViewItemLabel(symRef, it);
                 }
             }
         }
@@ -800,5 +821,43 @@
                 }
             }
         }
+
+        private void btnUp_Click(object sender, EventArgs e)
+        {
+            if (lstInstances.SelectedItems.Count == 1)
+            {
+                var it = lstInstances.SelectedItems[0];
+                var oldIdx = lstInstances.Items.IndexOf(it);
+                ISymbolInstance symRef = (ISymbolInstance)it.Tag;
+                int idx = _comp.MoveSymbolInstanceUp(symRef);
+                if (idx >= 0)
+                {
+                    var item = lstInstances.Items[idx];
+                    lstInstances.Items.RemoveAt(oldIdx);
+                    lstInstances.Items.RemoveAt(idx);
+                    lstInstances.Items.Insert(idx, it);
+                    lstInstances.Items.Insert(oldIdx, item);
+                }
+            }
+        }
+
+        private void btnDown_Click(object sender, EventArgs e)
+        {
+            if (lstInstances.SelectedItems.Count == 1)
+            {
+                var it = lstInstances.SelectedItems[0];
+                var oldIdx = lstInstances.Items.IndexOf(it);
+                ISymbolInstance symRef = (ISymbolInstance)it.Tag;
+                int idx = _comp.MoveSymbolInstanceDown(symRef);
+                if (idx <= _comp.SymbolInstance.Count() - 1 && idx >= 0)
+                {
+                    var item = lstInstances.Items[idx];
+                    lstInstances.Items.RemoveAt(idx);
+                    lstInstances.Items.RemoveAt(oldIdx);
+                    lstInstances.Items.Insert(oldIdx, item);
+                    lstInstances.Items.Insert(idx, it);
+                }
+            }
+        }
     }
 }
\ No newline at end of file

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.resx	2015-03-05 13:30:21 UTC (rev 8561)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Scales/SymbolInstancesDialog.resx	2015-03-05 15:35:06 UTC (rev 8562)
@@ -264,6 +264,36 @@
   <data name="btnDelete.Text" xml:space="preserve">
     <value>Delete</value>
   </data>
+  <data name="toolStripSeparator2.Size" type="System.Drawing.Size, System.Drawing">
+    <value>6, 25</value>
+  </data>
+  <data name="btnUp.Enabled" type="System.Boolean, mscorlib">
+    <value>False</value>
+  </data>
+  <data name="btnUp.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+    <value>Magenta</value>
+  </data>
+  <data name="btnUp.Size" type="System.Drawing.Size, System.Drawing">
+    <value>23, 22</value>
+  </data>
+  <data name="btnUp.Text" xml:space="preserve">
+    <value>Move Up</value>
+  </data>
+  <data name="btnDown.Enabled" type="System.Boolean, mscorlib">
+    <value>False</value>
+  </data>
+  <data name="btnDown.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+    <value>Magenta</value>
+  </data>
+  <data name="btnDown.Size" type="System.Drawing.Size, System.Drawing">
+    <value>23, 22</value>
+  </data>
+  <data name="btnDown.Text" xml:space="preserve">
+    <value>Move Down</value>
+  </data>
+  <data name="toolStripSeparator5.Size" type="System.Drawing.Size, System.Drawing">
+    <value>6, 25</value>
+  </data>
   <data name="btnSaveExternal.Enabled" type="System.Boolean, mscorlib">
     <value>False</value>
   </data>
@@ -276,9 +306,6 @@
   <data name="btnSaveExternal.Text" xml:space="preserve">
     <value>Export</value>
   </data>
-  <data name="toolStripSeparator2.Size" type="System.Drawing.Size, System.Drawing">
-    <value>6, 25</value>
-  </data>
   <data name="btnEditInstanceProperties.Enabled" type="System.Boolean, mscorlib">
     <value>False</value>
   </data>
@@ -286,7 +313,7 @@
     <value>Magenta</value>
   </data>
   <data name="btnEditInstanceProperties.Size" type="System.Drawing.Size, System.Drawing">
-    <value>150, 22</value>
+    <value>197, 22</value>
   </data>
   <data name="btnEditInstanceProperties.Text" xml:space="preserve">
     <value>Edit Instance Properties</value>
@@ -298,11 +325,20 @@
     <value>Magenta</value>
   </data>
   <data name="btnEditComponent.Size" type="System.Drawing.Size, System.Drawing">
-    <value>90, 22</value>
+    <value>197, 22</value>
   </data>
   <data name="btnEditComponent.Text" xml:space="preserve">
     <value>Edit Symbol</value>
   </data>
+  <data name="btnEdit.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
+    <value>Magenta</value>
+  </data>
+  <data name="btnEdit.Size" type="System.Drawing.Size, System.Drawing">
+    <value>56, 22</value>
+  </data>
+  <data name="btnEdit.Text" xml:space="preserve">
+    <value>Edit</value>
+  </data>
   <data name="toolStrip1.Location" type="System.Drawing.Point, System.Drawing">
     <value>3, 16</value>
   </data>
@@ -696,29 +732,53 @@
   <data name=">>btnDelete.Type" xml:space="preserve">
     <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
+  <data name=">>toolStripSeparator2.Name" xml:space="preserve">
+    <value>toolStripSeparator2</value>
+  </data>
+  <data name=">>toolStripSeparator2.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>btnUp.Name" xml:space="preserve">
+    <value>btnUp</value>
+  </data>
+  <data name=">>btnUp.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>btnDown.Name" xml:space="preserve">
+    <value>btnDown</value>
+  </data>
+  <data name=">>btnDown.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name=">>toolStripSeparator5.Name" xml:space="preserve">
+    <value>toolStripSeparator5</value>
+  </data>
+  <data name=">>toolStripSeparator5.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
   <data name=">>btnSaveExternal.Name" xml:space="preserve">
     <value>btnSaveExternal</value>
   </data>
   <data name=">>btnSaveExternal.Type" xml:space="preserve">
     <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
-  <data name=">>toolStripSeparator2.Name" xml:space="preserve">
-    <value>toolStripSeparator2</value>
+  <data name=">>btnEdit.Name" xml:space="preserve">
+    <value>btnEdit</value>
   </data>
-  <data name=">>toolStripSeparator2.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  <data name=">>btnEdit.Type" xml:space="preserve">
+    <value>System.Windows.Forms.ToolStripDropDownButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>btnEditInstanceProperties.Name" xml:space="preserve">
     <value>btnEditInstanceProperties</value>
   </data>
   <data name=">>btnEditInstanceProperties.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>btnEditComponent.Name" xml:space="preserve">
     <value>btnEditComponent</value>
   </data>
   <data name=">>btnEditComponent.Type" xml:space="preserve">
-    <value>System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </data>
   <data name=">>btnAddProperty.Name" xml:space="preserve">
     <value>btnAddProperty</value>

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/LayerDefinitionInterfaces.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/LayerDefinitionInterfaces.cs	2015-03-05 13:30:21 UTC (rev 8561)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/LayerDefinitionInterfaces.cs	2015-03-05 15:35:06 UTC (rev 8562)
@@ -1913,6 +1913,10 @@
         /// Removes all symbol instances
         /// </summary>
         void RemoveAllSymbolInstances();
+
+        int MoveSymbolInstanceUp(ISymbolInstance symRef);
+
+        int MoveSymbolInstanceDown(ISymbolInstance symRef);
     }
 
     /// <summary>

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_1_0/VectorLayerDefinitionImpl.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_1_0/VectorLayerDefinitionImpl.cs	2015-03-05 13:30:21 UTC (rev 8561)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_1_0/VectorLayerDefinitionImpl.cs	2015-03-05 15:35:06 UTC (rev 8562)
@@ -2090,6 +2090,46 @@
             }
         }
 
+        public int MoveSymbolInstanceUp(ISymbolInstance inst)
+        {
+            var sym = inst as SymbolInstance;
+            if (sym != null)
+            {
+                int oldIdx = this.SymbolInstance.IndexOf(sym);
+                int newIdx = oldIdx - 1;
+                if (newIdx >= 0)
+                {
+                    //Swap old and new items
+                    var newItem = this.SymbolInstance[newIdx];
+                    this.SymbolInstance[newIdx] = sym;
+                    this.SymbolInstance[oldIdx] = newItem;
+
+                    return newIdx;
+                }
+            }
+            return -1;
+        }
+
+        public int MoveSymbolInstanceDown(ISymbolInstance inst)
+        {
+            var sym = inst as SymbolInstance;
+            if (sym != null)
+            {
+                int oldIdx = this.SymbolInstance.IndexOf(sym);
+                int newIdx = oldIdx + 1;
+                if (newIdx <= this.SymbolInstance.Count - 1)
+                {
+                    //Swap old and new items
+                    var newItem = this.SymbolInstance[newIdx];
+                    this.SymbolInstance[newIdx] = sym;
+                    this.SymbolInstance[oldIdx] = newItem;
+
+                    return newIdx;
+                }
+            }
+            return -1;
+        }
+
         public void AddSymbolInstance(ISymbolInstance inst)
         {
             var sym = inst as SymbolInstance;

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_2_0/VectorLayerDefinitionImpl.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_2_0/VectorLayerDefinitionImpl.cs	2015-03-05 13:30:21 UTC (rev 8561)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_2_0/VectorLayerDefinitionImpl.cs	2015-03-05 15:35:06 UTC (rev 8562)
@@ -2090,6 +2090,46 @@
             }
         }
 
+        public int MoveSymbolInstanceUp(ISymbolInstance inst)
+        {
+            var sym = inst as SymbolInstance;
+            if (sym != null)
+            {
+                int oldIdx = this.SymbolInstance.IndexOf(sym);
+                int newIdx = oldIdx - 1;
+                if (newIdx >= 0)
+                {
+                    //Swap old and new items
+                    var newItem = this.SymbolInstance[newIdx];
+                    this.SymbolInstance[newIdx] = sym;
+                    this.SymbolInstance[oldIdx] = newItem;
+
+                    return newIdx;
+                }
+            }
+            return -1;
+        }
+
+        public int MoveSymbolInstanceDown(ISymbolInstance inst)
+        {
+            var sym = inst as SymbolInstance;
+            if (sym != null)
+            {
+                int oldIdx = this.SymbolInstance.IndexOf(sym);
+                int newIdx = oldIdx + 1;
+                if (newIdx <= this.SymbolInstance.Count - 1)
+                {
+                    //Swap old and new items
+                    var newItem = this.SymbolInstance[newIdx];
+                    this.SymbolInstance[newIdx] = sym;
+                    this.SymbolInstance[oldIdx] = newItem;
+
+                    return newIdx;
+                }
+            }
+            return -1;
+        }
+
         public void AddSymbolInstance(ISymbolInstance inst)
         {
             var sym = inst as SymbolInstance;

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_3_0/VectorLayerDefinitionImpl.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_3_0/VectorLayerDefinitionImpl.cs	2015-03-05 13:30:21 UTC (rev 8561)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v1_3_0/VectorLayerDefinitionImpl.cs	2015-03-05 15:35:06 UTC (rev 8562)
@@ -2091,6 +2091,46 @@
             }
         }
 
+        public int MoveSymbolInstanceUp(ISymbolInstance inst)
+        {
+            var sym = inst as SymbolInstance;
+            if (sym != null)
+            {
+                int oldIdx = this.SymbolInstance.IndexOf(sym);
+                int newIdx = oldIdx - 1;
+                if (newIdx >= 0)
+                {
+                    //Swap old and new items
+                    var newItem = this.SymbolInstance[newIdx];
+                    this.SymbolInstance[newIdx] = sym;
+                    this.SymbolInstance[oldIdx] = newItem;
+
+                    return newIdx;
+                }
+            }
+            return -1;
+        }
+
+        public int MoveSymbolInstanceDown(ISymbolInstance inst)
+        {
+            var sym = inst as SymbolInstance;
+            if (sym != null)
+            {
+                int oldIdx = this.SymbolInstance.IndexOf(sym);
+                int newIdx = oldIdx + 1;
+                if (newIdx <= this.SymbolInstance.Count - 1)
+                {
+                    //Swap old and new items
+                    var newItem = this.SymbolInstance[newIdx];
+                    this.SymbolInstance[newIdx] = sym;
+                    this.SymbolInstance[oldIdx] = newItem;
+
+                    return newIdx;
+                }
+            }
+            return -1;
+        }
+
         public void AddSymbolInstance(ISymbolInstance inst)
         {
             var sym = inst as SymbolInstance;

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v2_3_0/VectorLayerDefinitionImpl.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v2_3_0/VectorLayerDefinitionImpl.cs	2015-03-05 13:30:21 UTC (rev 8561)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v2_3_0/VectorLayerDefinitionImpl.cs	2015-03-05 15:35:06 UTC (rev 8562)
@@ -2093,6 +2093,46 @@
             }
         }
 
+        public int MoveSymbolInstanceUp(ISymbolInstance inst)
+        {
+            var sym = inst as SymbolInstance;
+            if (sym != null)
+            {
+                int oldIdx = this.SymbolInstance.IndexOf(sym);
+                int newIdx = oldIdx - 1;
+                if (newIdx >= 0)
+                {
+                    //Swap old and new items
+                    var newItem = this.SymbolInstance[newIdx];
+                    this.SymbolInstance[newIdx] = sym;
+                    this.SymbolInstance[oldIdx] = newItem;
+
+                    return newIdx;
+                }
+            }
+            return -1;
+        }
+
+        public int MoveSymbolInstanceDown(ISymbolInstance inst)
+        {
+            var sym = inst as SymbolInstance;
+            if (sym != null)
+            {
+                int oldIdx = this.SymbolInstance.IndexOf(sym);
+                int newIdx = oldIdx + 1;
+                if (newIdx <= this.SymbolInstance.Count - 1)
+                {
+                    //Swap old and new items
+                    var newItem = this.SymbolInstance[newIdx];
+                    this.SymbolInstance[newIdx] = sym;
+                    this.SymbolInstance[oldIdx] = newItem;
+
+                    return newIdx;
+                }
+            }
+            return -1;
+        }
+
         public void AddSymbolInstance(ISymbolInstance inst)
         {
             var sym = inst as SymbolInstance;

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v2_4_0/VectorLayerDefinitionImpl.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v2_4_0/VectorLayerDefinitionImpl.cs	2015-03-05 13:30:21 UTC (rev 8561)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/LayerDefinition/v2_4_0/VectorLayerDefinitionImpl.cs	2015-03-05 15:35:06 UTC (rev 8562)
@@ -2093,6 +2093,46 @@
             }
         }
 
+        public int MoveSymbolInstanceUp(ISymbolInstance inst)
+        {
+            var sym = inst as SymbolInstance;
+            if (sym != null)
+            {
+                int oldIdx = this.SymbolInstance.IndexOf(sym);
+                int newIdx = oldIdx - 1;
+                if (newIdx >= 0)
+                {
+                    //Swap old and new items
+                    var newItem = this.SymbolInstance[newIdx];
+                    this.SymbolInstance[newIdx] = sym;
+                    this.SymbolInstance[oldIdx] = newItem;
+
+                    return newIdx;
+                }
+            }
+            return -1;
+        }
+
+        public int MoveSymbolInstanceDown(ISymbolInstance inst)
+        {
+            var sym = inst as SymbolInstance;
+            if (sym != null)
+            {
+                int oldIdx = this.SymbolInstance.IndexOf(sym);
+                int newIdx = oldIdx + 1;
+                if (newIdx <= this.SymbolInstance.Count - 1)
+                {
+                    //Swap old and new items
+                    var newItem = this.SymbolInstance[newIdx];
+                    this.SymbolInstance[newIdx] = sym;
+                    this.SymbolInstance[oldIdx] = newItem;
+
+                    return newIdx;
+                }
+            }
+            return -1;
+        }
+
         public void AddSymbolInstance(ISymbolInstance inst)
         {
             var sym = inst as SymbolInstance;



More information about the mapguide-commits mailing list