[mapguide-commits] r7561 - trunk/Tools/Maestro/Maestro.Editors/LayerDefinition

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jun 5 06:24:42 PDT 2013


Author: jng
Date: 2013-06-05 06:24:42 -0700 (Wed, 05 Jun 2013)
New Revision: 7561

Modified:
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/LayerPropertiesSectionCtrl.cs
Log:
#2283: Auto-assign feature class / geometry for a new vector layer if it is possible

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/LayerPropertiesSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/LayerPropertiesSectionCtrl.cs	2013-06-05 04:37:12 UTC (rev 7560)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/LayerPropertiesSectionCtrl.cs	2013-06-05 13:24:42 UTC (rev 7561)
@@ -40,6 +40,21 @@
             _vl = _parent.SubLayer as IVectorLayerDefinition;
             Debug.Assert(_vl != null);
 
+            if (service.IsNew)
+            {
+                //Let's try to auto-assign a feature class
+                string[] classNames = _edsvc.FeatureService.GetClassNames(_vl.ResourceId, null);
+                if (classNames.Length == 1) //Only one class in this Feature Source
+                {
+                    var clsDef = _edsvc.FeatureService.GetClassDefinition(_vl.ResourceId, classNames[0]);
+                    if (!string.IsNullOrEmpty(clsDef.DefaultGeometryPropertyName)) //It has a default geometry
+                    {
+                        _vl.FeatureName = classNames[0];
+                        _vl.Geometry = clsDef.DefaultGeometryPropertyName;
+                    }
+                }
+            }
+
             _props = new List<INameStringPair>(_vl.PropertyMapping);
             //Modifying the visibility constitutes a change in the resource
             //_props.ListChanged += OnPropertyListChanged;



More information about the mapguide-commits mailing list