This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -318,53 +289,6 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
returnQStringList();
}
/** \brief Get histogram. Histograms are cached in providers.
* @param theBandNo The band (number).
* @param theBinCount Number of bins (intervals,buckets). If 0, the number of bins is decided automaticaly according to data type, raster size etc.
* @param theMinimum Minimum value, if NaN, raster minimum value will be used.
* @param theMaximum Maximum value, if NaN, raster minimum value will be used.
* @param theExtent Extent used to calc histogram, if empty, whole raster extent is used.
* @param theSampleSize Approximate number of cells in sample. If 0, all cells (whole raster will be used). If raster does not have exact size (WCS without exact size for example), provider decides size of sample.
* @param theIncludeOutOfRange include out of range values
* @return Vector of non NULL cell counts for each bin.
* @note theBinCount, theMinimun and theMaximum not optional in python bindings
*/
virtual QgsRasterHistogram histogram( int theBandNo,
/** \brief Find values for cumulative pixel count cut.
* @param theBandNo The band (number).
* @param theLowerCount The lower count as fraction of 1, e.g. 0.02 = 2%
* @param theUpperCount The upper count as fraction of 1, e.g. 0.98 = 98%
* @param theLowerValue Location into which the lower value will be set.
* @param theUpperValue Location into which the upper value will be set.
* @param theExtent Extent used to calc histogram, if empty, whole raster extent is used.
* @param theSampleSize Approximate number of cells in sample. If 0, all cells (whole raster will be used). If raster does not have exact size (WCS without exact size for example), provider decides size of sample.
@@ -387,35 +311,6 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
/** \brief Returns true if raster has at least one populated histogram. */
boolhasPyramids();
/** If the provider supports it, return band stats for the
given band. Default behaviour is to blockwise read the data
and generate the stats unless the provider overloads this function. */
//virtual QgsRasterBandStats bandStatistics( int theBandNo );
/** \brief Get band statistics.
* @param theBandNo The band (number).
* @param theStats Requested statistics
* @param theExtent Extent used to calc histogram, if empty, whole raster extent is used.
* @param theSampleSize Approximate number of cells in sample. If 0, all cells (whole raster will be used). If raster does not have exact size (WCS without exact size for example), provider decides size of sample.
* @return Band statistics.
*/
virtual QgsRasterBandStats bandStatistics( int theBandNo,
int theStats = QgsRasterBandStats::All,
const QgsRectangle & theExtent = QgsRectangle(),
int theSampleSize = 0 );
/** \brief Returns true if histogram is available (cached, already calculated), the parameters are the same as in histogram() */
virtualboolhasStatistics( int theBandNo,
int theStats = QgsRasterBandStats::All,
const QgsRectangle & theExtent = QgsRectangle(),
int theSampleSize = 0 );
/** \brief helper function to create zero padded band names */
QString generateBandName( int theBandNumber ) const
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: inherit from QObject? It would be probably better but QgsDataProvider inherits already from QObject and multiple inheritance from QObject is not allowed
classCORE_EXPORT QgsRasterInterface
{
Q_DECLARE_TR_FUNCTIONS( QgsRasterInterface );
public:
//! If you add to this, please also add to capabilitiesString()
enum Capability
{
NoCapabilities = 0,
Identify = 1,
ExactMinimumMaximum = 1 << 1,
ExactResolution = 1 << 2,
EstimatedMinimumMaximum = 1 << 3,
BuildPyramids = 1 << 4,
Histogram = 1 << 5,
Size = 1 << 6, // has fixed source type
Create = 1 << 7, //create new datasets
Remove = 1 << 8, //delete datasets
IdentifyValue = 1 << 9,
IdentifyText = 1 << 10,
IdentifyHtml = 1 << 11,
IdentifyFeature = 1 << 12// WMS GML -> feature
};
#if0
struct Range
{
Expand All
@@ -53,8 +78,26 @@ class CORE_EXPORT QgsRasterInterface
/** Clone itself, create deep copy */
virtual QgsRasterInterface *clone() const = 0;
/** Returns a bitmask containing the supported capabilities
*/
virtualintcapabilities() const
{
return QgsRasterInterface::NoCapabilities;
}
/**
* Returns the above in friendly format.
*/
QString capabilitiesString() const;
/** Returns data type for the band specified by number */
virtual QGis::DataType dataType( int bandNo ) const = 0;
/** Returns source data type for the band specified by number,
* source data type may be shorter than dataType
*/
virtual QGis::DataType srcDataType( int bandNo ) { if ( mInput ) returnmInput->srcDataType( bandNo ); elsereturn QGis::UnknownDataType; };
#if0
{
Q_UNUSED( bandNo );
Expand All
@@ -63,11 +106,31 @@ class CORE_EXPORT QgsRasterInterface
}
#endif
/**
* Get the extent of the interface.
* @return QgsRectangle containing the extent of the layer
/** Return no data value for specific band. Each band/provider must have
* no data value, if there is no one set in original data, provider decides one
* possibly using wider data type.
Expand DownExpand Up
@@ -129,6 +192,73 @@ class CORE_EXPORT QgsRasterInterface
returnmInput ? mInput->srcInput() : this;
}
/** \brief Get band statistics.
* @param theBandNo The band (number).
* @param theStats Requested statistics
* @param theExtent Extent used to calc statistics, if empty, whole raster extent is used.
* @param theSampleSize Approximate number of cells in sample. If 0, all cells (whole raster will be used). If raster does not have exact size (WCS without exact size for example), provider decides size of sample.
* @return Band statistics.
*/
virtual QgsRasterBandStats bandStatistics( int theBandNo,
int theStats = QgsRasterBandStats::All,
const QgsRectangle & theExtent = QgsRectangle(),
int theSampleSize = 0 );
/** \brief Returns true if histogram is available (cached, already calculated). * The parameters are the same as in bandStatistics()
* @return true if statistics are available (ready to use)
*/
virtualboolhasStatistics( int theBandNo,
int theStats = QgsRasterBandStats::All,
const QgsRectangle & theExtent = QgsRectangle(),
int theSampleSize = 0 );
/** \brief Get histogram. Histograms are cached in providers.
* @param theBandNo The band (number).
* @param theBinCount Number of bins (intervals,buckets). If 0, the number of bins is decided automaticaly according to data type, raster size etc.
* @param theMinimum Minimum value, if NaN, raster minimum value will be used.
* @param theMaximum Maximum value, if NaN, raster minimum value will be used.
* @param theExtent Extent used to calc histogram, if empty, whole raster extent is used.
* @param theSampleSize Approximate number of cells in sample. If 0, all cells (whole raster will be used). If raster does not have exact size (WCS without exact size for example), provider decides size of sample.
* @param theIncludeOutOfRange include out of range values
* @return Vector of non NULL cell counts for each bin.
* @note theBinCount, theMinimun and theMaximum not optional in python bindings
*/
virtual QgsRasterHistogram histogram( int theBandNo,
/** \brief Find values for cumulative pixel count cut.
* @param theBandNo The band (number).
* @param theLowerCount The lower count as fraction of 1, e.g. 0.02 = 2%
* @param theUpperCount The upper count as fraction of 1, e.g. 0.98 = 98%
* @param theLowerValue Location into which the lower value will be set.
* @param theUpperValue Location into which the upper value will be set.
* @param theExtent Extent used to calc histogram, if empty, whole raster extent is used.
* @param theSampleSize Approximate number of cells in sample. If 0, all cells (whole raster will be used). If raster does not have exact size (WCS without exact size for example), provider decides size of sample.
*/
virtualvoidcumulativeCut( int theBandNo,
double theLowerCount,
double theUpperCount,
double &theLowerValue,
double &theUpperValue,
const QgsRectangle & theExtent = QgsRectangle(),
int theSampleSize = 0 );
/** Switch on (and clear old statistics) or off collection of statistics */
//void setStatsOn( bool on );
Expand All
@@ -142,9 +272,32 @@ class CORE_EXPORT QgsRasterInterface
// QgsRasterInterface used as input
QgsRasterInterface* mInput;
/** \brief List of cached statistics, all bands mixed */
QList <QgsRasterBandStats> mStatistics;
/** \brief List of cached histograms, all bands mixed */
QList <QgsRasterHistogram> mHistograms;
// On/off state, if off, it does not do anything, replicates input
boolmOn;
/** Fill in histogram defaults if not specified
* @note theBinCount, theMinimun and theMaximum not optional in python bindings
*/
voidinitHistogram( QgsRasterHistogram &theHistogram, int theBandNo,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters