[QGIS Commit] r12963 - trunk/qgis/src/core/composer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Feb 22 18:34:42 EST 2010


Author: mhugent
Date: 2010-02-22 18:34:42 -0500 (Mon, 22 Feb 2010)
New Revision: 12963

Modified:
   trunk/qgis/src/core/composer/qgscomposermap.cpp
Log:
Fix for missing left line in composer grid (happend with negative left boundary coords). Fixes ticket #2458

Modified: trunk/qgis/src/core/composer/qgscomposermap.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposermap.cpp	2010-02-22 22:54:19 UTC (rev 12962)
+++ trunk/qgis/src/core/composer/qgscomposermap.cpp	2010-02-22 23:34:42 UTC (rev 12963)
@@ -1042,10 +1042,14 @@
     return 1;
   }
 
+
   QPolygonF mapPolygon = transformedMapPolygon();
   QRectF mapBoundingRect = mapPolygon.boundingRect();
-  double currentLevel = ( int )(( mapBoundingRect.top() - mGridOffsetY ) / mGridIntervalY + 1.0 ) * mGridIntervalY + mGridOffsetY;
 
+  //consider to round up to the next step in case the left boundary is > 0
+  double roundCorrection = mapBoundingRect.top() > 0 ? 1.0 : 0.0;
+  double currentLevel = ( int )(( mapBoundingRect.top() - mGridOffsetY ) / mGridIntervalY + roundCorrection ) * mGridIntervalY + mGridOffsetY;
+
   if ( mRotation <= 0.0 )
   {
     //no rotation. Do it 'the easy way'
@@ -1109,8 +1113,11 @@
 
   QPolygonF mapPolygon = transformedMapPolygon();
   QRectF mapBoundingRect = mapPolygon.boundingRect();
-  double currentLevel = ( int )(( mapBoundingRect.left() - mGridOffsetX ) / mGridIntervalX + 1.0 ) * mGridIntervalX + mGridOffsetX;
 
+  //consider to round up to the next step in case the left boundary is > 0
+  double roundCorrection = mapBoundingRect.left() > 0 ? 1.0 : 0.0;
+  double currentLevel = ( int )(( mapBoundingRect.left() - mGridOffsetX ) / mGridIntervalX + roundCorrection ) * mGridIntervalX + mGridOffsetX;
+
   if ( mRotation <= 0.0 )
   {
     //no rotation. Do it 'the easy way'



More information about the QGIS-commit mailing list