[SCM] qgis branch, master, updated. a2ee769957385f4e084c5e8b6ba178a8c877d1db
Marco Hugentobler
marco.hugentobler at sourcepole.ch
Tue Mar 20 13:42:37 UTC 2012
The following commit has been merged in the master branch:
commit eaed6703c9d12e265d8f4c47175cc1801eb51175
Author: Marco Hugentobler <marco.hugentobler at sourcepole.ch>
Date: Fri Mar 2 10:59:01 2012 +0100
Use symbolsForFeature in point displacement renderer
diff --git a/src/core/symbology-ng/qgspointdisplacementrenderer.cpp b/src/core/symbology-ng/qgspointdisplacementrenderer.cpp
index 6eebd42..a822770 100644
--- a/src/core/symbology-ng/qgspointdisplacementrenderer.cpp
+++ b/src/core/symbology-ng/qgspointdisplacementrenderer.cpp
@@ -105,14 +105,14 @@ bool QgsPointDisplacementRenderer::renderFeature( QgsFeature& feature, QgsRender
{
labelAttributeList << QString();
}
- symbolList << dynamic_cast<QgsMarkerSymbolV2*>( mRenderer->symbolForFeature( attIt.value() ) );
+ symbolList << dynamic_cast<QgsMarkerSymbolV2*>( firstSymbolForFeature( mRenderer, attIt.value() ) );
}
}
}
}
else //only one feature
{
- symbolList << dynamic_cast<QgsMarkerSymbolV2*>( mRenderer->symbolForFeature( feature ) );
+ symbolList << dynamic_cast<QgsMarkerSymbolV2*>( firstSymbolForFeature( mRenderer, feature ) );
if ( mDrawLabels )
{
labelAttributeList << getLabel( feature );
@@ -574,3 +574,19 @@ void QgsPointDisplacementRenderer::drawLabels( const QPointF& centerPoint, QgsSy
p->restore();
}
}
+
+QgsSymbolV2* QgsPointDisplacementRenderer::firstSymbolForFeature( QgsFeatureRendererV2* r, QgsFeature& f )
+{
+ if ( !r )
+ {
+ return 0;
+ }
+
+ QgsSymbolV2List symbolList = r->symbolsForFeature( f );
+ if ( symbolList.size() < 1 )
+ {
+ return 0;
+ }
+
+ return symbolList.at( 0 );
+}
diff --git a/src/core/symbology-ng/qgspointdisplacementrenderer.h b/src/core/symbology-ng/qgspointdisplacementrenderer.h
index a6cf4ca..a8f9270 100644
--- a/src/core/symbology-ng/qgspointdisplacementrenderer.h
+++ b/src/core/symbology-ng/qgspointdisplacementrenderer.h
@@ -145,6 +145,8 @@ class CORE_EXPORT QgsPointDisplacementRenderer: public QgsFeatureRendererV2
void drawCircle( double radiusPainterUnits, QgsSymbolV2RenderContext& context, const QPointF& centerPoint, int nSymbols );
void drawSymbols( QgsFeature& f, QgsRenderContext& context, const QList<QgsMarkerSymbolV2*>& symbolList, const QList<QPointF>& symbolPositions, bool selected = false );
void drawLabels( const QPointF& centerPoint, QgsSymbolV2RenderContext& context, const QList<QPointF>& labelShifts, const QStringList& labelList );
+ /**Returns first symbol for feature or 0 if none*/
+ QgsSymbolV2* firstSymbolForFeature( QgsFeatureRendererV2* r, QgsFeature& f );
};
#endif // QGSPOINTDISPLACEMENTRENDERER_H
--
The Quantum GIS in Debian project
More information about the Pkg-grass-devel
mailing list