File: qgsrasterlayer.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (502 lines) | stat: -rw-r--r-- 15,760 bytes parent folder | download | duplicates (12)
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/raster/qgsrasterlayer.h                                     *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/





typedef QList < QPair< QString, QColor > > QgsLegendColorList;

class QgsRasterLayer : QgsMapLayer, QgsAbstractProfileSource
{
%Docstring(signature="appended")
Represents a raster layer.

A :py:class:`QgsRasterLayer` is instantiated by specifying the name of a
data provider, such as "gdal" or "wms", and a url defining the specific
data set to connect to. The raster layer constructor in turn
instantiates a :py:class:`QgsRasterDataProvider` subclass corresponding
to the provider type, and passes it the url. The data provider connects
to the data source.

Sample usage of the :py:class:`QgsRasterLayer` class:

.. code-block:: python

         my_raster_layer = QgsRasterLayer("/path/to/file.tif", "my layer")
%End

%TypeHeaderCode
#include "qgsrasterlayer.h"
%End
  public:


    static const double SAMPLE_SIZE;

    static const QgsContrastEnhancement::ContrastEnhancementAlgorithm SINGLE_BAND_ENHANCEMENT_ALGORITHM;

    static const QgsContrastEnhancement::ContrastEnhancementAlgorithm MULTIPLE_BAND_SINGLE_BYTE_ENHANCEMENT_ALGORITHM;

    static const QgsContrastEnhancement::ContrastEnhancementAlgorithm MULTIPLE_BAND_MULTI_BYTE_ENHANCEMENT_ALGORITHM;

    static const QgsRasterMinMaxOrigin::Limits SINGLE_BAND_MIN_MAX_LIMITS;

    static const QgsRasterMinMaxOrigin::Limits MULTIPLE_BAND_SINGLE_BYTE_MIN_MAX_LIMITS;

    static const QgsRasterMinMaxOrigin::Limits MULTIPLE_BAND_MULTI_BYTE_MIN_MAX_LIMITS;

    QgsRasterLayer();
%Docstring
Constructor. Provider is not set.
%End

    struct LayerOptions
    {

      explicit LayerOptions( bool loadDefaultStyle = true,
                             const QgsCoordinateTransformContext &transformContext = QgsCoordinateTransformContext() );
%Docstring
Constructor for LayerOptions.
%End

      bool loadDefaultStyle;

      QgsCoordinateTransformContext transformContext;

      bool skipCrsValidation;

    };

    explicit QgsRasterLayer( const QString &uri,
                             const QString &baseName = QString(),
                             const QString &providerType = "gdal",
                             const QgsRasterLayer::LayerOptions &options = QgsRasterLayer::LayerOptions() );
%Docstring
This is the constructor for the RasterLayer class.

The main tasks carried out by the constructor are:

- Load the rasters default style (.qml) file if it exists
- Populate the RasterStatsVector with initial values for each band.
- Calculate the layer extents
- Determine whether the layer is gray, paletted or multiband.
- Assign sensible defaults for the red, green, blue and gray bands.
%End

    ~QgsRasterLayer();

    SIP_PYOBJECT __repr__();
%MethodCode
    QString str = QStringLiteral( "<QgsRasterLayer: '%1' (%2)>" ).arg( sipCpp->name(), sipCpp->dataProvider() ? sipCpp->dataProvider()->name() : QStringLiteral( "Invalid" ) );
    sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

    virtual QgsRasterLayer *clone() const /Factory/;

%Docstring
Returns a new instance equivalent to this one. A new provider is created
for the same data source and renderer is cloned too.

:return: a new layer instance
%End

    virtual QgsAbstractProfileGenerator *createProfileGenerator( const QgsProfileRequest &request ) /Factory/;


    static bool isValidRasterFileName( const QString &fileNameQString, QString &retError );
%Docstring
This helper checks to see whether the file name appears to be a valid
raster file name. If the file name looks like it could be valid, but
some sort of error occurs in processing the file, the error is returned
in ``retError``.
%End

    static bool isValidRasterFileName( const QString &fileNameQString );

    static QDateTime lastModified( const QString   &name );
%Docstring
Returns time stamp for given file name
%End

 void setDataProvider( const QString &provider ) /Deprecated/;
%Docstring
Set the data provider.

.. deprecated:: 3.40

   Use the version with ProviderOptions instead.
%End

    void setDataProvider( const QString &provider, const QgsDataProvider::ProviderOptions &options, Qgis::DataProviderReadFlags flags = Qgis::DataProviderReadFlags() );
%Docstring
Set the data provider.

:param provider: provider key string, must match a valid
                 :py:class:`QgsRasterDataProvider` key. E.g. "gdal",
                 "wms", etc.
:param options: provider options
:param flags: provider flags since QGIS 3.16

.. versionadded:: 3.2
%End

