Skip to content
Permalink
Browse files

Better consideration of large point symbols in composer legend

  • Loading branch information
Marco Hugentobler
Marco Hugentobler committed Jun 17, 2011
1 parent a083c5e commit 7a72e7815caa7725dc577bec4e8682986570b5e0
Showing with 17 additions and 3 deletions.
  1. +17 −3 src/core/composer/qgscomposerlegend.cpp
@@ -377,13 +377,27 @@ void QgsComposerLegend::drawSymbolV2( QPainter* p, QgsSymbolV2* s, double curren
}
rasterScaleFactor = ( paintDevice->logicalDpiX() + paintDevice->logicalDpiY() ) / 2.0 / 25.4;
}

//Consider symbol size for point markers
double height = mSymbolHeight;
double width = mSymbolWidth;
if ( s->type() == QgsSymbolV2::Marker )
{
QgsMarkerSymbolV2* markerSymbol = dynamic_cast<QgsMarkerSymbolV2*>( s );
if ( markerSymbol )
{
height = markerSymbol->size();
width = markerSymbol->size();
}
}

p->save();
p->translate( currentXPosition, currentYCoord );
p->scale( 1.0 / rasterScaleFactor, 1.0 / rasterScaleFactor );
s->drawPreviewIcon( p, QSize( mSymbolWidth * rasterScaleFactor, mSymbolHeight * rasterScaleFactor ) );
s->drawPreviewIcon( p, QSize( width * rasterScaleFactor, height * rasterScaleFactor ) );
p->restore();
currentXPosition += mSymbolWidth;
symbolHeight = mSymbolHeight;
currentXPosition += width;
symbolHeight = height;
}

void QgsComposerLegend::drawPointSymbol( QPainter* p, QgsSymbol* s, double currentYCoord, double& currentXPosition, double& symbolHeight, int opacity ) const

0 comments on commit 7a72e78

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