[Qgis-developer] Ellipse renderer
Marco Hugentobler
marco.hugentobler at sourcepole.ch
Tue Jun 14 09:48:29 EDT 2011
Hi QGIS devs
Recently, I was writing a symbollayer to render ellipse shapes (and also
rectangles, triangles, crosses by specifying width and height). Moreover, the
symbol layer allows to set all parameters (width, height, colors, rotation,
outline with) from data fields, in mm or map units.
The code is contained in my github clone int the branch
'data_defined_symbollayer'. To give it a try, you can do the following:
git add remote add mhugent git://github.com/mhugent/Quantum-GIS.git
git checkout --track mhugent/data_defined_symbollayer
The reason it's in a branch is that data defined rendering in symbol layers
needed some API changes. They are quite small:
- A pointer to the rendered QgsFeature* has been added to
QgsSymbolV2RenderContext (such that the symbollayer has the possibility to
check the data defined attribute values)
- A symbollayer has the possibility to specify which attribute fields it needs
for rendering (by default, QgsSymbolLayerV2::usedAttributes returns an empty
set).
- The symbollayer widgets receive a pointer to their vector layer. Normal
symbol layer widgets don't use it, the widgets of data defined symbol layers
get the available fields through that pointer.
At first, I tried to achieve the data defined layer without API change by
creating a new subclass of QgsFeatureRendererV2 (as discussed with Martin in
Lisbon. However, it turned out this approach would need a lot of duplication
to provide graduated / unique / rule based classification and to provide a
seamless integration with the existing symbology(ng).
What do you think?
Regards,
Marco
--
Dr. Marco Hugentobler
Sourcepole - Linux & Open Source Solutions
Churerstrasse 22, CH-8808 Pfäffikon SZ, Switzerland
marco.hugentobler at sourcepole.ch http://www.sourcepole.ch
Technical Advisor QGIS Project Steering Committee
More information about the Qgis-developer
mailing list