Skip to content

Commit

Permalink
Make sure all attributes are fetched for distance based renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 29, 2016
1 parent 3253cdc commit 7acb07f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/core/symbology-ng/qgspointclusterrenderer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class QgsPointClusterRenderer : QgsPointDistanceRenderer
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
void stopRender( QgsRenderContext& context );
QDomElement save( QDomDocument& doc );
virtual QList<QString> usedAttributes();

//! Create a renderer from XML element
static QgsFeatureRenderer* create( QDomElement& symbologyElem ) /Factory/;
Expand Down
1 change: 1 addition & 0 deletions python/core/symbology-ng/qgspointdisplacementrenderer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class QgsPointDisplacementRenderer : QgsPointDistanceRenderer
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
void stopRender( QgsRenderContext& context );
QDomElement save( QDomDocument& doc );
virtual QList<QString> usedAttributes();

//! Create a renderer from XML element
static QgsFeatureRenderer* create( QDomElement& symbologyElem ) /Factory/;
Expand Down
8 changes: 8 additions & 0 deletions src/core/symbology-ng/qgspointclusterrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@ QDomElement QgsPointClusterRenderer::save( QDomDocument& doc )
return rendererElement;
}

QList<QString> QgsPointClusterRenderer::usedAttributes()
{
QList<QString> attr = QgsPointDistanceRenderer::usedAttributes();
if ( mClusterSymbol )
attr.append( mClusterSymbol->usedAttributes().toList() );
return attr;
}

void QgsPointClusterRenderer::setClusterSymbol( QgsMarkerSymbol* symbol )
{
mClusterSymbol.reset( symbol );
Expand Down
1 change: 1 addition & 0 deletions src/core/symbology-ng/qgspointclusterrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class CORE_EXPORT QgsPointClusterRenderer: public QgsPointDistanceRenderer
virtual void startRender( QgsRenderContext& context, const QgsFields& fields ) override;
void stopRender( QgsRenderContext& context ) override;
QDomElement save( QDomDocument& doc ) override;
virtual QList<QString> usedAttributes() override;

//! Creates a renderer from XML element
static QgsFeatureRenderer* create( QDomElement& symbologyElem );
Expand Down
8 changes: 8 additions & 0 deletions src/core/symbology-ng/qgspointdisplacementrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@ QDomElement QgsPointDisplacementRenderer::save( QDomDocument& doc )
return rendererElement;
}

QList<QString> QgsPointDisplacementRenderer::usedAttributes()
{
QList<QString> attr = QgsPointDistanceRenderer::usedAttributes();
if ( mCenterSymbol )
attr.append( mCenterSymbol->usedAttributes().toList() );
return attr;
}

void QgsPointDisplacementRenderer::setCenterSymbol( QgsMarkerSymbol* symbol )
{
mCenterSymbol.reset( symbol );
Expand Down
1 change: 1 addition & 0 deletions src/core/symbology-ng/qgspointdisplacementrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class CORE_EXPORT QgsPointDisplacementRenderer: public QgsPointDistanceRenderer
virtual void startRender( QgsRenderContext& context, const QgsFields& fields ) override;
void stopRender( QgsRenderContext& context ) override;
QDomElement save( QDomDocument& doc ) override;
virtual QList<QString> usedAttributes() override;

//! Create a renderer from XML element
static QgsFeatureRenderer* create( QDomElement& symbologyElem );
Expand Down

0 comments on commit 7acb07f

Please sign in to comment.