[Qgis-developer] python: which symbol for classified feature

Richard Duivenvoorde rdmailings at duif.net
Sat May 9 14:21:09 EDT 2009


Martin Dobias wrote:
> Hi Richard,
> 
> you might want to call renderer's renderFeature() method. This method
> prepares painter for drawing of the feature based on the geometry
> type:
> - line - sets painter's pen
> - polygon - sets painter's pen and brush
> - point - modifies a QImage instance passed as an argument (will
> contain the marker)
> 
> I'm not sure whether it will work with point symbols in python, the
> interface is somehow messy. But for lines and polygons you should be
> able to get the information you want from painter.
> 
> Bye
> Martin

Thanks for your answer Martin. But I wasn't able to get any info from 
the painter after calling the renderFeature(..) method...

So what I did now (and is working :-) ): is actually copy the 
functionality of the symbolForFeature(feature) method to my plugin in 
python: after rendering a renderer holds a list of 'symbols' which not 
only hold the symbolic-info, but also the lower- and  upperborder (if 
availble). So given the value of a feature I can determine myself which 
symbol is used for it (just like the implementation of symbolForFeature.

Regards,

Richard Duivenvoorde


More information about the Qgis-developer mailing list