Skip to content
Permalink
Browse files
[composer] Fix graphical corruption with map grid frames
  • Loading branch information
nyalldawson committed Feb 5, 2014
1 parent d8c9592 commit 7d4776a403a21e20e5ba5a9e33859bfad7a4a777
Showing with 15 additions and 5 deletions.
  1. +12 −5 src/core/composer/qgscomposermap.cpp
  2. +3 −0 src/core/composer/qgscomposermap.h
@@ -1919,6 +1919,12 @@ void QgsComposerMap::updateBoundingRect()
}
}

void QgsComposerMap::setFrameOutlineWidth( double outlineWidth )
{
QgsComposerItem::setFrameOutlineWidth( outlineWidth );
updateBoundingRect();
}

QgsRectangle QgsComposerMap::transformedExtent() const
{
double dx = mXOffset;
@@ -1946,10 +1952,11 @@ QPolygonF QgsComposerMap::transformedMapPolygon() const

double QgsComposerMap::maxExtension() const
{
if ( !mGridEnabled || !mShowGridAnnotation || ( mLeftGridAnnotationPosition != OutsideMapFrame && mRightGridAnnotationPosition != OutsideMapFrame
&& mTopGridAnnotationPosition != OutsideMapFrame && mBottomGridAnnotationPosition != OutsideMapFrame ) )
double frameExtension = mFrame ? pen().widthF() / 2.0 : 0.0;
if ( !mGridEnabled || ( mGridFrameStyle == QgsComposerMap::NoGridFrame && ( !mShowGridAnnotation || ( mLeftGridAnnotationPosition != OutsideMapFrame && mRightGridAnnotationPosition != OutsideMapFrame
&& mTopGridAnnotationPosition != OutsideMapFrame && mBottomGridAnnotationPosition != OutsideMapFrame ) ) ) )
{
return 0;
return frameExtension;
}

QList< QPair< double, QLineF > > xLines;
@@ -1960,7 +1967,7 @@ double QgsComposerMap::maxExtension() const

if ( xGridReturn != 0 && yGridReturn != 0 )
{
return 0;
return frameExtension;
}

double maxExtension = 0;
@@ -1985,7 +1992,7 @@ double QgsComposerMap::maxExtension() const

//grid frame
double gridFrameDist = ( mGridFrameStyle == NoGridFrame ) ? 0 : mGridFrameWidth + ( mGridFramePenThickness / 2.0 );
return maxExtension + mAnnotationFrameDistance + gridFrameDist;
return qMax( frameExtension, maxExtension + mAnnotationFrameDistance + gridFrameDist );
}

void QgsComposerMap::mapPolygon( const QgsRectangle& extent, QPolygonF& poly ) const
@@ -334,6 +334,9 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
@note this function was added in version 1.4*/
void updateBoundingRect();

/* reimplement setFrameOutlineWidth, so that updateBoundingRect() is called after setting the frame width */
virtual void setFrameOutlineWidth( double outlineWidth );

/**Sets length of the cros segments (if grid style is cross)
@note this function was added in version 1.4*/
void setCrossLength( double l ) {mCrossLength = l;}

0 comments on commit 7d4776a

Please sign in to comment.