    Qgis::RasterLayerType rasterType() const;
%Docstring
Returns the raster layer type (which is a read only property).
%End

    void setRenderer( QgsRasterRenderer *renderer /Transfer/ );
%Docstring
Sets the raster's ``renderer``. Takes ownership of the renderer object.

.. seealso:: :py:func:`renderer`
%End

    QgsRasterRenderer *renderer() const;
%Docstring
Returns the raster's renderer.

.. seealso:: :py:func:`setRenderer`
%End

    QgsRasterResampleFilter *resampleFilter() const;
%Docstring
Returns the raster's resample filter.

.. seealso:: :py:func:`brightnessFilter`

.. seealso:: :py:func:`hueSaturationFilter`
%End

    QgsBrightnessContrastFilter *brightnessFilter() const;
%Docstring
Returns the raster's brightness/contrast filter.

.. seealso:: :py:func:`resampleFilter`

.. seealso:: :py:func:`hueSaturationFilter`
%End

    QgsHueSaturationFilter *hueSaturationFilter() const;
%Docstring
Returns the raster's hue/saturation filter.

.. seealso:: :py:func:`resampleFilter`

.. seealso:: :py:func:`brightnessFilter`
%End

    void setResamplingStage( Qgis::RasterResamplingStage stage );
%Docstring
Select which stage of the pipe should apply resampling.

.. seealso:: :py:func:`QgsRasterPipe.setResamplingStage`

.. versionadded:: 3.16
%End

    Qgis::RasterResamplingStage resamplingStage() const;
%Docstring
Returns which stage of the pipe should apply resampling.

.. seealso:: :py:func:`QgsRasterPipe.resamplingStage`

.. versionadded:: 3.16
%End

    QgsRasterPipe *pipe();
%Docstring
Returns the raster pipe.
%End

    int width() const;
%Docstring
Returns the width of the (unclipped) raster.

.. seealso:: :py:func:`height`
%End

    int height() const;
%Docstring
Returns the height of the (unclipped) raster.

.. seealso:: :py:func:`width`
%End

    int bandCount() const;
%Docstring
Returns the number of bands in this layer.
%End

    QString bandName( int bandNoInt ) const;
%Docstring
Returns the name of a band given its number.
%End

    QgsRasterAttributeTable *attributeTable( int bandNumber ) const;
%Docstring
Returns the (possibly NULL) raster attribute table for the given band
``bandNumber``.

.. versionadded:: 3.30
%End

    int attributeTableCount( ) const;
%Docstring
Returns the number of attribute tables for the raster by counting the
number of bands that have an associated attribute table.

.. versionadded:: 3.30
%End

    bool canCreateRasterAttributeTable( );
%Docstring
Returns ``True`` if the raster renderer is suitable for creation of a
raster attribute table. The supported renderers are
:py:class:`QgsPalettedRasterRenderer` and
:py:class:`QgsSingleBandPseudoColorRenderer`.

.. versionadded:: 3.30
%End

    virtual QgsRasterDataProvider *dataProvider();

%Docstring
Returns the source data provider.

This will be ``None`` if the layer is invalid.
%End

    virtual const QgsRasterDataProvider *dataProvider() const /PyName=constDataProvider/;

%Docstring
Returns the source data provider.

This will be ``None`` if the layer is invalid.
%End

    virtual void reload();

    virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) /Factory/;


    void draw( QPainter *theQPainter,
               QgsRasterViewPort *myRasterViewPort,
               const QgsMapToPixel *qgsMapToPixel = 0 );
%Docstring
This is an overloaded version of the :py:func:`~QgsRasterLayer.draw`
function that is called by both :py:func:`~QgsRasterLayer.draw` and
thumbnailAsPixmap
%End

 QgsLegendColorList legendSymbologyItems() const /Deprecated/;
%Docstring
Returns a list with classification items (Text and color).

.. deprecated:: 3.40

   Use :py:func:`QgsRasterRenderer.createLegendNodes()` instead.
%End

    virtual bool isSpatial() const;

    virtual QString htmlMetadata() const;

    virtual Qgis::MapLayerProperties properties() const;


    QPixmap paletteAsPixmap( int bandNumber = 1 );
%Docstring
Returns a 100x100 pixmap of the color palette. If the layer has no
palette a white pixmap will be returned

:param bandNumber: the number of the band to use for generating a pixmap
                   of the associated palette
%End

    double rasterUnitsPerPixelX() const;
%Docstring
Returns the number of raster units per each raster pixel in X axis.

In a world file, this is normally the first row (without the sign).
(E.g. the value reported by the GDAL geotransform[1]).

