void QgsSymbolSelectorWidget::addLayer() { QModelIndex idx = layersTree->currentIndex(); if ( !idx.isValid() ) return; int insertIdx = -1; SymbolLayerItem *item = static_cast<SymbolLayerItem *>( model->itemFromIndex( idx ) ); if ( item->isLayer() ) { insertIdx = item->row(); item = static_cast<SymbolLayerItem *>( item->parent() ); } QgsSymbol *parentSymbol = item->symbol(); // save data-defined values at marker level QgsProperty ddSize( parentSymbol->type() == QgsSymbol::Marker ? static_cast<QgsMarkerSymbol *>( parentSymbol )->dataDefinedSize() : QgsProperty() ); QgsProperty ddAngle( parentSymbol->type() == QgsSymbol::Marker ? static_cast<QgsMarkerSymbol *>( parentSymbol )->dataDefinedAngle() : QgsProperty() ); QgsProperty ddWidth( parentSymbol->type() == QgsSymbol::Line ? static_cast<QgsLineSymbol *>( parentSymbol )->dataDefinedWidth() : QgsProperty() ); QgsSymbolLayer *newLayer = QgsApplication::symbolLayerRegistry()->defaultSymbolLayer( parentSymbol->type() ); if ( insertIdx == -1 ) parentSymbol->appendSymbolLayer( newLayer ); else parentSymbol->insertSymbolLayer( item->rowCount() - insertIdx, newLayer ); // restore data-defined values at marker level if ( ddSize ) static_cast<QgsMarkerSymbol *>( parentSymbol )->setDataDefinedSize( ddSize ); if ( ddAngle ) static_cast<QgsMarkerSymbol *>( parentSymbol )->setDataDefinedAngle( ddAngle ); if ( ddWidth ) static_cast<QgsLineSymbol *>( parentSymbol )->setDataDefinedWidth( ddWidth ); SymbolLayerItem *newLayerItem = new SymbolLayerItem( newLayer ); item->insertRow( insertIdx == -1 ? 0 : insertIdx, newLayerItem ); item->updatePreview(); layersTree->setCurrentIndex( model->indexFromItem( newLayerItem ) ); updateUi(); updatePreview(); }
void QgsStyleManagerDialog::populateSymbols( const QStringList& symbolNames, bool check ) { QStandardItemModel* model = qobject_cast<QStandardItemModel*>( listItems->model() ); model->clear(); int type = currentItemType(); for ( int i = 0; i < symbolNames.count(); ++i ) { QString name = symbolNames[i]; QgsSymbol* symbol = mStyle->symbol( name ); if ( symbol && symbol->type() == type ) { QStandardItem* item = new QStandardItem( name ); QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( symbol, listItems->iconSize() ); item->setIcon( icon ); item->setData( name ); // used to find out original name when user edited the name item->setCheckable( check ); item->setToolTip( name ); // add to model model->appendRow( item ); } delete symbol; } selectedSymbolsChanged( QItemSelection(), QItemSelection() ); symbolSelected( listItems->currentIndex() ); }
void QgsComposerSymbolItem::readXML( const QDomElement& itemElem ) { if ( itemElem.isNull() ) { return; } setText( itemElem.attribute( "text", "" ) ); setLayerID( itemElem.attribute( "layerId", "" ) ); QgsVectorLayer* vLayer = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( mLayerID ) ); if ( vLayer ) { QDomElement symbolElem = itemElem.firstChildElement( "symbol" ); if ( !symbolElem.isNull() ) { QgsSymbol* symbol = new QgsSymbol( vLayer->geometryType() ); symbol->readXML( symbolElem, vLayer ); setSymbol( symbol ); //add icon switch ( symbol->type() ) { case QGis::Point: setIcon( QIcon( QPixmap::fromImage( symbol->getPointSymbolAsImage() ) ) ); break; case QGis::Line: setIcon( QIcon( QPixmap::fromImage( symbol->getLineSymbolAsImage() ) ) ); break; case QGis::Polygon: setIcon( QIcon( QPixmap::fromImage( symbol->getPolygonSymbolAsImage() ) ) ); break; case QGis::NoGeometry: setIcon( QIcon( QgsApplication::activeThemePath() + "/mIconTableLayer.png" ) ); break; case QGis::UnknownGeometry: // should not occur break; } } } }
void QgsQuickPrint::scalePointSymbols( int theScaleFactor, SymbolScalingType theDirection ) { if ( 0 >= theScaleFactor ) { QgsDebugMsg( "invalid scale factor" ); return; } QStringList myLayerSet = mpMapRenderer->layerSet(); QStringListIterator myLayerIterator( myLayerSet ); while ( myLayerIterator.hasNext() ) { QString myLayerId = myLayerIterator.next(); QgsDebugMsg( "Scaling point symbols for print for " + myLayerId ); QgsMapLayer * mypLayer = QgsMapLayerRegistry::instance()->mapLayer( myLayerId ); if ( mypLayer ) { QgsVectorLayer *mypVectorLayer = qobject_cast<QgsVectorLayer *>( mypLayer ); if ( mypVectorLayer ) { const QgsRenderer* mypRenderer = mypVectorLayer->renderer(); const QList<QgsSymbol*> mySymbolList = mypRenderer->symbols(); // // Single symbol // if ( 1 == mySymbolList.size() ) { QgsSymbol * mypSymbol = mySymbolList.at( 0 ); if ( mypSymbol->type() == QGis::Point ) { if ( theDirection == ScaleUp ) { mypSymbol->setPointSize( mypSymbol->pointSize() * theScaleFactor ); } else //Scale Down { mypSymbol->setPointSize( mypSymbol->pointSize() / theScaleFactor ); } } } else //class breaks { QListIterator<QgsSymbol *> myIterator( mySymbolList ); while ( myIterator.hasNext() ) { QgsSymbol * mypSymbol = myIterator.next(); if ( mypSymbol->type() == QGis::Point ) { if ( theDirection == ScaleUp ) { mypSymbol->setPointSize( mypSymbol->pointSize() * theScaleFactor ); } else //Scale Down { mypSymbol->setPointSize( mypSymbol->pointSize() / theScaleFactor ); } } } //symbol loop } //class breaks } //if vectorlayer } //if maplayer } //layer iterator }
void QgsQuickPrint::printMap() { if ( mOutputFileName.isEmpty() ) { return; } if ( mpMapRenderer == NULL ) { return; } //ensure the user never omitted the extension from the file name if ( !mOutputFileName.toUpper().endsWith( ".PDF" ) ) { mOutputFileName += ".pdf"; } // Initialising the printer this way lets us find out what // the screen resolution is which we store and then // reset the resolution of the printer after that... QPrinter myPrinter( QPrinter::ScreenResolution ); // Try to force the printer resolution to 300dpi // to get past platform specific defaults in printer // resolution... // int myPrintResolutionDpi = 300; myPrinter.setResolution( myPrintResolutionDpi ); myPrinter.setOutputFormat( QPrinter::PdfFormat ); QgsDebugMsg( QString( "Printing to page size %1" ).arg( pageSizeToString( mPageSize ) ) ); myPrinter.setPageSize( mPageSize ); myPrinter.setOutputFileName( mOutputFileName ); myPrinter.setOrientation( QPrinter::Landscape ); myPrinter.setDocName( "quickprint Report" ); QPainter myPrintPainter( &myPrinter ); myPrintPainter.setPen( Qt::gray ); myPrintPainter.setBrush( Qt::white ); // This is what we are aiming for: // a // +-(1)------ Acme Maps (2) --------------------------------------+ // |b 12/01/2007 (3) | // | Earthquakes (4) | // | +--(5)--------------------------------------------------------+ | // | |c | | // | | +-(6)---------------------------------------+ +~(7)~~~~~~+ | | // | | | | | | | | // | | | | | | | | // | | | | | | | | // | | | | | | | | // | | | | | | | | // | | | | | | | | // | | | | | | | | // | | | | | | | | // | | | | | | | | // | | | | | | | | // | | | | | | | | // | | +-------------------------------------------+ +~~~~~~~~~~+ | | // | | | | // | +-------------------------------------------------------------+ | // | | // | +-(8)-----+ +-(9-)----+ +-(10)----+ /|\ | // | | | |Copyright| | | / | \ | // | | | | 2008 | | | |(11) | // | +---------+ +---------+ +---------+ | // | +~(12)~~~~~~+ | // +-----------------------------------------------------------------+ // // 1) PageBorder 8) Logo1 // 2) PageTitle 9) CopyrightText // 3) MapDate 10) Logo2 // 4) MapTitle 11) NorthArrow // 5) MapFrame 12) ScaleBar // 6) MapPixmap // 7) LegendPixmap // a OriginXY // b HorizontalSpacing // c VerticalSpacing // // Note: Different operating systems will use different // page resolutions for QPrinter::HighResolution so I'm // working all coordinates out as percentages of page // size so that we can hopefully get comarable print // results on all platforms. // // // Note #2: Im defining all measurements here as my plan // is to later support templates with different page // layouts and paper sizes etc. // //set the top left origin for the print layout int myOriginX = myPrinter.pageRect().left(); int myOriginY = myPrinter.pageRect().top(); int myDrawableWidth = myPrinter.pageRect().width() - myOriginX; int myDrawableHeight = myPrinter.pageRect().height() - myOriginY; //define the spacing between layout elements int myHorizontalSpacing = myDrawableWidth / 100; // 1% int myVerticalSpacing = myDrawableHeight / 100; // 1% //define the proportions for the page layout int myMapWidthPercent = 65; int myMapHeightPercent = 71; int myLegendWidthPercent = 25; int myLegendHeightPercent = 65; int myLogoWidthPercent = 23; int myLogoHeightPercent = 17; // // Remember the size and dpi of the maprender // so we can restore it properly // int myOriginalDpi = mpMapRenderer->outputDpi(); //sensible default to prevent divide by zero if ( 0 == myOriginalDpi ) myOriginalDpi = 96; QSize myOriginalSize = mpMapRenderer->outputSize(); //define the font sizes and family int myMapTitleFontSize = 24; int myMapDateFontSize = 16; int myMapNameFontSize = 32; int myLegendFontSize = 12; #ifdef Q_OS_LINUX//this sucks... myLegendFontSize -= 2; #endif #ifdef WIN32 //this sucks too... myMapTitleFontSize /= 2; myMapDateFontSize /= 2; myMapNameFontSize /= 2; myLegendFontSize /= 2; #endif QString myFontFamily = "Arial"; // // Draw the PageBorder // myPrintPainter.drawRect( myOriginX, myOriginY, myDrawableWidth, myDrawableHeight ); // // Draw the PageTitle // QFont myTitleFont( myFontFamily, myMapTitleFontSize ); myPrintPainter.setFont( myTitleFont ); QFontMetrics myTitleMetrics( myTitleFont, &myPrinter ); int myPageTitleHeight = myTitleMetrics.height(); int myPageTitleWidth = myTitleMetrics.width( mTitleText ); myOriginX += myHorizontalSpacing; myOriginY -= ( myPageTitleHeight / 2 ); QRect myPageTitleRect( myOriginX, myOriginY, myPageTitleWidth, myPageTitleHeight ); // make sure the title goes onto a white background myPrintPainter.setPen( Qt::white ); myPrintPainter.drawRect( myPageTitleRect ); myPrintPainter.setPen( Qt::black ); myPrintPainter.drawText( myPageTitleRect, Qt::AlignCenter, mTitleText ); // // Draw the MapDate // QFont myDateFont( myFontFamily, myMapDateFontSize ); QString myDateText( QDate::currentDate().toString( Qt::LocalDate ) ); myPrintPainter.setFont( myDateFont ); QFontMetrics myDateMetrics( myDateFont, &myPrinter ); int myDateHeight = myDateMetrics.height(); //int myDateWidth = myDateMetrics.width(myDateText); myOriginX += myHorizontalSpacing; myOriginY += myPageTitleHeight + myVerticalSpacing ; QRect myDateRect( myOriginX, myOriginY, myPageTitleWidth, //use same width as page title for centering myDateHeight ); // make sure the title goes onto a white background myPrintPainter.setPen( Qt::white ); myPrintPainter.drawRect( myDateRect ); myPrintPainter.setPen( Qt::black ); myPrintPainter.drawText( myDateRect, Qt::AlignCenter, myDateText ); // // Draw the MapName // QFont myNameFont( myFontFamily, myMapNameFontSize ); myPrintPainter.setFont( myNameFont ); QFontMetrics myNameMetrics( myNameFont, &myPrinter ); int myNameHeight = myNameMetrics.height(); int myNameWidth = myNameMetrics.width( mNameText ); myOriginX = myPrinter.pageRect().left() + myDrawableWidth / 2; //page center myOriginX -= myNameWidth / 2; myOriginY = myPrinter.pageRect().top() + ( myPageTitleHeight / 2 ) + myVerticalSpacing ; QRect myNameRect( myOriginX, myOriginY, myNameWidth, myNameHeight ); // make sure the title goes onto a white background myPrintPainter.setPen( Qt::white ); myPrintPainter.drawRect( myNameRect ); myPrintPainter.setPen( Qt::black ); myPrintPainter.drawText( myNameRect, Qt::AlignCenter, mNameText ); // // Draw the MapFrame (top) // int myMapFrameWidth = myDrawableWidth ; myOriginX = myPrinter.pageRect().left() + myHorizontalSpacing; myOriginY += myNameHeight + myVerticalSpacing; QLine myMapFrameTopLine( myOriginX, myOriginY, myMapFrameWidth, myOriginY ); myPrintPainter.setPen( Qt::black ); myPrintPainter.drawLine( myMapFrameTopLine ); // Draw the map onto a pixmap // @TODO: we need to save teh extent of the screen map and // then set them again for the print map so that the map scales // properly in the print int myMapDimensionX = ( myDrawableWidth / 100 ) * myMapHeightPercent; int myMapDimensionY = ( myDrawableHeight / 100 ) * myMapWidthPercent; 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 ); QPainter myMapPainter; myMapPainter.begin( &myMapImage ); // Now resize for print mpMapRenderer->setOutputSize( QSize( myMapDimensionX, myMapDimensionY ), ( myPrinter.logicalDpiX() + myPrinter.logicalDpiY() ) / 2 ); mpMapRenderer->render( &myMapPainter ); myMapPainter.end(); //draw the map pixmap onto our pdf print device myOriginX = myPrinter.pageRect().left() + myHorizontalSpacing; myOriginY += myVerticalSpacing * 2; myPrintPainter.drawImage( myOriginX, myOriginY, myMapImage ); // // Draw the legend // QFont myLegendFont( myFontFamily, myLegendFontSize ); //myPrintPainter.setFont(myLegendFont); int myLegendDimensionX = ( myDrawableWidth / 100 ) * myLegendWidthPercent; int myLegendDimensionY = ( myDrawableHeight / 100 ) * myLegendHeightPercent; // Create a viewport to make coordinate conversions easier // The viewport has the same dimensions as the page(otherwise items // drawn into it will appear squashed), but a different origin. QRect myOriginalViewport = myPrintPainter.viewport(); //for restoring later myOriginX += myMapDimensionX + myHorizontalSpacing; myPrintPainter.setViewport( myOriginX, myOriginY, myOriginalViewport.width(), myOriginalViewport.height() ); //draw a rectangale around the legend frame //@TODO make this user settable if ( 0 == 1 ) //put some real logic here { myPrintPainter.drawRect( 0, 0, myLegendDimensionX, myLegendDimensionY ); } //get font metric and other vars needed QFontMetrics myLegendFontMetrics( myLegendFont, &myPrinter ); int myLegendFontHeight = myLegendFontMetrics.height(); int myLegendXPos = 0; int myLegendYPos = 0; int myLegendSpacer = myLegendFontHeight / 2; //for vertical and horizontal spacing int myLegendVerticalSpacer = myLegendFontHeight / 3; //for vertical between rows int myIconWidth = myLegendFontHeight; myPrintPainter.setFont( myLegendFont ); QStringList myLayerSet = mpMapRenderer->layerSet(); QStringListIterator myLayerIterator( myLayerSet ); //second clause below is to prevent legend spilling out the bottom while ( myLayerIterator.hasNext() && myLegendYPos < myLegendDimensionY ) { QString myLayerId = myLayerIterator.next(); QgsMapLayer * mypLayer = QgsMapLayerRegistry::instance()->mapLayer( myLayerId ); if ( mypLayer ) { QgsVectorLayer *mypVectorLayer = qobject_cast<QgsVectorLayer *>( mypLayer ); // TODO: add support for symbology-ng renderers if ( mypVectorLayer && mypVectorLayer->renderer() ) { QString myLayerName = mypVectorLayer->name(); QIcon myIcon; QPixmap myPixmap( QSize( myIconWidth, myIconWidth ) ); //square //based on code from qgslegendlayer.cpp - see that file for more info const QgsRenderer* mypRenderer = mypVectorLayer->renderer(); const QList<QgsSymbol*> mySymbolList = mypRenderer->symbols(); // // Single symbol // double widthScale = ( myPrinter.logicalDpiX() + myPrinter.logicalDpiY() ) / 2.0 / 25.4; if ( 1 == mySymbolList.size() ) { QgsSymbol * mypSymbol = mySymbolList.at( 0 ); myPrintPainter.setPen( mypSymbol->pen() ); myPrintPainter.setBrush( mypSymbol->brush() ); myLegendXPos = 0 ; if ( mypSymbol->type() == QGis::Point ) { QImage myImage; myImage = mypSymbol->getPointSymbolAsImage( widthScale ); myPrintPainter.drawImage( myLegendXPos, myLegendYPos, myImage ); } else if ( mypSymbol->type() == QGis::Line ) { myPrintPainter.drawLine( myLegendXPos, myLegendYPos, myLegendXPos + myIconWidth, myLegendYPos + myIconWidth ); } else //polygon { myPrintPainter.drawRect( myLegendXPos, myLegendYPos, myIconWidth, myIconWidth ); } myLegendXPos += myIconWidth + myLegendSpacer; myPrintPainter.setPen( Qt::black ); QStringList myWrappedLayerNameList = wordWrap( myLayerName, myLegendFontMetrics, myLegendDimensionX - myIconWidth ); // // Loop through wrapped legend label lines // QStringListIterator myLineWrapIterator( myWrappedLayerNameList ); while ( myLineWrapIterator.hasNext() ) { QString myLine = myLineWrapIterator.next(); QRect myLegendItemRect( myLegendXPos, myLegendYPos, myLegendDimensionX - myIconWidth, myLegendFontHeight ); myPrintPainter.drawText( myLegendItemRect, Qt::AlignLeft, myLine ); myLegendYPos += myLegendVerticalSpacer + myLegendFontHeight; } } else //class breaks { // draw in the layer name first, after we loop for the class breaks QStringList myWrappedLayerNameList = wordWrap( myLayerName, myLegendFontMetrics, myLegendDimensionX - myIconWidth ); // Check the wrapped layer name wont overrun the space we have // for the legend ... int myLabelHeight = myLegendFontHeight * myWrappedLayerNameList.count(); if ( myLegendYPos + myLabelHeight > myLegendDimensionY ) { continue; } // // Loop through wrapped legend label lines // QStringListIterator myLineWrapIterator( myWrappedLayerNameList ); while ( myLineWrapIterator.hasNext() ) { QString myLine = myLineWrapIterator.next(); myLegendXPos = myIconWidth; QRect myLegendItemRect( myLegendXPos, myLegendYPos, myLegendFontMetrics.width( myLine ), myLegendFontHeight ); myPrintPainter.setPen( Qt::black ); myPrintPainter.drawText( myLegendItemRect, Qt::AlignLeft, myLine ); myLegendYPos += myLegendVerticalSpacer + myLegendFontHeight; } // // Loop through the class breaks // QListIterator<QgsSymbol *> myIterator( mySymbolList ); while ( myIterator.hasNext() && myLegendYPos < myLegendDimensionY ) { QgsSymbol * mypSymbol = myIterator.next(); myPrintPainter.setPen( mypSymbol->pen() ); myPrintPainter.setBrush( mypSymbol->brush() ); myLegendXPos = myLegendSpacer * 3; //extra indent for class breaks if ( mypSymbol->type() == QGis::Point ) { QImage myImage; myImage = mypSymbol->getPointSymbolAsImage( widthScale ); myPrintPainter.drawImage( myLegendXPos, myLegendYPos, myImage ); } else if ( mypSymbol->type() == QGis::Line ) { myPrintPainter.drawLine( myLegendXPos, myLegendYPos, myLegendXPos + myIconWidth, myLegendYPos + myIconWidth ); } else //polygon { myPrintPainter.drawRect( myLegendXPos, myLegendYPos, myIconWidth, myIconWidth ); } // // Now work out the class break label // QString myLabel; QString myLower = mypSymbol->lowerValue(); if ( !myLower.isEmpty() ) { myLabel = myLower; } QString myUpper = mypSymbol->upperValue(); if ( !myUpper.isEmpty() ) { myLabel += " - "; myLabel += myUpper; } QString myText = mypSymbol->label(); if ( !myText.isEmpty() ) { myLabel += " "; myLabel += myText; } myLabel = myLabel.trimmed(); myLegendXPos += myIconWidth + myLegendSpacer; myPrintPainter.setPen( Qt::black ); QStringList myWrappedLayerNameList = wordWrap( myLabel, myLegendFontMetrics, myLegendDimensionX - myLegendXPos ); // // Loop through wrapped legend label lines // QStringListIterator myLineWrapIterator( myWrappedLayerNameList ); while ( myLineWrapIterator.hasNext() ) { QString myLine = myLineWrapIterator.next(); // check if the text will overflow the space we have QRect myLegendItemRect( myLegendXPos, myLegendYPos, myLegendDimensionX - myIconWidth, myLegendFontHeight ); myPrintPainter.drawText( myLegendItemRect, Qt::AlignLeft, myLine ); myLegendYPos += myLegendVerticalSpacer + myLegendFontHeight; } //wordwrap loop } //symbol loop } //class breaks } //if vectorlayer } //if maplayer } //layer iterator //reinstate the viewport myPrintPainter.setViewport( myOriginalViewport ); // // Draw the MapFrame (bottom) // myOriginX = myPrinter.pageRect().left() + myHorizontalSpacing; myOriginY += myMapDimensionY + ( myVerticalSpacing * 2 ); QLine myMapFrameBottomLine( myOriginX, myOriginY, myMapFrameWidth, myOriginY ); myPrintPainter.setPen( Qt::black ); myPrintPainter.drawLine( myMapFrameBottomLine ); // // Draw logo 1 // int myLogoXDim = ( myDrawableWidth / 100 ) * myLogoWidthPercent; int myLogoYDim = ( myDrawableHeight / 100 ) * myLogoHeightPercent; QPixmap myLogo1; QgsDebugMsg( QString( "Logo1: %1" ).arg( mLogo1File ) ); myLogo1.fill( Qt::white ); myLogo1.load( mLogo1File ); myLogo1 = myLogo1.scaled( myLogoXDim, myLogoYDim, Qt::KeepAspectRatio ); myOriginX = myPrinter.pageRect().left() + myHorizontalSpacing; myOriginY += myVerticalSpacing ; myPrintPainter.drawPixmap( myOriginX, myOriginY, myLogo1 ); // // Draw Copyright Text // myOriginX += myHorizontalSpacing + myLogoXDim; QRect myCopyrightRect( myOriginX, myOriginY, myLogoXDim, myLogoYDim ); myPrintPainter.setPen( Qt::black ); QFont myCopyrightFont( myFontFamily, myMapDateFontSize ); myPrintPainter.setFont( myCopyrightFont ); //myPrintPainter.drawRect( myCopyrightRect ); myPrintPainter.drawText( myCopyrightRect, Qt::AlignCenter | Qt::TextWordWrap, mCopyrightText ); // // Draw logo 2 // QPixmap myLogo2; myLogo2.fill( Qt::white ); myLogo2.load( mLogo2File ); myLogo2 = myLogo2.scaled( myLogoXDim, myLogoYDim, Qt::KeepAspectRatio ); myOriginX += myHorizontalSpacing + myLogoXDim; myPrintPainter.drawPixmap( myOriginX, myOriginY, myLogo2 ); // // Draw the north arrow // myOriginX += myHorizontalSpacing + myLogoXDim; // use half the available space for the n.arrow // and the rest for the scale bar (see below) QPixmap myNorthArrow( myLogoYDim / 2, myLogoYDim / 2 ); myNorthArrow.fill( Qt::white ); QPainter myNorthPainter( &myNorthArrow ); QSvgRenderer mySvgRenderer( mNorthArrowFile ); mySvgRenderer.render( &myNorthPainter ); myPrintPainter.drawPixmap( myOriginX + (( myLogoXDim / 2 ) ), myOriginY, myNorthArrow ); // // Draw the scale bar // myOriginY += myLogoYDim / 2 + myVerticalSpacing; myPrintPainter.setViewport( myOriginX, myOriginY, myOriginalViewport.width(), myOriginalViewport.height() ); renderPrintScaleBar( &myPrintPainter, mpMapRenderer, myLogoXDim ); myPrintPainter.setViewport( myOriginalViewport ); // // Finish up // myPrintPainter.end(); #if 0 mProgressDialog.setValue( 0 ); mProgressDialog.setLabelText( tr( "Please wait while your report is generated", "COMMENTED OUT" ) ); mProgressDialog.show(); mProgressDialog.setWindowModality( Qt::WindowModal ); mProgressDialog.setAutoClose( true ); #endif // // Restore the map render to its former glory // mpMapRenderer->setOutputSize( myOriginalSize, myOriginalDpi ); }