[mapguide-commits] r6679 - in trunk/Tools/Maestro: Maestro.Editors/LayerDefinition/Vector OSGeo.MapGuide.MaestroAPI/Services

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue May 22 10:20:34 EDT 2012


Author: jng
Date: 2012-05-22 07:20:34 -0700 (Tue, 22 May 2012)
New Revision: 6679

Modified:
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Services/IFeatureService.cs
Log:
#2004: Eliminate the need for a full schema walk in Vector Layer settings UI. Again we only need to do class name listings and fetching single Class Definitions, so a full walk is overkill. Also slap a big warning to the API docs of IFeatureService.DescribeFeatureSource()

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs	2012-05-22 14:07:08 UTC (rev 6678)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs	2012-05-22 14:20:34 UTC (rev 6679)
@@ -92,13 +92,10 @@
             if (this.DesignMode)
                 return;
 
-            if (_cachedDesc == null)
-                _cachedDesc = _edsvc.FeatureService.DescribeFeatureSource(txtFeatureSource.Text);
-
             //Init cached schemas and selected class
             if (!string.IsNullOrEmpty(txtFeatureClass.Text))
             {                
-                var cls = _cachedDesc.GetClass(txtFeatureClass.Text);
+                var cls = _edsvc.FeatureService.GetClassDefinition(txtFeatureSource.Text, txtFeatureClass.Text);
                 if (cls != null)
                 {
                     _selectedClass = cls;
@@ -121,39 +118,15 @@
             base.UnsubscribeEventHandlers();
         }
 
-        private FeatureSourceDescription _cachedDesc;
-
         private void txtFeatureSource_TextChanged(object sender, EventArgs e)
         {
             if (string.IsNullOrEmpty(txtFeatureSource.Text))
                 return;
 
-            _cachedDesc = _edsvc.FeatureService.DescribeFeatureSource(txtFeatureSource.Text);
-
-            if (string.IsNullOrEmpty(txtFeatureClass.Text))
+            if (!string.IsNullOrEmpty(txtFeatureClass.Text))
             {
                 //This feature source must have at least one class definition with a geometry property
-                ClassDefinition clsDef = null;
-                foreach (FeatureSchema fs in _cachedDesc.Schemas)
-                {
-                    if (clsDef != null)
-                        break;
-
-                    foreach (ClassDefinition cls in fs.Classes)
-                    {
-                        if (clsDef != null)
-                            break;
-
-                        foreach (PropertyDefinition prop in cls.Properties)
-                        {
-                            if (prop.Type == PropertyDefinitionType.Geometry)
-                            {
-                                clsDef = cls;
-                                break;
-                            }
-                        }
-                    }
-                }
+                ClassDefinition clsDef = _edsvc.FeatureService.GetClassDefinition(txtFeatureSource.Text, txtFeatureClass.Text);
                 if (clsDef == null)
                 {
                     MessageBox.Show(string.Format(Properties.Resources.InvalidFeatureSourceNoClasses, txtFeatureSource.Text));
@@ -254,11 +227,12 @@
 
         private void btnBrowseSchema_Click(object sender, EventArgs e)
         {
-            var list = new List<ClassDefinition>(_cachedDesc.AllClasses).ToArray();
-            var item = GenericItemSelectionDialog.SelectItem(null, null, list, "QualifiedName", "QualifiedName");
+            var list = _edsvc.FeatureService.GetClassNames(txtFeatureSource.Text, null);
+            var item = GenericItemSelectionDialog.SelectItem(null, null, list);
             if (item != null)
             {
-                SetFeatureClass(item);
+                var cls = _edsvc.FeatureService.GetClassDefinition(txtFeatureSource.Text, item);
+                SetFeatureClass(cls);
             }
         }
 

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Services/IFeatureService.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Services/IFeatureService.cs	2012-05-22 14:07:08 UTC (rev 6678)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Services/IFeatureService.cs	2012-05-22 14:20:34 UTC (rev 6679)
@@ -196,6 +196,11 @@
         /// Describes the specified feature source
         /// </summary>
         /// <param name="resourceID"></param>
+        /// <remarks>
+        /// If you only need to list schemas and class names, use the respective <see cref="M:OSGeo.MapGuide.MaestroAPI.Services.IFeatureService.GetSchemas" /> and
+        /// <see cref="M:OSGeo.MapGuide.MaestroAPI.Services.IFeatureService.GetClassNames" /> methods. Using this API will have a noticeable performance impact on 
+        /// really large datastores (whose size is in the 100s of classes).
+        /// </remarks>
         /// <returns></returns>
         FeatureSourceDescription DescribeFeatureSource(string resourceID);
 
@@ -204,6 +209,11 @@
         /// </summary>
         /// <param name="resourceID"></param>
         /// <param name="schema"></param>
+        /// <remarks>
+        /// If you only need to list schemas and class names, use the respective <see cref="M:OSGeo.MapGuide.MaestroAPI.Services.IFeatureService.GetSchemas" /> and
+        /// <see cref="M:OSGeo.MapGuide.MaestroAPI.Services.IFeatureService.GetClassNames" /> methods. Using this API will have a noticeable performance impact on 
+        /// really large datastores (whose size is in the 100s of classes).
+        /// </remarks>
         /// <returns></returns>
         FeatureSchema DescribeFeatureSource(string resourceID, string schema);
 



More information about the mapguide-commits mailing list