mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Fixing null pointer on ramp bug
This commit is contained in:
parent
25a7be2966
commit
b558c08bd4
@ -1301,15 +1301,18 @@ void QgsGraduatedSymbolRendererV2::updateColorRamp( QgsVectorColorRampV2 *ramp,
|
||||
this->setInvertedColorRamp( inverted );
|
||||
}
|
||||
|
||||
foreach ( QgsRendererRangeV2 range, mRanges )
|
||||
if( mSourceColorRamp )
|
||||
{
|
||||
QgsSymbolV2* symbol = range.symbol()->clone();
|
||||
double colorValue;
|
||||
if ( inverted ) colorValue = ( mRanges.count() > 1 ? ( double )( mRanges.count() - i - 1 ) / ( mRanges.count() - 1 ) : 0 );
|
||||
else colorValue = ( mRanges.count() > 1 ? ( double ) i / ( mRanges.count() - 1 ) : 0 );
|
||||
symbol->setColor( mSourceColorRamp->color( colorValue ) );
|
||||
updateRangeSymbol( i, symbol );
|
||||
++i;
|
||||
foreach ( QgsRendererRangeV2 range, mRanges )
|
||||
{
|
||||
QgsSymbolV2* symbol = range.symbol()->clone();
|
||||
double colorValue;
|
||||
if ( inverted ) colorValue = ( mRanges.count() > 1 ? ( double )( mRanges.count() - i - 1 ) / ( mRanges.count() - 1 ) : 0 );
|
||||
else colorValue = ( mRanges.count() > 1 ? ( double ) i / ( mRanges.count() - 1 ) : 0 );
|
||||
symbol->setColor( mSourceColorRamp->color( colorValue ) );
|
||||
updateRangeSymbol( i, symbol );
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -581,6 +581,7 @@ void QgsGraduatedSymbolRendererV2Widget::classifyGraduated()
|
||||
|
||||
mRenderer->setClassAttribute(attrName);
|
||||
mRenderer->setMode(mode);
|
||||
mRenderer->setSourceColorRamp(ramp->clone());
|
||||
bool updateUiCount=true;
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
mRenderer->updateClasses(mLayer,mode,nclasses);
|
||||
|
Loading…
x
Reference in New Issue
Block a user