Skip to content

Commit a3b8977

Browse files
author
mhugent
committed
Fix legend images in quickprint
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9559 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 4e3a24f commit a3b8977

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

src/gui/qgsquickprint.cpp

+6-22
Original file line numberDiff line numberDiff line change
@@ -341,19 +341,14 @@ void QgsQuickPrint::printMap()
341341
int myMapDimensionX = ( myDrawableWidth / 100 ) * myMapHeightPercent;
342342
int myMapDimensionY = ( myDrawableHeight / 100 ) * myMapWidthPercent;
343343

344-
//QPixmap myMapPixmap( myMapDimensionX, myMapDimensionY );
345344
QImage myMapImage(QSize(myMapDimensionX, myMapDimensionY), QImage::Format_ARGB32);
346345
myMapImage.setDotsPerMeterX((double)(myPrinter.logicalDpiX()) / 25.4 * 1000.0);
347346
myMapImage.setDotsPerMeterY((double)(myPrinter.logicalDpiY()) / 25.4 * 1000.0);
348347
myMapImage.fill(0);
349-
//myMapPixmap.fill( mMapBackgroundColour );
350348
QPainter myMapPainter;
351-
//myMapPainter.begin( &myMapPixmap );
352349
myMapPainter.begin(&myMapImage);
353350
// Now resize for print
354351
mpMapRenderer->setOutputSize(QSize( myMapDimensionX, myMapDimensionY ), (myPrinter.logicalDpiX() + myPrinter.logicalDpiY()) / 2 );
355-
//scalePointSymbols( mySymbolScalingAmount, ScaleUp );
356-
//scaleTextLabels( mySymbolScalingAmount, ScaleUp );
357352
mpMapRenderer->render( &myMapPainter );
358353

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

364359
myPrintPainter.drawImage(myOriginX, myOriginY, myMapImage);
365360

366-
/*myPrintPainter.drawPixmap(
367-
myOriginX,
368-
myOriginY,
369-
myMapPixmap );*/
370-
371361
//
372362
// Draw the legend
373363
//
@@ -425,6 +415,8 @@ void QgsQuickPrint::printMap()
425415
//
426416
// Single symbol
427417
//
418+
double widthScale = (myPrinter.logicalDpiX() + myPrinter.logicalDpiY()) / 2.0 / 25.4;
419+
428420
if ( 1 == mySymbolList.size() )
429421
{
430422
QgsSymbol * mypSymbol = mySymbolList.at( 0 );
@@ -434,10 +426,8 @@ void QgsQuickPrint::printMap()
434426
if ( mypSymbol->type() == QGis::Point )
435427
{
436428
QImage myImage;
437-
myImage = mypSymbol->getPointSymbolAsImage();
438-
myPixmap = QPixmap::fromImage( myImage ); // convert to pixmap
439-
myPixmap = myPixmap.scaled( myIconWidth, myIconWidth );
440-
myPrintPainter.drawPixmap( myLegendXPos, myLegendYPos, myPixmap );
429+
myImage = mypSymbol->getPointSymbolAsImage(widthScale);
430+
myPrintPainter.drawImage(myLegendXPos, myLegendYPos, myImage);
441431
}
442432
else if ( mypSymbol->type() == QGis::Line )
443433
{
@@ -513,10 +503,8 @@ void QgsQuickPrint::printMap()
513503
if ( mypSymbol->type() == QGis::Point )
514504
{
515505
QImage myImage;
516-
myImage = mypSymbol->getPointSymbolAsImage();
517-
myPixmap = QPixmap::fromImage( myImage ); // convert to pixmap
518-
myPixmap = myPixmap.scaled( myIconWidth, myIconWidth );
519-
myPrintPainter.drawPixmap( myLegendXPos, myLegendYPos, myPixmap );
506+
myImage = mypSymbol->getPointSymbolAsImage(widthScale);
507+
myPrintPainter.drawImage(myLegendXPos, myLegendYPos, myImage);
520508
}
521509
else if ( mypSymbol->type() == QGis::Line )
522510
{
@@ -665,10 +653,6 @@ void QgsQuickPrint::printMap()
665653
// Finish up
666654
//
667655

668-
//reinstate the symbols scaling for screen display
669-
//scalePointSymbols( mySymbolScalingAmount, ScaleDown );
670-
//scaleTextLabels( mySymbolScalingAmount, ScaleDown );
671-
672656

673657
myPrintPainter.end();
674658
/*

0 commit comments

Comments
 (0)