[mapguide-commits] r8029 - in trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI: . Resource/Validation

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Apr 10 04:46:06 PDT 2014


Author: jng
Date: 2014-04-10 04:46:06 -0700 (Thu, 10 Apr 2014)
New Revision: 8029

Modified:
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseMapDefinitionValidator.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ValidationStatusCode.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Strings.Designer.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Strings.resx
Log:
When validating a Map Definition, we should also be doing the selectability test on any layers marked as selectable.

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseMapDefinitionValidator.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseMapDefinitionValidator.cs	2014-04-10 11:43:33 UTC (rev 8028)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseMapDefinitionValidator.cs	2014-04-10 11:46:06 UTC (rev 8029)
@@ -150,7 +150,7 @@
                     {
                         issues.AddRange(ResourceValidatorSet.Validate(context, layer, recurse));
                     }
-
+                    
                     IVectorLayerDefinition vl = null;
                     if (layer.SubLayer.LayerType == LayerType.Vector)
                         vl = (IVectorLayerDefinition)layer.SubLayer;
@@ -160,8 +160,15 @@
                         try
                         {
                             IFeatureSource fs = (IFeatureSource)context.GetResource(vl.ResourceId);
-                            //The layer recurses on the FeatureSource
-                            //issues.AddRange(Validation.Validate(fs, true));
+                            if (l.Selectable)
+                            {
+                                //Test selectability requirement
+                                string[] idProps = fs.GetIdentityProperties(vl.FeatureName);
+                                if (idProps == null || idProps.Length == 0)
+                                {
+                                    issues.Add(new ValidationIssue(resource, ValidationStatus.Warning, ValidationStatusCode.Warning_MapDefinition_UnselectableLayer, string.Format(Strings.MDF_UnselectableLayer, l.Name, vl.FeatureName, fs.ResourceID)));
+                                }
+                            }
 
                             try
                             {

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ValidationStatusCode.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ValidationStatusCode.cs	2014-04-10 11:43:33 UTC (rev 8028)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ValidationStatusCode.cs	2014-04-10 11:46:06 UTC (rev 8029)
@@ -198,6 +198,11 @@
         Warning_MapDefinition_FeatureSourceWithNullExtent,
 
         /// <summary>
+        /// The Map Definition contains an unselectable layer as that layer's class definition has no identity properties
+        /// </summary>
+        Warning_MapDefinition_UnselectableLayer,
+
+        /// <summary>
         /// The specified initial view parameters lie outside the referenced Map Definition's extents. Usually means you will see nothing when the Fusion viewer loads.
         /// </summary>
         Warning_Fusion_InitialViewOutsideMapExtents = 3401,

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Strings.Designer.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Strings.Designer.cs	2014-04-10 11:43:33 UTC (rev 8028)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Strings.Designer.cs	2014-04-10 11:46:06 UTC (rev 8029)
@@ -1,7 +1,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:4.0.30319.17929
+//     Runtime Version:4.0.30319.18444
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.
@@ -2187,6 +2187,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to Layer {0} is marked as selectable but its feature class {1} in ({2}) has no identity properties. This layer will not be selectable..
+        /// </summary>
+        public static string MDF_UnselectableLayer {
+            get {
+                return ResourceManager.GetString("MDF_UnselectableLayer", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to Layer {0} is a type that is unsupported by Maestro.
         /// </summary>
         public static string MDF_UnsupportedLayerTypeWarning {

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Strings.resx
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Strings.resx	2014-04-10 11:43:33 UTC (rev 8028)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Strings.resx	2014-04-10 11:46:06 UTC (rev 8029)
@@ -3432,4 +3432,7 @@
   <data name="Func_URLENCODE_StringValueDescription" xml:space="preserve">
     <value>String to URL encode</value>
   </data>
+  <data name="MDF_UnselectableLayer" xml:space="preserve">
+    <value>Layer {0} is marked as selectable but its feature class {1} in ({2}) has no identity properties. This layer will not be selectable.</value>
+  </data>
 </root>
\ No newline at end of file



More information about the mapguide-commits mailing list