AW: AW: AW: [Qgis-developer] Addition to QgsRenderContext

Hugentobler Marco marco.hugentobler at karto.baug.ethz.ch
Fri Aug 7 01:11:55 EDT 2009


Hi Magnus

The way to pass opacity as rendering argument looks good, thank you for fixing the transparency issue!

Still there is an issue with backwards compatibility. The purpose of b.c. is that plugins and third party apps don't need to be changed for the 1.x versions.

Take QgsRenderer and assume someone wrote a plugin or an application that has its custom renderer class (e.g. QGIS mapserver has QgsSLDRenderer which implements a rule based renderer as in SLD).
Now QgsRenderer changed to:

void renderFeature(QPainter* p, QgsFeature& f,QImage* pic, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0);
void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* pic, bool selected );
virtual void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* pic, bool selected, double opacity ) = 0;

This means that QgsSLDRenderer needs to add the third function, otherwise the compiler complains and the vector layer won't call the old function (compatibility broken).

Isn't it possible to work with default arguments? As far as I see from the .sip files, SIP supports the use of default arguments such that API compatibility also would work for the bindings. But I'm not an export in SIP, so please Martin or someone else correct me if I'm wrong.

Regards,
Marco


-----Ursprüngliche Nachricht-----
Von: Magnus Homann [mailto:magnus at homann.se]
Gesendet: Mi 05.08.2009 17:26
An: Hugentobler  Marco
Betreff: Re: AW: AW: [Qgis-developer] Addition to QgsRenderContext
 
Hugentobler Marco skrev:
> Hi Magnus
> 
>> 1) Set alpha channel dynamically, or
>> 2) Cache in QgsVectorLayer
> 
> What do you mean with 'set alpha channel dynamically'?
> 
> Adding an extra parameter to the interfaces, as you suggested, sounds reasonable to me. Keep attention to add default values for it in the function signatures (to not break API compatibility for plugins and third party applications).

I comitted r11275, please have a look if it is OK.

Magnus



More information about the Qgis-developer mailing list