[mapguide-commits] r6256 - in trunk/Tools/Maestro/Maestro.Editors:
LayerDefinition/Vector Properties
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Nov 28 23:38:32 EST 2011
Author: jng
Date: 2011-11-28 20:38:32 -0800 (Mon, 28 Nov 2011)
New Revision: 6256
Modified:
trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs
trunk/Tools/Maestro/Maestro.Editors/Properties/Resources.Designer.cs
trunk/Tools/Maestro/Maestro.Editors/Properties/Resources.resx
Log:
#1848: Alert to user if they picked an empty feature source when creating a new vector layer definition
Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs 2011-11-29 03:58:05 UTC (rev 6255)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/VectorLayerSettingsSectionCtrl.cs 2011-11-29 04:38:32 UTC (rev 6256)
@@ -109,11 +109,42 @@
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))
{
- SetFeatureClass(_cachedDesc.Schemas[0].Classes[0]);
+ //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;
+ }
+ }
+ }
+ }
+ if (clsDef == null)
+ {
+ MessageBox.Show(string.Format(Properties.Resources.InvalidFeatureSourceNoClasses, txtFeatureSource.Text));
+ txtFeatureSource.Text = string.Empty;
+ return;
+ }
+ SetFeatureClass(clsDef);
}
}
Modified: trunk/Tools/Maestro/Maestro.Editors/Properties/Resources.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Properties/Resources.Designer.cs 2011-11-29 03:58:05 UTC (rev 6255)
+++ trunk/Tools/Maestro/Maestro.Editors/Properties/Resources.Designer.cs 2011-11-29 04:38:32 UTC (rev 6256)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.5448
+// Runtime Version:2.0.50727.4963
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -1753,6 +1753,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Feature Source ({0}) has no usable feature classes. Choose a different feature source.
+ /// </summary>
+ internal static string InvalidFeatureSourceNoClasses {
+ get {
+ return ResourceManager.GetString("InvalidFeatureSourceNoClasses", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Invalid field count in line {0}.
/// </summary>
internal static string InvalidFieldCountError {
Modified: trunk/Tools/Maestro/Maestro.Editors/Properties/Resources.resx
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Properties/Resources.resx 2011-11-29 03:58:05 UTC (rev 6255)
+++ trunk/Tools/Maestro/Maestro.Editors/Properties/Resources.resx 2011-11-29 04:38:32 UTC (rev 6256)
@@ -1298,4 +1298,7 @@
<data name="disk" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\disk.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
+ <data name="InvalidFeatureSourceNoClasses" xml:space="preserve">
+ <value>Feature Source ({0}) has no usable feature classes. Choose a different feature source</value>
+ </data>
</root>
\ No newline at end of file
More information about the mapguide-commits
mailing list