Skip to content

Commit

Permalink
Fix #10663 (additional nodata value pixels not transparent)
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Jun 22, 2014
1 parent 0d360d4 commit e8d80a3
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/core/raster/qgsrasterdataprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,4 +513,14 @@ bool QgsRasterDataProvider::userNoDataValuesContains( int bandNo, double value )
return QgsRasterRange::contains( value, rangeList );
}

void QgsRasterDataProvider::copyBaseSettings( const QgsRasterDataProvider& other )
{
mDpi = other.mDpi;
mSrcNoDataValue = other.mSrcNoDataValue;
mSrcHasNoDataValue = other.mSrcHasNoDataValue;
mUseSrcNoDataValue = other.mUseSrcNoDataValue;
mUserNoDataValue = other.mUserNoDataValue;
mExtent = other.mExtent;
}

// ENDS
3 changes: 3 additions & 0 deletions src/core/raster/qgsrasterdataprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
/** Returns true if user no data contains value */
bool userNoDataValuesContains( int bandNo, double value ) const;

/** Copy member variables from other raster data provider. Useful for implementation of clone() method in subclasses */
void copyBaseSettings( const QgsRasterDataProvider& other );

static QStringList cStringList2Q_( char ** stringList );

static QString makeTableCell( const QString & value );
Expand Down
1 change: 1 addition & 0 deletions src/providers/gdal/qgsgdalprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ QgsRasterInterface * QgsGdalProvider::clone() const
{
QgsDebugMsg( "Entered" );
QgsGdalProvider * provider = new QgsGdalProvider( dataSourceUri() );
provider->copyBaseSettings( *this );
return provider;
}

Expand Down
1 change: 1 addition & 0 deletions src/providers/grass/qgsgrassrasterprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ QgsGrassRasterProvider::~QgsGrassRasterProvider()
QgsRasterInterface * QgsGrassRasterProvider::clone() const
{
QgsGrassRasterProvider * provider = new QgsGrassRasterProvider( dataSourceUri() );
provider->copyBaseSettings( *this );
return provider;
}

Expand Down
1 change: 1 addition & 0 deletions src/providers/wcs/qgswcsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ QgsWcsProvider::~QgsWcsProvider()
QgsRasterInterface * QgsWcsProvider::clone() const
{
QgsWcsProvider * provider = new QgsWcsProvider( dataSourceUri() );
provider->copyBaseSettings( *this );
return provider;
}

Expand Down
4 changes: 3 additions & 1 deletion src/providers/wms/qgswmsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ QgsWmsProvider::~QgsWmsProvider()

QgsRasterInterface * QgsWmsProvider::clone() const
{
return new QgsWmsProvider( dataSourceUri(), mCaps.isValid() ? &mCaps : 0 );
QgsWmsProvider* provider = new QgsWmsProvider( dataSourceUri(), mCaps.isValid() ? &mCaps : 0 );
provider->copyBaseSettings( *this );
return provider;
}


Expand Down

0 comments on commit e8d80a3

Please sign in to comment.