Skip to content

Commit

Permalink
Save scale by area/diameter setting
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Aug 10, 2012
1 parent 468650b commit e0e5f1a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -1810,6 +1810,15 @@ void QgsVectorLayerProperties::initDiagramTab()
mIncreaseSmallDiagramsCheckBox->setChecked( settingList.at( 0 ).minimumSize != 0 );
mIncreaseMinimumSizeSpinBox->setValue( settingList.at( 0 ).minimumSize );

if ( settingList.at( 0 ).scaleByArea )
{
mScaleDependencyComboBox->setCurrentIndex( 0 );
}
else
{
mScaleDependencyComboBox->setCurrentIndex( 1 );
}

QList< QColor > categoryColors = settingList.at( 0 ).categoryColors;
QList< int > categoryIndices = settingList.at( 0 ).categoryIndices;
QList< int >::const_iterator catIt = categoryIndices.constBegin();
Expand Down
23 changes: 21 additions & 2 deletions src/core/qgsdiagramrendererv2.cpp
Expand Up @@ -95,6 +95,16 @@ void QgsDiagramSettings::readXML( const QDomElement& elem )
diagramOrientation = Up;
}

// scale dependency
if ( elem.attribute( "scaleDependency" ) == "Diameter" )
{
scaleByArea = false;
}
else
{
scaleByArea = true;
}

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

minimumSize = elem.attribute( "minimumSize" ).toDouble();
Expand Down Expand Up @@ -144,11 +154,20 @@ void QgsDiagramSettings::writeXML( QDomElement& rendererElem, QDomDocument& doc
// label placement method (text diagram)
if ( labelPlacementMethod == Height )
{
categoryElem.setAttribute( "labelPlacementMethod", "Height" );
categoryElem.setAttribute( "labelPlacementMethod", "Height" );
}
else
{
categoryElem.setAttribute( "labelPlacementMethod", "XHeight" );
}

if ( scaleByArea )
{
categoryElem.setAttribute( "scaleDependency", "Area" );
}
else
{
categoryElem.setAttribute( "labelPlacementMethod", "XHeight" );
categoryElem.setAttribute( "scaleDependency", "Diameter" );
}

// orientation (histogram)
Expand Down

0 comments on commit e0e5f1a

Please sign in to comment.