Hi Klaus,
1. When FileBitmapTileCache is unable to save image files (like when its CacheDirectory
is set to an unauthorized folder), the following drawing procedure will fail too.
This is because when we are using caches in a TileOverlay, the TileOverlay saves the drawing result to image files, then it loads the image files. So if the file saving fails, then the upcoming drawing will fail too.
2. Currently we don’t have an existing solution for this, but we can accomplish this by inheriting FileBitmapTileCache and overriding the SaveTileCore method. Here is a sample that may be usable:
public class MyFileCache : FileBitmapTileCache
{
public MyFileCache(string folder)
: base(folder)
{ }
protected override void SaveTileCore(ThinkGeo.MapSuite.Core.Tile tile)
{
BitmapTile bitmapTile = tile as BitmapTile;
if (bitmapTile != null)
{
using (MemoryStream stream = new MemoryStream())
{
bitmapTile.Bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
long sizeInKB = stream.Length / 1024;
if (sizeInKB > 2)
{
base.SaveTileCore(tile);
}
}
}
}
}
Hope this can be of help.
Regards,
Tsui