-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
873b4b0
commit b740a89
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,8 @@ QgsRasterTransparencyWidget::QgsRasterTransparencyWidget( QgsRasterLayer *layer, | |
|
||
connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsPanelWidget::widgetChanged ); | ||
connect( cboxTransparencyBand, &QgsRasterBandComboBox::bandChanged, this, &QgsPanelWidget::widgetChanged ); | ||
connect( mSrcNoDataValueCheckBox, &QCheckBox::stateChanged, this, &QgsPanelWidget::widgetChanged ); | ||
connect( leNoDataValue, &QLineEdit::textEdited, this, &QgsPanelWidget::widgetChanged ); | ||
|
||
mPixelSelectorTool = nullptr; | ||
if ( mMapCanvas ) | ||
|
@@ -103,6 +105,17 @@ void QgsRasterTransparencyWidget::syncToLayer() | |
mSrcNoDataValueCheckBox->setEnabled( enableSrcNoData ); | ||
lblSrcNoDataValue->setEnabled( enableSrcNoData ); | ||
|
||
QgsRasterRangeList noDataRangeList = mRasterLayer->dataProvider()->userNoDataValues( 1 ); | ||
QgsDebugMsg( QString( "noDataRangeList.size = %1" ).arg( noDataRangeList.size() ) ); | ||
if ( !noDataRangeList.isEmpty() ) | ||
{ | ||
leNoDataValue->insert( QgsRasterBlock::printValue( noDataRangeList.value( 0 ).min() ) ); | ||
} | ||
else | ||
{ | ||
leNoDataValue->insert( QLatin1String( "" ) ); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
} | ||
|
||
populateTransparencyTable( mRasterLayer->renderer() ); | ||
} | ||
|
||
|
@@ -366,6 +379,25 @@ bool QgsRasterTransparencyWidget::rasterIsMultiBandColor() | |
|
||
void QgsRasterTransparencyWidget::apply() | ||
{ | ||
//set NoDataValue | ||
QgsRasterRangeList myNoDataRangeList; | ||
This comment has been minimized.
Sorry, something went wrong.
DelazJ
Contributor
|
||
if ( "" != leNoDataValue->text() ) | ||
This comment has been minimized.
Sorry, something went wrong.
Gustry
Contributor
|
||
{ | ||
bool myDoubleOk = false; | ||
double myNoDataValue = leNoDataValue->text().toDouble( &myDoubleOk ); | ||
if ( myDoubleOk ) | ||
{ | ||
QgsRasterRange myNoDataRange( myNoDataValue, myNoDataValue ); | ||
myNoDataRangeList << myNoDataRange; | ||
} | ||
} | ||
for ( int bandNo = 1; bandNo <= mRasterLayer->dataProvider()->bandCount(); bandNo++ ) | ||
{ | ||
mRasterLayer->dataProvider()->setUserNoDataValue( bandNo, myNoDataRangeList ); | ||
mRasterLayer->dataProvider()->setUseSourceNoDataValue( bandNo, mSrcNoDataValueCheckBox->isChecked() ); | ||
} | ||
|
||
//transparency settings | ||
QgsRasterRenderer *rasterRenderer = mRasterLayer->renderer(); | ||
if ( rasterRenderer ) | ||
{ | ||
|
without double quotes?