mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Don't treat null values as zero for graduated symbology
This commit is contained in:
parent
f91e79bcf1
commit
f7bf3f2819
@ -192,6 +192,10 @@ QgsSymbolV2* QgsGraduatedSymbolRendererV2::symbolForFeature( QgsFeature& feature
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Null values should not be categorized
|
||||||
|
if ( attrs[mAttrNum] == "")
|
||||||
|
return NULL;
|
||||||
|
|
||||||
// find the right category
|
// find the right category
|
||||||
QgsSymbolV2* symbol = symbolForValue( attrs[mAttrNum].toDouble() );
|
QgsSymbolV2* symbol = symbolForValue( attrs[mAttrNum].toDouble() );
|
||||||
if ( symbol == NULL )
|
if ( symbol == NULL )
|
||||||
@ -802,8 +806,12 @@ QgsGraduatedSymbolRendererV2* QgsGraduatedSymbolRendererV2::createRenderer(
|
|||||||
lst.append( attrNum );
|
lst.append( attrNum );
|
||||||
|
|
||||||
QgsFeatureIterator fit = vlayer->getFeatures( QgsFeatureRequest().setFlags( QgsFeatureRequest::NoGeometry ).setSubsetOfAttributes( lst ) );
|
QgsFeatureIterator fit = vlayer->getFeatures( QgsFeatureRequest().setFlags( QgsFeatureRequest::NoGeometry ).setSubsetOfAttributes( lst ) );
|
||||||
|
|
||||||
|
// create list of non-null attribute values
|
||||||
while ( fit.nextFeature( f ) )
|
while ( fit.nextFeature( f ) )
|
||||||
|
if ( f.attribute( attrNum ) != "" )
|
||||||
values.append( f.attribute( attrNum ).toDouble() );
|
values.append( f.attribute( attrNum ).toDouble() );
|
||||||
|
|
||||||
// calculate the breaks
|
// calculate the breaks
|
||||||
if ( mode == Quantile )
|
if ( mode == Quantile )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user