Skip to content
Permalink
Browse files

Merge feature attributes: Return NULL if unable to calculate

  • Loading branch information
m-kuhn committed Jun 19, 2013
1 parent 7d38eac commit e02459cb5d1ea4e44da58adef308aa0e66f84892
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/app/qgsmergeattributesdialog.cpp
@@ -327,7 +327,7 @@ QVariant QgsMergeAttributesDialog::minimumAttribute( int col )

if ( numberOfConsideredFeatures < 1 )
{
return QString();
return QVariant( mVectorLayer->pendingFields()[col].type() );
}

return QVariant( minimumValue );
@@ -377,6 +377,12 @@ QVariant QgsMergeAttributesDialog::meanAttribute( int col )
++numberOfConsideredFeatures;
}
}

if ( numberOfConsideredFeatures < 1 )
{
return QVariant( mVectorLayer->pendingFields()[col].type() );
}

double mean = sum / numberOfConsideredFeatures;
return QVariant( mean );
}
@@ -401,6 +407,13 @@ QVariant QgsMergeAttributesDialog::medianAttribute( int col )

double medianValue;
int size = valueList.size();


if ( size < 1 )
{
return QVariant( mVectorLayer->pendingFields()[col].type() );
}

bool even = ( size % 2 ) < 1;
if ( even )
{

0 comments on commit e02459c

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