Skip to content
Permalink
Browse files

cleanup 3568fe7

  • Loading branch information
jef-n committed Jan 23, 2014
1 parent eb92999 commit 810773a608f433ebe8928489f6d411746fc6102d
Showing with 21 additions and 25 deletions.
  1. +21 −25 src/app/qgsdiagramproperties.cpp
@@ -442,37 +442,33 @@ void QgsDiagramProperties::on_mRemoveCategoryPushButton_clicked()

void QgsDiagramProperties::on_mFindMaximumValueButton_clicked()
{
//get maximum value from provider (ignoring not-commited edits)
if ( mLayer )
if ( !mLayer )
return;

float maxValue = 0.0;
if ( mSizeAttributeComboBox->currentIndex() >= mAvailableAttributes )
{
// condition removed, keep this useless scope to avoid screewing diff (easier to review)
QgsExpression exp( mSizeAttributeComboBox->currentText() );
exp.prepare( mLayer->pendingFields() );
if ( !exp.hasEvalError() )
{
float maxValue = 0;
if ( mSizeAttributeComboBox->currentIndex() >= mAvailableAttributes )
{
QgsExpression exp( mSizeAttributeComboBox->currentText() );
exp.prepare( mLayer->pendingFields() );
if ( exp.hasEvalError() )
{
QgsDebugMsgLevel( "Prepare error:" + exp.evalErrorString(), 4 );
}
else
{
QgsFeature feature;
QgsFeatureIterator features = mLayer->getFeatures();
while ( features.nextFeature( *&feature ) )
{
maxValue = qMax( maxValue, exp.evaluate( &feature ).toFloat() );
}
}
}
else
QgsFeature feature;
QgsFeatureIterator features = mLayer->getFeatures();
while ( features.nextFeature( *&feature ) )
{
maxValue = mLayer->maximumValue( mSizeAttributeComboBox->itemData( mSizeAttributeComboBox->currentIndex() ).toInt() ).toFloat();
maxValue = qMax( maxValue, exp.evaluate( &feature ).toFloat() );
}
mValueLineEdit->setText( QString( "%1" ).arg( maxValue ) );
}
else
{
QgsDebugMsgLevel( "Prepare error:" + exp.evalErrorString(), 4 );
}
}
else
{
maxValue = mLayer->maximumValue( mSizeAttributeComboBox->itemData( mSizeAttributeComboBox->currentIndex() ).toInt() ).toFloat();
}
mValueLineEdit->setText( QString( "%1" ).arg( maxValue ) );
}

void QgsDiagramProperties::on_mDisplayDiagramsGroupBox_toggled( bool checked )

0 comments on commit 810773a

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