[QGIS Commit] r9559 - trunk/qgis/src/gui
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat Nov 1 10:19:14 EDT 2008
Author: mhugent
Date: 2008-11-01 10:19:14 -0400 (Sat, 01 Nov 2008)
New Revision: 9559
Modified:
trunk/qgis/src/gui/qgsquickprint.cpp
Log:
Fix legend images in quickprint
Modified: trunk/qgis/src/gui/qgsquickprint.cpp
===================================================================
--- trunk/qgis/src/gui/qgsquickprint.cpp 2008-10-31 20:06:55 UTC (rev 9558)
+++ trunk/qgis/src/gui/qgsquickprint.cpp 2008-11-01 14:19:14 UTC (rev 9559)
@@ -341,19 +341,14 @@
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 @@
myPrintPainter.drawImage(myOriginX, myOriginY, myMapImage);
- /*myPrintPainter.drawPixmap(
- myOriginX,
- myOriginY,
- myMapPixmap );*/
-
//
// Draw the legend
//
@@ -425,6 +415,8 @@
//
// 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 @@
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 @@
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,11 +653,7 @@
// Finish up
//
- //reinstate the symbols scaling for screen display
- //scalePointSymbols( mySymbolScalingAmount, ScaleDown );
- //scaleTextLabels( mySymbolScalingAmount, ScaleDown );
-
myPrintPainter.end();
/*
mProgressDialog.setValue ( 0 );
More information about the QGIS-commit
mailing list