Skip to content

Commit

Permalink
Fix legend images in quickprint
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9559 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Nov 1, 2008
1 parent 4e3a24f commit a3b8977
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions src/gui/qgsquickprint.cpp
Expand Up @@ -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();
Expand All @@ -363,11 +358,6 @@ void QgsQuickPrint::printMap()

myPrintPainter.drawImage(myOriginX, myOriginY, myMapImage);

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

//
// Draw the legend
//
Expand Down Expand Up @@ -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 );
Expand All @@ -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 )
{
Expand Down Expand Up @@ -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 )
{
Expand Down Expand Up @@ -665,10 +653,6 @@ void QgsQuickPrint::printMap()
// Finish up
//

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


myPrintPainter.end();
/*
Expand Down

0 comments on commit a3b8977

Please sign in to comment.