Skip to content

Commit 8c8d028

Browse files
committedSep 17, 2012
raster saveas rendered with QgsSingleBandPseudoColorRenderer fix
1 parent a544133 commit 8c8d028

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed
 

‎src/core/raster/qgssinglebandpseudocolorrenderer.cpp‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,27 @@ QgsSingleBandPseudoColorRenderer::~QgsSingleBandPseudoColorRenderer()
3636
QgsRasterInterface * QgsSingleBandPseudoColorRenderer::clone() const
3737
{
3838
QgsRasterShader *shader = 0;
39+
3940
if ( mShader )
4041
{
4142
shader = new QgsRasterShader( mShader->minimumValue(), mShader->maximumValue() );
43+
44+
// Shader function
45+
const QgsColorRampShader* origColorRampShader = dynamic_cast<const QgsColorRampShader*>( mShader->rasterShaderFunction() );
46+
47+
if ( origColorRampShader )
48+
{
49+
QgsColorRampShader * colorRampShader = new QgsColorRampShader( mShader->minimumValue(), mShader->maximumValue() );
50+
51+
colorRampShader->setColorRampType( origColorRampShader->colorRampType() );
52+
53+
colorRampShader->setColorRampItemList( origColorRampShader->colorRampItemList() );
54+
shader->setRasterShaderFunction( colorRampShader );
55+
}
4256
}
4357
QgsSingleBandPseudoColorRenderer * renderer = new QgsSingleBandPseudoColorRenderer( 0, mBand, shader );
58+
59+
4460
return renderer;
4561
}
4662

@@ -91,7 +107,7 @@ void * QgsSingleBandPseudoColorRenderer::readBlock( int bandNo, QgsRectangle co
91107
void* rasterData = mInput->block( mBand, extent, width, height );
92108
if ( ! rasterData )
93109
{
94-
QgsDebugMsg("No raster data!" );
110+
QgsDebugMsg( "No raster data!" );
95111
return 0;
96112
}
97113

0 commit comments

Comments
 (0)
Please sign in to comment.