QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
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
58 {
60 };
61
65 QgsRasterPipe() = default;
66
71
73
74 QgsRasterPipe &operator=( const QgsRasterPipe &rh ) = delete;
75
89 void moveToThread( QThread *thread );
90
98 bool insert( int idx, QgsRasterInterface *interface SIP_TRANSFER );
99#ifdef SIP_RUN
100 % MethodCode
101 sipRes = sipCpp->insert( a0, a1 );
102 if ( !sipRes )
103 {
104 // if insertion failed transfer ownership back to python
105 PyObject *o = sipGetPyObject( a1, sipType_QgsRasterInterface );
106 if ( o )
107 sipTransferTo( o, NULL );
108 }
109 % End
110#endif
111
120 bool replace( int idx, QgsRasterInterface *interface SIP_TRANSFER );
121
143 bool set( QgsRasterInterface *interface SIP_TRANSFER );
144
150 bool remove( int idx );
151
157 bool remove( QgsRasterInterface *interface );
158
162 int size() const { return mInterfaces.size(); }
163
167 QgsRasterInterface *at( int idx ) const { return mInterfaces.at( idx ); }
168
172 QgsRasterInterface *last() const { return mInterfaces.last(); }
173
179 bool setOn( int idx, bool on );
180
184 bool canSetOn( int idx, bool on );
185
186 // Getters for special types of interfaces
187
191 QgsRasterDataProvider *provider() const;
192
196 QgsRasterRenderer *renderer() const;
197
201 QgsRasterResampleFilter *resampleFilter() const;
202
206 QgsBrightnessContrastFilter *brightnessFilter() const;
207
211 QgsHueSaturationFilter *hueSaturationFilter() const;
212
216 QgsRasterProjector *projector() const;
217
221 QgsRasterNuller *nuller() const;
222
232 void setResamplingStage( Qgis::RasterResamplingStage stage );
233
240 Qgis::RasterResamplingStage resamplingStage() const { return mResamplingStage; }
241
247 QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
248
256 const QgsPropertyCollection &dataDefinedProperties() const SIP_SKIP { return mDataDefinedProperties; }
257
267 void setDataDefinedProperties( const QgsPropertyCollection &collection ) { mDataDefinedProperties = collection; }
268
275 void evaluateDataDefinedProperties( QgsExpressionContext &context );
276
282 static QgsPropertiesDefinition propertyDefinitions();
283
284 private:
285#ifdef SIP_RUN
286 QgsRasterPipe( const QgsRasterPipe &pipe );
287#endif
288
290 Qgis::RasterPipeInterfaceRole interfaceRole( QgsRasterInterface *iface ) const;
291
292 // Interfaces in pipe, the first is always provider
293 QVector<QgsRasterInterface *> mInterfaces;
294
295 QMap<Qgis::RasterPipeInterfaceRole, int> mRoleMap;
296
297 // Set role in mRoleMap
298 void setRole( QgsRasterInterface *interface, int idx );
299
300 // Unset role in mRoleMap
301 void unsetRole( QgsRasterInterface *interface );
302
303 // Check if index is in bounds
304 bool checkBounds( int idx ) const;
305
307 QgsRasterInterface *interface( Qgis::RasterPipeInterfaceRole role ) const;
308
313 bool connect( QVector<QgsRasterInterface *> interfaces );
314
316
318 QgsPropertyCollection mDataDefinedProperties;
319
321 static QgsPropertiesDefinition sPropertyDefinitions;
322
323 static void initPropertyDefinitions();
324};
325
326#endif
327
328
RasterResamplingStage
Stage at which raster resampling occurs.
Definition: qgis.h:891
@ ResampleFilter
Resampling occurs in ResamplingFilter.
RasterPipeInterfaceRole
Sublayer flags.
Definition: qgis.h:874
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.
QgsRasterInterface * at(int idx) const
Returns the interface at the specified index.
Property
Data definable properties.
Definition: qgsrasterpipe.h:58
@ RendererOpacity
Raster renderer global opacity.
Definition: qgsrasterpipe.h:59
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_TRANSFER
Definition: qgis_sip.h:36
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.