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

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Mar 4 12:03:42 EST 2010


Author: ksgeograf
Date: 2010-03-04 12:03:41 -0500 (Thu, 04 Mar 2010)
New Revision: 4630

Modified:
   trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditor.cs
   trunk/Tools/Maestro/MaestroAPI/Selection.cs
Log:
Maestro: 
Removed redundant code in the LayerEditor for reading extents.
Fixed a bug in the constructor for the runtime map selection.
Added an override to the ToString() method the runtime map selection so it behaves like ToXml().


Modified: trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditor.cs	2010-03-04 02:36:52 UTC (rev 4629)
+++ trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditor.cs	2010-03-04 17:03:41 UTC (rev 4630)
@@ -491,26 +491,16 @@
 
                 try
                 {
-                    Topology.Geometries.IEnvelope env = m_layer.GetSpatialExtent();
+                    Topology.Geometries.IEnvelope env = m_layer.GetSpatialExtent(true);
                     map.Extents = new OSGeo.MapGuide.MaestroAPI.Box2DType();
                     map.Extents.MinX = env.MinX;
                     map.Extents.MinY = env.MinY;
                     map.Extents.MaxX = env.MaxX;
                     map.Extents.MaxY = env.MaxY;
                 }
-                catch
+                catch (Exception ex)
                 {
-
-                    OSGeo.MapGuide.MaestroAPI.FdoSpatialContextList lst = m_editor.CurrentConnection.GetSpatialContextInfo(m_layer.Item.ResourceId, false);
-
-                    if (lst.SpatialContext != null && lst.SpatialContext.Count >= 1)
-                    {
-                        map.Extents = new OSGeo.MapGuide.MaestroAPI.Box2DType();
-                        map.Extents.MinX = double.Parse(lst.SpatialContext[0].Extent.LowerLeftCoordinate.X, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture);
-                        map.Extents.MinY = double.Parse(lst.SpatialContext[0].Extent.LowerLeftCoordinate.Y, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); ;
-                        map.Extents.MaxX = double.Parse(lst.SpatialContext[0].Extent.UpperRightCoordinate.X, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); ;
-                        map.Extents.MaxY = double.Parse(lst.SpatialContext[0].Extent.UpperRightCoordinate.Y, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture); ;
-                    }
+                    m_editor.SetLastException(ex);
                 }
 
                 MaestroAPI.MapLayerType l = new OSGeo.MapGuide.MaestroAPI.MapLayerType();

Modified: trunk/Tools/Maestro/MaestroAPI/Selection.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/Selection.cs	2010-03-04 02:36:52 UTC (rev 4629)
+++ trunk/Tools/Maestro/MaestroAPI/Selection.cs	2010-03-04 17:03:41 UTC (rev 4630)
@@ -30,6 +30,7 @@
         public Selection(RuntimeClasses.RuntimeMap map, string xml)
             : this(map)
         {
+            FromXml(xml);
         }
 
         /// <summary>
@@ -93,6 +94,15 @@
         }
 
         /// <summary>
+        /// Returns the selection Xml, the same as ToXml()
+        /// </summary>
+        /// <returns>The selection xml</returns>
+        public override string ToString()
+        {
+            return ToXml();
+        }
+
+        /// <summary>
         /// Helper class to represent a layer with selected objects
         /// </summary>
         public class LayerSelection : IList<object[]>



More information about the mapguide-commits mailing list