[Qgis-developer] Raster drawing style always set to single band gray
Radim Blazek
radim.blazek at gmail.com
Wed May 15 08:25:46 PDT 2013
On Tue, May 14, 2013 at 11:34 AM, Alexander Bruy
<alexander.bruy at gmail.com> wrote:
> Hi all,
>
> seems something broken in raster subsystem. Method drawingStyle() of
> QgsRasterLayer class always returns 1 despite which rendering style
> is set via properties or qml file.
>
> Steps to reproduce:
> 1. load singleband gray raster
> 2. open layer properties and in Style tab set "Render type" to
> Singleband pseudocolor
> 3. add several classes and assign colors for them, apply changes
> 4. close layer properties
> 5. open Python console and run next code (raster layer should be
> active):
>
> l = iface.mapCanvas().currentLayer()
> l.drawingStyle()
>
> This always returns value 1, but for Singleband pseudocolor it
> must be 2.
Drawing style was left in raster layer from 1.8 where rendering was
done by raster layer and each DrawingStyle had rendering method in
raster layer. In master, rendering is done by renderers set by
setRenderer() and you can set even your custom renderer. There is no 1
to 1 mapping between renderer and drawing style.
My suggestion is to remove mDrawingStyle, drawingStyle() and
setDrawingStyle() completely and keep only
setRendererForDrawingStyle() for simple renderer setting. OK Marco?
How / why do you need to use drawing style getter? Can you use the
renderer directly?
Radim
> Should I file ticket?
>
> --
> Alexander Bruy
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
More information about the Qgis-developer
mailing list