[Qgis-developer] new generation symbology
wonder.sk at gmail.com
Wed Jan 21 08:54:08 EST 2009
On Wed, Jan 21, 2009 at 2:25 PM, Hugentobler Marco
<marco.hugentobler at karto.baug.ethz.ch> wrote:
> Hi Martin
>>Well, but adding ArrowLineSymbolLayer would mean that people will need
>>to duplicate code from SimpleLineSymbolLayer and implement the
>>decoration. And I don't like the idea of code duplication.
>>But probably it would be wise to move arrow decoration from LineSymbol
>>to LineSymbolLayer but keep it available for any line symbol. What do
> Maybe you know the decorator pattern from the 'design pattern' book (Gamma et al.). I think that would be the most elegant solution for this problem as it allows to add new decorations by adding new subclasses. The code duplication is avoided by a reference to another LineSymbolLayer object and by calling the 'renderPolyline' method of that object before drawing the arrow.
Right, using decorator patter might be a solution. But... in fact what
other decorations will we need? I can't really think of more useful
I'm asking that with KISS principle in mind: unnecessary complexity
should be avoided. Adding support for additional decorators might lead
to more complex code, more complex GUI and new bugs...
>>I think that will be possible. Imagine that we add
>> QgsVectorLayer::drawV2() function that will use new rendering
>> capabilities, while the original QgsVectorLayer::draw() will keep
>> working. Similarly, the new classes might be kept in an other
>> directory and with different names, e.h. QgsSymbolV2, QgsRendererV2.
>> Once this will be implemented in core library, it will be possible to
>> alter QgsMapRenderer, QgsMapCanvas and QGIS user interface to use the
>> new classes.
> Hm, it's not clear to me how QgsMapRender knows if it should call the old draw method or the new one.
> But I'm going to read the RFC.
There are some possibilities - e.g. adding a function
QgsMapRenderer::setRendererVersion() with an enum as a parameter which
would determine whether QgsRenderer or QgsRendererV2 should be used in
More information about the Qgis-developer