[QGIS Commit] r13687 - trunk/qgis/src/core/renderer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Jun 8 02:39:03 EDT 2010


Author: mhugent
Date: 2010-06-08 02:38:54 -0400 (Tue, 08 Jun 2010)
New Revision: 13687

Modified:
   trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.cpp
   trunk/qgis/src/core/renderer/qgssinglesymbolrenderer.cpp
   trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.cpp
Log:
Fix for marker size in map units

Modified: trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.cpp
===================================================================
--- trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.cpp	2010-06-07 22:46:38 UTC (rev 13686)
+++ trunk/qgis/src/core/renderer/qgsgraduatedsymbolrenderer.cpp	2010-06-08 06:38:54 UTC (rev 13687)
@@ -170,14 +170,7 @@
 
     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;
+      scale = 1.0 / renderContext.mapToPixel().mapUnitsPerPixel();
     }
 
     *img = theSymbol->getPointSymbolAsImage( scale, selected, mSelectionColor, fieldScale,

Modified: trunk/qgis/src/core/renderer/qgssinglesymbolrenderer.cpp
===================================================================
--- trunk/qgis/src/core/renderer/qgssinglesymbolrenderer.cpp	2010-06-07 22:46:38 UTC (rev 13686)
+++ trunk/qgis/src/core/renderer/qgssinglesymbolrenderer.cpp	2010-06-08 06:38:54 UTC (rev 13687)
@@ -155,14 +155,7 @@
 
     if ( sy->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;
+      scale = 1.0 / renderContext.mapToPixel().mapUnitsPerPixel();
     }
 
     *img = sy->getPointSymbolAsImage( scale, selected, mSelectionColor, fieldScale, rotation, renderContext.rasterScaleFactor(), opacity );

Modified: trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.cpp
===================================================================
--- trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.cpp	2010-06-07 22:46:38 UTC (rev 13686)
+++ trunk/qgis/src/core/renderer/qgsuniquevaluerenderer.cpp	2010-06-08 06:38:54 UTC (rev 13687)
@@ -145,14 +145,7 @@
 
     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;
+      scale = 1.0 / renderContext.mapToPixel().mapUnitsPerPixel();
     }
 
     *img = symbol->getPointSymbolAsImage( scale, selected, mSelectionColor,



More information about the QGIS-commit mailing list