Skip to content

Commit

Permalink
[print layout] Fix missing grid lines
Browse files Browse the repository at this point in the history
  • Loading branch information
agiudiceandrea authored and nyalldawson committed Sep 29, 2024
1 parent 1f8731b commit 19f7649
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/layout/qgslayoutitemmapgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,7 @@ int QgsLayoutItemMapGrid::xGridLines() const
}

//consider to round up to the next step in case the left boundary is > 0
const double roundCorrection = mapBoundingRect.top() > 0 ? 1.0 : 0.0;
const double roundCorrection = mapBoundingRect.top() > gridOffsetY ? 1.0 : 0.0;
double currentLevel = static_cast< int >( ( mapBoundingRect.top() - gridOffsetY ) / gridIntervalY + roundCorrection ) * gridIntervalY + gridOffsetY;

int gridLineCount = 0;
Expand Down Expand Up @@ -1649,7 +1649,7 @@ int QgsLayoutItemMapGrid::yGridLines() const
}

//consider to round up to the next step in case the left boundary is > 0
const double roundCorrection = mapBoundingRect.left() > 0 ? 1.0 : 0.0;
const double roundCorrection = mapBoundingRect.left() > gridOffsetX ? 1.0 : 0.0;
double currentLevel = static_cast< int >( ( mapBoundingRect.left() - gridOffsetX ) / gridIntervalX + roundCorrection ) * gridIntervalX + gridOffsetX;

int gridLineCount = 0;
Expand Down Expand Up @@ -1722,7 +1722,7 @@ int QgsLayoutItemMapGrid::xGridLinesCrsTransform( const QgsRectangle &bbox, cons
return 1;
}

const double roundCorrection = bbox.yMaximum() > 0 ? 1.0 : 0.0;
const double roundCorrection = bbox.yMaximum() > mEvaluatedOffsetY ? 1.0 : 0.0;
double currentLevel = static_cast< int >( ( bbox.yMaximum() - mEvaluatedOffsetY ) / mEvaluatedIntervalY + roundCorrection ) * mEvaluatedIntervalY + mEvaluatedOffsetY;

const double minX = bbox.xMinimum();
Expand Down Expand Up @@ -1801,7 +1801,7 @@ int QgsLayoutItemMapGrid::yGridLinesCrsTransform( const QgsRectangle &bbox, cons
return 1;
}

const double roundCorrection = bbox.xMinimum() > 0 ? 1.0 : 0.0;
const double roundCorrection = bbox.xMinimum() > mEvaluatedOffsetX ? 1.0 : 0.0;
double currentLevel = static_cast< int >( ( bbox.xMinimum() - mEvaluatedOffsetX ) / mEvaluatedIntervalX + roundCorrection ) * mEvaluatedIntervalX + mEvaluatedOffsetX;

const double minY = bbox.yMinimum();
Expand Down

0 comments on commit 19f7649

Please sign in to comment.