[Qgis-developer] How to load a colour table on a raster,
programmatically (in python)?
Martin Dobias
wonder.sk at gmail.com
Wed Aug 11 04:07:55 EDT 2010
On Wed, Aug 11, 2010 at 9:26 AM, Benoit de Cabissole <benoit at exigesa.com> wrote:
>
> Something is still bothering me: what does happen if the raster is cached
> before I set the cache to None?
> I've tried the following code:
>
> # - backup current cache state
> bQI = theLayer.cacheImage()
> if bQI != None: theLayer.setCacheImage( None )
>
> ... refresh raster ...
>
> # - restore the state of image cache
> theLayer.setCacheImage( bQI )
The render cache works as follows: if there's a cached image and the
current extent has not changed, the cached image will be used. If the
cached image is not available (i.e. set to None), the layer will be
rendered again (and new cache image will be set). So with this code,
you would set the old cache image again - not something you want. All
you want is to remove the old cache image.
> It runs with no error, but on exit of QGIS it bombs out!
There was a small problem with python bindings (now fixed in r14053),
but again, there's no reason why you would want to do that.
Cheers
Martin
More information about the Qgis-developer
mailing list