On 08/05/2010 03:08 PM, Benoit de Cabissole wrote:
I've implemented the code following your suggestions, but it throws the
following error:
==================================================================
Traceback (most recent call last):
File "C:\Documents and
Settings\Benoit/.qgis/python/plugins\bcccoltbl\cdlgTBL.py", line 373, in
accept
self.theLayer.rasterShader().setColorRampItemList(theTBL)
AttributeError: 'QgsRasterShader' object has no attribute
'setColorRampItemList'
Sorry Benoit. I kind of gave you the short hand version.
RasterLayer.rasterShader() returns the base class of QgsColorRampShader
which is QgsRasterShader() you will have to cast the base class to type
QgsColorRampShader, but don't even know if that is possible in python.
However, there is another way, You could create your own instance of a
QgsColorRampShader and pass that to the raster layer using
>>yourColorRampShader = QgsColorRampShader()
>>yourColorRampShader.setColorRampItemList( YourList )
>>RasterLayer.setRasterShaderFunction( yourColorRampShader )
If you take this approach, you no longer have to call
RasterLayer.setColorShadingAlgorithm().
That should do it. I don't do much python coding, so i may not be able
to highlight all of the differences between the python and c++ approach.
-pete
--
====================================
Peter J. Ersts, Software Developer
American Museum of Natural History
Center for Biodiversity and Conservation
Central Park West at 79th Street
New York, New York 10024
Web: http://biodiversityinformatics.amnh.org
Web: http://cbc.amnh.org
Open Source,
...evolving through community cooperation to change the world bit by bit
Quantum GIS Raster Development Team.
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer