Re: NetworkMapSource and ChamplainCache change proposal
- From: Jiří Techet <techet gmail com>
- To: Emmanuel Rodriguez <emmanuel rodriguez gmail com>, libchamplain-list gnome org
- Subject: Re: NetworkMapSource and ChamplainCache change proposal
- Date: Tue, 24 Nov 2009 00:22:24 +0100
On Mon, Nov 23, 2009 at 01:32, Jiří Techet <techet gmail com> wrote:
> Hello Emmanuel,
>
> your idea of having cache attached directly to ChamplainView makes a
> lot of sense - this is what I expected and was a bit surprised that it
> was attached to MapSource after looking at the source code. Caches and
> MapSources should be independent to make it easy to implement a new
> cache or MapSource and not having to care about the other. I made the
> original proposal just not to change too many things. I also like your
> idea of having a chain of caches (not sure if it will ever be used in
> practice, but it makes things more elegant). After thinking about it a
> little, I believe we could do the following:
>
> Notice that Cache is basically a MapSource - it's a source whose tiles
> are stored offline and, in addition, you can store some tiles into it.
> So we could inherit a cache from MapSource + add the extra methods for
> storing tiles. Now, for fill_tile(), we could use the chain of
> responsibility like this:
>
> ChamplainView --> cache1 --> cache2 --> NetworkMapSource
>
> (Where the number of caches is arbitrary, or even 0, and the last in
> the chain is NetworkMapSource.) If the tile is not present in cache1,
> it asks the next one in the chain and so on. When it reaches
> NetworkMapSource, it will load the tile from the network and a reverse
> procedure will occur to store the tile into a cache:
>
> NetworkMapSource --> cache2 --> cache1
>
Just looking at what I have written I think I wasn't quite right here
- even when storing the tile we should do it in the same order as when
loading it, so
cache1 --> cache2 --> NetworkMapSource
For multiple map sources and caches, like
cache1 --> cache2 --> NetworkMapSource1 --> cache3 --> cache4 -->
NetworkMapSource2
NetworkMapSource1 will start storing into cache1 and NetworkMapSource2
into cache3.
Actually, the more I look at how things get complicated and possibly
confusing, I would suggest that we should use "caches first, map
sources second" only strategy and not to interleave caches and map
sources. This will also make the interface of ChamplainView simpler
and less confusing.
Jiri
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]