@@ -341,19 +341,14 @@ void QgsQuickPrint::printMap()
341
341
int myMapDimensionX = ( myDrawableWidth / 100 ) * myMapHeightPercent;
342
342
int myMapDimensionY = ( myDrawableHeight / 100 ) * myMapWidthPercent;
343
343
344
- // QPixmap myMapPixmap( myMapDimensionX, myMapDimensionY );
345
344
QImage myMapImage (QSize (myMapDimensionX, myMapDimensionY), QImage::Format_ARGB32);
346
345
myMapImage.setDotsPerMeterX ((double )(myPrinter.logicalDpiX ()) / 25.4 * 1000.0 );
347
346
myMapImage.setDotsPerMeterY ((double )(myPrinter.logicalDpiY ()) / 25.4 * 1000.0 );
348
347
myMapImage.fill (0 );
349
- // myMapPixmap.fill( mMapBackgroundColour );
350
348
QPainter myMapPainter;
351
- // myMapPainter.begin( &myMapPixmap );
352
349
myMapPainter.begin (&myMapImage);
353
350
// Now resize for print
354
351
mpMapRenderer->setOutputSize (QSize ( myMapDimensionX, myMapDimensionY ), (myPrinter.logicalDpiX () + myPrinter.logicalDpiY ()) / 2 );
355
- // scalePointSymbols( mySymbolScalingAmount, ScaleUp );
356
- // scaleTextLabels( mySymbolScalingAmount, ScaleUp );
357
352
mpMapRenderer->render ( &myMapPainter );
358
353
359
354
myMapPainter.end ();
@@ -363,11 +358,6 @@ void QgsQuickPrint::printMap()
363
358
364
359
myPrintPainter.drawImage (myOriginX, myOriginY, myMapImage);
365
360
366
- /* myPrintPainter.drawPixmap(
367
- myOriginX,
368
- myOriginY,
369
- myMapPixmap );*/
370
-
371
361
//
372
362
// Draw the legend
373
363
//
@@ -425,6 +415,8 @@ void QgsQuickPrint::printMap()
425
415
//
426
416
// Single symbol
427
417
//
418
+ double widthScale = (myPrinter.logicalDpiX () + myPrinter.logicalDpiY ()) / 2.0 / 25.4 ;
419
+
428
420
if ( 1 == mySymbolList.size () )
429
421
{
430
422
QgsSymbol * mypSymbol = mySymbolList.at ( 0 );
@@ -434,10 +426,8 @@ void QgsQuickPrint::printMap()
434
426
if ( mypSymbol->type () == QGis::Point )
435
427
{
436
428
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);
441
431
}
442
432
else if ( mypSymbol->type () == QGis::Line )
443
433
{
@@ -513,10 +503,8 @@ void QgsQuickPrint::printMap()
513
503
if ( mypSymbol->type () == QGis::Point )
514
504
{
515
505
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);
520
508
}
521
509
else if ( mypSymbol->type () == QGis::Line )
522
510
{
@@ -665,10 +653,6 @@ void QgsQuickPrint::printMap()
665
653
// Finish up
666
654
//
667
655
668
- // reinstate the symbols scaling for screen display
669
- // scalePointSymbols( mySymbolScalingAmount, ScaleDown );
670
- // scaleTextLabels( mySymbolScalingAmount, ScaleDown );
671
-
672
656
673
657
myPrintPainter.end ();
674
658
/*
0 commit comments