[Qgis-developer] QGIS Plugin - Ovals
Richard Duivenvoorde
rdmailings at duif.net
Fri Jun 3 11:06:09 EDT 2011
On 06/03/2011 11:46 AM, uk52rob wrote:
> I have long hoped for a plugin to create ovals based on a point layer.
> It would ideally have the ability to select orientation in degrees,
> width and length (with values contained in fields also available).
>
> I notice that Pavol Kapusta created an excellent plugin called
> ‘Rectangles’ in the contributed repo to do exactly what it describes,
> but has anyone tried ovals?
>
> I am not a python developer myself, so I am not used to the language.
> However, if anyone is able to come up with a ‘simple’ (dare I say it)
> plugin, or has created one before and it has not yet reached a repo, I
> would be very grateful to hear from you.
In Martin's excellent python cookbook there is a part about the
appearance symbology of vector layers and how to do this in python:
http://www.qgis.org/pyqgis-cookbook/vector.html#appearance-symbology-of-vector-layers
The part of 'FooSymbolLayer' is an example for a red oval symbol. It's
not what you want, but it is a start for a developer.
Attached is the example from the cookbook, a little changed (apperently
the constructor for the Metadata has changed) always drawing a red oval
with a height which is two times the width.
To use it (only usable with New Symbology! tested in trunk here) is:
- put it in your python path somewhere (eg in your .qgis/python/plugins
directory)
- after starting qgis, open het python console and do (given the file is
still called foosymbol.py):
from foosymbol import *
- now if you open your point layer in new symbology, clicking on the
'Change...' button below the
- symbol preview you will find a new 'symbol layer type': FooMarker
- this will draw a red elipse with a height of two times the width
Anyway: you will need a (I think pretty experienced) python programmer
to make it work exactly the way you want it.
Hopefully there is somebody with some free time...
Regards,
Richard Duivenvoorde
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foosymbol.py
Type: text/x-python
Size: 2848 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/qgis-developer/attachments/20110603/d96912d4/foosymbol.py
More information about the Qgis-developer
mailing list