Skip to content
Permalink
Browse files

Fix grid margin handling for interior ticks mode

In this case the margin should push the ticks further inside the map frame
  • Loading branch information
nyalldawson committed Dec 6, 2018
1 parent 470cd0b commit 3838ef3b3f32cf2a64a4f233151c2d23645c5dd4
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/core/layout/qgslayoutitemmapgrid.cpp
@@ -915,7 +915,7 @@ void QgsLayoutItemMapGrid::drawGridFrameTicks( QPainter *p, const QMap< double,
if ( mGridFrameStyle == QgsLayoutItemMapGrid::InteriorTicks )
{
width = mGridFrameWidth;
x = ( border == QgsLayoutItemMapGrid::Left ) ? 0 - mGridFrameMargin : mMap->rect().width() - mGridFrameWidth + mGridFrameMargin;
x = ( border == QgsLayoutItemMapGrid::Left ) ? 0 + mGridFrameMargin : mMap->rect().width() - mGridFrameWidth - mGridFrameMargin;
}
else if ( mGridFrameStyle == QgsLayoutItemMapGrid::ExteriorTicks )
{
@@ -935,7 +935,7 @@ void QgsLayoutItemMapGrid::drawGridFrameTicks( QPainter *p, const QMap< double,
if ( mGridFrameStyle == QgsLayoutItemMapGrid::InteriorTicks )
{
height = mGridFrameWidth;
y = ( border == QgsLayoutItemMapGrid::Top ) ? 0 - mGridFrameMargin : mMap->rect().height() - mGridFrameWidth + mGridFrameMargin;
y = ( border == QgsLayoutItemMapGrid::Top ) ? 0 + mGridFrameMargin : mMap->rect().height() - mGridFrameWidth - mGridFrameMargin;
}
else if ( mGridFrameStyle == QgsLayoutItemMapGrid::ExteriorTicks )
{
@@ -1895,6 +1895,7 @@ bool QgsLayoutItemMapGrid::shouldShowDivisionForSide( QgsLayoutItemMapGrid::Anno
case QgsLayoutItemMapGrid::Bottom:
return shouldShowDivisionForDisplayMode( coordinate, mBottomFrameDivisions );
}
return false; // no warnings
}

bool QgsLayoutItemMapGrid::shouldShowDivisionForDisplayMode( QgsLayoutItemMapGrid::AnnotationCoordinate coordinate, QgsLayoutItemMapGrid::DisplayMode mode ) const
@@ -2029,6 +2030,7 @@ QgsLayoutItemMapGrid::DisplayMode QgsLayoutItemMapGrid::annotationDisplay( const
case QgsLayoutItemMapGrid::Bottom:
return mBottomGridAnnotationDisplay;
}
return mBottomGridAnnotationDisplay; // no warnings
}

double QgsLayoutItemMapGrid::maxExtension() const
@@ -2252,6 +2254,7 @@ QgsLayoutItemMapGrid::AnnotationPosition QgsLayoutItemMapGrid::annotationPositio
case QgsLayoutItemMapGrid::Bottom:
return mBottomGridAnnotationPosition;
}
return mLeftGridAnnotationPosition; // no warnings
}

QgsLayoutItemMapGrid::AnnotationDirection QgsLayoutItemMapGrid::annotationDirection( const BorderSide border ) const
@@ -2272,6 +2275,7 @@ QgsLayoutItemMapGrid::AnnotationDirection QgsLayoutItemMapGrid::annotationDirect
case QgsLayoutItemMapGrid::Bottom:
return mBottomGridAnnotationDirection;
}
return mLeftGridAnnotationDirection; // no warnings
}

void QgsLayoutItemMapGrid::setFrameDivisions( const QgsLayoutItemMapGrid::DisplayMode divisions, const QgsLayoutItemMapGrid::BorderSide border )
@@ -2311,6 +2315,7 @@ QgsLayoutItemMapGrid::DisplayMode QgsLayoutItemMapGrid::frameDivisions( const Qg
case QgsLayoutItemMapGrid::Bottom:
return mBottomFrameDivisions;
}
return mLeftFrameDivisions; // no warnings
}

int QgsLayoutItemMapGrid::crsGridParams( QgsRectangle &crsRect, QgsCoordinateTransform &inverseTransform ) const

0 comments on commit 3838ef3

Please sign in to comment.
You can’t perform that action at this time.