Re: python bindings GInitiallyUnowned issue
- From: Jiří Techet <techet gmail com>
- To: libchamplain-list gnome org
- Subject: Re: python bindings GInitiallyUnowned issue
- Date: Thu, 29 Jul 2010 17:55:29 +0200
On Thu, Jul 29, 2010 at 00:14, Ranen Ghosh <ranen ghosh gmail com> wrote:
> Thank you very much; this fixed my problem. In the interest of not posting
> similar already-answered questions to the mailing list, can you recommend
> any documentation? The reference that came in the source package didn't
> seem to say anything to suggest that what I attempted wouldn't work, and I
> couldn't make out anything useful from the error message.
> Thanks
Well, in principle it's described here:
http://library.gnome.org/devel/libchamplain/unstable/ChamplainMapSource.html
But I agree that there's a lot of room for improvements regarding the
documentation. In particular there should be some overview of the
provided classes and how they can be used/combined. It is on my TODO
list but there will be some more API changes in 0.8 related to map
sources so I would leave that work until the API is more or less
stable.
Jiri
>
> On 07/28/2010 04:53 PM, Jiří Techet wrote:
>>
>> Hi,
>>
>> On Wed, Jul 28, 2010 at 22:08, Ranen Ghosh<ranen ghosh gmail com> wrote:
>>
>>>
>>> Hello, I find that calling ChamplainView object's set_map_source() with
>>> the
>>> result of champlain.file_cache_new_full() in python leads to errors..
>>>
>>> self.tilecache = champlain.file_cache_new_full( 1,
>>> '/home/rghosh/shared/test/jepp_osm',
>>> True )
>>>
>>> print "ref count 1", sys.getrefcount(self.tilecache)
>>> sys.stdout.flush()
>>> view.set_map_source( self.tilecache )
>>> print "ref count 2", sys.getrefcount(self.tilecache)
>>>
>>> output:
>>>
>>> ref count 1 2
>>>
>>> ** (cluttertest.py:25857): CRITICAL **: get_min_zoom_level: assertion
>>> `CHAMPLAIN_IS_MAP_SOURCE (next_source)' failed
>>>
>>> ** (cluttertest.py:25857): CRITICAL **: get_max_zoom_level: assertion
>>> `CHAMPLAIN_IS_MAP_SOURCE (next_source)' failed
>>>
>>> ** (cluttertest.py:25857): CRITICAL **: get_license: assertion
>>> `CHAMPLAIN_IS_MAP_SOURCE (next_source)' failed
>>>
>>> ** (cluttertest.py:25857): CRITICAL **: get_tile_size: assertion
>>> `CHAMPLAIN_IS_MAP_SOURCE (next_source)' failed
>>>
>>> ** (cluttertest.py:25857): CRITICAL **: get_tile_size: assertion
>>> `CHAMPLAIN_IS_MAP_SOURCE (next_source)' failed
>>>
>>> ** (cluttertest.py:25857): CRITICAL **: get_tile_size: assertion
>>> `CHAMPLAIN_IS_MAP_SOURCE (next_source)' failed
>>> ref count 2 2
>>>
>>> I wonder if it's due to reference count issues in the python bindings,
>>> since
>>> ChamplainFileCache inherits from GInitiallyUnowned ?
>>>
>>
>> No, the problem is in incorrect usage of file cache in your code.
>> Since 0.6 libchamplain uses "chains" of map sources - if a tile is not
>> found in one map source, the next map source in the chain is checked
>> and so on. In your case you have created the file cache only and use
>> it as a map source passed to the view. When the tile is not found, the
>> next source in the chain is checked, but it is NULL because you have
>> not set it and these are the warnings you see.
>>
>> The correct (and easiest) way to do the thing you want is to create an
>> instance of ChamplainMapSourceChain and push an instance of
>> ChamplainErrorTileSource and ChamplainFileCache into it (in this
>> order). This will create the chain
>>
>> ChamplainFileCache -> ChamplainErrorTileSource
>>
>> ChamplainErrorTileSource is always successful so it never tries the
>> next source and just creates the error tile.
>>
>> I expect you want to do something special - otherwise the easiest way
>> to create ready to use chains is to use the factory methods - see the
>> demos and the documentation how to use them.
>>
>> Jiri
>>
>>
>>>
>>> Ranen
>>>
>>> _______________________________________________
>>> libchamplain-list mailing list
>>> libchamplain-list gnome org
>>> http://mail.gnome.org/mailman/listinfo/libchamplain-list
>>>
>>>
>
>
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]