From 19f7649447277f3df0e7c1032276d5ad65f2512e Mon Sep 17 00:00:00 2001 From: Andrea Giudiceandrea Date: Wed, 14 Aug 2024 11:18:34 +0200 Subject: [PATCH] [print layout] Fix missing grid lines --- src/core/layout/qgslayoutitemmapgrid.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/layout/qgslayoutitemmapgrid.cpp b/src/core/layout/qgslayoutitemmapgrid.cpp index c8f21bf233ca..fb4ed27255ff 100644 --- a/src/core/layout/qgslayoutitemmapgrid.cpp +++ b/src/core/layout/qgslayoutitemmapgrid.cpp @@ -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; @@ -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; @@ -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(); @@ -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();