Replace FileCache with IFileCache

Jul 1, 2014 at 9:00 AM
The current implementation of BruTile FileCache has a bug that prevents the save of tiles when the filename contains invalid characters, this bug has been fixed with changeset anyway as today you have to download the BruTile source, recompile it and update the dependency because the TileLayer accepts a concrete class to support caching.

I think it's better to remove this association by replacing the FileCache association with an interface like this:
interface IFileCache: ITileCache<byte[]>
   bool Exists(BruTile.TileIndex);
Jul 1, 2014 at 9:33 AM
I think it is even better to use
This interface might have been introduced with a later version of brutile, but I think we should update BruTile to some current version as it offers WMTS support.
If we not already have done that.
Jul 1, 2014 at 2:42 PM
Ok for IPersistentCache.

I'm testing WMTS support right now, it seems to work but I've tested just a couple of examples. What I feel it is missing is a way to access the Capabilities exposed from the server because I have to show the layers names and ITileSource.Title reports the identifier of the layers, this is not very friendly to users.

I sorted out by using this code:
private Tuple<LayerType, ITileSource>[] ParseCapabilities(Stream source)
      var ser = new XmlSerializer(typeof(Capabilities));

      using (var ms = new MemoryStream())

         ms.Seek(0, SeekOrigin.Begin);

         using (var reader = new StreamReader(ms))
             var capabilties = (Capabilities)ser.Deserialize(reader);

             ms.Seek(0, SeekOrigin.Begin);
             var sourcetiles = WmtsParser.Parse(ms);

             return (
                        from sourceTile in sourcetiles
                        join layer in capabilties.Contents.Layers on sourceTile.Title equals layer.Identifier.Value
                        select new Tuple<LayerType, ITileSource>(layer, sourceTile))