Skip to content

Commit

Permalink
[composer] Fix graphical corruption with map grid frames
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 5, 2014
1 parent d8c9592 commit 7d4776a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/core/composer/qgscomposermap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1919,6 +1919,12 @@ void QgsComposerMap::updateBoundingRect()
}
}

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

QgsRectangle QgsComposerMap::transformedExtent() const
{
double dx = mXOffset;
Expand Down Expand Up @@ -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;
Expand All @@ -1960,7 +1967,7 @@ double QgsComposerMap::maxExtension() const

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

double maxExtension = 0;
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/core/composer/qgscomposermap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;}
Expand Down

0 comments on commit 7d4776a

Please sign in to comment.