Skip to content
Permalink
Browse files
Fix "force layer to render as raster" setting wasn't correctly copied
with cloned renderers

And move more common code to QgsFeatureRenderer::copyRendererData

Fixes #43535
  • Loading branch information
nyalldawson committed Jun 8, 2021
1 parent fe45447 commit 131378650ff47f35588eed04162a7e2f2c728abf
@@ -506,7 +506,6 @@ QgsCategorizedSymbolRenderer *QgsCategorizedSymbolRenderer::clone() const
{
r->setSourceColorRamp( mSourceColorRamp->clone() );
}
r->setUsingSymbolLevels( usingSymbolLevels() );
r->setDataDefinedSizeLegend( mDataDefinedSizeLegend ? new QgsDataDefinedSizeLegend( *mDataDefinedSizeLegend ) : nullptr );

copyRendererData( r );
@@ -92,7 +92,6 @@ bool QgsEmbeddedSymbolRenderer::usesEmbeddedSymbols() const
QgsEmbeddedSymbolRenderer *QgsEmbeddedSymbolRenderer::clone() const
{
QgsEmbeddedSymbolRenderer *r = new QgsEmbeddedSymbolRenderer( mDefaultSymbol->clone() );
r->setUsingSymbolLevels( usingSymbolLevels() );
copyRendererData( r );
return r;
}
@@ -317,7 +317,6 @@ QgsGraduatedSymbolRenderer *QgsGraduatedSymbolRenderer::clone() const
{
r->setSourceColorRamp( mSourceColorRamp->clone() );
}
r->setUsingSymbolLevels( usingSymbolLevels() );
r->setDataDefinedSizeLegend( mDataDefinedSizeLegend ? new QgsDataDefinedSizeLegend( *mDataDefinedSizeLegend ) : nullptr );
r->setGraduatedMethod( graduatedMethod() );
copyRendererData( r );
@@ -55,17 +55,15 @@ void QgsFeatureRenderer::copyRendererData( QgsFeatureRenderer *destRenderer ) co
return;

destRenderer->setPaintEffect( mPaintEffect->clone() );
destRenderer->setForceRasterRender( mForceRaster );
destRenderer->setUsingSymbolLevels( mUsingSymbolLevels );
destRenderer->mOrderBy = mOrderBy;
destRenderer->mOrderByEnabled = mOrderByEnabled;
}

QgsFeatureRenderer::QgsFeatureRenderer( const QString &type )
: mType( type )
, mUsingSymbolLevels( false )
, mCurrentVertexMarkerType( QgsVectorLayer::Cross )
, mCurrentVertexMarkerSize( 2 )
, mForceRaster( false )
, mOrderByEnabled( false )
{
mPaintEffect = QgsPaintEffectRegistry::defaultStack();
mPaintEffect->setEnabled( false );
@@ -527,16 +527,16 @@ class CORE_EXPORT QgsFeatureRenderer

QString mType;

bool mUsingSymbolLevels;
bool mUsingSymbolLevels = false;

//! The current type of editing marker
int mCurrentVertexMarkerType;
//! The current size of editing marker
double mCurrentVertexMarkerSize;
double mCurrentVertexMarkerSize = 2;

QgsPaintEffect *mPaintEffect = nullptr;

bool mForceRaster;
bool mForceRaster = false;

/**
* \note this function is used to convert old sizeScale expressions to symbol
@@ -552,7 +552,7 @@ class CORE_EXPORT QgsFeatureRenderer

QgsFeatureRequest::OrderBy mOrderBy;

bool mOrderByEnabled;
bool mOrderByEnabled = false;

private:
#ifdef SIP_RUN
@@ -1061,7 +1061,6 @@ QgsRuleBasedRenderer *QgsRuleBasedRenderer::clone() const

QgsRuleBasedRenderer *r = new QgsRuleBasedRenderer( clonedRoot );

r->setUsingSymbolLevels( usingSymbolLevels() );
copyRendererData( r );
return r;
}
@@ -115,7 +115,6 @@ QString QgsSingleSymbolRenderer::dump() const
QgsSingleSymbolRenderer *QgsSingleSymbolRenderer::clone() const
{
QgsSingleSymbolRenderer *r = new QgsSingleSymbolRenderer( mSymbol->clone() );
r->setUsingSymbolLevels( usingSymbolLevels() );
r->setDataDefinedSizeLegend( mDataDefinedSizeLegend ? new QgsDataDefinedSizeLegend( *mDataDefinedSizeLegend ) : nullptr );
copyRendererData( r );
return r;

0 comments on commit 1313786

Please sign in to comment.