Skip to content
Permalink
Browse files
Fix legend images in quickprint
git-svn-id: http://svn.osgeo.org/qgis/trunk@9559 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Nov 1, 2008
1 parent 059cbee commit 86f2ab59bcf1ea08801451cbc04a95609b70e6a8
Showing with 6 additions and 22 deletions.
  1. +6 −22 src/gui/qgsquickprint.cpp
@@ -341,19 +341,14 @@ void QgsQuickPrint::printMap()
int myMapDimensionX = ( myDrawableWidth / 100 ) * myMapHeightPercent;
int myMapDimensionY = ( myDrawableHeight / 100 ) * myMapWidthPercent;

//QPixmap myMapPixmap( myMapDimensionX, myMapDimensionY );
QImage myMapImage(QSize(myMapDimensionX, myMapDimensionY), QImage::Format_ARGB32);
myMapImage.setDotsPerMeterX((double)(myPrinter.logicalDpiX()) / 25.4 * 1000.0);
myMapImage.setDotsPerMeterY((double)(myPrinter.logicalDpiY()) / 25.4 * 1000.0);
myMapImage.fill(0);
//myMapPixmap.fill( mMapBackgroundColour );
QPainter myMapPainter;
//myMapPainter.begin( &myMapPixmap );
myMapPainter.begin(&myMapImage);
// Now resize for print
mpMapRenderer->setOutputSize(QSize( myMapDimensionX, myMapDimensionY ), (myPrinter.logicalDpiX() + myPrinter.logicalDpiY()) / 2 );
//scalePointSymbols( mySymbolScalingAmount, ScaleUp );
//scaleTextLabels( mySymbolScalingAmount, ScaleUp );
mpMapRenderer->render( &myMapPainter );

myMapPainter.end();
@@ -363,11 +358,6 @@ void QgsQuickPrint::printMap()

myPrintPainter.drawImage(myOriginX, myOriginY, myMapImage);

/*myPrintPainter.drawPixmap(
myOriginX,
myOriginY,
myMapPixmap );*/

//
// Draw the legend
//
@@ -425,6 +415,8 @@ void QgsQuickPrint::printMap()
//
// Single symbol
//
double widthScale = (myPrinter.logicalDpiX() + myPrinter.logicalDpiY()) / 2.0 / 25.4;

if ( 1 == mySymbolList.size() )
{
QgsSymbol * mypSymbol = mySymbolList.at( 0 );
@@ -434,10 +426,8 @@ void QgsQuickPrint::printMap()
if ( mypSymbol->type() == QGis::Point )
{
QImage myImage;
myImage = mypSymbol->getPointSymbolAsImage();
myPixmap = QPixmap::fromImage( myImage ); // convert to pixmap
myPixmap = myPixmap.scaled( myIconWidth, myIconWidth );
myPrintPainter.drawPixmap( myLegendXPos, myLegendYPos, myPixmap );
myImage = mypSymbol->getPointSymbolAsImage(widthScale);
myPrintPainter.drawImage(myLegendXPos, myLegendYPos, myImage);
}
else if ( mypSymbol->type() == QGis::Line )
{
@@ -513,10 +503,8 @@ void QgsQuickPrint::printMap()
if ( mypSymbol->type() == QGis::Point )
{
QImage myImage;
myImage = mypSymbol->getPointSymbolAsImage();
myPixmap = QPixmap::fromImage( myImage ); // convert to pixmap
myPixmap = myPixmap.scaled( myIconWidth, myIconWidth );
myPrintPainter.drawPixmap( myLegendXPos, myLegendYPos, myPixmap );
myImage = mypSymbol->getPointSymbolAsImage(widthScale);
myPrintPainter.drawImage(myLegendXPos, myLegendYPos, myImage);
}
else if ( mypSymbol->type() == QGis::Line )
{
@@ -665,10 +653,6 @@ void QgsQuickPrint::printMap()
// Finish up
//

//reinstate the symbols scaling for screen display
//scalePointSymbols( mySymbolScalingAmount, ScaleDown );
//scaleTextLabels( mySymbolScalingAmount, ScaleDown );


myPrintPainter.end();
/*

0 comments on commit 86f2ab5

Please sign in to comment.