15
15
* *
16
16
***************************************************************************/
17
17
18
+ #include < QDebug>
19
+
18
20
#include " qgslogger.h"
19
21
#include " qgsapplication.h"
20
22
#include " qgisapp.h"
@@ -434,7 +436,7 @@ void QgsRasterLayerProperties::setMinimumMaximumEstimateWarning()
434
436
435
437
if ( myEstimatedValues )
436
438
{
437
- lblMinMaxEstimateWarning->setText ( tr ( " Note: Minimum Maximum values are estimates or user defined" ) );
439
+ lblMinMaxEstimateWarning->setText ( tr ( " Note: Minimum Maximum values are estimates, user defined, or calculated from the current extent " ) );
438
440
}
439
441
else
440
442
{
@@ -1934,7 +1936,6 @@ void QgsRasterLayerProperties::on_pbnHistRefresh_clicked()
1934
1936
QgsDebugMsg ( QString ( " max %1" ).arg ( myYAxisMax ) );
1935
1937
QgsDebugMsg ( QString ( " min %1" ).arg ( myYAxisMin ) );
1936
1938
1937
-
1938
1939
// create the image onto which graph and axes will be drawn
1939
1940
int myImageWidth = pixHistogram->width () - 2 ;
1940
1941
int myImageHeight = pixHistogram->height () - 2 ; // Take two pixels off to account for the boarder around the QLabel
@@ -2086,6 +2087,7 @@ void QgsRasterLayerProperties::on_pbnHistRefresh_clicked()
2086
2087
QgsDebugMsg ( QString ( " Band %1, bin %2, Hist Value : %3, Scaled Value : %4" ).arg ( myIteratorInt ).arg ( myBin ).arg ( myBinValue ).arg ( myY ) );
2087
2088
QgsDebugMsg ( " myY = myGraphImageHeight - myY" );
2088
2089
QgsDebugMsg ( QString ( " myY = %1-%2" ).arg ( myGraphImageHeight ).arg ( myY ) );
2090
+
2089
2091
if ( myGraphType == BAR_CHART )
2090
2092
{
2091
2093
// draw the bar
@@ -2136,6 +2138,7 @@ void QgsRasterLayerProperties::on_pbnHistRefresh_clicked()
2136
2138
myPolygon << QPointF ( myX + myYGutterWidth, myY );
2137
2139
}
2138
2140
}
2141
+
2139
2142
if ( myGraphType == LINE_CHART )
2140
2143
{
2141
2144
QLinearGradient myGradient;
@@ -2832,6 +2835,9 @@ void QgsRasterLayerProperties::on_pbtnLoadMinMax_clicked()
2832
2835
if ( mRasterLayerIsGdal && ( mRasterLayer ->drawingStyle () == QgsRasterLayer::SingleBandGray || mRasterLayer ->drawingStyle () == QgsRasterLayer::MultiBandSingleGandGray || mRasterLayer ->drawingStyle () == QgsRasterLayer::MultiBandColor ) )
2833
2836
{
2834
2837
QgsRasterBandStats myRasterBandStats;
2838
+ double myMinimumMaximum[2 ];
2839
+ myMinimumMaximum[0 ] = 0 ;
2840
+ myMinimumMaximum[1 ] = 0 ;
2835
2841
if ( rbtnThreeBand->isChecked () )
2836
2842
{
2837
2843
rbtnThreeBandMinMax->setChecked ( true );
@@ -2849,10 +2855,22 @@ void QgsRasterLayerProperties::on_pbtnLoadMinMax_clicked()
2849
2855
leBlueMax->setText ( QString::number ( myRasterBandStats.maximumValue ) );
2850
2856
mRGBMinimumMaximumEstimated = false ;
2851
2857
}
2858
+ else if ( rbtnExtentMinMax->isChecked () )
2859
+ {
2860
+ mRasterLayer ->computeMinimumMaximumFromLastExtent ( mRasterLayer ->bandNumber ( cboRed->currentText () ), myMinimumMaximum );
2861
+ leRedMin->setText ( QString::number ( myMinimumMaximum[0 ] ) );
2862
+ leRedMax->setText ( QString::number ( myMinimumMaximum[1 ] ) );
2863
+ mRasterLayer ->computeMinimumMaximumFromLastExtent ( mRasterLayer ->bandNumber ( cboGreen->currentText () ), myMinimumMaximum );
2864
+ leGreenMin->setText ( QString::number ( myMinimumMaximum[0 ] ) );
2865
+ leGreenMax->setText ( QString::number ( myMinimumMaximum[1 ] ) );
2866
+ mRasterLayer ->computeMinimumMaximumFromLastExtent ( mRasterLayer ->bandNumber ( cboBlue->currentText () ), myMinimumMaximum );
2867
+ leBlueMin->setText ( QString::number ( myMinimumMaximum[0 ] ) );
2868
+ leBlueMax->setText ( QString::number ( myMinimumMaximum[1 ] ) );
2869
+ mRGBMinimumMaximumEstimated = true ;
2870
+ }
2852
2871
else
2853
2872
{
2854
2873
rbtnEstimateMinMax->setChecked ( true );
2855
- double myMinimumMaximum[2 ];
2856
2874
mRasterLayer ->computeMinimumMaximumEstimates ( mRasterLayer ->bandNumber ( cboRed->currentText () ), myMinimumMaximum );
2857
2875
leRedMin->setText ( QString::number ( myMinimumMaximum[0 ] ) );
2858
2876
leRedMax->setText ( QString::number ( myMinimumMaximum[1 ] ) );
@@ -2876,10 +2894,16 @@ void QgsRasterLayerProperties::on_pbtnLoadMinMax_clicked()
2876
2894
leGrayMax->setText ( QString::number ( myRasterBandStats.maximumValue ) );
2877
2895
mGrayMinimumMaximumEstimated = false ;
2878
2896
}
2897
+ else if ( rbtnExtentMinMax->isChecked () )
2898
+ {
2899
+ mRasterLayer ->computeMinimumMaximumFromLastExtent ( mRasterLayer ->bandNumber ( cboGray->currentText () ), myMinimumMaximum );
2900
+ leGrayMin->setText ( QString::number ( myMinimumMaximum[0 ] ) );
2901
+ leGrayMax->setText ( QString::number ( myMinimumMaximum[1 ] ) );
2902
+ mGrayMinimumMaximumEstimated = true ;
2903
+ }
2879
2904
else
2880
2905
{
2881
2906
rbtnEstimateMinMax->setChecked ( true );
2882
- double myMinimumMaximum[2 ];
2883
2907
mRasterLayer ->computeMinimumMaximumEstimates ( mRasterLayer ->bandNumber ( cboGray->currentText () ), myMinimumMaximum );
2884
2908
leGrayMin->setText ( QString::number ( myMinimumMaximum[0 ] ) );
2885
2909
leGrayMax->setText ( QString::number ( myMinimumMaximum[1 ] ) );
0 commit comments