Skip to content

Commit

Permalink
converted size expr evaluate to 0 on NULL field
Browse files Browse the repository at this point in the history
fix #12888
use coalesce(expr,0) to have zero size if expression evaluates to NULL
otherwise the default size would be used
  • Loading branch information
vmora authored and nyalldawson committed Jun 24, 2015
1 parent 2e35781 commit 4fb22b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/symbology-ng/qgsrendererv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,20 +665,20 @@ void QgsFeatureRendererV2::convertSymbolSizeScale( QgsSymbolV2 * symbol, QgsSymb
QgsMarkerSymbolV2 * s = static_cast<QgsMarkerSymbolV2 *>( symbol );
if ( QgsSymbolV2::ScaleArea == QgsSymbolV2::ScaleMethod( method ) )
{
const QgsDataDefined dd( "sqrt(" + QString::number( s->size() ) + " * (" + field + "))" );
const QgsDataDefined dd( "coalesce(sqrt(" + QString::number( s->size() ) + " * (" + field + ")),0)" );
s->setDataDefinedSize( dd );
}
else
{
const QgsDataDefined dd( QString::number( s->size() ) + " * (" + field + ")" );
const QgsDataDefined dd( "coalesce(" + QString::number( s->size() ) + " * (" + field + "),0)" );
s->setDataDefinedSize( dd );
}
s->setScaleMethod( QgsSymbolV2::ScaleDiameter );
}
else if ( symbol->type() == QgsSymbolV2::Line )
{
QgsLineSymbolV2 * s = static_cast<QgsLineSymbolV2 *>( symbol );
const QgsDataDefined dd( QString::number( s->width() ) + " * (" + field + ")" );
const QgsDataDefined dd( "coalesce(" + QString::number( s->width() ) + " * (" + field + "),0)" );
s->setDataDefinedWidth( dd );
}
}
Expand Down

0 comments on commit 4fb22b4

Please sign in to comment.