|
QGIS API Documentation
master-59fd5e0
|
00001 /*************************************************************************** 00002 qgsrasterpipe.h - Internal raster processing modules interface 00003 -------------------------------------- 00004 Date : Jun 21, 2012 00005 Copyright : (C) 2012 by Radim Blazek 00006 email : radim dot blazek at gmail dot com 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef QGSRASTERPIPE_H 00019 #define QGSRASTERPIPE_H 00020 00021 #include <QImage> 00022 #include <QObject> 00023 00024 #include "qgsbrightnesscontrastfilter.h" 00025 #include "qgshuesaturationfilter.h" 00026 #include "qgsrasterdataprovider.h" 00027 #include "qgsrasterinterface.h" 00028 #include "qgsrasternuller.h" 00029 #include "qgsrasterprojector.h" 00030 #include "qgsrasterrenderer.h" 00031 #include "qgsrasterresamplefilter.h" 00032 #include "qgsrectangle.h" 00033 00034 #if defined(Q_OS_WIN) 00035 #undef interface 00036 #endif 00037 00041 class CORE_EXPORT QgsRasterPipe 00042 { 00043 public: 00044 // Role of known interfaces 00045 enum Role 00046 { 00047 UnknownRole = 0, 00048 ProviderRole = 1, 00049 RendererRole = 2, 00050 BrightnessRole = 3, 00051 ResamplerRole = 4, 00052 ProjectorRole = 5, 00053 NullerRole = 6, 00054 HueSaturationRole = 7 00055 }; 00056 00057 QgsRasterPipe(); 00058 QgsRasterPipe( const QgsRasterPipe& thePipe ); 00059 00060 ~QgsRasterPipe(); 00061 00064 bool insert( int idx, QgsRasterInterface* theInterface ); 00065 00068 bool replace( int idx, QgsRasterInterface* theInterface ); 00069 00076 bool set( QgsRasterInterface * theInterface ); 00077 00079 bool remove( int idx ); 00080 00082 bool remove( QgsRasterInterface * theInterface ); 00083 00084 int size() const { return mInterfaces.size(); } 00085 QgsRasterInterface * at( int idx ) const { return mInterfaces.at( idx ); } 00086 QgsRasterInterface * last() const { return mInterfaces.last(); } 00087 00090 bool setOn( int idx, bool on ); 00091 00093 bool canSetOn( int idx, bool on ); 00094 00095 // Getters for special types of interfaces 00096 QgsRasterDataProvider * provider() const; 00097 QgsRasterRenderer * renderer() const; 00098 QgsRasterResampleFilter * resampleFilter() const; 00099 QgsBrightnessContrastFilter * brightnessFilter() const; 00100 QgsHueSaturationFilter * hueSaturationFilter() const; 00101 QgsRasterProjector * projector() const; 00102 QgsRasterNuller * nuller() const; 00103 00104 private: 00106 Role interfaceRole( QgsRasterInterface * iface ) const; 00107 00108 // Interfaces in pipe, the first is always provider 00109 QVector<QgsRasterInterface*> mInterfaces; 00110 00111 QMap<Role, int> mRoleMap; 00112 00113 // Set role in mRoleMap 00114 void setRole( QgsRasterInterface * theInterface, int idx ); 00115 00116 // Unset role in mRoleMap 00117 void unsetRole( QgsRasterInterface * theInterface ); 00118 00119 // Check if index is in bounds 00120 bool checkBounds( int idx ) const; 00121 00123 QgsRasterInterface * interface( Role role ) const; 00124 00127 bool connect( QVector<QgsRasterInterface*> theInterfaces ); 00128 }; 00129 00130 #endif 00131 00132