Ethan,
The modified version of the sample I uploaded implements more than just the Drawn & Drawing Exceptions.
It renders the layer name BUILDING_POLY with an area and label.
The data is included in the application directory structure.
What does not work for my project is what I stated in my original post, namely “The “Shape Does Not Pass Simple Validation” error appears only when a label is applied to the Building_Poly layer”.
The other issue arises when there is more than just the BUILDING_POLY layer being rendered. When there are more layers and this error is encountered the other layers stop being rendered.
To make this clearer I have modified the code so that you can see the issue. Copy the code below and replace the exiting map_loaded with this code. This code renders the BUILDING_POLY and WATER layers. The code below as is does not label the BUILDING_POLY layer, hence, both layers are rendered.
So execute the code as is and you will see both layers.
Next go in and uncomment the line with the words Remove Comment, recompile the code and execute. Now you will see only the BUILDING_POLY layer rendered with labels and with errors on the map itself. When labels appear and the error is encountered all other rendering of the map stops.
Does my explanation make sense now?
Thanks,
Dennis
private void map_Loaded(object sender, RoutedEventArgs e)
{
string TheLogMessage;
string ThePath;
string TheTable;
Collection<string> TheGeoDatabaseTableNames;
System.Type TheSystemType;
ThinkGeo.MapSuite.Shapes.WellKnownType TheWellKnownType;
ThinkGeo.MapSuite.Shapes.Projection TheProjection;
map.MapUnit = GeographyUnit.DecimalDegree;
map.MapUnit = GeographyUnit.Feet;
AreaStyle areaStyle;
FileGeoDatabaseFeatureLayer fileGeoDatabaseFeatureLayer;
LayerOverlay layerOverlay = new LayerOverlay();
// catch MapSuite Drawing Exceptions
layerOverlay.DrawingExceptionMode = DrawingExceptionMode.DrawException;
layerOverlay.DrawnException += new EventHandler<DrawnExceptionTileOverlayEventArgs> (TheLayerOverlay_DrawnException );
layerOverlay.DrawingException += new EventHandler<DrawingExceptionTileOverlayEventArgs>(TheLayerOverlay_DrawingException);
ThePath = string.Format("{0}", "../../AppData/Shapes.gdb");
TheTable = string.Format("{0}", "states");
ThePath = string.Format("{0}", "../../AppData/Airport.gdb");
TheTable = string.Format("{0}", "WATER");
TheTable = string.Format("{0}", "BUILDING_POLY");
try
{
TheGeoDatabaseTableNames = FileGeoDatabaseFeatureLayer.GetTableNames(ThePath);
}
catch (Exception ex)
{
TheLogMessage = string.Format("FileGeoDatabaseFeatureLayer.GetTableNames({0}{1}Message={1})", ThePath, Environment.NewLine, ex.Message);
}
// first layer with issue
fileGeoDatabaseFeatureLayer = new FileGeoDatabaseFeatureLayer(ThePath, TheTable);
fileGeoDatabaseFeatureLayer.Open();
// catch MapSuite Drawing Exceptions
fileGeoDatabaseFeatureLayer.DrawingExceptionMode = DrawingExceptionMode.DrawException;
fileGeoDatabaseFeatureLayer.DrawnException += new EventHandler<DrawnExceptionLayerEventArgs> (FileGeoDatabaseFeatureLayer_DrawnException );
fileGeoDatabaseFeatureLayer.DrawingException += new EventHandler<DrawingExceptionLayerEventArgs>(FileGeoDatabaseFeatureLayer_DrawingException);
TheSystemType = fileGeoDatabaseFeatureLayer.FeatureSource.GetType();
TheWellKnownType = fileGeoDatabaseFeatureLayer.FeatureSource.GetFirstFeaturesWellKnownType();
TheProjection = fileGeoDatabaseFeatureLayer.FeatureSource.Projection;
areaStyle = new AreaStyle();
areaStyle.FillSolidBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214));
areaStyle.OutlinePen = new GeoPen(GeoColor.FromArgb(255, 118, 138, 69), 1);
areaStyle.OutlinePen.DashStyle = LineDashStyle.Solid;
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = areaStyle;
// label
// Remove Comment fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("NUMBER", "Arial", 08, DrawingFontStyles.Bold, GeoColor.StandardColors.Black, 1, 1);
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
layerOverlay.Layers.Add(fileGeoDatabaseFeatureLayer);
// second layer does not have issue
TheTable = string.Format("{0}", "WATER");
fileGeoDatabaseFeatureLayer = new FileGeoDatabaseFeatureLayer(ThePath, TheTable);
fileGeoDatabaseFeatureLayer.Open();
// catch MapSuite Drawing Exceptions
fileGeoDatabaseFeatureLayer.DrawingExceptionMode = DrawingExceptionMode.DrawException;
fileGeoDatabaseFeatureLayer.DrawnException += new EventHandler<DrawnExceptionLayerEventArgs>(FileGeoDatabaseFeatureLayer_DrawnException);
fileGeoDatabaseFeatureLayer.DrawingException += new EventHandler<DrawingExceptionLayerEventArgs>(FileGeoDatabaseFeatureLayer_DrawingException);
TheSystemType = fileGeoDatabaseFeatureLayer.FeatureSource.GetType();
TheWellKnownType = fileGeoDatabaseFeatureLayer.FeatureSource.GetFirstFeaturesWellKnownType();
TheProjection = fileGeoDatabaseFeatureLayer.FeatureSource.Projection;
areaStyle = new AreaStyle();
areaStyle.FillSolidBrush = new GeoSolidBrush(GeoColor.GeographicColors.DeepOcean);
areaStyle.OutlinePen = new GeoPen(GeoColor.FromArgb(255, 118, 138, 69), 1);
areaStyle.OutlinePen.DashStyle = LineDashStyle.Solid;
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = areaStyle;
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
layerOverlay.Layers.Add(fileGeoDatabaseFeatureLayer);
map.Overlays.Add(layerOverlay);
map.CurrentExtent = fileGeoDatabaseFeatureLayer.GetBoundingBox();
map.Refresh();
}