Skip to content

Commit

Permalink
Introduce capabilities for renderers (now only symbol levels capability)
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Nov 26, 2011
1 parent 4a5d442 commit 56525c2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,8 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )

select( attributes, rendererContext.extent() );

if ( mRendererV2->usingSymbolLevels() )
if ( ( mRendererV2->capabilities() & QgsFeatureRendererV2::SymbolLevels )
&& mRendererV2->usingSymbolLevels() )
drawRendererV2Levels( rendererContext, labeling );
else
drawRendererV2( rendererContext, labeling );
Expand Down
4 changes: 4 additions & 0 deletions src/core/symbology-ng/qgscategorizedsymbolrendererv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ class CORE_EXPORT QgsCategorizedSymbolRendererV2 : public QgsFeatureRendererV2

virtual QgsFeatureRendererV2* clone();

//! returns bitwise OR-ed capabilities of the renderer
//! \note added in 2.0
virtual int capabilities() { return SymbolLevels; }

virtual QgsSymbolV2List symbols();

const QgsCategoryList& categories() { return mCategories; }
Expand Down
4 changes: 4 additions & 0 deletions src/core/symbology-ng/qgsgraduatedsymbolrendererv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ class CORE_EXPORT QgsGraduatedSymbolRendererV2 : public QgsFeatureRendererV2

virtual QgsFeatureRendererV2* clone();

//! returns bitwise OR-ed capabilities of the renderer
//! \note added in 2.0
virtual int capabilities() { return SymbolLevels; }

virtual QgsSymbolV2List symbols();

QString classAttribute() const { return mAttrName; }
Expand Down
8 changes: 8 additions & 0 deletions src/core/symbology-ng/qgsrendererv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ class CORE_EXPORT QgsFeatureRendererV2
//! for debugging
virtual QString dump();

enum Capabilities {
SymbolLevels = 1 // rendering with symbol levels (i.e. implements symbols(), symbolForFeature())
};

//! returns bitwise OR-ed capabilities of the renderer
//! \note added in 2.0
virtual int capabilities() { return 0; }

//! for symbol levels
virtual QgsSymbolV2List symbols() = 0;

Expand Down
4 changes: 4 additions & 0 deletions src/core/symbology-ng/qgssinglesymbolrendererv2.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class CORE_EXPORT QgsSingleSymbolRendererV2 : public QgsFeatureRendererV2

virtual QgsFeatureRendererV2* clone();

//! returns bitwise OR-ed capabilities of the renderer
//! \note added in 2.0
virtual int capabilities() { return SymbolLevels; }

virtual QgsSymbolV2List symbols();

//! create renderer from XML element
Expand Down

0 comments on commit 56525c2

Please sign in to comment.