You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: python/core/raster/qgsrasterdataprovider.sip
+3-103Lines changed: 3 additions & 103 deletions
Original file line number
Diff line number
Diff line change
@@ -15,25 +15,6 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
15
15
16
16
public:
17
17
18
-
//! If you add to this, please also add to capabilitiesString()
19
-
enum Capability
20
-
{
21
-
NoCapabilities,
22
-
Identify,
23
-
ExactMinimumMaximum,
24
-
ExactResolution,
25
-
EstimatedMinimumMaximum,
26
-
BuildPyramids,
27
-
Histogram,
28
-
Size,
29
-
Create,
30
-
Remove,
31
-
IdentifyValue,
32
-
IdentifyText,
33
-
IdentifyHtml,
34
-
IdentifyFeature
35
-
};
36
-
37
18
// This is modified copy of GDALColorInterp
38
19
enum ColorInterpretation
39
20
{
@@ -104,23 +85,12 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
104
85
*/
105
86
virtual QImage* draw( const QgsRectangle & viewExtent, int pixelWidth, int pixelHeight ) = 0;
106
87
107
-
/** Returns a bitmask containing the supported capabilities
108
-
Note, some capabilities may change depending on whether
109
-
a spatial filter is active on this provider, so it may
110
-
be prudent to check this value per intended operation.
111
-
*/
112
-
virtual int capabilities() const;
113
-
114
-
/**
115
-
* Returns the above in friendly format.
116
-
*/
117
-
QString capabilitiesString() const;
118
-
119
-
120
88
// TODO: Get the supported formats by this provider
121
89
122
90
// TODO: Get the file masks supported by this provider, suitable for feeding into the file open dialog box
123
91
92
+
virtual QgsRectangle extent() = 0;
93
+
124
94
/** Returns data type for the band specified by number */
125
95
virtual QGis::DataType dataType( int bandNo ) const = 0;
126
96
@@ -162,7 +132,7 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
162
132
virtual QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height ) / Factory /;
163
133
164
134
/* Read a value from a data block at a given index. */
165
-
virtual double readValue( void *data, int type, int index );
135
+
//virtual double readValue( void *data, int type, int index );
166
136
167
137
/* Return true if source band has no data value */
168
138
virtual bool srcHasNoDataValue( int bandNo ) const;
@@ -198,50 +168,6 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
198
168
/** \brief Returns the sublayers of this layer - Useful for providers that manage their own layers, such as WMS */
199
169
virtual QStringList subLayers() const;
200
170
201
-
/** \brief Get histogram. Histograms are cached in providers.
202
-
* @param theBandNo The band (number).
203
-
* @param theBinCount Number of bins (intervals,buckets). If 0, the number of bins is decided automaticaly according to data type, raster size etc.
204
-
* @param theMinimum Minimum value, if NaN, raster minimum value will be used.
205
-
* @param theMaximum Maximum value, if NaN, raster minimum value will be used.
206
-
* @param theExtent Extent used to calc histogram, if empty, whole raster extent is used.
207
-
* @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.
208
-
* @param theIncludeOutOfRange include out of range values
209
-
* @return Vector of non NULL cell counts for each bin.
210
-
*/
211
-
virtual QgsRasterHistogram histogram( int theBandNo,
212
-
int theBinCount,
213
-
double theMinimum,
214
-
double theMaximum,
215
-
const QgsRectangle & theExtent = QgsRectangle(),
216
-
int theSampleSize = 0,
217
-
bool theIncludeOutOfRange = false );
218
-
219
-
/** \brief Returns true if histogram is available (cached, already calculated), the parameters are the same as in histogram() */
220
-
virtual bool hasHistogram( int theBandNo,
221
-
int theBinCount,
222
-
double theMinimum,
223
-
double theMaximum,
224
-
const QgsRectangle & theExtent = QgsRectangle(),
225
-
int theSampleSize = 0,
226
-
bool theIncludeOutOfRange = false );
227
-
228
-
/** \brief Find values for cumulative pixel count cut.
229
-
* @param theBandNo The band (number).
230
-
* @param theLowerCount The lower count as fraction of 1, e.g. 0.02 = 2%
231
-
* @param theUpperCount The upper count as fraction of 1, e.g. 0.98 = 98%
232
-
* @param theLowerValue Location into which the lower value will be set.
233
-
* @param theUpperValue Location into which the upper value will be set.
234
-
* @param theExtent Extent used to calc histogram, if empty, whole raster extent is used.
235
-
* @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.
@@ -259,32 +185,6 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
259
185
/** \brief Returns true if raster has at least one populated histogram. */
260
186
bool hasPyramids();
261
187
262
-
/** If the provider supports it, return band stats for the
263
-
given band. Default behaviour is to blockwise read the data
264
-
and generate the stats unless the provider overloads this function. */
265
-
//virtual QgsRasterBandStats bandStatistics( int theBandNo );
266
-
267
-
/** \brief Get band statistics.
268
-
* @param theBandNo The band (number).
269
-
* @param theStats Requested statistics
270
-
* @param theExtent Extent used to calc histogram, if empty, whole raster extent is used.
271
-
* @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.
272
-
* @return Band statistics.
273
-
*/
274
-
virtual QgsRasterBandStats bandStatistics( int theBandNo,
275
-
int theStats = QgsRasterBandStats::All,
276
-
const QgsRectangle & theExtent = QgsRectangle(),
277
-
int theSampleSize = 0 );
278
-
279
-
/** \brief Returns true if histogram is available (cached, already calculated), the parameters are the same as in histogram() */
280
-
virtual bool hasStatistics( int theBandNo,
281
-
int theStats = QgsRasterBandStats::All,
282
-
const QgsRectangle & theExtent = QgsRectangle(),
283
-
int theSampleSize = 0 );
284
-
285
-
/** \brief helper function to create zero padded band names */
286
-
QString generateBandName( int theBandNumber ) const;
287
-
288
188
/**
289
189
* Get metadata in a format suitable for feeding directly
290
190
* into a subset of the GUI raster properties "Metadata" tab.
/** Returns a bitmask containing the supported capabilities */
70
+
virtual int capabilities() const;
71
+
72
+
/**
73
+
* Returns the above in friendly format.
74
+
*/
75
+
QString capabilitiesString() const;
76
+
52
77
/** Returns data type for the band specified by number */
53
78
virtual QGis::DataType dataType( int bandNo ) const = 0;
54
79
@@ -57,6 +82,14 @@ class QgsRasterInterface
57
82
/** Get number of bands */
58
83
virtual int bandCount() const = 0;
59
84
85
+
/** Get block size */
86
+
virtual int xBlockSize() const;
87
+
virtual int yBlockSize() const;
88
+
89
+
/** Get raster size */
90
+
virtual int xSize() const;
91
+
virtual int ySize() const;
92
+
60
93
/** Return no data value for specific band. Each band/provider must have
61
94
* no data value, if there is no one set in original data, provider decides one
62
95
* possibly using wider data type.
@@ -90,5 +123,74 @@ class QgsRasterInterface
90
123
* resampling etc.
91
124
*/
92
125
virtual QgsRasterInterface *srcInput();
126
+
127
+
/** \brief Get band statistics.
128
+
* @param theBandNo The band (number).
129
+
* @param theStats Requested statistics
130
+
* @param theExtent Extent used to calc statistics, if empty, whole raster extent is used.
131
+
* @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.
132
+
* @return Band statistics.
133
+
*/
134
+
virtual QgsRasterBandStats bandStatistics( int theBandNo,
135
+
int theStats = QgsRasterBandStats::All,
136
+
const QgsRectangle & theExtent = QgsRectangle(),
137
+
int theSampleSize = 0 );
138
+
139
+
/** \brief Returns true if histogram is available (cached, already calculated). * The parameters are the same as in bandStatistics()
140
+
* @return true if statistics are available (ready to use)
141
+
*/
142
+
virtual bool hasStatistics( int theBandNo,
143
+
int theStats = QgsRasterBandStats::All,
144
+
const QgsRectangle & theExtent = QgsRectangle(),
145
+
int theSampleSize = 0 );
146
+
147
+
148
+
/** \brief Get histogram. Histograms are cached in providers.
149
+
* @param theBandNo The band (number).
150
+
* @param theBinCount Number of bins (intervals,buckets). If 0, the number of bins is decided automaticaly according to data type, raster size etc.
151
+
* @param theMinimum Minimum value, if NaN, raster minimum value will be used.
152
+
* @param theMaximum Maximum value, if NaN, raster minimum value will be used.
153
+
* @param theExtent Extent used to calc histogram, if empty, whole raster extent is used.
154
+
* @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.
155
+
* @param theIncludeOutOfRange include out of range values
156
+
* @return Vector of non NULL cell counts for each bin.
157
+
* @note theBinCount, theMinimun and theMaximum not optional in python bindings
158
+
*/
159
+
virtual QgsRasterHistogram histogram( int theBandNo,
160
+
int theBinCount,
161
+
double theMinimum,
162
+
double theMaximum,
163
+
const QgsRectangle & theExtent,
164
+
int theSampleSize,
165
+
bool theIncludeOutOfRange );
166
+
167
+
/** \brief Returns true if histogram is available (cached, already calculated), the parameters are the same as in histogram()
168
+
* @note theBinCount, theMinimun and theMaximum not optional in python bindings
169
+
*/
170
+
virtual bool hasHistogram( int theBandNo,
171
+
int theBinCount,
172
+
double theMinimum,
173
+
double theMaximum,
174
+
const QgsRectangle & theExtent,
175
+
int theSampleSize,
176
+
bool theIncludeOutOfRange );
177
+
178
+
/** \brief Find values for cumulative pixel count cut.
179
+
* @param theBandNo The band (number).
180
+
* @param theLowerCount The lower count as fraction of 1, e.g. 0.02 = 2%
181
+
* @param theUpperCount The upper count as fraction of 1, e.g. 0.98 = 98%
182
+
* @param theLowerValue Location into which the lower value will be set.
183
+
* @param theUpperValue Location into which the upper value will be set.
184
+
* @param theExtent Extent used to calc histogram, if empty, whole raster extent is used.
185
+
* @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.
0 commit comments