[QGIS Commit] r14873 - in branches/raster-providers/src: core
providers/gdal providers/grass
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed Dec 8 14:55:47 EST 2010
Author: rblazek
Date: 2010-12-08 11:55:47 -0800 (Wed, 08 Dec 2010)
New Revision: 14873
Modified:
branches/raster-providers/src/core/qgsrasterdataprovider.h
branches/raster-providers/src/providers/gdal/qgsgdalprovider.cpp
branches/raster-providers/src/providers/gdal/qgsgdalprovider.h
branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.cpp
branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.h
Log:
properties crash fix - grass histogram
Modified: branches/raster-providers/src/core/qgsrasterdataprovider.h
===================================================================
--- branches/raster-providers/src/core/qgsrasterdataprovider.h 2010-12-08 19:43:40 UTC (rev 14872)
+++ branches/raster-providers/src/core/qgsrasterdataprovider.h 2010-12-08 19:55:47 UTC (rev 14873)
@@ -309,7 +309,9 @@
// Defined in parent
/** \brief Returns the sublayers of this layer - Useful for providers that manage their own layers, such as WMS */
- //virtual QStringList subLayers() const ;
+ virtual QStringList subLayers() const {
+ return QStringList();
+ }
/** \brief Populate the histogram vector for a given band */
Modified: branches/raster-providers/src/providers/gdal/qgsgdalprovider.cpp
===================================================================
--- branches/raster-providers/src/providers/gdal/qgsgdalprovider.cpp 2010-12-08 19:43:40 UTC (rev 14872)
+++ branches/raster-providers/src/providers/gdal/qgsgdalprovider.cpp 2010-12-08 19:55:47 UTC (rev 14873)
@@ -862,9 +862,8 @@
return PROVIDER_DESCRIPTION;
}
-//QStringList QgsGdalProvider::subLayers( GDALDatasetH dataset )
// This is used also by global isValidRasterFileName
-QStringList subLayers( GDALDatasetH dataset )
+QStringList subLayers_( GDALDatasetH dataset )
{
QStringList subLayers;
@@ -1192,7 +1191,7 @@
QStringList QgsGdalProvider::subLayers() const
{
- return subLayers( mGdalDataset );
+ return subLayers_( mGdalDataset );
}
@@ -1424,7 +1423,7 @@
}
else if ( GDALGetRasterCount( myDataset ) == 0 )
{
- QStringList layers = subLayers( myDataset );
+ QStringList layers = subLayers_( myDataset );
if ( layers.size() == 0 )
{
GDALClose( myDataset );
Modified: branches/raster-providers/src/providers/gdal/qgsgdalprovider.h
===================================================================
--- branches/raster-providers/src/providers/gdal/qgsgdalprovider.h 2010-12-08 19:43:40 UTC (rev 14872)
+++ branches/raster-providers/src/providers/gdal/qgsgdalprovider.h 2010-12-08 19:55:47 UTC (rev 14873)
@@ -232,7 +232,7 @@
//bool isValidRasterFileName( const QString & theFileNameQString );
- static QStringList subLayers( GDALDatasetH dataset );
+ //static QStringList subLayers( GDALDatasetH dataset );
/** \brief Returns the sublayers of this layer - Useful for providers that manage their own layers, such as WMS */
QStringList subLayers() const;
Modified: branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.cpp
===================================================================
--- branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.cpp 2010-12-08 19:43:40 UTC (rev 14872)
+++ branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.cpp 2010-12-08 19:55:47 UTC (rev 14873)
@@ -29,6 +29,7 @@
#include "qgscoordinatetransform.h"
#include "qgsrectangle.h"
#include "qgscoordinatereferencesystem.h"
+#include "qgsrasterbandstats.h"
#include <QImage>
#include <QSettings>
@@ -386,13 +387,29 @@
return myMetadata;
}
-void populateHistogram( int theBandNoInt,
+void QgsGrassRasterProvider::populateHistogram( int theBandNoInt,
QgsRasterBandStats & theBandStats,
- int theBinCountInt = 256,
- bool theIgnoreOutOfRangeFlag = true,
- bool theThoroughBandScanFlag = false)
+ int theBinCount,
+ bool theIgnoreOutOfRangeFlag,
+ bool theHistogramEstimatedFlag)
{
- // TODO
+ // TODO: we could either implement it in QgsRasterDataProvider::populateHistogram
+ // or use r.stats (see d.histogram)
+ if ( theBandStats.histogramVector->size() != theBinCount ||
+ theIgnoreOutOfRangeFlag != theBandStats.isHistogramOutOfRange ||
+ theHistogramEstimatedFlag != theBandStats.isHistogramEstimated )
+ {
+ theBandStats.histogramVector->clear();
+ theBandStats.isHistogramEstimated = theHistogramEstimatedFlag;
+ theBandStats.isHistogramOutOfRange = theIgnoreOutOfRangeFlag;
+ for ( int myBin = 0; myBin < theBinCount; myBin++ )
+ {
+ theBandStats.histogramVector->push_back( 0 );
+ }
+ }
+ QgsDebugMsg( ">>>>> Histogram vector now contains " +
+ QString::number( theBandStats.histogramVector->size() ) + " elements" );
+
}
Modified: branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.h
===================================================================
--- branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.h 2010-12-08 19:43:40 UTC (rev 14872)
+++ branches/raster-providers/src/providers/grass/qgsgrassrasterprovider.h 2010-12-08 19:55:47 UTC (rev 14873)
@@ -214,6 +214,14 @@
void setImageEncoding( QString const & mimeType ) {}
void setImageCrs( QString const & crs ) {}
+ void populateHistogram( int theBandNoInt,
+ QgsRasterBandStats & theBandStats,
+ int theBinCountInt = 256,
+ bool theIgnoreOutOfRangeFlag = true,
+ bool theThoroughBandScanFlag = false
+ );
+
+
private:
/**
More information about the QGIS-commit
mailing list