[mapguide-commits] r5834 - in
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI: ObjectModels
Properties Resource/Validation
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon May 23 09:13:12 EDT 2011
Author: jng
Date: 2011-05-23 06:13:12 -0700 (Mon, 23 May 2011)
New Revision: 5834
Modified:
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/MapDefinitionValidator.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ValidationStatusCode.cs
Log:
#1631: Add Map Definition validation checks for non-existent parent groups
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs 2011-05-23 12:55:40 UTC (rev 5833)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ObjectModels/MapDefinitionInterfaces.cs 2011-05-23 13:13:12 UTC (rev 5834)
@@ -468,7 +468,6 @@
public static IMapLayerGroup GetGroupByName(this IMapDefinition map, string name)
{
Check.NotNull(map, "map");
- Check.NotEmpty(name, "name");
foreach (var group in map.MapLayerGroup)
{
if (name.Equals(group.Name))
@@ -508,7 +507,6 @@
public static IEnumerable<IMapLayer> GetLayersForGroup(this IMapDefinition map, string name)
{
Check.NotNull(map, "map");
- Check.NotEmpty(name, "name");
foreach (var layer in map.MapLayer)
{
if (name.Equals(layer.Group))
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs 2011-05-23 12:55:40 UTC (rev 5833)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.Designer.cs 2011-05-23 13:13:12 UTC (rev 5834)
@@ -764,6 +764,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Layer Group ({0}) belongs to a non-existent Layer Group ({1}).
+ /// </summary>
+ internal static string MDF_GroupWithNonExistentGroup {
+ get {
+ return ResourceManager.GetString("MDF_GroupWithNonExistentGroup", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Layer {0} does not have a legend label.
/// </summary>
internal static string MDF_LayerMissingLabelInformation {
@@ -791,6 +800,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Layer ({0}) belongs to a non-existent Layer Group ({1}).
+ /// </summary>
+ internal static string MDF_LayerWithNonExistentGroup {
+ get {
+ return ResourceManager.GetString("MDF_LayerWithNonExistentGroup", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Layer {0} has no geometry column.
/// </summary>
internal static string MDF_MissingLayerGeometryColumnError {
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx 2011-05-23 12:55:40 UTC (rev 5833)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Properties/Resources.resx 2011-05-23 13:13:12 UTC (rev 5834)
@@ -500,4 +500,10 @@
<data name="NullString" xml:space="preserve">
<value>(null)</value>
</data>
+ <data name="MDF_GroupWithNonExistentGroup" xml:space="preserve">
+ <value>Layer Group ({0}) belongs to a non-existent Layer Group ({1})</value>
+ </data>
+ <data name="MDF_LayerWithNonExistentGroup" xml:space="preserve">
+ <value>Layer ({0}) belongs to a non-existent Layer Group ({1})</value>
+ </data>
</root>
\ No newline at end of file
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/MapDefinitionValidator.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/MapDefinitionValidator.cs 2011-05-23 12:55:40 UTC (rev 5833)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/MapDefinitionValidator.cs 2011-05-23 13:13:12 UTC (rev 5834)
@@ -59,11 +59,20 @@
IMapDefinition mdef = resource as IMapDefinition;
foreach (IMapLayerGroup g in mdef.MapLayerGroup)
+ {
if (g.ShowInLegend && (g.LegendLabel == null || g.LegendLabel.Trim().Length == 0))
issues.Add(new ValidationIssue(mdef, ValidationStatus.Information, ValidationStatusCode.Info_MapDefinition_GroupMissingLabelInformation, string.Format(Properties.Resources.MDF_GroupMissingLabelInformation, g.Name)));
else if (g.ShowInLegend && g.LegendLabel.Trim().ToLower() == "layer group")
issues.Add(new ValidationIssue(mdef, ValidationStatus.Information, ValidationStatusCode.Info_MapDefinition_GroupHasDefaultLabel, string.Format(Properties.Resources.MDF_GroupHasDefaultLabelInformation, g.Name)));
+ if (!string.IsNullOrEmpty(g.Group))
+ {
+ var grp = mdef.GetGroupByName(g.Group);
+ if (grp == null)
+ issues.Add(new ValidationIssue(mdef, ValidationStatus.Error, ValidationStatusCode.Error_MapDefinition_GroupWithNonExistentGroup, string.Format(Properties.Resources.MDF_GroupWithNonExistentGroup, g.Name, g.Group)));
+ }
+ }
+
List<IBaseMapLayer> layers = new List<IBaseMapLayer>();
foreach (IBaseMapLayer l in mdef.MapLayer)
layers.Add(l);
@@ -88,6 +97,14 @@
else
nameCounter.Add(l.Name, l);
+ var ml = l as IMapLayer;
+ if (ml != null && !string.IsNullOrEmpty(ml.Group))
+ {
+ var grp = mdef.GetGroupByName(ml.Group);
+ if (grp == null)
+ issues.Add(new ValidationIssue(mdef, ValidationStatus.Error, ValidationStatusCode.Error_MapDefinition_LayerWithNonExistentGroup, string.Format(Properties.Resources.MDF_LayerWithNonExistentGroup, ml.Name, ml.Group)));
+ }
+
if (l.ShowInLegend && (string.IsNullOrEmpty(l.LegendLabel) || l.LegendLabel.Trim().Length == 0))
issues.Add(new ValidationIssue(mdef, ValidationStatus.Information, ValidationStatusCode.Warning_MapDefinition_LayerMissingLegendLabel, string.Format(Properties.Resources.MDF_LayerMissingLabelInformation, l.Name)));
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ValidationStatusCode.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ValidationStatusCode.cs 2011-05-23 12:55:40 UTC (rev 5833)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ValidationStatusCode.cs 2011-05-23 13:13:12 UTC (rev 5834)
@@ -60,7 +60,7 @@
Warning_MapDefinition_MissingSpatialContext,
Warning_MapDefinition_LayerReprojection,
Warning_MapDefinition_DataOutsideMapBounds,
-
+
Warning_Fusion_InitialViewOutsideMapExtents = 3401,
Warning_Fusion_MapCoordSysIncompatibleWithCommericalLayers,
@@ -82,6 +82,8 @@
Error_MapDefinition_ResourceRead,
Error_MapDefinition_FeatureSourceRead,
Error_MapDefinition_LayerRead,
+ Error_MapDefinition_LayerWithNonExistentGroup,
+ Error_MapDefinition_GroupWithNonExistentGroup,
Error_Fusion_MissingMap = 5301,
Error_Fusion_InvalidMap,
More information about the mapguide-commits
mailing list