QGIS API Documentation  2.99.0-Master (c558d51)
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 
25 class QgsRasterInterface;
26 class QgsRasterRenderer;
30 class QgsRasterProjector;
31 class QgsRasterNuller;
35 
36 #if defined(Q_OS_WIN)
37 #undef interface
38 #endif
39 
43 class CORE_EXPORT QgsRasterPipe
44 {
45  public:
46  // Role of known interfaces
47  enum Role
48  {
49  UnknownRole = 0,
50  ProviderRole = 1,
51  RendererRole = 2,
52  BrightnessRole = 3,
53  ResamplerRole = 4,
54  ProjectorRole = 5,
55  NullerRole = 6,
56  HueSaturationRole = 7
57  };
58 
59  QgsRasterPipe();
60  QgsRasterPipe( const QgsRasterPipe& thePipe );
61 
62  ~QgsRasterPipe();
63 
66  bool insert( int idx, QgsRasterInterface* theInterface );
67 
70  bool replace( int idx, QgsRasterInterface* theInterface );
71 
78  bool set( QgsRasterInterface * theInterface );
79 
81  bool remove( int idx );
82 
84  bool remove( QgsRasterInterface * theInterface );
85 
86  int size() const { return mInterfaces.size(); }
87  QgsRasterInterface * at( int idx ) const { return mInterfaces.at( idx ); }
88  QgsRasterInterface * last() const { return mInterfaces.last(); }
89 
92  bool setOn( int idx, bool on );
93 
95  bool canSetOn( int idx, bool on );
96 
97  // Getters for special types of interfaces
98  QgsRasterDataProvider * provider() const;
99  QgsRasterRenderer * renderer() const;
100  QgsRasterResampleFilter * resampleFilter() const;
101  QgsBrightnessContrastFilter * brightnessFilter() const;
102  QgsHueSaturationFilter * hueSaturationFilter() const;
103  QgsRasterProjector * projector() const;
104  QgsRasterNuller * nuller() const;
105 
106  private:
108  Role interfaceRole( QgsRasterInterface * iface ) const;
109 
110  // Interfaces in pipe, the first is always provider
111  QVector<QgsRasterInterface*> mInterfaces;
112 
113  QMap<Role, int> mRoleMap;
114 
115  // Set role in mRoleMap
116  void setRole( QgsRasterInterface * theInterface, int idx );
117 
118  // Unset role in mRoleMap
119  void unsetRole( QgsRasterInterface * theInterface );
120 
121  // Check if index is in bounds
122  bool checkBounds( int idx ) const;
123 
125  QgsRasterInterface * interface( Role role ) const;
126 
129  bool connect( QVector<QgsRasterInterface*> theInterfaces );
130 
131  QgsRasterPipe& operator=( const QgsRasterPipe& rh );
132 };
133 
134 #endif
135 
136 
Base class for processing modules.
Definition: qgsrasterpipe.h:43
QgsRasterInterface * at(int idx) const
Definition: qgsrasterpipe.h:87
Raster pipe that deals with null values.
QgsRasterInterface * last() const
Definition: qgsrasterpipe.h:88
Resample filter pipe for rasters.
int size() const
Definition: qgsrasterpipe.h:86
Base class for processing filters like renderers, reprojector, resampler etc.
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.
Manipulates raster pixel values so that they enhanceContrast or clip into a specified numerical range...
Raster renderer pipe that applies colors to a raster.
Base class for raster data providers.