Skip to content

Commit

Permalink
Fix for #239 - retain outline color of selected polygons
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9476 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Oct 14, 2008
1 parent 84dc86a commit 700a204
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
15 changes: 11 additions & 4 deletions src/core/renderer/qgscontinuouscolorrenderer.cpp
Expand Up @@ -155,7 +155,7 @@ void QgsContinuousColorRenderer::renderFeature( QPainter * p, QgsFeature & f, QI
linePen.setWidthF( widthScale*mMinimumSymbol->pen().widthF() );
p->setPen( linePen );
}
else
else //polygon
{
p->setBrush( QColor( red, green, blue ) );
if ( mDrawPolygonOutline )
Expand All @@ -166,15 +166,22 @@ void QgsContinuousColorRenderer::renderFeature( QPainter * p, QgsFeature & f, QI
p->setPen( pen );
}
else
{
p->setPen( Qt::NoPen );
}
}
if ( selected )
{
QPen pen = mMinimumSymbol->pen();
pen.setColor( mSelectionColor );
//for polygons we dont use selection colour for outline
//otherwise adjacent features appear merged when selected
if ( mGeometryType != QGis::Polygon )
{
QPen pen = mMinimumSymbol->pen();
pen.setColor( mSelectionColor );
p->setPen( pen );
}
QBrush brush = mMinimumSymbol->brush();
brush.setColor( mSelectionColor );
p->setPen( pen );
p->setBrush( brush );
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/core/renderer/qgsgraduatedsymbolrenderer.cpp
Expand Up @@ -153,9 +153,7 @@ void QgsGraduatedSymbolRenderer::renderFeature( QPainter * p, QgsFeature & f, QI
else
{
QPen pen = theSymbol->pen();
pen.setColor( mSelectionColor );
pen.setWidthF( widthScale * pen.widthF() );
p->setPen( pen );

if ( mGeometryType == QGis::Polygon )
{
Expand All @@ -164,6 +162,11 @@ void QgsGraduatedSymbolRenderer::renderFeature( QPainter * p, QgsFeature & f, QI
brush.setColor( mSelectionColor );
p->setBrush( brush );
}
else //dont draw outlines in selection colour for polys otherwise they appear merged
{
pen.setColor( mSelectionColor );
}
p->setPen( pen );
}
}
}
Expand Down
12 changes: 7 additions & 5 deletions src/core/renderer/qgssinglesymbolrenderer.cpp
Expand Up @@ -137,18 +137,20 @@ void QgsSingleSymbolRenderer::renderFeature( QPainter * p, QgsFeature & f, QImag
{
QPen pen = mSymbol->pen();
pen.setWidthF( widthScale * pen.widthF() );
// We set pen color in case it is an area with no brush (transparent).
// Previously, this was only done for lines. Why?
pen.setColor( mSelectionColor );
p->setPen( pen );

if ( mGeometryType == QGis::Polygon )
{
QBrush brush = mSymbol->brush();
scaleBrush( brush, rasterScaleFactor ); //scale brush content for printout
brush.setColor( mSelectionColor );
p->setBrush( brush );
}
else //for lines we draw in selection color
{
// We set pen color in case it is an area with no brush (transparent).
// Previously, this was only done for lines. Why?
pen.setColor( mSelectionColor );
p->setPen( pen );
}
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/core/renderer/qgsuniquevaluerenderer.cpp
Expand Up @@ -162,15 +162,18 @@ void QgsUniqueValueRenderer::renderFeature( QPainter* p, QgsFeature& f, QImage*
{
QPen pen = symbol->pen();
pen.setWidthF( widthScale * pen.widthF() );
pen.setColor( mSelectionColor );
p->setPen( pen );
if ( mGeometryType == QGis::Polygon )
{
QBrush brush = symbol->brush();
scaleBrush( brush, rasterScaleFactor ); //scale brush content for printout
brush.setColor( mSelectionColor );
p->setBrush( brush );
}
else //dont draw outlines of polygons in selection colour otherwise they appear merged
{
pen.setColor( mSelectionColor );
}
p->setPen( pen );
}
}
}
Expand Down

0 comments on commit 700a204

Please sign in to comment.