Skip to content

Commit

Permalink
Fix for missing left line in composer grid (happend with negative lef…
Browse files Browse the repository at this point in the history
…t boundary coords). Fixes ticket #2458

git-svn-id: http://svn.osgeo.org/qgis/trunk@12963 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Feb 22, 2010
1 parent c9c41d5 commit 38c5d72
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/core/composer/qgscomposermap.cpp
Expand Up @@ -1042,9 +1042,13 @@ int QgsComposerMap::xGridLines( QList< QPair< double, QLineF > >& lines ) const
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 )
{
Expand Down Expand Up @@ -1109,7 +1113,10 @@ int QgsComposerMap::yGridLines( QList< QPair< double, QLineF > >& lines ) const

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 )
{
Expand Down

0 comments on commit 38c5d72

Please sign in to comment.