Skip to content
Permalink
Browse files
Fix transparency restoration on project load
  • Loading branch information
timlinux authored and mhugent committed Feb 11, 2012
1 parent 2c9320a commit 46ba39082a063eeab67b8e896e5bc5c6f8d98f83
Showing with 17 additions and 3 deletions.
  1. +1 −1 src/core/qgsmaplayer.h
  2. +13 −2 src/core/raster/qgsrasterlayer.cpp
  3. +3 −0 src/core/raster/qgsrasterlayer.h
@@ -201,7 +201,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
unsigned int getTransparency();

/** Mutator for transparency level. Should be between 0 and 255 */
void setTransparency( unsigned int );
virtual void setTransparency( unsigned int );

/**
* If an operation returns 0 (e.g. draw()), this function
@@ -3151,7 +3151,8 @@ bool QgsRasterLayer::readSymbology( const QDomNode& layer_node, QString& errorMe
{
QgsColorRampShader* myColorRampShader = ( QgsColorRampShader* ) mRasterShader->rasterShaderFunction();

//TODO: Remove the customColorRampType check and following if() in v2.0, added for compatibility with older ( bugged ) project files
//TODO: Remove the customColorRampType check and following if() in v2.0,
//added for compatibility with older ( bugged ) project files
QDomNode customColorRampTypeNode = customColorRampNode.namedItem( "customColorRampType" );
QDomNode colorRampTypeNode = customColorRampNode.namedItem( "colorRampType" );
QString myRampType = "";
@@ -3760,7 +3761,8 @@ QString QgsRasterLayer::generateBandName( int theBandNumber )
*/
bool QgsRasterLayer::hasBand( QString const & theBandName )
{
//TODO: This function is no longer really needed and about be removed -- it is only used to see if "Palette" exists which is not the correct way to see if a band is paletted or not
//TODO: This function is no longer really needed and about be removed
//-- it is only used to see if "Palette" exists which is not the correct way to see if a band is paletted or not
QgsDebugMsg( "Looking for band : " + theBandName );

for ( int i = 1; i <= mDataProvider->bandCount(); i++ )
@@ -3984,3 +3986,12 @@ bool QgsRasterLayer::readColorTable( int theBandNumber, QList<QgsColorRampShader
return true;
}


void QgsRasterLayer::setTransparency( unsigned int theInt )
{
mTransparencyLevel = theInt;
if ( mRenderer )
{
mRenderer->setOpacity( mTransparencyLevel / 255.0 );
}
}
@@ -694,6 +694,9 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
/** \brief receive progress signal from provider */
void onProgress( int, double, QString );

/** \brief Overload the setTransparency method from QgsMapLayer */
void setTransparency( unsigned int theInt );

signals:
/** \brief Signal for notifying listeners of long running processes */
void progressUpdate( int theValue );

0 comments on commit 46ba390

Please sign in to comment.