I somehow got the WorldMapKitRenderLayer to throw the following exception:
System.IO.IOException was unhandled by user code
Message="The process cannot access the file '\\\\sup-amr1\\gis\\wmk5\\LayersBoundingBoxes.ids' because it is being used by another process."
Source="mscorlib"
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at hhQ=.vFE=.Khk=(String xFE=, RtreeSpatialIndexReadWriteMode xVE=)
at ThinkGeo.MapSuite.Core.RtreeSpatialIndex.OpenCore()
at ThinkGeo.MapSuite.Core.SpatialIndex.Open()
at ThinkGeo.MapSuite.Core.WorldMapKitRenderLayer.OpenCore() in C:\dev\LUT600 2.1.1\OCC600\Source\GIS\Modules\ThinkGeo\ThinkGeoLibrary\Layer\WorldMapKitRenderLayer.cs:line 3240
at ThinkGeo.MapSuite.Core.Layer.Open()
at ThinkGeo.MapSuite.WpfDesktopEdition.LayerTile.DrawCore(GeoCanvas geoCanvas)
at ThinkGeo.MapSuite.WpfDesktopEdition.Tile.uhM=(GeoCanvas uxM=)
at ThinkGeo.MapSuite.WpfDesktopEdition.Tile.Draw(GeoCanvas geoCanvas)
InnerException:
When the map got into this state, I had to shut down the application. Before this happened, I started getting a bunch of these errors attached. This is with v5.5.31.0
I have seen this particular error before about the GeoCanvas not drawing but cannot remember what we did to solve it. Attached is the draw core of my WorldMapKitRenderLayer.
.
Could you guys please look into this Thanks.?
protected override void DrawCore(GeoCanvas canvas, Collection<SimpleCandidate> labelsInAllLayers)
{
try
{
RectangleShape extent = canvas.CurrentWorldExtent;
object image = canvas.NativeImage;
GeographyUnit unit = canvas.MapUnit;
bool isInDrawing = canvas.IsDrawing;
if (isInDrawing)
{
canvas.EndDrawing();
}
Collection<string> candidateLayerNames = new Collection<string>();
if (rtreeSpatialIndex != null)
{
candidateLayerNames = rtreeSpatialIndex.GetFeatureIdsIntersectingBoundingBox(extent);
}
WorldMapKitShapeFileFeatureLayer layer = null;
for (int i = 0; i < staticLayers.Count; i++)
{
layer = staticLayers[i];
if (candidateLayerNames.Count == 0 || candidateLayerNames.Contains(Path.GetFileName(layer.ShapePathFileName)))
{
canvas.BeginDrawing(image, extent, unit);
layer.Open();
layer.Draw(canvas, labelsInAllLayers);
//layer.Close();
canvas.Flush(); //canvas.EndDrawing();
}
}
for (int i = 0; i < dynamicLayers.Count; i++)
{
layer = dynamicLayers[i];
if (candidateLayerNames.Count == 0 || candidateLayerNames.Contains(Path.GetFileName(layer.ShapePathFileName)))
{
canvas.BeginDrawing(image, extent, unit);
layer.Open();
layer.Draw(canvas, labelsInAllLayers);
//layer.Close();
canvas.Flush(); //canvas.EndDrawing();
}
}
if (isInDrawing)
{
canvas.BeginDrawing(image, extent, unit);
}
}
catch (Exception ex)
{
ActionResponse.LogError(ex, "WMK Render Layer");
}
}