QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
qgsrasterpipe.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsrasterpipe.h - Internal raster processing modules interface
3 --------------------------------------
4 Date : Jun 21, 2012
5 Copyright : (C) 2012 by Radim Blazek
6 email : radim dot blazek at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSRASTERPIPE_H
19#define QGSRASTERPIPE_H
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
23#include "qgis.h"
25
26#include <QImage>
27#include <QMap>
28#include <QObject>
29
36class QgsRasterNuller;
40
41#if defined(Q_OS_WIN)
42#undef interface
43#endif
44
49class CORE_EXPORT QgsRasterPipe
50{
51 public:
52
53 // *INDENT-OFF*
54
60 {
61 RendererOpacity,
62 };
63 // *INDENT-ON*
64
68 QgsRasterPipe() = default;
69
74
76
77 QgsRasterPipe &operator=( const QgsRasterPipe &rh ) = delete;
78
92 void moveToThread( QThread *thread );
93
101 bool insert( int idx, QgsRasterInterface *interface SIP_TRANSFER );
102#ifdef SIP_RUN
103 % MethodCode
104 sipRes = sipCpp->insert( a0, a1 );
105 if ( !sipRes )
106 {
107 // if insertion failed transfer ownership back to python
108 PyObject *o = sipGetPyObject( a1, sipType_QgsRasterInterface );
109 if ( o )
110 sipTransferTo( o, NULL );
111 }
112 % End
113#endif
114
123 bool replace( int idx, QgsRasterInterface *interface SIP_TRANSFER );
124
146 bool set( QgsRasterInterface *interface SIP_TRANSFER );
147
153 bool remove( int idx );
154
160 bool remove( QgsRasterInterface *interface );
161
165 int size() const { return mInterfaces.size(); }
166
170 QgsRasterInterface *at( int idx ) const { return mInterfaces.at( idx ); }
171
175 QgsRasterInterface *last() const { return mInterfaces.last(); }
176
182 bool setOn( int idx, bool on );
183
187 bool canSetOn( int idx, bool on );
188
189 // Getters for special types of interfaces
190
194 QgsRasterDataProvider *provider() const;
195
199 QgsRasterRenderer *renderer() const;
200
204 QgsRasterResampleFilter *resampleFilter() const;
205
209 QgsBrightnessContrastFilter *brightnessFilter() const;
210
214 QgsHueSaturationFilter *hueSaturationFilter() const;
215
219 QgsRasterProjector *projector() const;
220
224 QgsRasterNuller *nuller() const;
225
235 void setResamplingStage( Qgis::RasterResamplingStage stage );
236
243 Qgis::RasterResamplingStage resamplingStage() const { return mResamplingStage; }
244
250 QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
251
259 const QgsPropertyCollection &dataDefinedProperties() const SIP_SKIP { return mDataDefinedProperties; }
260
270 void setDataDefinedProperties( const QgsPropertyCollection &collection ) { mDataDefinedProperties = collection; }
271
278 void evaluateDataDefinedProperties( QgsExpressionContext &context );
279
285 static QgsPropertiesDefinition propertyDefinitions();
286
287 private:
288#ifdef SIP_RUN
289 QgsRasterPipe( const QgsRasterPipe &pipe );
290#endif
291
293 Qgis::RasterPipeInterfaceRole interfaceRole( QgsRasterInterface *iface ) const;
294
295 // Interfaces in pipe, the first is always provider
296 QVector<QgsRasterInterface *> mInterfaces;
297
298 QMap<Qgis::RasterPipeInterfaceRole, int> mRoleMap;
299
300 // Set role in mRoleMap
301 void setRole( QgsRasterInterface *interface, int idx );
302
303 // Unset role in mRoleMap
304 void unsetRole( QgsRasterInterface *interface );
305
306 // Check if index is in bounds
307 bool checkBounds( int idx ) const;
308
310 QgsRasterInterface *interface( Qgis::RasterPipeInterfaceRole role ) const;
311
316 bool connect( QVector<QgsRasterInterface *> interfaces );
317
319
321 QgsPropertyCollection mDataDefinedProperties;
322
324 static QgsPropertiesDefinition sPropertyDefinitions;
325
326 static void initPropertyDefinitions();
327};
328
329#endif
330
331
RasterResamplingStage
Stage at which raster resampling occurs.
Definition: qgis.h:1138
@ ResampleFilter
Resampling occurs in ResamplingFilter.
RasterPipeInterfaceRole
Raster pipe interface roles.
Definition: qgis.h:1121
Brightness/contrast and gamma correction filter pipe for rasters.
Manipulates raster or point cloud pixel values so that they enhanceContrast or clip into a specified ...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Color and saturation filter pipe for rasters.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
Base class for raster data providers.
Base class for processing filters like renderers, reprojector, resampler etc.
Raster pipe that deals with null values.
Contains a pipeline of raster interfaces for sequential raster processing.
Definition: qgsrasterpipe.h:50
int size() const
Returns the size of the pipe (the number of interfaces contained in the pipe).
QgsRasterInterface * last() const
Returns last interface in the pipe.
QgsRasterPipe()=default
Constructor for an empty QgsRasterPipe.
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the pipe's property collection, used for data defined overrides.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the pipe's property collection, used for data defined overrides.
Property
Data definable properties.
Definition: qgsrasterpipe.h:60
QgsRasterInterface * at(int idx) const
Returns the interface at the specified index.
Qgis::RasterResamplingStage resamplingStage() const
Returns which stage of the pipe should apply resampling.
QgsRasterPipe & operator=(const QgsRasterPipe &rh)=delete
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the pipe's property collection, used for data defined overrides.
QgsRasterProjector implements approximate projection support for it calculates grid of points in sour...
Raster renderer pipe that applies colors to a raster.
Resample filter pipe for rasters.
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition: qgis_sip.h:271
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.