Skip to content
Permalink
Browse files

converted size expr evaluate to 0 on NULL field

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 5, 2015
1 parent 2e35781 commit 4fb22b4ef6daccdca163c696b16c950afc3c93b9
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/core/symbology-ng/qgsrendererv2.cpp
@@ -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 );
}
}

0 comments on commit 4fb22b4

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