[prev in list] [next in list] [prev in thread] [next in thread] 

List:       qgis-developer
Subject:    Re: [Qgis-developer] python: which symbol for classified feature
From:       Martin Dobias <wonder.sk () gmail ! com>
Date:       2009-04-29 9:40:18
Message-ID: e8e7199c0904290240l79fa1a7at4d996a597c7f8908 () mail ! gmail ! com
[Download RAW message or body]

On Sat, Apr 25, 2009 at 10:47 PM, Richard Duivenvoorde
<rdmailings@duif.net> wrote:
> Hi devs,
>
> I'm trying to determine the symbol for a feature when a layers is classified
> in one way or another, using the python interface.
>
> If I'm correct, I can ask a renderer for it's symbols (via symbols()),
> returning me a List of symbols used, but I cannot myself determine, given a
> feature with which symbol it's (going to be) associated.
>
> Looking at some cpp code, I find a protected member symbolForFeature.
>
> Should I use that one? And if possible can this be made public via the
> python interface?
>
> Or am I on the wrong track anyway, and should I ask another class for the
> color and pen of a certain classified feature?

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
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic