[Qgis-developer] Developer cookbook in SVN
Martin Dobias
wonder.sk at gmail.com
Tue Aug 10 18:08:47 EDT 2010
On Mon, Aug 9, 2010 at 7:10 PM, Benoit de Cabissole <benoit at exigesa.com> wrote:
> Hi all,
>
> The cookbook is a very good idea. Thanks to set it up!
>
> I've got a problem with the recipe in the raster, Single Band Rasters
> section. The code shown to do colormap does not fully work: the layer is
> told to use a ColorRampShader, then a custom raster shader function is
> initialised and filled with relevant data (a list and flag) and then
> nothing. How is this custom function fed back into the raster? Am I missing
> something?
When you tell the layer to use color ramp shader, an appropriate
shader function is created. So in fact it's not a custom shader
function which is being initialized - it's the shader function which
has been created in previous setColorShadingAlgorithm() call.
> In my code I tried to use:
> theLayer.setRasterShaderFunction( myShaderFunction )
> but it only causes an "access violation" error when QGIS exits.
I've fixed that issue in r14046.
> After testing the code in the cookbook I can confirm that a colormap is
> created: the colormap tab is filled with the correct colour ramp but the
> type of colouring (symbology tab, color map combobox) is not changed to
> 'Colormap', it stays at whatever setting it was before calling the code and
> needs to be manually witched to "Colormap" to have the raster taking the
> colours of the colormap.
>
> Could you please complete the code in the cookbook to show the final step?
I've explained that in previous mail, but for the record, it has been
added also to the cookbook (r14050).
Regards
Martin
More information about the Qgis-developer
mailing list