[mapguide-commits] r5973 - in trunk/Tools/Maestro/Maestro.Editors/LayerDefinition: Raster Vector

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Jul 6 06:43:58 EDT 2011


Author: jng
Date: 2011-07-06 03:43:58 -0700 (Wed, 06 Jul 2011)
New Revision: 5973

Modified:
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Raster/RasterLayerSettingsSectionCtrl.cs
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Raster/RasterLayerSettingsSectionCtrl.resx
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs
Log:
#1740: Auto-set feature class when creating new Vector/Raster layer definition.


Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Raster/RasterLayerSettingsSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Raster/RasterLayerSettingsSectionCtrl.cs	2011-07-06 02:16:58 UTC (rev 5972)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Raster/RasterLayerSettingsSectionCtrl.cs	2011-07-06 10:43:58 UTC (rev 5973)
@@ -93,6 +93,10 @@
                     _selectedClass = cls;
                 }
             }
+            else
+            {
+                SetFeatureClass(_cachedDesc.Schemas[0].Classes[0]);
+            }
         }
 
         private void btnBrowseFeatureSource_Click(object sender, EventArgs e)
@@ -134,37 +138,42 @@
             var item = GenericItemSelectionDialog.SelectItem(null, null, list.ToArray(), "QualifiedName", "QualifiedName");
             if (item != null)
             {
-                txtFeatureClass.Text = item.QualifiedName;
-                _selectedClass = item;
+                SetFeatureClass(item);
+            }
+        }
 
-                //See if geometry needs invalidation
-                bool invalidate = true;
-                foreach (var col in item.Properties)
-                {
-                    if (col.Type == PropertyDefinitionType.Raster && col.Name.Equals(txtGeometry.Text))
-                    {
-                        invalidate = false;
-                        break;
-                    }
-                }
-                if (invalidate)
-                {
-                    txtGeometry.Text = string.Empty;
-                }
+        private void SetFeatureClass(ClassDefinition item)
+        {
+            txtFeatureClass.Text = item.QualifiedName;
+            _selectedClass = item;
 
-                //See if we can auto-assign geometry
-                List<PropertyDefinition> geoms = new List<PropertyDefinition>();
-                foreach (var col in _selectedClass.Properties)
+            //See if geometry needs invalidation
+            bool invalidate = true;
+            foreach (var col in item.Properties)
+            {
+                if (col.Type == PropertyDefinitionType.Raster && col.Name.Equals(txtGeometry.Text))
                 {
-                    if (col.Type == PropertyDefinitionType.Raster)
-                        geoms.Add(col);
+                    invalidate = false;
+                    break;
                 }
+            }
+            if (invalidate)
+            {
+                txtGeometry.Text = string.Empty;
+            }
 
-                if (geoms.Count == 1)
-                    txtGeometry.Text = geoms[0].Name;
+            //See if we can auto-assign geometry
+            List<PropertyDefinition> geoms = new List<PropertyDefinition>();
+            foreach (var col in _selectedClass.Properties)
+            {
+                if (col.Type == PropertyDefinitionType.Raster)
+                    geoms.Add(col);
+            }
 
-                //OnFeatureClassChanged();
-            }
+            if (geoms.Count == 1)
+                txtGeometry.Text = geoms[0].Name;
+
+            //OnFeatureClassChanged();
         }
 
         private void btnBrowseGeometry_Click(object sender, EventArgs e)

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Raster/RasterLayerSettingsSectionCtrl.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Raster/RasterLayerSettingsSectionCtrl.resx	2011-07-06 02:16:58 UTC (rev 5972)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Raster/RasterLayerSettingsSectionCtrl.resx	2011-07-06 10:43:58 UTC (rev 5973)
@@ -417,6 +417,9 @@
   <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <data name="$this.HeaderText" xml:space="preserve">
+    <value>Feature Source Settings</value>
+  </data>
   <data name="$this.Size" type="System.Drawing.Size, System.Drawing">
     <value>449, 145</value>
   </data>
@@ -424,6 +427,6 @@
     <value>RasterLayerSettingsSectionCtrl</value>
   </data>
   <data name="&gt;&gt;$this.Type" xml:space="preserve">
-    <value>Maestro.Editors.Common.EditorBindableCollapsiblePanel, Maestro.Editors, Version=3.0.0.5475, Culture=neutral, PublicKeyToken=null</value>
+    <value>Maestro.Editors.Common.EditorBindableCollapsiblePanel, Maestro.Editors, Version=3.1.0.5859, Culture=neutral, PublicKeyToken=null</value>
   </data>
 </root>
\ No newline at end of file

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs	2011-07-06 02:16:58 UTC (rev 5972)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs	2011-07-06 10:43:58 UTC (rev 5973)
@@ -110,6 +110,11 @@
         private void txtFeatureSource_TextChanged(object sender, EventArgs e)
         {
             _cachedDesc = _edsvc.FeatureService.DescribeFeatureSource(txtFeatureSource.Text);
+
+            if (string.IsNullOrEmpty(txtFeatureClass.Text))
+            {
+                SetFeatureClass(_cachedDesc.Schemas[0].Classes[0]);
+            }
         }
 
         internal event EventHandler FeatureClassChanged;
@@ -202,37 +207,42 @@
             var item = GenericItemSelectionDialog.SelectItem(null, null, list, "QualifiedName", "QualifiedName");
             if (item != null)
             {
-                txtFeatureClass.Text = item.QualifiedName;
-                _selectedClass = item;
-                
-                //See if geometry needs invalidation
-                bool invalidate = true;
-                foreach (var col in item.Properties)
-                {
-                    if (col.Type == PropertyDefinitionType.Geometry && col.Name.Equals(txtGeometry.Text))
-                    {
-                        invalidate = false;
-                        break;
-                    }
-                }
-                if (invalidate)
-                {
-                    txtGeometry.Text = string.Empty;
-                }
+                SetFeatureClass(item);
+            }
+        }
 
-                //See if we can auto-assign geometry
-                List<PropertyDefinition> geoms = new List<PropertyDefinition>();
-                foreach (var col in _selectedClass.Properties)
+        private void SetFeatureClass(ClassDefinition item)
+        {
+            txtFeatureClass.Text = item.QualifiedName;
+            _selectedClass = item;
+
+            //See if geometry needs invalidation
+            bool invalidate = true;
+            foreach (var col in item.Properties)
+            {
+                if (col.Type == PropertyDefinitionType.Geometry && col.Name.Equals(txtGeometry.Text))
                 {
-                    if (col.Type == PropertyDefinitionType.Geometry)
-                        geoms.Add(col);
+                    invalidate = false;
+                    break;
                 }
+            }
+            if (invalidate)
+            {
+                txtGeometry.Text = string.Empty;
+            }
 
-                if (geoms.Count == 1)
-                    txtGeometry.Text = geoms[0].Name;
+            //See if we can auto-assign geometry
+            List<PropertyDefinition> geoms = new List<PropertyDefinition>();
+            foreach (var col in _selectedClass.Properties)
+            {
+                if (col.Type == PropertyDefinitionType.Geometry)
+                    geoms.Add(col);
+            }
 
-                OnFeatureClassChanged();
-            }
+            if (geoms.Count == 1)
+                txtGeometry.Text = geoms[0].Name;
+
+            OnFeatureClassChanged();
         }
 
         private void btnBrowseGeometry_Click(object sender, EventArgs e)



More information about the mapguide-commits mailing list