[mapguide-commits] r4422 - in trunk/Tools/Maestro/Maestro/ResourceValidators: . Strings

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sat Dec 12 05:17:19 EST 2009


Author: ksgeograf
Date: 2009-12-12 05:17:19 -0500 (Sat, 12 Dec 2009)
New Revision: 4422

Modified:
   trunk/Tools/Maestro/Maestro/ResourceValidators/MapDefinitionValidator.cs
   trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/MapDefinitionValidator.Designer.cs
   trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/MapDefinitionValidator.resx
Log:
Maestro:
Added a check for duplicate layer names in a map.

Modified: trunk/Tools/Maestro/Maestro/ResourceValidators/MapDefinitionValidator.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceValidators/MapDefinitionValidator.cs	2009-12-12 10:16:06 UTC (rev 4421)
+++ trunk/Tools/Maestro/Maestro/ResourceValidators/MapDefinitionValidator.cs	2009-12-12 10:17:19 UTC (rev 4422)
@@ -51,8 +51,15 @@
                     foreach(MaestroAPI.BaseMapLayerType l in g.BaseMapLayer)
                         layers.Add(l);
 
+            Dictionary<string, MaestroAPI.BaseMapLayerType> nameCounter = new Dictionary<string, OSGeo.MapGuide.MaestroAPI.BaseMapLayerType>();
+
             foreach (MaestroAPI.BaseMapLayerType l in layers)
             {
+                if (nameCounter.ContainsKey(l.Name))
+                    issues.Add(new ValidationIssue(mdef, ValidationStatus.Warning, string.Format(Strings.MapDefinitionValidator.LayerNameDuplicateWarning, l.Name, l.ResourceId, nameCounter[l.Name].ResourceId)));
+                else
+                    nameCounter.Add(l.Name, l);
+ 
                 if (l.ShowInLegend && (string.IsNullOrEmpty(l.LegendLabel) ||  l.LegendLabel.Trim().Length == 0))
                     issues.Add(new ValidationIssue(mdef, ValidationStatus.Information, string.Format(Strings.MapDefinitionValidator.LayerMissingLabelInformation, l.Name)));
                 

Modified: trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/MapDefinitionValidator.Designer.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/MapDefinitionValidator.Designer.cs	2009-12-12 10:16:06 UTC (rev 4421)
+++ trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/MapDefinitionValidator.Designer.cs	2009-12-12 10:17:19 UTC (rev 4422)
@@ -115,6 +115,15 @@
         }
         
         /// <summary>
+        ///   Looks up a localized string similar to The layer name {0} is used for both &quot;{1}&quot; and &quot;{2}&quot;.
+        /// </summary>
+        internal static string LayerNameDuplicateWarning {
+            get {
+                return ResourceManager.GetString("LayerNameDuplicateWarning", resourceCulture);
+            }
+        }
+        
+        /// <summary>
         ///   Looks up a localized string similar to Layer {0} could not be read: {1}.
         /// </summary>
         internal static string LayerReadError {

Modified: trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/MapDefinitionValidator.resx
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/MapDefinitionValidator.resx	2009-12-12 10:16:06 UTC (rev 4421)
+++ trunk/Tools/Maestro/Maestro/ResourceValidators/Strings/MapDefinitionValidator.resx	2009-12-12 10:17:19 UTC (rev 4422)
@@ -141,6 +141,10 @@
     <value>Layer {0} does not have a legend label</value>
     <comment>An information message that is displayed if a layer has a blank legend label</comment>
   </data>
+  <data name="LayerNameDuplicateWarning" xml:space="preserve">
+    <value>The layer name {0} is used for both "{1}" and "{2}"</value>
+    <comment>A warning message that is displayed if two layers share the same layer name</comment>
+  </data>
   <data name="LayerReadError" xml:space="preserve">
     <value>Layer {0} could not be read: {1}</value>
     <comment>An error message that is displayed if a LayerDefinition fails to load</comment>



More information about the mapguide-commits mailing list