Skip to content

Commit

Permalink
Save settings for scaling small diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Aug 9, 2012
1 parent bb8f1d6 commit 98e637c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/core/qgsdiagramrendererv2.cpp
Expand Up @@ -75,6 +75,7 @@ void QgsDiagramSettings::readXML( const QDomElement& elem )
labelPlacementMethod = XHeight;
}

minimumSize = elem.attribute( "minimumSize" ).toDouble();

//colors
categoryColors.clear();
Expand Down Expand Up @@ -125,6 +126,7 @@ void QgsDiagramSettings::writeXML( QDomElement& rendererElem, QDomDocument& doc
categoryElem.setAttribute( "labelPlacementMethod", "XHeight" );
}

categoryElem.setAttribute( "minimumSize", QString::number( minimumSize ) );

QString colors;
for ( int i = 0; i < categoryColors.size(); ++i )
Expand Down Expand Up @@ -347,9 +349,9 @@ QSizeF QgsLinearlyInterpolatedDiagramRenderer::diagramSize( const QgsAttributeMa
mUpperSize.height() * ratio + mLowerSize.height() * ( 1 - ratio ) );

// Scale, if extension is smaller than the specified minimum
if ( size.width() <= mSettings.mMinimumSize && size.height() <= mSettings.mMinimumSize )
if ( size.width() <= mSettings.minimumSize && size.height() <= mSettings.minimumSize )
{
size.scale( mSettings.mMinimumSize, mSettings.mMinimumSize, Qt::KeepAspectRatio );
size.scale( mSettings.minimumSize, mSettings.minimumSize, Qt::KeepAspectRatio );
}

return size;
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsdiagramrendererv2.h
Expand Up @@ -119,7 +119,7 @@ struct CORE_EXPORT QgsDiagramSettings
double maxScaleDenominator;

//! Scale diagrams smaller than mMinimumSize to mMinimumSize
double mMinimumSize;
double minimumSize;

void readXML( const QDomElement& elem );
void writeXML( QDomElement& rendererElem, QDomDocument& doc ) const;
Expand Down

0 comments on commit 98e637c

Please sign in to comment.