Skip to content

Commit

Permalink
Better consideration of large point symbols in composer legend
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Hugentobler committed Jun 17, 2011
1 parent a083c5e commit 7a72e78
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/core/composer/qgscomposerlegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7a72e78

Please sign in to comment.