[Qgis-developer] Layer Visibility and Transparency

sergio cavalcante sergio.cavalcante at gmail.com
Fri Oct 23 09:40:18 EDT 2009


Hello guys,

I'm developing a tool using the great qgis api, but i've got some problems
to use some features, and after search a lot, I need your help. That are two
issues.

1 - I need to make an animation mode for raster images. So first, I've tried
to make a list with all raster images, and, using a QTimeLine, set them
visible or not. but the comand
QgsMapCanvasLayer(LayerSet.at(0)).SetVisible(FALSE); //Layerset is the
MapCanvas LayerSet.
it didin't work. So, to make the animation possible, I've had to replace the
current layerset of the mapcanvas, but this is too memory expensive. So why
possibly this setVisible didn't work?

2 - I need to make a pixel color transparent. I've achieved that using the
setNoDataValue, but what I really need is, instead of make the pixel
completely transparent, a transparency of, for example 50%. I've also tried
with this function:

   QgsRasterTransparency::TransparentSingleValuePixel myTransparentPixel;
    QList<QgsRasterTransparency::TransparentSingleValuePixel>
myTransparentSingleValuePixelList;

    myTransparentPixel.pixelValue = 0.0;
    myTransparentPixel.percentTransparent = 50.0;

    myTransparentSingleValuePixelList.append( myTransparentPixel );
    mRasterLayer->rasterTransparency()->setTransparentSingleValuePixelList(
myTransparentSingleValuePixelList );
    m_qgsImage->refresh();

but, it also didn't work.

Any Ideas?

Best Regards,
------------------------------
Sérgio Cavalcante
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20091023/7a873f31/attachment.html


More information about the Qgis-developer mailing list