QGIS API Documentation 4.1.0-Master (60fea48833c)
Loading...
Searching...
No Matches
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.h"
22#include "qgis_core.h"
23#include "qgis_sip.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 // *INDENT-OFF*
53
59 {
60 RendererOpacity,
61 };
62 // *INDENT-ON*
63
67 QgsRasterPipe() = default;
68
70
72
73 QgsRasterPipe &operator=( const QgsRasterPipe &rh ) = delete;
74
88 void moveToThread( QThread *thread );
89
97 bool insert( int idx, QgsRasterInterface *interface SIP_TRANSFER );
98#ifdef SIP_RUN
99 // clang-format off
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// clang-format on
111#endif
112
121 bool replace( int idx, QgsRasterInterface *interface SIP_TRANSFER );
122
144 bool set( QgsRasterInterface *interface SIP_TRANSFER );
145
151 bool remove( int idx );
152
158 bool remove( QgsRasterInterface *interface );
159
163 int size() const { return mInterfaces.size(); }
164
168 QgsRasterInterface *at( int idx ) const { return mInterfaces.at( idx ); }
169
173 QgsRasterInterface *last() const { return mInterfaces.last(); }
174
180 bool setOn( int idx, bool on );
181
185 bool canSetOn( int idx, bool on );
186
187 // Getters for special types of interfaces
188
192 QgsRasterDataProvider *provider() const;
193
197 QgsRasterRenderer *renderer() const;
198
202 QgsRasterResampleFilter *resampleFilter() const;
203
207 QgsBrightnessContrastFilter *brightnessFilter() const;
208
212 QgsHueSaturationFilter *hueSaturationFilter() const;
213
217 QgsRasterProjector *projector() const;
218
222 QgsRasterNuller *nuller() const;
223
233 void setResamplingStage( Qgis::RasterResamplingStage stage );
234
241 Qgis::RasterResamplingStage resamplingStage() const { return mResamplingStage; }
242
248 QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
249
257 const QgsPropertyCollection &dataDefinedProperties() const SIP_SKIP { return mDataDefinedProperties; }
258
268 void setDataDefinedProperties( const QgsPropertyCollection &collection ) { mDataDefinedProperties = collection; }
269
276 void evaluateDataDefinedProperties( QgsExpressionContext &context );
277
283 static QgsPropertiesDefinition propertyDefinitions();
284
285 private:
286#ifdef SIP_RUN
287 QgsRasterPipe( const QgsRasterPipe &pipe );
288#endif
289
291 Qgis::RasterPipeInterfaceRole interfaceRole( QgsRasterInterface *iface ) const;
292
293 // Interfaces in pipe, the first is always provider
294 QVector<QgsRasterInterface *> mInterfaces;
295
296 QMap<Qgis::RasterPipeInterfaceRole, int> mRoleMap;
297
298 // Set role in mRoleMap
299 void setRole( QgsRasterInterface *interface, int idx );
300
301 // Unset role in mRoleMap
302 void unsetRole( QgsRasterInterface *interface );
303
304 // Check if index is in bounds
305 bool checkBounds( int idx ) const;
306
308 QgsRasterInterface *interface( Qgis::RasterPipeInterfaceRole role ) const;
309
314 bool connect( QVector<QgsRasterInterface *> interfaces );
315
317
319 QgsPropertyCollection mDataDefinedProperties;
320
322 static QgsPropertiesDefinition sPropertyDefinitions;
323
324 static void initPropertyDefinitions();
325};
326
327#endif
RasterResamplingStage
Stage at which raster resampling occurs.
Definition qgis.h:1548
@ ResampleFilter
Resampling occurs in ResamplingFilter.
Definition qgis.h:1549
RasterPipeInterfaceRole
Raster pipe interface roles.
Definition qgis.h:1531
Brightness/contrast and gamma correction filter pipe for rasters.
Handles contrast enhancement and clipping.
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 an 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.
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.
void moveToThread(QThread *thread)
Moves the pipe to another thread.
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.
bool insert(int idx, QgsRasterInterface *interface)
Attempts to insert interface at specified index and connect if connection would fail,...
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.
Implements approximate projection support for optimised raster transformation.
Raster renderer pipe that applies colors to a raster.
Resample filter pipe for rasters.
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:267
#define SIP_TRANSFER
Definition qgis_sip.h:35
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.