[mapguide-commits] r4520 - in trunk/Tools/Maestro: Maestro/ResourceEditors MaestroAPI/Generated

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Jan 11 02:40:02 EST 2010


Author: ksgeograf
Date: 2010-01-11 02:40:00 -0500 (Mon, 11 Jan 2010)
New Revision: 4520

Modified:
   trunk/Tools/Maestro/Maestro/ResourceEditors/MapEditor.cs
   trunk/Tools/Maestro/MaestroAPI/Generated/MapDefinition-1.0.0.cs
Log:
Maestro:
Fixes for issue #1221.

Modified: trunk/Tools/Maestro/Maestro/ResourceEditors/MapEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceEditors/MapEditor.cs	2010-01-11 06:27:59 UTC (rev 4519)
+++ trunk/Tools/Maestro/Maestro/ResourceEditors/MapEditor.cs	2010-01-11 07:40:00 UTC (rev 4520)
@@ -1390,7 +1390,7 @@
                 foreach (ListViewItem lvi in lstDrawOrder.SelectedItems)
                     selected.Add(lvi);
 
-                if (up)
+                if (!up)
                     selected.Reverse();
 
 				foreach(ListViewItem lvi in selected)
@@ -1501,11 +1501,20 @@
                             maplayer.Group = (trvLayerGroups.SelectedNode.Tag as MaestroAPI.MapLayerGroupType).Name;
                         else if (trvLayerGroups.SelectedNode.Tag is MaestroAPI.MapLayerType)
                             maplayer.Group = (trvLayerGroups.SelectedNode.Tag as MaestroAPI.MapLayerType).Group;
+
+                        int index = 0;
+                        foreach (MaestroAPI.MapLayerType l in m_map.Layers)
+                            if (l.Group == maplayer.Group)
+                                index = Math.Max(index, m_map.Layers.IndexOf(l));
+
+                        if (index <= 0)
+                            m_map.Layers.Add(maplayer);
+                        else
+                            m_map.Layers.Insert(index + 1, maplayer);
                     }
-                    
+                    else
+                        m_map.Layers.Add(maplayer);
 
-                    m_map.Layers.Add(maplayer);
-                    
                     lastItem = maplayer;
                 }
 

Modified: trunk/Tools/Maestro/MaestroAPI/Generated/MapDefinition-1.0.0.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/Generated/MapDefinition-1.0.0.cs	2010-01-11 06:27:59 UTC (rev 4519)
+++ trunk/Tools/Maestro/MaestroAPI/Generated/MapDefinition-1.0.0.cs	2010-01-11 07:40:00 UTC (rev 4520)
@@ -753,8 +753,63 @@
 	}
         
     public class MapLayerTypeCollection : System.Collections.CollectionBase {
-        
-        public MapLayerType this[int idx] {
+
+        /// <summary>
+        /// Gets or sets the index of a layer, given the layer name.
+        /// Is case sensitive but will search case insensitive if no layer matches with case sensitive.
+        /// </summary>
+        /// <param name="name">The name of the layer</param>
+        /// <returns>The index of the layer, or -1 if no such layer could be found</returns>
+        public int IndexOf(string name)
+        {
+            int rml = -1;
+            for (int i = 0; i < this.Count; i++)
+                if (this[i].Name == name)
+                    return i;
+                else if (rml == -1 && this[i].Name.ToLower() == name.ToLower())
+                    rml = i;
+
+            return rml;
+
+        }
+
+        /// <summary>
+        /// Gets a value indicating if the layer exists in the map.
+        /// Is case sensitive but will search case insensitive if no layer matches with case sensitive.
+        /// </summary>
+        /// <param name="name">The name of the layer</param>
+        /// <returns>True if the layer was found, false otherwise</returns>
+        public bool Contains(string name)
+        {
+            return IndexOf(name) != -1;
+        }
+
+        /// <summary>
+        /// Gets or sets a layer based on the layers name.
+        /// Is case sensitive but will search case insensitive if no layer matches with case sensitive.
+        /// </summary>
+        public MapLayerType this[string name]
+        {
+            get
+            {
+                int ix = IndexOf(name);
+                if (ix == -1)
+                    throw new IndexOutOfRangeException("The layer named: " + name + " was not found in the map");
+                else
+                    return this[ix];
+            }
+            set
+            {
+                int ix = IndexOf(name);
+                if (ix == -1)
+                    throw new IndexOutOfRangeException("The layer named: " + name + " was not found");
+                else
+                    this[ix] = value;
+            }
+        }
+
+        public MapLayerType this[int idx]
+        {
             get {
                 return ((MapLayerType)(base.InnerList[idx]));
             }
@@ -762,7 +817,7 @@
                 base.InnerList[idx] = value;
             }
         }
-        
+
         public int Add(MapLayerType value) {
             return base.InnerList.Add(value);
         }
@@ -771,11 +826,71 @@
 		{
 			return base.InnerList.IndexOf(value);
 		}
+
+        public void Insert(int index, MapLayerType value)
+        {
+            base.InnerList.Insert(index, value);
+        }
     }
     
     public class MapLayerGroupTypeCollection : System.Collections.CollectionBase {
-        
-        public MapLayerGroupType this[int idx] {
+
+        /// <summary>
+        /// Gets or sets the index of a layer, given the layer name.
+        /// Is case sensitive but will search case insensitive if no layer matches with case sensitive.
+        /// </summary>
+        /// <param name="name">The name of the layer</param>
+        /// <returns>The index of the layer, or -1 if no such layer could be found</returns>
+        public int IndexOf(string name)
+        {
+            int rml = -1;
+            for (int i = 0; i < this.Count; i++)
+                if (this[i].Name == name)
+                    return i;
+                else if (rml == -1 && this[i].Name.ToLower() == name.ToLower())
+                    rml = i;
+
+            return rml;
+
+        }
+
+        /// <summary>
+        /// Gets a value indicating if the layer exists in the map.
+        /// Is case sensitive but will search case insensitive if no layer matches with case sensitive.
+        /// </summary>
+        /// <param name="name">The name of the layer</param>
+        /// <returns>True if the layer was found, false otherwise</returns>
+        public bool Contains(string name)
+        {
+            return IndexOf(name) != -1;
+        }
+
+        /// <summary>
+        /// Gets or sets a layer based on the layers name.
+        /// Is case sensitive but will search case insensitive if no layer matches with case sensitive.
+        /// </summary>
+        public MapLayerGroupType this[string name]
+        {
+            get
+            {
+                int ix = IndexOf(name);
+                if (ix == -1)
+                    throw new IndexOutOfRangeException("The layer named: " + name + " was not found in the map");
+                else
+                    return this[ix];
+            }
+            set
+            {
+                int ix = IndexOf(name);
+                if (ix == -1)
+                    throw new IndexOutOfRangeException("The layer named: " + name + " was not found");
+                else
+                    this[ix] = value;
+            }
+        }
+
+        public MapLayerGroupType this[int idx]
+        {
             get {
                 return ((MapLayerGroupType)(base.InnerList[idx]));
             }



More information about the mapguide-commits mailing list