[QGIS Commit] r8155 - trunk/qgis/src/gui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Feb 13 13:37:41 EST 2008


Author: timlinux
Date: 2008-02-13 13:37:41 -0500 (Wed, 13 Feb 2008)
New Revision: 8155

Modified:
   trunk/qgis/src/gui/qgsquickprint.cpp
Log:
Some tweaks to try to ensure proper font sizing in projected maps and to make the scale bar a little skinnier


Modified: trunk/qgis/src/gui/qgsquickprint.cpp
===================================================================
--- trunk/qgis/src/gui/qgsquickprint.cpp	2008-02-13 18:18:18 UTC (rev 8154)
+++ trunk/qgis/src/gui/qgsquickprint.cpp	2008-02-13 18:37:41 UTC (rev 8155)
@@ -222,7 +222,13 @@
   int myLegendHeightPercent = 65;
   int myLogoWidthPercent = 23;
   int myLogoHeightPercent = 17;
-  int mySymbolScalingAmount = myPrintResolutionDpi / myScreenResolutionDpi; 
+  //
+  // Remember the size and dpi of the maprender
+  // so we can restore it properly
+  //
+  int myOriginalDpi = mpMapRender->outputDpi();
+  QSize myOriginalSize = mpMapRender->outputSize();
+  int mySymbolScalingAmount = myPrintResolutionDpi / myOriginalDpi; 
 
   //define the font sizes and family
   int myMapTitleFontSize = 24;
@@ -337,12 +343,6 @@
   myMapPixmap.fill ( mMapBackgroundColour );
   QPainter myMapPainter;
   myMapPainter.begin( &myMapPixmap );
-  //
-  // Remember the size and dpi of the maprender
-  // so we can restore it properly
-  //
-  int myOriginalDpi = mpMapRender->outputDpi();
-  QSize myOriginalSize = mpMapRender->outputSize();
   // Now resize for print
   mpMapRender->setOutputSize( 
       QSize ( myMapDimensionX, myMapDimensionY ), myPrinter.resolution() ); 
@@ -795,7 +795,6 @@
   bool mySnappingFlag = true;
   QColor mColour = Qt::black;
   // Hard coded sizes
-  int myMajorTickSize=10;
   int myTextOffsetX=0;
   int myTextOffsetY=5;
   int myXMargin=20;
@@ -935,14 +934,14 @@
   myStops << QGradientStop(1.0,QColor("#656565"));
   //draw again with the brush in the revers direction to complete teh glossiness
   QLinearGradient myReverseGlossyBrush(
-                  QPointF(myOriginX,myOriginY +  myMajorTickSize*3), 
+                  QPointF(myOriginX,myOriginY +  myFontHeight*3), 
                   QPointF(myOriginX,myOriginY));
   thepPainter->setBrush(myReverseGlossyBrush);
   thepPainter->drawRect( 
       myOriginX, 
       myOriginY, 
       myOriginX + myScaleBarWidthInt,  
-      myOriginY + myMajorTickSize
+      myOriginY + myFontHeight
       );
 
   //
@@ -953,7 +952,6 @@
   //Draw the minimum label buffer
   thepPainter->setPen( myBackColor );
   myFontWidth = myFontMetrics.width( "0" );
-  myFontHeight = myFontMetrics.height();
 
   for (int i = 0-myBufferSize; i <= myBufferSize; i++)
   {
@@ -1003,14 +1001,13 @@
   //
   thepPainter->setPen( myBackColor );
   myFontWidth = myFontMetrics.width( myScaleBarUnitLabel );
-  myFontHeight = myFontMetrics.height();
   //first the buffer
   for (int i = 0-myBufferSize; i <= myBufferSize; i++)
   {
     for (int j = 0-myBufferSize; j <= myBufferSize; j++)
     {
       thepPainter->drawText( i + (myOriginX+myScaleBarWidthInt+myTextOffsetX),
-          j + myOriginY + myMajorTickSize + (myFontHeight*2.5) + myTextOffsetY,
+          j + myOriginY + myFontHeight + (myFontHeight*2.5) + myTextOffsetY,
           myScaleBarUnitLabel);
     }
   }
@@ -1018,7 +1015,7 @@
   thepPainter->setPen( myForeColor );
   thepPainter->drawText(
       myOriginX + myScaleBarWidthInt + myTextOffsetX,
-      myOriginY + myMajorTickSize + (myFontHeight*2.5) +  myTextOffsetY,
+      myOriginY + myFontHeight + (myFontHeight*2.5) +  myTextOffsetY,
       myScaleBarUnitLabel
       );
 }



More information about the QGIS-commit mailing list