/
qgsalignraster.sip
313 lines (257 loc) · 7.08 KB
/
qgsalignraster.sip
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/raster/qgsalignraster.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsAlignRaster
{
%Docstring
QgsAlignRaster takes one or more raster layers and warps (resamples) them
so they have the same:
- coordinate reference system
- cell size and raster size
- offset of the raster grid
.. versionadded:: 2.12
%End
%TypeHeaderCode
#include "qgsalignraster.h"
#include <gdal_version.h>
%End
public:
QgsAlignRaster();
struct RasterInfo
{
public:
RasterInfo( const QString &layerpath );
%Docstring
Construct raster info with a path to a raster file
%End
~RasterInfo();
bool isValid() const;
%Docstring
Check whether the given path is a valid raster
:rtype: bool
%End
QString crs() const;
%Docstring
Return CRS in WKT format
:rtype: str
%End
QSize rasterSize() const;
%Docstring
Return size of the raster grid in pixels
:rtype: QSize
%End
int bandCount() const;
%Docstring
Return number of raster bands in the file
:rtype: int
%End
QSizeF cellSize() const;
%Docstring
Return cell size in map units
:rtype: QSizeF
%End
QPointF gridOffset() const;
%Docstring
Return grid offset
:rtype: QPointF
%End
QgsRectangle extent() const;
%Docstring
Return extent of the raster
:rtype: QgsRectangle
%End
QPointF origin() const;
%Docstring
Return origin of the raster
:rtype: QPointF
%End
void dump() const;
%Docstring
write contents of the object to standard error stream - for debugging
%End
double identify( double mx, double my );
%Docstring
Get raster value at the given coordinates (from the first band)
:rtype: float
%End
protected:
private:
RasterInfo( const QgsAlignRaster::RasterInfo &rh );
};
enum ResampleAlg
{
RA_NearestNeighbour,
RA_Bilinear,
RA_Cubic,
RA_CubicSpline,
RA_Lanczos,
RA_Average,
RA_Mode,
RA_Max,
RA_Min,
RA_Median,
RA_Q1,
RA_Q3,
};
struct Item
{
Item( const QString &input, const QString &output );
QString inputFilename;
%Docstring
filename of the source raster
%End
QString outputFilename;
%Docstring
filename of the newly created aligned raster (will be overwritten if exists already)
%End
QgsAlignRaster::ResampleAlg resampleMethod;
%Docstring
resampling method to be used
%End
bool rescaleValues;
%Docstring
rescaling of values according to the change of pixel size
%End
double srcCellSizeInDestCRS;
%Docstring
used for rescaling of values (if necessary)
%End
};
typedef QList<QgsAlignRaster::Item> List;
struct ProgressHandler
{
virtual bool progress( double complete ) = 0;
%Docstring
:return: false if the execution should be canceled, true otherwise
:rtype: bool
%End
virtual ~ProgressHandler();
};
void setProgressHandler( ProgressHandler *progressHandler );
%Docstring
Assign a progress handler instance. Does not take ownership. None can be passed.
%End
ProgressHandler *progressHandler() const;
%Docstring
Get associated progress handler. May be None (default)
:rtype: ProgressHandler
%End
void setRasters( const List &list );
%Docstring
Set list of rasters that will be aligned
%End
List rasters() const;
%Docstring
Get list of rasters that will be aligned
:rtype: List
%End
void setGridOffset( QPointF offset );
QPointF gridOffset() const;
%Docstring
:rtype: QPointF
%End
void setCellSize( double x, double y );
%Docstring
Set output cell size
%End
void setCellSize( QSizeF size );
%Docstring
Set output cell size
%End
QSizeF cellSize() const;
%Docstring
Get output cell size
:rtype: QSizeF
%End
void setDestinationCrs( const QString &crsWkt );
%Docstring
Set the output CRS in WKT format
%End
QString destinationCrs() const;
%Docstring
Get the output CRS in WKT format
:rtype: str
%End
void setClipExtent( double xmin, double ymin, double xmax, double ymax );
%Docstring
No extra clipping is done if the rectangle is null
%End
void setClipExtent( const QgsRectangle &extent );
%Docstring
No extra clipping is done if the rectangle is null
%End
QgsRectangle clipExtent() const;
%Docstring
No extra clipping is done if the rectangle is null
:rtype: QgsRectangle
%End
bool setParametersFromRaster( const RasterInfo &rasterInfo, const QString &customCRSWkt = QString(), QSizeF customCellSize = QSizeF(), QPointF customGridOffset = QPointF( -1, -1 ) );
%Docstring
:return: true on success (may fail if it is not possible to reproject raster to given CRS)
:rtype: bool
%End
bool setParametersFromRaster( const QString &filename, const QString &customCRSWkt = QString(), QSizeF customCellSize = QSizeF(), QPointF customGridOffset = QPointF( -1, -1 ) );
%Docstring
See the other variant for details.
:rtype: bool
%End
bool checkInputParameters();
%Docstring
:return: true on success, sets error on error (see errorMessage())
:rtype: bool
%End
QSize alignedRasterSize() const;
%Docstring
.. note::
first need to run checkInputParameters() which returns with success
:rtype: QSize
%End
QgsRectangle alignedRasterExtent() const;
%Docstring
.. note::
first need to run checkInputParameters() which returns with success
:rtype: QgsRectangle
%End
bool run();
%Docstring
:return: true on success, sets error on error (see errorMessage())
:rtype: bool
%End
QString errorMessage() const;
%Docstring
Error message is empty if run() succeeded (returned true)
:rtype: str
%End
void dump() const;
%Docstring
write contents of the object to standard error stream - for debugging
%End
int suggestedReferenceLayer() const;
%Docstring
Return index of the layer which has smallest cell size (returns -1 on error)
:rtype: int
%End
protected:
bool createAndWarp( const Item &raster );
%Docstring
Internal function for processing of one raster (1. create output, 2. do the alignment)
:rtype: bool
%End
static bool suggestedWarpOutput( const RasterInfo &info, const QString &destWkt, QSizeF *cellSize = 0, QPointF *gridOffset = 0, QgsRectangle *rect = 0 );
%Docstring
Determine suggested output of raster warp to a different CRS. Returns true on success
:rtype: bool
%End
protected:
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/raster/qgsalignraster.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/