Skip to content
Permalink
Browse files

Fix point displacement renderer to work with the new selection parameter

git-svn-id: http://svn.osgeo.org/qgis/trunk@13354 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Apr 23, 2010
1 parent 962c8dd commit 8e1b2aafff7adb96100efe0c7c3c6eea03c42d48
@@ -66,7 +66,7 @@ QgsFeatureRendererV2* QgsPointDisplacementRenderer::clone()
return r;
}

void QgsPointDisplacementRenderer::renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer, bool drawVertexMarker )
void QgsPointDisplacementRenderer::renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer, bool selected, bool drawVertexMarker )
{
//point position in screen coords
QgsGeometry* geom = feature.geometry();
@@ -147,7 +147,7 @@ void QgsPointDisplacementRenderer::renderFeature( QgsFeature& feature, QgsRender
}


QgsSymbolV2RenderContext symbolContext( context, QgsSymbolV2::MM );
QgsSymbolV2RenderContext symbolContext( context, QgsSymbolV2::MM, 1.0, selected );
double circleAdditionPainterUnits = symbolContext.outputLineWidth( mCircleRadiusAddition );
double radius = std::max(( diagonal / 2 ), labelAttributeList.size() * diagonal / 2 / M_PI ) + circleAdditionPainterUnits;

@@ -163,7 +163,7 @@ void QgsPointDisplacementRenderer::renderFeature( QgsFeature& feature, QgsRender
{
if ( mCenterSymbol )
{
mCenterSymbol->renderPoint( pt, context );
mCenterSymbol->renderPoint( pt, context, layer, selected );
}
else
{
@@ -172,7 +172,7 @@ void QgsPointDisplacementRenderer::renderFeature( QgsFeature& feature, QgsRender
}

//draw symbols on the circle
drawSymbols( context, symbolList, symbolPositions );
drawSymbols( context, symbolList, symbolPositions, selected );
//and also the labels
drawLabels( pt, symbolContext, labelPositions, labelAttributeList );
}
@@ -508,15 +508,15 @@ void QgsPointDisplacementRenderer::drawCircle( double radiusPainterUnits, QgsSym
p->drawArc( QRectF( centerPoint.x() - radiusPainterUnits, centerPoint.y() - radiusPainterUnits, 2 * radiusPainterUnits, 2 * radiusPainterUnits ), 0, 5760 );
}

void QgsPointDisplacementRenderer::drawSymbols( QgsRenderContext& context, const QList<QgsMarkerSymbolV2*>& symbolList, const QList<QPointF>& symbolPositions )
void QgsPointDisplacementRenderer::drawSymbols( QgsRenderContext& context, const QList<QgsMarkerSymbolV2*>& symbolList, const QList<QPointF>& symbolPositions, bool selected )
{
QList<QPointF>::const_iterator symbolPosIt = symbolPositions.constBegin();
QList<QgsMarkerSymbolV2*>::const_iterator symbolIt = symbolList.constBegin();
for ( ; symbolPosIt != symbolPositions.constEnd() && symbolIt != symbolList.constEnd(); ++symbolPosIt, ++symbolIt )
{
if ( *symbolIt )
{
( *symbolIt )->renderPoint( *symbolPosIt, context );
( *symbolIt )->renderPoint( *symbolPosIt, context, -1, selected );
}
}
}
@@ -37,7 +37,7 @@ class QgsPointDisplacementRenderer: public QgsFeatureRendererV2
QgsFeatureRendererV2* clone();

/**Reimplemented from QgsFeatureRendererV2*/
void renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer = -1, bool drawVertexMarker = false );
void renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer = -1, bool selected = false, bool drawVertexMarker = false );

QgsSymbolV2* symbolForFeature( QgsFeature& feature );

@@ -143,7 +143,7 @@ class QgsPointDisplacementRenderer: public QgsFeatureRendererV2
//helper functions
void calculateSymbolAndLabelPositions( const QPointF& centerPoint, int nPosition, double radius, double symbolDiagonal, QList<QPointF>& symbolPositions, QList<QPointF>& labelShifts ) const;
void drawCircle( double radiusPainterUnits, QgsSymbolV2RenderContext& context, const QPointF& centerPoint, int nSymbols );
void drawSymbols( QgsRenderContext& context, const QList<QgsMarkerSymbolV2*>& symbolList, const QList<QPointF>& symbolPositions );
void drawSymbols( 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 );
};

0 comments on commit 8e1b2aa

Please sign in to comment.
You can’t perform that action at this time.