Force recollection of hist when checkboxes state is altered

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@2985 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
timlinux 2005-03-17 21:08:29 +00:00
parent 06946753b2
commit 15af1d01f2
2 changed files with 11 additions and 3 deletions

View File

@ -3607,7 +3607,7 @@ void QgsRasterLayer::identify(QgsRect * r)
} // void QgsRasterLayer::identify(QgsRect * r)
void QgsRasterLayer::populateHistogram(int theBandNoInt, int theBinCountInt,bool theIgnoreOutOfRangeFlag,bool theThoroughBandScanFlag)
void QgsRasterLayer::populateHistogram(int theBandNoInt, int theBinCountInt,bool theIgnoreOutOfRangeFlag,bool theHistogramEstimatedFlag)
{
GDALRasterBand *myGdalBand = gdalDataset->GetRasterBand(theBandNoInt);
@ -3617,9 +3617,13 @@ void QgsRasterLayer::populateHistogram(int theBandNoInt, int theBinCountInt,bool
//vector is not equal to the number of bins
//i.e if the histogram has never previously been generated or the user has
//selected a new number of bins.
if (myRasterBandStats.histogramVector->size()!=theBinCountInt)
if (myRasterBandStats.histogramVector->size()!=theBinCountInt ||
theIgnoreOutOfRangeFlag != myRasterBandStats.histogramOutOfRangeFlag ||
theHistogramEstimatedFlag != myRasterBandStats.histogramEstimatedFlag)
{
myRasterBandStats.histogramVector->clear();
myRasterBandStats.histogramEstimatedFlag=theHistogramEstimatedFlag;
myRasterBandStats.histogramOutOfRangeFlag=theIgnoreOutOfRangeFlag;
int myHistogramArray[theBinCountInt];
@ -3635,7 +3639,7 @@ void QgsRasterLayer::populateHistogram(int theBandNoInt, int theBinCountInt,bool
* void * pProgressData
* )
*/
myGdalBand->GetHistogram( -0.5, theBinCountInt-.5, theBinCountInt, myHistogramArray ,theIgnoreOutOfRangeFlag ,theThoroughBandScanFlag , GDALDummyProgress, NULL );
myGdalBand->GetHistogram( -0.5, theBinCountInt-.5, theBinCountInt, myHistogramArray ,theIgnoreOutOfRangeFlag ,theHistogramEstimatedFlag , GDALDummyProgress, NULL );
for (int myBin = 0; myBin <theBinCountInt; myBin++)
{

View File

@ -224,6 +224,10 @@ struct RasterBandStats
/** \brief Store the histogram for a given layer */
typedef QValueVector<int> HistogramVector;
HistogramVector * histogramVector;
/** \brief whteher histogram values are estimated or completely calculated */
bool histogramEstimatedFlag;
/** whehter histogram compuation should include out of range values */
bool histogramOutOfRangeFlag;
/** Color table */
QgsColorTable colorTable;
};