Hi
We have a WPF application using ThinkGeo for showing a raster map and several layers contained in shapefiles. Each shapefile can be show/hide, moved to the front pushed to the back, …
When showing shapefiles I load the shape file with similar code:
ShapeFileFeatureLayer shapeFileLayer = null;
try
{
shapeFileLayer = new ShapeFileFeatureLayer(shapefile.LayerFile);
shapeFileLayer.Open();
shapeFileLayer.Name = shapefile.LayerName;
shapeFileLayer.IsVisible = shapefile.Visible;
// set the wished ZoomLevels and styles
// configure the projection
}
catch (Exception ex)
{
return false;
}
finally
{
if (shapeFileLayer.IsOpen)
{
shapeFileLayer.Close();
}
}
m_OverlayShapeFiles.Layers.Add(shapefile.LayerName, shapeFileLayer);
m_OverlayShapeFiles.Layers.MoveToTop(shapeFileLayer);
Where m_OverlayShapeFiles is:
private readonly LayerOverlay m_OverlayShapeFiles;
I have tried to replace LayerOverlay with FeatureLayerWpfDrawingOverlay but I got the following exception:
EXCEPTION: The FeatureSource is not open. Please call the Open method before calling this method.
at ThinkGeo.Core.ValidatorHelper.CheckFeatureSourceIsOpen(Boolean isOpen)
at ThinkGeo.Core.QueryTools.GetFeaturesInsideBoundingBox(RectangleShape boundingBox, ReturningColumnsType returningColumnNamesType)
at ThinkGeo.UI.Wpf.FeatureLayerWpfDrawingOverlay.xEM=(GeoCollection`1 layers, IMapArguments mapView)
at ThinkGeo.UI.Wpf.FeatureLayerWpfDrawingOverlay.DrawAsyncCore(RectangleShape targetExtent, OverlayRefreshType overlayRefreshType, CancellationToken cancellationToken)
at ThinkGeo.UI.Wpf.Overlay.DrawAsync(RectangleShape targetExtent, OverlayRefreshType refreshType, CancellationToken cancellationToken)
END EXCEPTION --------------------------------------------------------------------
Is it possible to use FeatureLayerWpfDrawingOverlay with shape files?
If so what is wrong in my code?
Best regards
Domenico