QGIS API Documentation  2.99.0-Master (0a63d1f)
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 <QImage>
23 #include <QMap>
24 #include <QObject>
25 
26 class QgsRasterInterface;
27 class QgsRasterRenderer;
31 class QgsRasterProjector;
32 class QgsRasterNuller;
36 
37 #if defined(Q_OS_WIN)
38 #undef interface
39 #endif
40 
44 class CORE_EXPORT QgsRasterPipe
45 {
46  public:
47  // Role of known interfaces
48  enum Role
49  {
50  UnknownRole = 0,
51  ProviderRole = 1,
52  RendererRole = 2,
53  BrightnessRole = 3,
54  ResamplerRole = 4,
55  ProjectorRole = 5,
56  NullerRole = 6,
57  HueSaturationRole = 7
58  };
59 
60  QgsRasterPipe();
61  QgsRasterPipe( const QgsRasterPipe& thePipe );
62 
63  ~QgsRasterPipe();
64 
65  QgsRasterPipe& operator=( const QgsRasterPipe& rh ) = delete;
66 
69  bool insert( int idx, QgsRasterInterface* theInterface );
70 
73  bool replace( int idx, QgsRasterInterface* theInterface );
74 
81  bool set( QgsRasterInterface * theInterface );
82 
84  bool remove( int idx );
85 
87  bool remove( QgsRasterInterface * theInterface );
88 
89  int size() const { return mInterfaces.size(); }
90  QgsRasterInterface * at( int idx ) const { return mInterfaces.at( idx ); }
91  QgsRasterInterface * last() const { return mInterfaces.last(); }
92 
95  bool setOn( int idx, bool on );
96 
98  bool canSetOn( int idx, bool on );
99 
100  // Getters for special types of interfaces
101  QgsRasterDataProvider * provider() const;
102  QgsRasterRenderer * renderer() const;
103  QgsRasterResampleFilter * resampleFilter() const;
104  QgsBrightnessContrastFilter * brightnessFilter() const;
105  QgsHueSaturationFilter * hueSaturationFilter() const;
106  QgsRasterProjector * projector() const;
107  QgsRasterNuller * nuller() const;
108 
109  private:
111  Role interfaceRole( QgsRasterInterface * iface ) const;
112 
113  // Interfaces in pipe, the first is always provider
114  QVector<QgsRasterInterface*> mInterfaces;
115 
116  QMap<Role, int> mRoleMap;
117 
118  // Set role in mRoleMap
119  void setRole( QgsRasterInterface * theInterface, int idx );
120 
121  // Unset role in mRoleMap
122  void unsetRole( QgsRasterInterface * theInterface );
123 
124  // Check if index is in bounds
125  bool checkBounds( int idx ) const;
126 
128  QgsRasterInterface * interface( Role role ) const;
129 
132  bool connect( QVector<QgsRasterInterface*> theInterfaces );
133 
134 };
135 
136 #endif
137 
138 
Base class for processing modules.
Definition: qgsrasterpipe.h:44
Raster pipe that deals with null values.
QgsRasterInterface * last() const
Definition: qgsrasterpipe.h:91
Resample filter pipe for rasters.
QgsRasterInterface * at(int idx) const
Definition: qgsrasterpipe.h:90
Base class for processing filters like renderers, reprojector, resampler etc.
int size() const
Definition: qgsrasterpipe.h:89
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.