1 /* 2 * $Id: keaband.h 29258 2015-05-28 22:08:43Z rouault $ 3 * keaband.h 4 * 5 * Created by Pete Bunting on 01/08/2012. 6 * Copyright 2012 LibKEA. All rights reserved. 7 * 8 * This file is part of LibKEA. 9 * 10 * Permission is hereby granted, free of charge, to any person 11 * obtaining a copy of this software and associated documentation 12 * files (the "Software"), to deal in the Software without restriction, 13 * including without limitation the rights to use, copy, modify, 14 * merge, publish, distribute, sublicense, and/or sell copies of the 15 * Software, and to permit persons to whom the Software is furnished 16 * to do so, subject to the following conditions: 17 * 18 * The above copyright notice and this permission notice shall be 19 * included in all copies or substantial portions of the Software. 20 * 21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 25 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 26 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 * 29 */ 30 31 #ifndef KEABAND_H 32 #define KEABAND_H 33 34 #include "gdal_pam.h" 35 #if defined(USE_GCC_VISIBILITY_FLAG) && !defined(DllExport) 36 #define DllExport CPL_DLL 37 #endif 38 #include "keadataset.h" 39 40 class KEAOverview; 41 class KEAMaskBand; 42 43 // Provides the implementation of a GDAL raster band 44 class KEARasterBand : public GDALPamRasterBand 45 { 46 private: 47 int *m_pnRefCount; // reference count of m_pImageIO 48 49 int m_nOverviews; // number of overviews 50 KEAOverview **m_panOverviewBands; // array of overview objects 51 GDALRasterBand *m_pMaskBand; // pointer to mask band if one exists (and been requested) 52 bool m_bMaskBandOwned; // do we delete it or not? 53 54 GDALRasterAttributeTable *m_pAttributeTable; // pointer to the attribute table 55 // created on first call to GetDefaultRAT() 56 GDALColorTable *m_pColorTable; // pointer to the color table 57 // created on first call to GetColorTable() 58 59 int m_nAttributeChunkSize; // for reporting via the metadata 60 public: 61 // constructor/destructor 62 KEARasterBand( KEADataset *pDataset, int nSrcBand, GDALAccess eAccess, kealib::KEAImageIO *pImageIO, int *pRefCount ); 63 ~KEARasterBand(); 64 65 // virtual methods for overview support 66 int GetOverviewCount(); 67 GDALRasterBand* GetOverview(int nOverview); 68 69 // virtual methods for band names (aka description) 70 void SetDescription(const char *); 71 72 // virtual methods for handling the metadata 73 CPLErr SetMetadataItem (const char *pszName, const char *pszValue, const char *pszDomain=""); 74 const char *GetMetadataItem (const char *pszName, const char *pszDomain=""); 75 char **GetMetadata(const char *pszDomain=""); 76 CPLErr SetMetadata(char **papszMetadata, const char *pszDomain=""); 77 78 // virtual methods for the no data value 79 double GetNoDataValue(int *pbSuccess=NULL); 80 CPLErr SetNoDataValue(double dfNoData); 81 82 // virtual methods for RATs 83 GDALRasterAttributeTable *GetDefaultRAT(); 84 CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT); 85 86 // virtual methods for color tables 87 GDALColorTable *GetColorTable(); 88 CPLErr SetColorTable(GDALColorTable *poCT); 89 90 // virtual methods for color interpretation 91 GDALColorInterp GetColorInterpretation(); 92 CPLErr SetColorInterpretation(GDALColorInterp gdalinterp); 93 94 // virtual mthods for band masks 95 CPLErr CreateMaskBand(int nFlags); 96 GDALRasterBand* GetMaskBand(); 97 int GetMaskFlags(); 98 99 // internal methods for overviews 100 void readExistingOverviews(); 101 void deleteOverviewObjects(); 102 void CreateOverviews(int nOverviews, int *panOverviewList); GetOverviewList()103 KEAOverview** GetOverviewList() { return m_panOverviewBands; } 104 105 protected: 106 // methods for accessing data as blocks 107 virtual CPLErr IReadBlock( int, int, void * ); 108 virtual CPLErr IWriteBlock( int, int, void * ); 109 110 // updates m_papszMetadataList 111 void UpdateMetadataList(); 112 113 kealib::KEAImageIO *m_pImageIO; // our image access pointer - refcounted 114 char **m_papszMetadataList; // CPLStringList of metadata 115 kealib::KEADataType m_eKEADataType; // data type as KEA enum 116 }; 117 118 119 #endif //KEABAND_H 120