Re: NetworkMapSource and ChamplainCache change proposal


I am happy you like it :) More in the text below.

On Sun, 2009-11-22 at 13:47 +0100, Jiří Techet wrote:
> <embedded_bug_report>
> By the way, this:
> (define-virtual fill_tile
>   (of-object "ChamplainMapSource")
>   (return-type "none")
>   (parameters
>     '("ChamplainTile*" "tile")
>   )
> )
> is missing in pychamplain-base.defs - without it, you can't override
> the fill_tile in your subclass of ChamplainMapSource in Python (see
> e.g. pyclutter to see how to make virtual method bindings for Python).
> </embedded_bug_report>
Alright, open a bug against the binding component in the libchamplain
product on :)

> So I would really prefer if libchamplain changed to make
> ChamplainCache overridable. What I would like to propose is the
> following:
> 1. Introduce ChamplainBaseCache with the very basic methods that
> NetworkMapSource needs to access the cache.
Either that or an interface.  Do you think the Cache implementations
would share any code at all? if yes, then a BaseCache makes sens.

> 2. Derive ChamplainCache from it and implement these methods -
> basically means to move the code that accesses the tile-files in
> NetworkMapSource here. After looking at the code I think that either
> the semantics of the existing functions (namely update_tile()) will
> have to change a bit or some extra methods will have to be introduced,
> maybe both (this might not be such a big problem since I think that
> nobody uses these methods of ChamplainCache directly now).
API stability wise I think naming the interface (or base class)
ChamplainCache and naming the default implementation differently, maybe

> 3. ChamplainCache singleton instance would remain as the default cache
> (this preserves the compatibility with existing applications), but
> there should be a method that changes the cache used by
> NetworkMapSource.
To change the default cache, there could be a function you call and pass
the GType of the Cache class to use as cache.  For example,
champlain_set_cache (CHAMPLAIN_TYPE_FILE_CACHE). You'd have to call it
before creating the view.

> 4. Anyone who wants to implement his own cache would derive
> ChamplainBaseCache, implement its methods and assign it to
> NetworkMapSource.
Or the interface :) There are other sources coming up in the local
rendering branch from Simon Wenner, so it should be a global function

> And now some good news - if you decide you like the proposed changes,
> I'd be happy to implement them (well, the patch might be shorter than
> this email :-). What's your opinion?
Go ahead! if you deliver before January, we can have this in the next
major release in March.

This is unexpected area of expansion for libchamplain's code but well
worth it! :)


Attachment: signature.asc
Description: This is a digitally signed message part

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]