Skip to content

Commit

Permalink
Merge feature attributes: Return NULL if unable to calculate
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jun 19, 2013
1 parent 7d38eac commit e02459c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/app/qgsmergeattributesdialog.cpp
Expand Up @@ -327,7 +327,7 @@ QVariant QgsMergeAttributesDialog::minimumAttribute( int col )

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

return QVariant( minimumValue );
Expand Down Expand Up @@ -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 );
}
Expand All @@ -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 )
{
Expand Down

0 comments on commit e02459c

Please sign in to comment.