[mapguide-commits] r5242 - trunk/Tools/Maestro/Maestro/ResourceEditors

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Oct 5 00:38:11 EDT 2010


Author: jng
Date: 2010-10-05 04:38:11 +0000 (Tue, 05 Oct 2010)
New Revision: 5242

Modified:
   trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditor.cs
Log:
Refine the layer preview logic. Try to set the preview Map Definition coordinate system to match the coordinate system of the Layer's active spatial context

Modified: trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditor.cs	2010-10-04 17:04:54 UTC (rev 5241)
+++ trunk/Tools/Maestro/Maestro/ResourceEditors/LayerEditor.cs	2010-10-05 04:38:11 UTC (rev 5242)
@@ -520,6 +520,29 @@
                 map.Layers.Add(l);
 
                 m_editor.CurrentConnection.SaveResourceAs(m_layer, templayer);
+
+                //Try to infer CS from layer
+                var ldf = (LayerDefinition)m_editor.CurrentConnection.GetResource(templayer);
+                var feats = (FeatureSource)m_editor.CurrentConnection.GetResource(ldf.Item.ResourceId);
+                var scList = feats.GetSpatialInfo();
+                if (scList.SpatialContext.Count > 0)
+                {
+                    string wkt = string.Empty;
+                    foreach (FdoSpatialContextListSpatialContext sc in scList.SpatialContext)
+                    {
+                        if (sc.IsActive)
+                        {
+                            wkt = sc.CoordinateSystemWkt;
+                            continue;
+                        }
+                    }
+                    if (string.IsNullOrEmpty(wkt))
+                        map.CoordinateSystem = scList.SpatialContext[0].CoordinateSystemWkt;
+
+                    if (!string.IsNullOrEmpty(wkt))
+                        map.CoordinateSystem = wkt;
+                }
+
                 m_editor.CurrentConnection.SaveResourceAs(map, tempmap);
 
                 if (m_editor.UseFusionPreview)



More information about the mapguide-commits mailing list