[Qgis-developer] Python based Renderer (V2) for vector field data

Martin Dobias wonder.sk at gmail.com
Thu Jan 14 10:56:51 EST 2010


Hi Chris

On Tue, Jan 12, 2010 at 10:42 PM, Chris Crook <ccrook at linz.govt.nz> wrote:
> I trying to develop a renderer as a python plugin, using the symbology-ng
> rendering interface.  The renderer is to plot a vector field data from a
> vectory layer as arrows at each point, where the size and orientation of the
> arrow is calculated from attributes of the point.
>
> This is going well up to the point of being able to create the renderer from
> the python console, and render data.  I have one issue which is that I
> wanted to use one of the existing symbol layers
> (QgsSimpleMarkerSymbolLayerV2) but I think that this is not defined in the
> python interface?  However this is easy to work around for the moment.

That's right, the default symbol layer classes are not yet available in PyQGIS.


> However now that I have a working renderer I am wanting to have it
> integrated into the application.  To do this I think I need to install the
> renderer into the registry, and then create a widget to select and configure
> it.
>
> I don't think  I can do this using python.  Just trying to do the first bit
> - install the renderer into the interface - I think that the python
> interface doesn't provide the necessary functionality?  I don't have the
> QgsRendererV2Metadata class, or the QgsRendererV2Registry


Ah... you're right. I'm looking at the bindings right now and I see
neither renderer nor symbol layer registry wrapped properly :-/


> Perhaps I am completely on the wrong track, and I should be doing this some
> other way?

You're on the right track.

You can still work with the renderer even if it's not registered, just
there will be some annoyances - loading of project files with this
renderer or inability to change its properties in vector layer
properties dialog.

> Any suggestions as to how to proceed from here?

I'm going to fix the bindings in svn trunk and will update the
symbology-ng page with information on how to proceed with custom
renderers and symbol layer types.

Regards
Martin


More information about the Qgis-developer mailing list