[mapguide-commits] r5664 - in
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource: . Validation
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Mar 28 08:23:13 EDT 2011
Author: jng
Date: 2011-03-28 05:23:13 -0700 (Mon, 28 Mar 2011)
New Revision: 5664
Modified:
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/IResourceValidator.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ApplicationDefinitionValidator.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseLayerDefinitionValidator.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseWebLayoutValidator.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/MapDefinitionValidator.cs
Log:
#1644: Cleanup recursive validation behaviour
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/IResourceValidator.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/IResourceValidator.cs 2011-03-28 10:56:52 UTC (rev 5663)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/IResourceValidator.cs 2011-03-28 12:23:13 UTC (rev 5664)
@@ -40,8 +40,8 @@
/// resource type
/// </summary>
/// <param name="context"></param>
- /// <param name="resource"></param>
- /// <param name="recurse"></param>
+ /// <param name="resource">The resource to be validated</param>
+ /// <param name="recurse">Indicates whether to also validate resources this resource depends on</param>
/// <returns></returns>
ValidationIssue[] Validate(ResourceValidationContext context, IResource resource, bool recurse);
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ApplicationDefinitionValidator.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ApplicationDefinitionValidator.cs 2011-03-28 10:56:52 UTC (rev 5663)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/ApplicationDefinitionValidator.cs 2011-03-28 12:23:13 UTC (rev 5664)
@@ -63,62 +63,61 @@
issues.Add(new ValidationIssue(fusionApp, ValidationStatus.Error, ValidationStatusCode.Error_Fusion_MissingMap, string.Format(Properties.Resources.ADF_MapMissingError)));
else
{
- if (recurse)
+ foreach (IMapGroup mapGroup in fusionApp.MapSet.MapGroups)
{
- foreach (IMapGroup mapGroup in fusionApp.MapSet.MapGroups)
+ bool checkCmsProjection = false;
+ List<IMapDefinition> mapDefsInGroup = new List<IMapDefinition>();
+ foreach (IMap map in mapGroup.Map)
{
- bool checkCmsProjection = false;
- List<IMapDefinition> mapDefsInGroup = new List<IMapDefinition>();
- foreach (IMap map in mapGroup.Map)
+ if (IsCommercialOverlay(map))
{
- if (IsCommercialOverlay(map))
+ checkCmsProjection = true;
+ }
+ try
+ {
+ if (map.Type.ToLower() == "mapguide")
{
- checkCmsProjection = true;
- }
- try
- {
- if (map.Type.ToLower() == "mapguide")
+ var mdfId = map.GetMapDefinition();
+ if (string.IsNullOrEmpty(mdfId) || !resource.CurrentConnection.ResourceService.ResourceExists(mdfId))
{
- var mdfId = map.GetMapDefinition();
- if (string.IsNullOrEmpty(mdfId) || !resource.CurrentConnection.ResourceService.ResourceExists(mdfId))
+ issues.Add(new ValidationIssue(fusionApp, ValidationStatus.Error, ValidationStatusCode.Error_Fusion_InvalidMap, string.Format(Properties.Resources.ADF_MapInvalidError, mapGroup.id)));
+ }
+ else
+ {
+ IMapDefinition mdef = (IMapDefinition)context.GetResource(mdfId);
+ mapDefsInGroup.Add(mdef);
+
+ IEnvelope mapEnv = ObjectFactory.CreateEnvelope(mdef.Extents.MinX, mdef.Extents.MaxX, mdef.Extents.MinY, mdef.Extents.MaxY);
+
+ if (mapGroup.InitialView != null)
{
- issues.Add(new ValidationIssue(fusionApp, ValidationStatus.Error, ValidationStatusCode.Error_Fusion_InvalidMap, string.Format(Properties.Resources.ADF_MapInvalidError, mapGroup.id)));
+ if (!mapEnv.Contains(mapGroup.InitialView.CenterX, mapGroup.InitialView.CenterY))
+ issues.Add(new ValidationIssue(mdef, ValidationStatus.Warning, ValidationStatusCode.Warning_Fusion_InitialViewOutsideMapExtents, string.Format(Properties.Resources.ADF_ViewOutsideMapExtents)));
}
- else
- {
- IMapDefinition mdef = (IMapDefinition)context.GetResource(mdfId);
- mapDefsInGroup.Add(mdef);
- if (recurse)
- issues.AddRange(ResourceValidatorSet.Validate(context, mdef, true));
-
- IEnvelope mapEnv = ObjectFactory.CreateEnvelope(mdef.Extents.MinX, mdef.Extents.MaxX, mdef.Extents.MinY, mdef.Extents.MaxY);
-
- if (mapGroup.InitialView != null)
- {
- if (!mapEnv.Contains(mapGroup.InitialView.CenterX, mapGroup.InitialView.CenterY))
- issues.Add(new ValidationIssue(mdef, ValidationStatus.Warning, ValidationStatusCode.Warning_Fusion_InitialViewOutsideMapExtents, string.Format(Properties.Resources.ADF_ViewOutsideMapExtents)));
- }
+ if (recurse)
+ {
+ issues.AddRange(ResourceValidatorSet.Validate(context, mdef, recurse));
}
}
}
- catch (Exception ex)
- {
- string msg = NestedExceptionMessageProcessor.GetFullMessage(ex);
- issues.Add(new ValidationIssue(fusionApp, ValidationStatus.Error, ValidationStatusCode.Error_Fusion_MapValidationError, string.Format(Properties.Resources.ADF_MapValidationError, mapGroup.id, msg)));
- }
}
+ catch (Exception ex)
+ {
+ string msg = NestedExceptionMessageProcessor.GetFullMessage(ex);
+ issues.Add(new ValidationIssue(fusionApp, ValidationStatus.Error, ValidationStatusCode.Error_Fusion_MapValidationError, string.Format(Properties.Resources.ADF_MapValidationError, mapGroup.id, msg)));
+ }
+ }
- if (checkCmsProjection)
+ if (checkCmsProjection)
+ {
+ foreach (var mdf in mapDefsInGroup)
{
- foreach (var mdf in mapDefsInGroup)
+ var wkt = mdf.CoordinateSystem;
+ var csCode = resource.CurrentConnection.CoordinateSystemCatalog.ConvertWktToCoordinateSystemCode(wkt);
+ if (csCode.ToUpper() != "WGS84.PSEUDOMERCATOR")
{
- var wkt = mdf.CoordinateSystem;
- var csCode = resource.CurrentConnection.CoordinateSystemCatalog.ConvertWktToCoordinateSystemCode(wkt);
- if (csCode.ToUpper() != "WGS84.PSEUDOMERCATOR")
- {
- issues.Add(new ValidationIssue(resource, ValidationStatus.Warning, ValidationStatusCode.Warning_Fusion_MapCoordSysIncompatibleWithCommericalLayers, string.Format(Properties.Resources.ADF_MapWithIncompatibleCommericalCs, mdf.ResourceID)));
- }
+ issues.Add(new ValidationIssue(resource, ValidationStatus.Warning, ValidationStatusCode.Warning_Fusion_MapCoordSysIncompatibleWithCommericalLayers, string.Format(Properties.Resources.ADF_MapWithIncompatibleCommericalCs, mdf.ResourceID)));
}
}
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseLayerDefinitionValidator.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseLayerDefinitionValidator.cs 2011-03-28 10:56:52 UTC (rev 5663)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseLayerDefinitionValidator.cs 2011-03-28 12:23:13 UTC (rev 5664)
@@ -180,6 +180,11 @@
}
}
}
+
+ if (recurse)
+ {
+ issues.AddRange(ResourceValidatorSet.Validate(context, dws, recurse));
+ }
}
}
else
@@ -187,85 +192,87 @@
issues.Add(new ValidationIssue(resource, ValidationStatus.Warning, ValidationStatusCode.Warning_LayerDefinition_UnsupportedLayerType, Properties.Resources.LDF_UnsupportedLayerTypeWarning));
}
- if (recurse)
+ if (vldef != null || gldef != null)
{
- if (vldef != null || gldef != null)
+ //Load referenced feature source
+ IFeatureSource fs = null;
+
+ try
{
- //Load referenced feature source
- IFeatureSource fs = null;
+ fs = (IFeatureSource)context.GetResource(ldef.SubLayer.ResourceId);
+ issues.AddRange(ResourceValidatorSet.Validate(context, fs, recurse));
+ }
+ catch (Exception)
+ {
+ issues.Add(new ValidationIssue(resource, ValidationStatus.Error, ValidationStatusCode.Error_LayerDefinition_FeatureSourceLoadError, string.Format(Properties.Resources.LDF_FeatureSourceLoadError)));
+ }
+ if (fs != null)
+ {
+ //Verify specified feature class and geometry check out
try
{
- fs = (IFeatureSource)context.GetResource(ldef.SubLayer.ResourceId);
- issues.AddRange(ResourceValidatorSet.Validate(context, fs, recurse));
- }
- catch (Exception)
- {
- issues.Add(new ValidationIssue(resource, ValidationStatus.Error, ValidationStatusCode.Error_LayerDefinition_FeatureSourceLoadError, string.Format(Properties.Resources.LDF_FeatureSourceLoadError)));
- }
+ string qualClassName = vldef == null ? gldef.FeatureName : vldef.FeatureName;
+ string geometry = vldef == null ? gldef.Geometry : vldef.Geometry;
- if (fs != null)
- {
- //Verify specified feature class and geometry check out
- try
+ bool foundSchema = false;
+ bool foundGeometry = false;
+
+ FeatureSourceDescription desc = context.DescribeFeatureSource(ldef.SubLayer.ResourceId);
+ foreach (FeatureSchema fsc in desc.Schemas)
{
- string qualClassName = vldef == null ? gldef.FeatureName : vldef.FeatureName;
- string geometry = vldef == null ? gldef.Geometry : vldef.Geometry;
-
- bool foundSchema = false;
- bool foundGeometry = false;
-
- FeatureSourceDescription desc = context.DescribeFeatureSource(ldef.SubLayer.ResourceId);
- foreach (FeatureSchema fsc in desc.Schemas)
+ foreach (ClassDefinition scm in fsc.Classes)
{
- foreach (ClassDefinition scm in fsc.Classes)
+ if (scm.QualifiedName == qualClassName)
{
- if (scm.QualifiedName == qualClassName)
+ foundSchema = true;
+
+ foreach (PropertyDefinition col in scm.Properties)
{
- foundSchema = true;
-
- foreach (PropertyDefinition col in scm.Properties)
+ if (col.Name == geometry)
{
- if (col.Name == geometry)
- {
- foundGeometry = true;
- break;
- }
+ foundGeometry = true;
+ break;
}
+ }
- if (vldef != null && vldef.PropertyMapping != null)
+ if (vldef != null && vldef.PropertyMapping != null)
+ {
+ foreach (INameStringPair s in vldef.PropertyMapping)
{
- foreach (INameStringPair s in vldef.PropertyMapping)
+ bool found = false;
+ foreach (PropertyDefinition col in scm.Properties)
{
- bool found = false;
- foreach (PropertyDefinition col in scm.Properties)
+ if (col.Name == s.Name)
{
- if (col.Name == s.Name)
- {
- found = true;
- break;
- }
+ found = true;
+ break;
}
- if (!found)
- issues.Add(new ValidationIssue(resource, ValidationStatus.Error, ValidationStatusCode.Error_LayerDefinition_ClassNotFound, string.Format(Properties.Resources.LDF_SchemaMissingError, qualClassName, fs.ResourceID)));
}
+ if (!found)
+ issues.Add(new ValidationIssue(resource, ValidationStatus.Error, ValidationStatusCode.Error_LayerDefinition_ClassNotFound, string.Format(Properties.Resources.LDF_SchemaMissingError, qualClassName, fs.ResourceID)));
}
+ }
- break;
- }
+ break;
}
}
+ }
- if (!foundSchema)
- issues.Add(new ValidationIssue(resource, ValidationStatus.Error, ValidationStatusCode.Error_LayerDefinition_ClassNotFound, string.Format(Properties.Resources.LDF_SchemaMissingError, qualClassName, fs.ResourceID)));
- else if (!foundGeometry)
- issues.Add(new ValidationIssue(resource, ValidationStatus.Error, ValidationStatusCode.Error_LayerDefinition_GeometryNotFound, string.Format(Properties.Resources.LDF_GeometryMissingError, geometry, qualClassName, fs.ResourceID)));
- }
- catch (Exception)
- {
- issues.Add(new ValidationIssue(fs, ValidationStatus.Error, ValidationStatusCode.Error_LayerDefinition_Generic, string.Format(Properties.Resources.LDF_SchemaAndColumnReadFailedError)));
- }
+ if (!foundSchema)
+ issues.Add(new ValidationIssue(resource, ValidationStatus.Error, ValidationStatusCode.Error_LayerDefinition_ClassNotFound, string.Format(Properties.Resources.LDF_SchemaMissingError, qualClassName, fs.ResourceID)));
+ else if (!foundGeometry)
+ issues.Add(new ValidationIssue(resource, ValidationStatus.Error, ValidationStatusCode.Error_LayerDefinition_GeometryNotFound, string.Format(Properties.Resources.LDF_GeometryMissingError, geometry, qualClassName, fs.ResourceID)));
}
+ catch (Exception)
+ {
+ issues.Add(new ValidationIssue(fs, ValidationStatus.Error, ValidationStatusCode.Error_LayerDefinition_Generic, string.Format(Properties.Resources.LDF_SchemaAndColumnReadFailedError)));
+ }
+
+ if (recurse)
+ {
+ issues.AddRange(ResourceValidatorSet.Validate(context, fs, recurse));
+ }
}
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseWebLayoutValidator.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseWebLayoutValidator.cs 2011-03-28 10:56:52 UTC (rev 5663)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/BaseWebLayoutValidator.cs 2011-03-28 12:23:13 UTC (rev 5664)
@@ -125,28 +125,26 @@
}
}
- if (recurse)
+ try
{
- try
+ IMapDefinition mdef = (IMapDefinition)context.GetResource(layout.Map.ResourceId);
+ if (layout.Map.InitialView != null)
{
- IMapDefinition mdef = (IMapDefinition)context.GetResource(layout.Map.ResourceId);
+ var mapEnv = ObjectFactory.CreateEnvelope(mdef.Extents.MinX, mdef.Extents.MaxX, mdef.Extents.MinY, mdef.Extents.MaxY);
+ if (!mapEnv.Contains(layout.Map.InitialView.CenterX, layout.Map.InitialView.CenterY))
+ issues.Add(new ValidationIssue(mdef, ValidationStatus.Warning, ValidationStatusCode.Warning_WebLayout_InitialViewOutsideMapExtents, string.Format(Properties.Resources.WL_StartViewOutsideExtentsWarning)));
+ }
+ if (recurse)
+ {
issues.AddRange(ResourceValidatorSet.Validate(context, mdef, true));
-
- if (layout.Map.InitialView != null)
- {
- var mapEnv = ObjectFactory.CreateEnvelope(mdef.Extents.MinX, mdef.Extents.MaxX, mdef.Extents.MinY, mdef.Extents.MaxY);
- if (!mapEnv.Contains(layout.Map.InitialView.CenterX, layout.Map.InitialView.CenterY))
- issues.Add(new ValidationIssue(mdef, ValidationStatus.Warning, ValidationStatusCode.Warning_WebLayout_InitialViewOutsideMapExtents, string.Format(Properties.Resources.WL_StartViewOutsideExtentsWarning)));
- }
-
}
- catch (Exception ex)
- {
- string msg = NestedExceptionMessageProcessor.GetFullMessage(ex);
- issues.Add(new ValidationIssue(layout, ValidationStatus.Error, ValidationStatusCode.Error_WebLayout_Generic, string.Format(Properties.Resources.WL_MapValidationError, layout.Map.ResourceId, msg)));
- }
}
+ catch (Exception ex)
+ {
+ string msg = NestedExceptionMessageProcessor.GetFullMessage(ex);
+ issues.Add(new ValidationIssue(layout, ValidationStatus.Error, ValidationStatusCode.Error_WebLayout_Generic, string.Format(Properties.Resources.WL_MapValidationError, layout.Map.ResourceId, msg)));
+ }
}
context.MarkValidated(resource.ResourceID);
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/MapDefinitionValidator.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/MapDefinitionValidator.cs 2011-03-28 10:56:52 UTC (rev 5663)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Resource/Validation/MapDefinitionValidator.cs 2011-03-28 12:23:13 UTC (rev 5664)
@@ -91,89 +91,89 @@
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)));
- if (recurse)
+ var mapEnv = ObjectFactory.CreateEnvelope(mdef.Extents.MinX, mdef.Extents.MaxX, mdef.Extents.MinY, mdef.Extents.MaxY);
+
+ try
{
- var mapEnv = ObjectFactory.CreateEnvelope(mdef.Extents.MinX, mdef.Extents.MaxX, mdef.Extents.MinY, mdef.Extents.MaxY);
+ ILayerDefinition layer = null;
+ IResource res = context.GetResource(l.ResourceId);
+ if (!ResourceValidatorSet.HasValidator(res.ResourceType, res.ResourceVersion))
+ {
+ //Need to trap the no registered validator message
+ issues.AddRange(ResourceValidatorSet.Validate(context, res, true));
+ continue;
+ }
- try
+ layer = (ILayerDefinition)res;
+ if (recurse)
{
- ILayerDefinition layer = null;
- IResource res = context.GetResource(l.ResourceId);
- if (!ResourceValidatorSet.HasValidator(res.ResourceType, res.ResourceVersion))
- {
- //Need to trap the no registered validator message
- issues.AddRange(ResourceValidatorSet.Validate(context, res, true));
- continue;
- }
+ issues.AddRange(ResourceValidatorSet.Validate(context, layer, recurse));
+ }
- layer = (ILayerDefinition)res;
- issues.AddRange(ResourceValidatorSet.Validate(context, layer, true));
+ IVectorLayerDefinition vl = null;
+ if (layer.SubLayer.LayerType == LayerType.Vector)
+ vl = (IVectorLayerDefinition)layer.SubLayer;
- IVectorLayerDefinition vl = null;
- if (layer.SubLayer.LayerType == LayerType.Vector)
- vl = (IVectorLayerDefinition)layer.SubLayer;
+ if (vl != null)
+ {
+ try
+ {
+ IFeatureSource fs = (IFeatureSource)context.GetResource(vl.ResourceId);
+ //The layer recurses on the FeatureSource
+ //issues.AddRange(Validation.Validate(fs, true));
- if (vl != null)
- {
try
{
- IFeatureSource fs = (IFeatureSource)context.GetResource(vl.ResourceId);
- //The layer recurses on the FeatureSource
- //issues.AddRange(Validation.Validate(fs, true));
+ FdoSpatialContextList scList = context.GetSpatialContexts(fs.ResourceID);
- try
+ if (scList.SpatialContext == null || scList.SpatialContext.Count == 0)
+ issues.Add(new ValidationIssue(fs, ValidationStatus.Warning, ValidationStatusCode.Warning_MapDefinition_MissingSpatialContext, string.Format(Properties.Resources.MDF_MissingSpatialContextWarning, fs.ResourceID)));
+ else
{
- FdoSpatialContextList scList = context.GetSpatialContexts(fs.ResourceID);
+ if (scList.SpatialContext.Count > 1)
+ issues.Add(new ValidationIssue(fs, ValidationStatus.Information, ValidationStatusCode.Info_MapDefinition_MultipleSpatialContexts, string.Format(Properties.Resources.MDF_MultipleSpatialContextsInformation, fs.ResourceID)));
- if (scList.SpatialContext == null || scList.SpatialContext.Count == 0)
- issues.Add(new ValidationIssue(fs, ValidationStatus.Warning, ValidationStatusCode.Warning_MapDefinition_MissingSpatialContext, string.Format(Properties.Resources.MDF_MissingSpatialContextWarning, fs.ResourceID)));
- else
- {
- if (scList.SpatialContext.Count > 1)
- issues.Add(new ValidationIssue(fs, ValidationStatus.Information, ValidationStatusCode.Info_MapDefinition_MultipleSpatialContexts, string.Format(Properties.Resources.MDF_MultipleSpatialContextsInformation, fs.ResourceID)));
+ bool skipGeomCheck = false;
- bool skipGeomCheck = false;
+ //TODO: Switch to the correct version (2.1), once released
+ if (scList.SpatialContext[0].CoordinateSystemWkt != mdef.CoordinateSystem)
+ {
+ if (layer.SubLayer.LayerType == LayerType.Raster && mdef.CurrentConnection.SiteVersion <= SiteVersions.GetVersion(OSGeo.MapGuide.MaestroAPI.KnownSiteVersions.MapGuideOS2_0_2))
+ issues.Add(new ValidationIssue(fs, ValidationStatus.Error, ValidationStatusCode.Error_MapDefinition_RasterReprojection, string.Format(Properties.Resources.MDF_RasterReprojectionError, fs.ResourceID)));
+ else
+ issues.Add(new ValidationIssue(fs, ValidationStatus.Warning, ValidationStatusCode.Warning_MapDefinition_LayerReprojection, string.Format(Properties.Resources.MDF_DataReprojectionWarning, fs.ResourceID)));
- //TODO: Switch to the correct version (2.1), once released
- if (scList.SpatialContext[0].CoordinateSystemWkt != mdef.CoordinateSystem)
- {
- if (layer.SubLayer.LayerType == LayerType.Raster && mdef.CurrentConnection.SiteVersion <= SiteVersions.GetVersion(OSGeo.MapGuide.MaestroAPI.KnownSiteVersions.MapGuideOS2_0_2))
- issues.Add(new ValidationIssue(fs, ValidationStatus.Error, ValidationStatusCode.Error_MapDefinition_RasterReprojection, string.Format(Properties.Resources.MDF_RasterReprojectionError, fs.ResourceID)));
- else
- issues.Add(new ValidationIssue(fs, ValidationStatus.Warning, ValidationStatusCode.Warning_MapDefinition_LayerReprojection, string.Format(Properties.Resources.MDF_DataReprojectionWarning, fs.ResourceID)));
+ skipGeomCheck = true;
+ }
- skipGeomCheck = true;
- }
-
- if (vl.Geometry != null && !skipGeomCheck)
- {
- var env = fs.GetSpatialExtent(vl.FeatureName, vl.Geometry);
- if (!env.Intersects(mapEnv))
- issues.Add(new ValidationIssue(fs, ValidationStatus.Warning, ValidationStatusCode.Warning_MapDefinition_DataOutsideMapBounds, string.Format(Properties.Resources.MDF_DataOutsideMapWarning, fs.ResourceID)));
- }
+ if (vl.Geometry != null && !skipGeomCheck)
+ {
+ var env = fs.GetSpatialExtent(vl.FeatureName, vl.Geometry);
+ if (!env.Intersects(mapEnv))
+ issues.Add(new ValidationIssue(fs, ValidationStatus.Warning, ValidationStatusCode.Warning_MapDefinition_DataOutsideMapBounds, string.Format(Properties.Resources.MDF_DataOutsideMapWarning, fs.ResourceID)));
}
}
- catch (Exception ex)
- {
- string msg = NestedExceptionMessageProcessor.GetFullMessage(ex);
- issues.Add(new ValidationIssue(layer, ValidationStatus.Error, ValidationStatusCode.Error_MapDefinition_ResourceRead, string.Format(Properties.Resources.MDF_ResourceReadError, fs.ResourceID, msg)));
- }
}
catch (Exception ex)
{
string msg = NestedExceptionMessageProcessor.GetFullMessage(ex);
- issues.Add(new ValidationIssue(mdef, ValidationStatus.Error, ValidationStatusCode.Error_MapDefinition_FeatureSourceRead, string.Format(Properties.Resources.MDF_FeatureSourceReadError, l.ResourceId, msg)));
+ issues.Add(new ValidationIssue(layer, ValidationStatus.Error, ValidationStatusCode.Error_MapDefinition_ResourceRead, string.Format(Properties.Resources.MDF_ResourceReadError, fs.ResourceID, msg)));
}
}
+ catch (Exception ex)
+ {
+ string msg = NestedExceptionMessageProcessor.GetFullMessage(ex);
+ issues.Add(new ValidationIssue(mdef, ValidationStatus.Error, ValidationStatusCode.Error_MapDefinition_FeatureSourceRead, string.Format(Properties.Resources.MDF_FeatureSourceReadError, l.ResourceId, msg)));
+ }
+ }
- }
- catch (Exception ex)
- {
- string msg = NestedExceptionMessageProcessor.GetFullMessage(ex);
- issues.Add(new ValidationIssue(mdef, ValidationStatus.Error, ValidationStatusCode.Error_MapDefinition_LayerRead, string.Format(Properties.Resources.MDF_LayerReadError, l.ResourceId, msg)));
- }
}
+ catch (Exception ex)
+ {
+ string msg = NestedExceptionMessageProcessor.GetFullMessage(ex);
+ issues.Add(new ValidationIssue(mdef, ValidationStatus.Error, ValidationStatusCode.Error_MapDefinition_LayerRead, string.Format(Properties.Resources.MDF_LayerReadError, l.ResourceId, msg)));
+ }
}
context.MarkValidated(resource.ResourceID);
More information about the mapguide-commits
mailing list