Skip to content

Commit 38c5d72

Browse files
author
mhugent
committed
Fix for missing left line in composer grid (happend with negative left boundary coords). Fixes ticket #2458
git-svn-id: http://svn.osgeo.org/qgis/trunk@12963 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent c9c41d5 commit 38c5d72

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/core/composer/qgscomposermap.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -1042,9 +1042,13 @@ int QgsComposerMap::xGridLines( QList< QPair< double, QLineF > >& lines ) const
10421042
return 1;
10431043
}
10441044

1045+
10451046
QPolygonF mapPolygon = transformedMapPolygon();
10461047
QRectF mapBoundingRect = mapPolygon.boundingRect();
1047-
double currentLevel = ( int )(( mapBoundingRect.top() - mGridOffsetY ) / mGridIntervalY + 1.0 ) * mGridIntervalY + mGridOffsetY;
1048+
1049+
//consider to round up to the next step in case the left boundary is > 0
1050+
double roundCorrection = mapBoundingRect.top() > 0 ? 1.0 : 0.0;
1051+
double currentLevel = ( int )(( mapBoundingRect.top() - mGridOffsetY ) / mGridIntervalY + roundCorrection ) * mGridIntervalY + mGridOffsetY;
10481052

10491053
if ( mRotation <= 0.0 )
10501054
{
@@ -1109,7 +1113,10 @@ int QgsComposerMap::yGridLines( QList< QPair< double, QLineF > >& lines ) const
11091113

11101114
QPolygonF mapPolygon = transformedMapPolygon();
11111115
QRectF mapBoundingRect = mapPolygon.boundingRect();
1112-
double currentLevel = ( int )(( mapBoundingRect.left() - mGridOffsetX ) / mGridIntervalX + 1.0 ) * mGridIntervalX + mGridOffsetX;
1116+
1117+
//consider to round up to the next step in case the left boundary is > 0
1118+
double roundCorrection = mapBoundingRect.left() > 0 ? 1.0 : 0.0;
1119+
double currentLevel = ( int )(( mapBoundingRect.left() - mGridOffsetX ) / mGridIntervalX + roundCorrection ) * mGridIntervalX + mGridOffsetX;
11131120

11141121
if ( mRotation <= 0.0 )
11151122
{

0 commit comments

Comments
 (0)