QGIS API Documentation  master-6227475
src/core/raster/qgssinglebandgrayrenderer.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                          qgssinglebandgrayrenderer.h
00003                          ---------------------------
00004     begin                : December 2011
00005     copyright            : (C) 2011 by Marco Hugentobler
00006     email                : marco at sourcepole dot ch
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 QGSSINGLEBANDGRAYRENDERER_H
00019 #define QGSSINGLEBANDGRAYRENDERER_H
00020 
00021 #include "qgsrasterrenderer.h"
00022 
00023 class QgsContrastEnhancement;
00024 class QDomElement;
00025 
00029 class CORE_EXPORT QgsSingleBandGrayRenderer: public QgsRasterRenderer
00030 {
00031   public:
00032     enum Gradient
00033     {
00034       BlackToWhite,
00035       WhiteToBlack
00036     };
00037 
00038     QgsSingleBandGrayRenderer( QgsRasterInterface* input, int grayBand );
00039     ~QgsSingleBandGrayRenderer();
00040     QgsRasterInterface * clone() const;
00041 
00042     static QgsRasterRenderer* create( const QDomElement& elem, QgsRasterInterface* input );
00043 
00044     QgsRasterBlock *block( int bandNo, QgsRectangle  const & extent, int width, int height );
00045 
00046     int grayBand() const { return mGrayBand; }
00047     void setGrayBand( int band ) { mGrayBand = band; }
00048     const QgsContrastEnhancement* contrastEnhancement() const { return mContrastEnhancement; }
00050     void setContrastEnhancement( QgsContrastEnhancement* ce );
00051 
00052     void setGradient( Gradient theGradient ) { mGradient = theGradient; }
00053     Gradient gradient() const { return mGradient; }
00054 
00055     void writeXML( QDomDocument& doc, QDomElement& parentElem ) const;
00056 
00057     void legendSymbologyItems( QList< QPair< QString, QColor > >& symbolItems ) const;
00058 
00059     QList<int> usesBands() const;
00060 
00061   private:
00062     int mGrayBand;
00063     Gradient mGradient;
00064     QgsContrastEnhancement* mContrastEnhancement;
00065 };
00066 
00067 #endif // QGSSINGLEBANDGRAYRENDERER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines