[QGIS Commit] r9546 - in trunk/qgis/src: core/symbology gui plugins
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat Oct 25 10:19:58 EDT 2008
Author: mhugent
Date: 2008-10-25 10:19:58 -0400 (Sat, 25 Oct 2008)
New Revision: 9546
Modified:
trunk/qgis/src/core/symbology/qgssymbol.cpp
trunk/qgis/src/core/symbology/qgssymbol.h
trunk/qgis/src/gui/qgsquickprint.cpp
trunk/qgis/src/plugins/CMakeLists.txt
Log:
Use image cache only for the first widthScale (usually screen dpi), not for composer and quickprint. Enabled quickprint again as the map rendering should be ok now, but legend still needs a bit of work
Modified: trunk/qgis/src/core/symbology/qgssymbol.cpp
===================================================================
--- trunk/qgis/src/core/symbology/qgssymbol.cpp 2008-10-25 13:02:21 UTC (rev 9545)
+++ trunk/qgis/src/core/symbology/qgssymbol.cpp 2008-10-25 14:19:58 UTC (rev 9546)
@@ -42,7 +42,7 @@
mPointSymbolName( "hard:circle" ),
mPointSize( DEFAULT_POINT_SIZE ),
mPointSymbolImage( 1, 1, QImage::Format_ARGB32_Premultiplied ),
- mWidthScale( 1.0 ),
+ mWidthScale( -1.0 ),
mCacheUpToDate( false ),
mCacheUpToDate2( false ),
mRotationClassificationField( -1 ),
@@ -60,7 +60,7 @@
mPointSymbolName( "hard:circle" ),
mPointSize( DEFAULT_POINT_SIZE ),
mPointSymbolImage( 1, 1, QImage::Format_ARGB32_Premultiplied ),
- mWidthScale( 1.0 ),
+ mWidthScale( -1.0 ),
mCacheUpToDate( false ),
mCacheUpToDate2( false ),
mRotationClassificationField( -1 ),
@@ -71,7 +71,7 @@
: mPointSymbolName( "hard:circle" ),
mPointSize( DEFAULT_POINT_SIZE ),
mPointSymbolImage( 1, 1, QImage::Format_ARGB32_Premultiplied ),
- mWidthScale( 1.0 ),
+ mWidthScale( -1.0 ),
mCacheUpToDate( false ),
mCacheUpToDate2( false ),
mRotationClassificationField( -1 ),
@@ -85,7 +85,7 @@
mPointSymbolName( "hard:circle" ),
mPointSize( DEFAULT_POINT_SIZE ),
mPointSymbolImage( 1, 1, QImage::Format_ARGB32_Premultiplied ),
- mWidthScale( 1.0 ),
+ mWidthScale( -1.0 ),
mCacheUpToDate( false ),
mCacheUpToDate2( false ),
mRotationClassificationField( -1 ),
@@ -332,12 +332,14 @@
QImage QgsSymbol::getPointSymbolAsImage( double widthScale, bool selected, QColor selectionColor, double scale,
double rotation, double rasterScaleFactor )
{
- //QgsDebugMsg(QString("Symbol scale = %1, and rotation = %2").arg(scale).arg(rotation));
if ( 1.0 == ( scale * rasterScaleFactor ) && 0 == rotation )
- {
- // If scale is 1.0 and rotation 0.0, use cached image.
- return getCachedPointSymbolAsImage( widthScale, selected, selectionColor );
- }
+ {
+ if(mWidthScale < 0 || widthScale == mWidthScale)
+ {
+ // If scale is 1.0 and rotation 0.0, use cached image.
+ return getCachedPointSymbolAsImage( widthScale, selected, selectionColor );
+ }
+ }
QImage preRotateImage;
QPen pen = mPen;
Modified: trunk/qgis/src/core/symbology/qgssymbol.h
===================================================================
--- trunk/qgis/src/core/symbology/qgssymbol.h 2008-10-25 13:02:21 UTC (rev 9545)
+++ trunk/qgis/src/core/symbology/qgssymbol.h 2008-10-25 14:19:58 UTC (rev 9546)
@@ -166,7 +166,7 @@
/* Point symbol cache */
QImage mPointSymbolImageSelected;
- /* Current line width scale used by mPointSymbolVectorImage */
+ /* Current line width scale used by mPointSymbolVectorImage. Equals -1.0 if not set */
double mWidthScale;
/* Point symbol cache but with line width scale mWidthScale */
Modified: trunk/qgis/src/gui/qgsquickprint.cpp
===================================================================
--- trunk/qgis/src/gui/qgsquickprint.cpp 2008-10-25 13:02:21 UTC (rev 9545)
+++ trunk/qgis/src/gui/qgsquickprint.cpp 2008-10-25 14:19:58 UTC (rev 9546)
@@ -340,25 +340,33 @@
// properly in the print
int myMapDimensionX = ( myDrawableWidth / 100 ) * myMapHeightPercent;
int myMapDimensionY = ( myDrawableHeight / 100 ) * myMapWidthPercent;
- QPixmap myMapPixmap( myMapDimensionX, myMapDimensionY );
- myMapPixmap.fill( mMapBackgroundColour );
+
+ //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( &myMapPixmap );
+ myMapPainter.begin(&myMapImage);
// Now resize for print
- mpMapRenderer->setOutputSize(
- QSize( myMapDimensionX, myMapDimensionY ), myPrinter.resolution() );
- scalePointSymbols( mySymbolScalingAmount, ScaleUp );
- scaleTextLabels( mySymbolScalingAmount, ScaleUp );
+ mpMapRenderer->setOutputSize(QSize( myMapDimensionX, myMapDimensionY ), (myPrinter.logicalDpiX() + myPrinter.logicalDpiY()) / 2 );
+ //scalePointSymbols( mySymbolScalingAmount, ScaleUp );
+ //scaleTextLabels( mySymbolScalingAmount, ScaleUp );
mpMapRenderer->render( &myMapPainter );
myMapPainter.end();
//draw the map pixmap onto our pdf print device
myOriginX = myPrinter.pageRect().left() + myHorizontalSpacing;
myOriginY += myVerticalSpacing * 2;
- myPrintPainter.drawPixmap(
+
+ myPrintPainter.drawImage(myOriginX, myOriginY, myMapImage);
+
+ /*myPrintPainter.drawPixmap(
myOriginX,
myOriginY,
- myMapPixmap );
+ myMapPixmap );*/
//
// Draw the legend
@@ -658,8 +666,8 @@
//
//reinstate the symbols scaling for screen display
- scalePointSymbols( mySymbolScalingAmount, ScaleDown );
- scaleTextLabels( mySymbolScalingAmount, ScaleDown );
+ //scalePointSymbols( mySymbolScalingAmount, ScaleDown );
+ //scaleTextLabels( mySymbolScalingAmount, ScaleDown );
myPrintPainter.end();
Modified: trunk/qgis/src/plugins/CMakeLists.txt
===================================================================
--- trunk/qgis/src/plugins/CMakeLists.txt 2008-10-25 13:02:21 UTC (rev 9545)
+++ trunk/qgis/src/plugins/CMakeLists.txt 2008-10-25 14:19:58 UTC (rev 9546)
@@ -18,7 +18,7 @@
INSTALL(FILES qgisplugin.h qgsrendererplugin.h DESTINATION ${QGIS_INCLUDE_DIR})
-#SUBDIRS (quick_print)
+SUBDIRS (quick_print)
SUBDIRS (coordinate_capture dxf2shp_converter)
More information about the QGIS-commit
mailing list