Skip to content
Permalink
Browse files

Add option to set min/max values to stdDev in singleband gray and mul…

…tiband color widgets
  • Loading branch information
mhugent committed Jun 19, 2012
1 parent 86c4b6a commit 480c8606b9a799c589a9a28bfcf9563781d95b4f
@@ -237,6 +237,13 @@ void QgsMultiBandColorRendererWidget::loadMinMaxValueForBand( int band, QLineEdi
minVal = minMax[0];
maxVal = minMax[1];
}
else if ( mUseStdDevRadioButton->isChecked() )
{
QgsRasterBandStats rasterBandStats = mRasterLayer->bandStatistics( band );
double diff = mStdDevSpinBox->value() * rasterBandStats.stdDev;
minVal = rasterBandStats.mean - diff;
maxVal = rasterBandStats.mean + diff;
}

minEdit->setText( QString::number( minVal ) );
maxEdit->setText( QString::number( maxVal ) );
@@ -113,6 +113,13 @@ void QgsSingleBandGrayRendererWidget::on_mLoadPushButton_clicked()
minVal = minMax[0];
maxVal = minMax[1];
}
else if ( mUseStdDevRadioButton->isChecked() )
{
QgsRasterBandStats rasterBandStats = mRasterLayer->bandStatistics( band );
double diff = mStdDevSpinBox->value() * rasterBandStats.stdDev;
minVal = rasterBandStats.mean - diff;
maxVal = rasterBandStats.mean + diff;
}
else
{
return;
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>320</width>
<height>452</height>
<height>529</height>
</rect>
</property>
<property name="windowTitle">
@@ -355,7 +355,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="2" column="1" colspan="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -368,13 +368,65 @@
</property>
</spacer>
</item>
<item row="2" column="2">
<item row="3" column="0">
<widget class="QRadioButton" name="mUseStdDevRadioButton">
<property name="text">
<string>Use standard deviation</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="mStdDevSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="mLoadPushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Load</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>251</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>388</width>
<height>292</height>
</rect>
</property>
<property name="windowTitle">
@@ -68,7 +68,7 @@
<string>Load min-/max values</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="mEstimateRadioButton">
<property name="text">
<string>Estimate (faster)</string>
@@ -78,7 +78,7 @@
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<item row="0" column="2" colspan="3">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -91,14 +91,14 @@
</property>
</spacer>
</item>
<item row="1" column="0">
<item row="1" column="0" colspan="2">
<widget class="QRadioButton" name="mActualRadioButton">
<property name="text">
<string>Actual (slower)</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<item row="1" column="2" colspan="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -111,14 +111,14 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<item row="2" column="0" colspan="2">
<widget class="QRadioButton" name="mCurrentExtentRadioButton">
<property name="text">
<string>CurrentExtent</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="2" column="2" colspan="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -131,13 +131,59 @@
</property>
</spacer>
</item>
<item row="2" column="2">
<item row="3" column="0" colspan="3">
<widget class="QRadioButton" name="mUseStdDevRadioButton">
<property name="text">
<string>Use standard deviation</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QDoubleSpinBox" name="mStdDevSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="4">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>148</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="mLoadPushButton">
<property name="text">
<string>Load</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="4">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>303</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>

0 comments on commit 480c860

Please sign in to comment.
You can’t perform that action at this time.