QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 <QImage>
22 #include <QMap>
23 #include <QObject>
24 
26 #include "qgshuesaturationfilter.h"
27 #include "qgsrasterdataprovider.h"
28 #include "qgsrasterinterface.h"
29 #include "qgsrasternuller.h"
30 #include "qgsrasterprojector.h"
31 #include "qgsrasterrenderer.h"
33 #include "qgsrectangle.h"
34 
35 #if defined(Q_OS_WIN)
36 #undef interface
37 #endif
38 
42 class CORE_EXPORT QgsRasterPipe
43 {
44  public:
45  // Role of known interfaces
46  enum Role
47  {
48  UnknownRole = 0,
49  ProviderRole = 1,
50  RendererRole = 2,
51  BrightnessRole = 3,
52  ResamplerRole = 4,
53  ProjectorRole = 5,
54  NullerRole = 6,
55  HueSaturationRole = 7
56  };
57 
58  QgsRasterPipe();
59  QgsRasterPipe( const QgsRasterPipe& thePipe );
60 
61  ~QgsRasterPipe();
62 
65  bool insert( int idx, QgsRasterInterface* theInterface );
66 
69  bool replace( int idx, QgsRasterInterface* theInterface );
70 
77  bool set( QgsRasterInterface * theInterface );
78 
80  bool remove( int idx );
81 
83  bool remove( QgsRasterInterface * theInterface );
84 
85  int size() const { return mInterfaces.size(); }
86  QgsRasterInterface * at( int idx ) const { return mInterfaces.at( idx ); }
87  QgsRasterInterface * last() const { return mInterfaces.last(); }
88 
91  bool setOn( int idx, bool on );
92 
94  bool canSetOn( int idx, bool on );
95 
96  // Getters for special types of interfaces
97  QgsRasterDataProvider * provider() const;
98  QgsRasterRenderer * renderer() const;
99  QgsRasterResampleFilter * resampleFilter() const;
100  QgsBrightnessContrastFilter * brightnessFilter() const;
101  QgsHueSaturationFilter * hueSaturationFilter() const;
102  QgsRasterProjector * projector() const;
103  QgsRasterNuller * nuller() const;
104 
105  private:
107  Role interfaceRole( QgsRasterInterface * iface ) const;
108 
109  // Interfaces in pipe, the first is always provider
110  QVector<QgsRasterInterface*> mInterfaces;
111 
112  QMap<Role, int> mRoleMap;
113 
114  // Set role in mRoleMap
115  void setRole( QgsRasterInterface * theInterface, int idx );
116 
117  // Unset role in mRoleMap
118  void unsetRole( QgsRasterInterface * theInterface );
119 
120  // Check if index is in bounds
121  bool checkBounds( int idx ) const;
122 
124  QgsRasterInterface * interface( Role role ) const;
125 
128  bool connect( QVector<QgsRasterInterface*> theInterfaces );
129 
130  QgsRasterPipe& operator=( const QgsRasterPipe& rh );
131 };
132 
133 #endif
134 
135 
Base class for processing modules.
Definition: qgsrasterpipe.h:42
Raster pipe that deals with null values.
QgsRasterInterface * last() const
Definition: qgsrasterpipe.h:87
Resample filter pipe for rasters.
QgsRasterInterface * at(int idx) const
Definition: qgsrasterpipe.h:86
Base class for processing filters like renderers, reprojector, resampler etc.
int size() const
Definition: qgsrasterpipe.h:85
QgsRasterProjector implements approximate projection support for it calculates grid of points in sour...
Brightness/contrast filter pipe for rasters.
Color and saturation filter pipe for rasters.
Raster renderer pipe that applies colors to a raster.
Base class for raster data providers.