1 /*************************************************************************** 2 qgsraster.h - Raster namespace 3 -------------------------------------- 4 Date : Apr 2013 5 Copyright : (C) 2013 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 QGSRASTER_H 19 #define QGSRASTER_H 20 21 #include "qgis_core.h" 22 #include "qgis_sip.h" 23 #include <QString> 24 25 #include "qgis.h" 26 27 /** 28 * \ingroup core 29 * \brief Raster namespace. 30 */ 31 class CORE_EXPORT QgsRaster 32 { 33 public: 34 // This is modified copy of GDALColorInterp 35 enum ColorInterpretation 36 { 37 UndefinedColorInterpretation = 0, 38 GrayIndex = 1, //!< Greyscale 39 PaletteIndex = 2, //!< Paletted (see associated color table) 40 RedBand = 3, //!< Red band of RGBA image 41 GreenBand = 4, //!< Green band of RGBA image 42 BlueBand = 5, //!< Blue band of RGBA image 43 AlphaBand = 6, //!< Alpha (0=transparent, 255=opaque) 44 HueBand = 7, //!< Hue band of HLS image 45 SaturationBand = 8, //!< Saturation band of HLS image 46 LightnessBand = 9, //!< Lightness band of HLS image 47 CyanBand = 10, //!< Cyan band of CMYK image 48 MagentaBand = 11, //!< Magenta band of CMYK image 49 YellowBand = 12, //!< Yellow band of CMYK image 50 BlackBand = 13, //!< Black band of CMLY image 51 YCbCr_YBand = 14, //!< Y Luminance 52 YCbCr_CbBand = 15, //!< Cb Chroma 53 YCbCr_CrBand = 16, //!< Cr Chroma 54 ContinuousPalette = 17 //!< Continuous palette, QGIS addition, GRASS 55 }; 56 57 enum IdentifyFormat 58 { 59 IdentifyFormatUndefined = 0, 60 IdentifyFormatValue = 1, // numerical pixel value 61 IdentifyFormatText = 1 << 1, // WMS text 62 IdentifyFormatHtml = 1 << 2, // WMS HTML 63 IdentifyFormatFeature = 1 << 3, // WMS GML/JSON -> feature 64 }; 65 66 // Progress types 67 enum RasterProgressType 68 { 69 ProgressHistogram = 0, 70 ProgressPyramids = 1, 71 ProgressStatistics = 2 72 }; 73 74 enum RasterBuildPyramids 75 { 76 PyramidsFlagNo = 0, 77 PyramidsFlagYes = 1, 78 PyramidsCopyExisting = 2 79 }; 80 81 enum RasterPyramidsFormat 82 { 83 PyramidsGTiff = 0, 84 PyramidsInternal = 1, 85 PyramidsErdas = 2 86 }; 87 88 //! \brief This enumerator describes the different kinds of drawing we can do 89 enum DrawingStyle 90 { 91 UndefinedDrawingStyle, 92 SingleBandGray, // a single band image drawn as a range of gray colors 93 SingleBandPseudoColor, // a single band image drawn using a pseudocolor algorithm 94 PalettedColor, // a "Palette" image drawn using color table 95 PalettedSingleBandGray, // a "Palette" layer drawn in gray scale 96 PalettedSingleBandPseudoColor, // a "Palette" layerdrawn using a pseudocolor algorithm 97 PalettedMultiBandColor, // currently not supported 98 MultiBandSingleBandGray, // a layer containing 2 or more bands, but a single band drawn as a range of gray colors 99 MultiBandSingleBandPseudoColor, // a layer containing 2 or more bands, but a single band drawn using a pseudocolor algorithm 100 MultiBandColor, // a layer containing 2 or more bands, mapped to RGB color space. In the case of a multiband with only two bands, one band will be mapped to more than one color. 101 SingleBandColorDataStyle // ARGB values rendered directly 102 }; 103 104 /** 105 * Check if the specified value is representable in the given data type. 106 * Supported are numerical types Byte, UInt16, Int16, UInt32, Int32, Float32, Float64. 107 * \param value 108 * \param dataType 109 * \note not available in Python bindings 110 * \since QGIS 2.16 111 */ 112 static bool isRepresentableValue( double value, Qgis::DataType dataType ) SIP_SKIP; 113 114 /** 115 * Gets value representable by given data type. 116 * Supported are numerical types Byte, UInt16, Int16, UInt32, Int32, Float32, Float64. 117 * This is done through C casting, so you have to be sure that the provided value is 118 * representable in the output data type. This can be checked with isRepresentableValue(). 119 * \param value 120 * \param dataType 121 * \since QGIS 2.1 122 */ 123 static double representableValue( double value, Qgis::DataType dataType ); 124 }; 125 126 #endif 127 128 129