@@ -542,9 +542,22 @@ void QgsRasterLayerProperties::sync()
542
542
}
543
543
544
544
// add current NoDataValue to NoDataValue line edit
545
- if ( mRasterLayer ->isNoDataValueValid () )
545
+ // TODO: should be per band
546
+ // TODO: no data ranges
547
+ if ( mRasterLayer ->dataProvider ()->srcHasNoDataValue ( 1 ) )
548
+ {
549
+ lblSrcNoDataValue->setText ( QgsRasterInterface::printValue ( mRasterLayer ->dataProvider ()->noDataValue ( 1 ) ) );
550
+ }
551
+ else
552
+ {
553
+ lblSrcNoDataValue->setText ( tr ( " not defined" ) );
554
+ }
555
+
556
+ QList<QgsRasterInterface::Range> noDataRangeList = mRasterLayer ->dataProvider ()->userNoDataValue ( 1 );
557
+ QgsDebugMsg ( QString ( " noDataRangeList.size = %1" ).arg ( noDataRangeList.size () ) );
558
+ if ( noDataRangeList.size () > 0 )
546
559
{
547
- leNoDataValue->insert ( QString::number ( mRasterLayer -> noDataValue (), ' g ' ) );
560
+ leNoDataValue->insert ( QgsRasterInterface::printValue ( noDataRangeList. value ( 0 ). min ) );
548
561
}
549
562
else
550
563
{
@@ -650,11 +663,18 @@ void QgsRasterLayerProperties::apply()
650
663
bool myDoubleOk = false ;
651
664
if ( " " != leNoDataValue->text () )
652
665
{
666
+ QList<QgsRasterInterface::Range> myNoDataRangeList;
653
667
double myNoDataValue = leNoDataValue->text ().toDouble ( &myDoubleOk );
654
668
if ( myDoubleOk )
655
669
{
656
670
mRasterLayer ->setNoDataValue ( myNoDataValue );
671
+ QgsRasterInterface::Range myNoDataRange;
672
+ myNoDataRange.min = myNoDataValue;
673
+ myNoDataRange.max = myNoDataValue;
674
+
675
+ myNoDataRangeList << myNoDataRange;
657
676
}
677
+ mRasterLayer ->dataProvider ()->setUserNoDataValue ( 1 , myNoDataRangeList );
658
678
}
659
679
660
680
// set renderer from widget
@@ -1551,6 +1571,7 @@ void QgsRasterLayerProperties::on_pbnSaveStyleAs_clicked()
1551
1571
settings.setValue ( " style/lastStyleDir" , QFileInfo ( outputFileName ).absolutePath () );
1552
1572
}
1553
1573
1574
+ #if 0
1554
1575
void QgsRasterLayerProperties::on_btnResetNull_clicked( )
1555
1576
{
1556
1577
//If reset NoDataValue is checked do this first, will ignore what ever is in the LineEdit
@@ -1564,6 +1585,7 @@ void QgsRasterLayerProperties::on_btnResetNull_clicked( )
1564
1585
leNoDataValue->clear();
1565
1586
}
1566
1587
}
1588
+ #endif
1567
1589
1568
1590
void QgsRasterLayerProperties::toggleBuildPyramidsButton ()
1569
1591
{
0 commit comments