[Qgis-developer] Symbology NG - rendering of selected symbols

Chris Crook ccrook at linz.govt.nz
Mon Apr 5 18:22:48 EDT 2010


The second item 2 on the list of proposed changes is redundant! This is handled by the flag passed to the current renderFeature function.

-----Original Message-----
From: qgis-developer-bounces at lists.osgeo.org [mailto:qgis-developer-bounces at lists.osgeo.org] On Behalf Of Chris Crook
Sent: Tuesday, 6 April 2010 10:14 a.m.
To: Martin Dobias
Cc: qgis-developer at lists.osgeo.org
Subject: RE: [Qgis-developer] Symbology NG - rendering of selected symbols

 
Hi Martin

I suppose I was thinking that the changes would need to be made in a minimal, non-breaking way, why I was thinking of adding renderSelectedFeature rather than adding a parameter to the renderFeature function, and by implementing this so it works continues to work with minimal changes for renderers which don't implement this function.  However maybe it isn't too late to make more dramatic changes - as this isn't the stable version!  

The other reason I can see for creating a separate function and implementation is that it ensures that if a new renderer doesn't provide an implementation for selected features, then they will still be visibly selected.

I think you are right in that it would be good for symbol layers to know how to render themselves when selected, and I guess just using setColor as a default implementation would work well, and give a better implementation than the current one.

With the symbol layers potentially caching symbols in the start/stop functions I'm not sure how handling the selection flag at the symbol level would work.  I guess the ideal would be for the startRender function to be passed a flag to let the renderer/symbol/symbolLayer know that they may need a selected version. 

I'm not sure I follow your thinking about using the QgsSymbolV2RenderContext to pass a selected flag, as it looks to me as if this is only created within the QgsSymbolV2 startRender, stopRender, and renderFeature funtions, where the selected status isn't available.  

I guess a boolean field in the QgsRenderContext could be used.  In the startRender function it would be used that the the renderer/symbol/symbolLayer needed to have a selected version available, and in the renderFeature function it would mean that the feature to be rendered is selected. 

Alternatively the selected flag could be added as a parameter to the startRender and renderFeature functions for the renderer, symbol, and symbol layer. 

Certainly adding the flag to the context would be less work than changing function signatures through the symbology stack.  I'm not sure which would be the "more correct" implementation?

So I guess I'm leaning towards:

1) Adding a boolean selected flag to QgsRenderContext, which is only used by the V2 renderers, used in startRender to indicate a selected symbology will be required, and renderFeature to indicate that the current feature is selected.
2) Updating QgsSimpleMarkerSymbolLayerV2 to optionally cache and use a selected version of the image (using setColor to set the colour to the selected colour ... Should this change the border colour too?)
3) Update QgsFontMarkerSymbolLayerV2 to use the selected colour if it is selected
4) Update QgsSvgMarkerSymbolLayerV2 to cache and use a selected version of the image. Not sure how to do this?  This should include an option for defining a selected version of the symbol (but maybe not yet implemented in GUI), and also some sort of default handling - perhaps creating a picture by rendering a larger background circle in the selected colour under the SVG image.
5) Update QgsSimpleLineSymbolLayerV2 and QgsLineDecorationSymbolLayerV2 to create and optionally use a mSelectedPen, and QgsMarkerLineSymbolLayerV2 to pass the selected flag to its marker symbol
6) Update QgsMarkerLineSymbolLayerV2 to optionally use the selected colour, and QgsSVGFillSymbolLayer to optionally fill the polygon with the selected colour before applying the SVG fill.
2) Adding a renderSelectedFeature virtual function to the QgsFeatureRendererV2 which by default just sets the QgsRenderContext flag and calls the renderFeature function


Cheers
Chris


______________________________________________________________________________________________________

This message contains information, which is confidential and may be subject to legal privilege. 
If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message.
If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info at linz.govt.nz) and destroy the original message.
LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ.

Thank you.
______________________________________________________________________________________________________


More information about the Qgis-developer mailing list