[Qgis-developer] Layer Visibility and Transparency

Tim Sutton lists at linfiniti.com
Sat Oct 24 03:31:09 EDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

Peter Ersts wrote:
> Sergio,
> 
> After either of these steps you would have to refresh the map canvas to
> see the changes, which would will mean redrawing all of the visible layers.
> 
> I don't know exactly how you are trying to implement this, but your best
> approach may be render each layer as an image ( "off screen" ) then have
> your application/plugin cycle through these images instead of using the
> map canvas, if that is what you are doing.
> 
> The transparency block looks fine at first glance ( you can use
> qgsrasterlayerproperties.cpp as an example if you have not already ) but
> take in mind you have to apply that to _each_ raster layer after it has
> been initialized.
> 

Sergio you could also use the new caching mechanism I have written in

https://trac.osgeo.org/qgis/ticket/1974

and then draw you changes onto the layer cache. When you call
mapCanvas->refresh() the draw will be very fast as it (QGIS) will simply
need to composite the layer caches.

Regards

Tim


> -pete
> 
> 
> sergio cavalcante wrote:
>> 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
> 
> 


- --

Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkrirTcACgkQqk07qZdiYjetnQCfY8PSB0efrpihZVKfq/tU7jqT
DaUAn0P7PbwLUn2DrPXHCsuWPNbnFqRj
=EHPf
-----END PGP SIGNATURE-----


More information about the Qgis-developer mailing list