Skip to content

Commit

Permalink
raster saveas rendered with QgsSingleBandPseudoColorRenderer fix
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Sep 17, 2012
1 parent a544133 commit 8c8d028
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/core/raster/qgssinglebandpseudocolorrenderer.cpp
Expand Up @@ -36,11 +36,27 @@ QgsSingleBandPseudoColorRenderer::~QgsSingleBandPseudoColorRenderer()
QgsRasterInterface * QgsSingleBandPseudoColorRenderer::clone() const
{
QgsRasterShader *shader = 0;

if ( mShader )
{
shader = new QgsRasterShader( mShader->minimumValue(), mShader->maximumValue() );

// Shader function
const QgsColorRampShader* origColorRampShader = dynamic_cast<const QgsColorRampShader*>( mShader->rasterShaderFunction() );

if ( origColorRampShader )
{
QgsColorRampShader * colorRampShader = new QgsColorRampShader( mShader->minimumValue(), mShader->maximumValue() );

colorRampShader->setColorRampType( origColorRampShader->colorRampType() );

colorRampShader->setColorRampItemList( origColorRampShader->colorRampItemList() );
shader->setRasterShaderFunction( colorRampShader );
}
}
QgsSingleBandPseudoColorRenderer * renderer = new QgsSingleBandPseudoColorRenderer( 0, mBand, shader );


return renderer;
}

Expand Down Expand Up @@ -91,7 +107,7 @@ void * QgsSingleBandPseudoColorRenderer::readBlock( int bandNo, QgsRectangle co
void* rasterData = mInput->block( mBand, extent, width, height );
if ( ! rasterData )
{
QgsDebugMsg("No raster data!" );
QgsDebugMsg( "No raster data!" );
return 0;
}

Expand Down

0 comments on commit 8c8d028

Please sign in to comment.