This project has moved and is read-only. For the latest updates, please go here.

Make TileLoder customizable

Apr 20, 2014 at 12:03 PM

I'd like to customize how the TileLoader loads the Tiles. In my case I need to add specific HTTP-Headers to the webrequests.

If the methods of the TileLoader weren't almost all static (and instead protected virtual) I could override one or two methods and be done. The used TileLoader would have to be configurable in the TileLayer (either with a protected virtual readonly property or a public settable property).

Is there a way to do this with the current version? If not, could the implementation of the TileLoader be change to allow this kind of customization (I could help with the implementation if required)?

Thanks for your help!
Best Regards Meinrad
Apr 20, 2014 at 5:43 PM
Edited Apr 20, 2014 at 5:46 PM
You can do this by means of a custom TileSource. You would have to derive from class ImageTileSource and override the LoadImage method to perform your special web request. You may also override the CanLoadAsync property and return true if your LoadImage implementation could be executed in a separate thread.
Apr 21, 2014 at 9:34 AM
Yes, I saw the ImageTileSource, but if I do that I loose the caching functionality...
Apr 21, 2014 at 8:12 PM
It shouldn't be too hard to add the necessary bits of code to your derived ImageTileSource. At least I am not considering to do any changes on the current TileImageLoader implementation for now.