[QGIS Commit] r12632 - in trunk/qgis/src/core: renderer symbology

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Dec 28 09:04:16 EST 2009


Author: jef
Date: 2009-12-28 09:04:16 -0500 (Mon, 28 Dec 2009)
New Revision: 12632

Modified:
   trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.cpp
   trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.cpp
   trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp
   trunk/qgis/src/core/symbology/qgssymbol.cpp
Log:
fix #2329

Modified: trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.cpp
===================================================================
--- trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.cpp	2009-12-28 13:35:05 UTC (rev 12631)
+++ trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.cpp	2009-12-28 14:04:16 UTC (rev 12632)
@@ -165,7 +165,22 @@
       oldName = theSymbol->pointSymbolName();
       theSymbol->setNamedPointSymbol( name );
     }
-    *img = theSymbol->getPointSymbolAsImage( renderContext.scaleFactor(), selected, mSelectionColor, fieldScale,
+
+    double scale = renderContext.scaleFactor();
+
+    if ( theSymbol->pointSizeUnits() )
+    {
+      /* Calc scale (still not nice) */
+      QgsPoint point;
+      point = renderContext.mapToPixel().transform( 0, 0 );
+      double x1 = point.x();
+      point = renderContext.mapToPixel().transform( 1000, 0 );
+      double x2 = point.x();
+
+      scale *= ( x2 - x1 ) * 0.001;
+    }
+
+    *img = theSymbol->getPointSymbolAsImage( scale, selected, mSelectionColor, fieldScale,
            rotation, renderContext.rasterScaleFactor(), opacity );
 
     if ( !oldName.isNull() )

Modified: trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.cpp
===================================================================
--- trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.cpp	2009-12-28 13:35:05 UTC (rev 12631)
+++ trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.cpp	2009-12-28 14:04:16 UTC (rev 12632)
@@ -141,7 +141,21 @@
       symbol->setNamedPointSymbol( name );
     }
 
-    *img = symbol->getPointSymbolAsImage( renderContext.scaleFactor(), selected, mSelectionColor,
+    double scale = renderContext.scaleFactor();
+
+    if ( symbol->pointSizeUnits() )
+    {
+      /* Calc scale (still not nice) */
+      QgsPoint point;
+      point = renderContext.mapToPixel().transform( 0, 0 );
+      double x1 = point.x();
+      point = renderContext.mapToPixel().transform( 1000, 0 );
+      double x2 = point.x();
+
+      scale *= ( x2 - x1 ) * 0.001;
+    }
+
+    *img = symbol->getPointSymbolAsImage( scale, selected, mSelectionColor,
                                           fieldScale, rotation, renderContext.rasterScaleFactor(),
                                           opacity );
     if ( !oldName.isNull() )

Modified: trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp
===================================================================
--- trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp	2009-12-28 13:35:05 UTC (rev 12631)
+++ trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp	2009-12-28 14:04:16 UTC (rev 12632)
@@ -300,7 +300,7 @@
   // width is necessary.
   double r = s / 2; // get half the size of the figure to be rendered (the radius)
 
-  QgsDebugMsg( QString( "Hard marker size %1" ).arg( s ) );
+  QgsDebugMsgLevel( QString( "Hard marker size %1" ).arg( s ), 3 );
 
   // Find out center coordinates of the QImage to draw on.
   double x_c = ( double )( imageSize / 2 ) + 0.5; // add 1/2 pixel for proper rounding when the figure's coordinates are added
@@ -309,7 +309,7 @@
   thepPainter->setPen( pen );
   thepPainter->setBrush( brush );
 
-  QgsDebugMsg( QString( "Hard marker radius %1" ).arg( r ) );
+  QgsDebugMsgLevel( QString( "Hard marker radius %1" ).arg( r ), 3 );
 
   // If radius is 0, draw a circle, so it wont disappear.
   if ( name == "circle" || r < 1 )

Modified: trunk/qgis/src/core/symbology/qgssymbol.cpp
===================================================================
--- trunk/qgis/src/core/symbology/qgssymbol.cpp	2009-12-28 13:35:05 UTC (rev 12631)
+++ trunk/qgis/src/core/symbology/qgssymbol.cpp	2009-12-28 14:04:16 UTC (rev 12632)
@@ -411,9 +411,9 @@
   }
   else
   {
-    QgsDebugMsg( QString( "marker:%1 mPointSize:%2 mPointSizeUnits:%3 scale:%4 widthScale:%5 rasterScaleFactor:%6 opacity:%7" )
+    QgsDebugMsgLevel( QString( "marker:%1 mPointSize:%2 mPointSizeUnits:%3 scale:%4 widthScale:%5 rasterScaleFactor:%6 opacity:%7" )
                  .arg( mPointSymbolName ).arg( mSize ).arg( mSizeInMapUnits ? "true" : "false" )
-                 .arg( scale ).arg( widthScale ).arg( rasterScaleFactor ).arg( opacity ) );
+                 .arg( scale ).arg( widthScale ).arg( rasterScaleFactor ).arg( opacity ), 3 );
 
 
     preRotateImage = QgsMarkerCatalogue::instance()->imageMarker(



More information about the QGIS-commit mailing list