.. note::

   If the :py:func:`~QgsRasterLayer.dataProvider` does not have native size/resolution then 1 will be returned. :py:func:`QgsRasterDataProvider.capabilities()` can be
   used to test for the :py:class:`Qgis`.RasterInterfaceCapability.Size capability in order to determine whether the data provider has a native size/resolution.

.. seealso:: :py:func:`rasterUnitsPerPixelY`
%End

    double rasterUnitsPerPixelY() const;
%Docstring
Returns the number of raster units per each raster pixel in Y axis.

In a world file, this is normally the first row (without the sign).

.. note::

   If the :py:func:`~QgsRasterLayer.dataProvider` does not have native size/resolution then 1 will be returned. :py:func:`QgsRasterDataProvider.capabilities()` can be
   used to test for the :py:class:`Qgis`.RasterInterfaceCapability.Size capability in order to determine whether the data provider has a native size/resolution.

.. seealso:: :py:func:`rasterUnitsPerPixelX`
%End

    virtual void setOpacity( double opacity ) ${SIP_FINAL};

    virtual double opacity() const ${SIP_FINAL};


    void setContrastEnhancement( QgsContrastEnhancement::ContrastEnhancementAlgorithm algorithm,
                                 QgsRasterMinMaxOrigin::Limits limits = QgsRasterMinMaxOrigin::MinMax,
                                 const QgsRectangle &extent = QgsRectangle(),
                                 int sampleSize = QgsRasterLayer::SAMPLE_SIZE,
                                 bool generateLookupTableFlag = true );
%Docstring
Set contrast enhancement algorithm

:param algorithm: Contrast enhancement algorithm
:param limits: Limits
:param extent: Extent used to calculate limits, if empty, use full layer
               extent
:param sampleSize: Size of data sample to calculate limits, if 0, use
                   full resolution
:param generateLookupTableFlag: Generate lookup table.
%End



    virtual QString subsetString() const;
%Docstring
Returns the string (typically sql) used to define a subset of the layer.

:return: The subset string or null QString if not implemented by the
         provider

.. versionadded:: 3.12
%End

    virtual bool setSubsetString( const QString &subset );
%Docstring
Sets the string (typically sql) used to define a subset of the layer

:param subset: The subset string. This may be the where clause of a sql
               statement or other definition string specific to the
               underlying dataprovider and data store.

:return: ``True``, when setting the subset string was successful,
         ``False`` otherwise

.. versionadded:: 3.12
%End


    void setDefaultContrastEnhancement();
%Docstring
Sets the default contrast enhancement
%End

    virtual QStringList subLayers() const;


    QImage previewAsImage( QSize size, const QColor &bgColor = Qt::white,
                           QImage::Format format = QImage::Format_ARGB32_Premultiplied );
%Docstring
Draws a preview of the rasterlayer into a QImage
%End

    virtual void setLayerOrder( const QStringList &layers );

    virtual void setSubLayerVisibility( const QString &name, bool vis );

    virtual QDateTime timestamp() const;

    virtual bool accept( QgsStyleEntityVisitorInterface *visitor ) const;


    bool writeSld( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QVariantMap &props = QVariantMap() ) const;
%Docstring
Writes the symbology of the layer into the document provided in SLD
1.0.0 format

:param node: the node that will have the style element added to it.
:param doc: the document that will have the QDomNode added.
:param errorMessage: reference to string that will be updated with any
                     error messages
:param props: a open ended set of properties that can drive/inform the
              SLD encoding

:return: ``True`` in case of success

.. versionadded:: 3.6
%End

    bool ignoreExtents() const;
%Docstring
If the ignoreExtent flag is set, the layer will also render outside the
bounding box reported by the data provider. To be used for example for
WMS layers with labels or symbology that happens to be drawn outside the
data extent.

.. versionadded:: 3.10
%End

    virtual QgsMapLayerTemporalProperties *temporalProperties();

    virtual QgsMapLayerElevationProperties *elevationProperties();


  public slots:
    void showStatusMessage( const QString &message );

    virtual void setTransformContext( const QgsCoordinateTransformContext &transformContext );
%Docstring
Sets the coordinate transform context to ``transformContext``

.. versionadded:: 3.8
%End

  signals:

    void subsetStringChanged();
%Docstring
Emitted when the layer's subset string has changed.

.. versionadded:: 3.12
%End

  protected:
    virtual bool readSymbology( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );

    virtual bool readStyle( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );

    virtual bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context );

     virtual bool writeSymbology( QDomNode &, QDomDocument &doc, QString &errorMessage,
                         const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const;
     virtual bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage,
                     const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const;
    virtual bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const;

    virtual QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const;

    virtual QString decodedSource( const QString &source, const QString &provider,  const QgsReadWriteContext &context ) const;


};


/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/raster/qgsrasterlayer.h                                     *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/