/src/gdal/frmts/gtiff/gtiffrasterband.h
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /******************************************************************************  | 
2  |  |  *  | 
3  |  |  * Project:  GeoTIFF Driver  | 
4  |  |  * Purpose:  GDAL GeoTIFF support.  | 
5  |  |  * Author:   Frank Warmerdam, warmerdam@pobox.com  | 
6  |  |  *  | 
7  |  |  ******************************************************************************  | 
8  |  |  * Copyright (c) 1998, 2002, Frank Warmerdam <warmerdam@pobox.com>  | 
9  |  |  * Copyright (c) 2007-2015, Even Rouault <even dot rouault at spatialys dot com>  | 
10  |  |  *  | 
11  |  |  * SPDX-License-Identifier: MIT  | 
12  |  |  ****************************************************************************/  | 
13  |  |  | 
14  |  | #ifndef GTIFFRASTERBAND_H_INCLUDED  | 
15  |  | #define GTIFFRASTERBAND_H_INCLUDED  | 
16  |  |  | 
17  |  | #include "gdal_pam.h"  | 
18  |  | #include "gdal_rat.h"  | 
19  |  |  | 
20  |  | #include "gtiff.h"  | 
21  |  |  | 
22  |  | #include <set>  | 
23  |  |  | 
24  |  | /************************************************************************/  | 
25  |  | /* ==================================================================== */  | 
26  |  | /*                            GTiffRasterBand                           */  | 
27  |  | /* ==================================================================== */  | 
28  |  | /************************************************************************/  | 
29  |  |  | 
30  |  | class GTiffDataset;  | 
31  |  |  | 
32  |  | class GTiffRasterBand CPL_NON_FINAL : public GDALPamRasterBand  | 
33  |  | { | 
34  |  |     CPL_DISALLOW_COPY_ASSIGN(GTiffRasterBand)  | 
35  |  |  | 
36  |  |     friend class GTiffDataset;  | 
37  |  |  | 
38  |  |     double m_dfOffset = 0;  | 
39  |  |     double m_dfScale = 1;  | 
40  |  |     CPLString m_osUnitType{}; | 
41  |  |     CPLString m_osDescription{}; | 
42  |  |     GDALColorInterp m_eBandInterp = GCI_Undefined;  | 
43  |  |     std::set<GTiffRasterBand **> m_aSetPSelf{}; | 
44  |  |     bool m_bHaveOffsetScale = false;  | 
45  |  |     std::unique_ptr<GDALRasterAttributeTable> m_poRAT{}; | 
46  |  |  | 
47  |  |     int DirectIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,  | 
48  |  |                  int nYSize, void *pData, int nBufXSize, int nBufYSize,  | 
49  |  |                  GDALDataType eBufType, GSpacing nPixelSpace,  | 
50  |  |                  GSpacing nLineSpace, GDALRasterIOExtraArg *psExtraArg);  | 
51  |  |  | 
52  |  |     static void DropReferenceVirtualMem(void *pUserData);  | 
53  |  |     CPLVirtualMem *GetVirtualMemAutoInternal(GDALRWFlag eRWFlag,  | 
54  |  |                                              int *pnPixelSpace,  | 
55  |  |                                              GIntBig *pnLineSpace,  | 
56  |  |                                              char **papszOptions);  | 
57  |  |  | 
58  |  |   protected:  | 
59  |  |     GTiffDataset *m_poGDS = nullptr;  | 
60  |  |     GDALMultiDomainMetadata m_oGTiffMDMD{}; | 
61  |  |  | 
62  |  |     double m_dfNoDataValue = DEFAULT_NODATA_VALUE;  | 
63  |  |     bool m_bNoDataSet = false;  | 
64  |  |  | 
65  |  |     int64_t m_nNoDataValueInt64 = GDAL_PAM_DEFAULT_NODATA_VALUE_INT64;  | 
66  |  |     bool m_bNoDataSetAsInt64 = false;  | 
67  |  |  | 
68  |  |     uint64_t m_nNoDataValueUInt64 = GDAL_PAM_DEFAULT_NODATA_VALUE_UINT64;  | 
69  |  |     bool m_bNoDataSetAsUInt64 = false;  | 
70  |  |  | 
71  |  |     void NullBlock(void *pData);  | 
72  |  |     CPLErr FillCacheForOtherBands(int nBlockXOff, int nBlockYOff);  | 
73  |  |     void CacheMaskForBlock(int nBlockXOff, int nBlockYOff);  | 
74  |  |     void ResetNoDataValues(bool bResetDatasetToo);  | 
75  |  |  | 
76  |  |     int ComputeBlockId(int nBlockXOff, int nBlockYOff) const;  | 
77  |  |  | 
78  |  |   public:  | 
79  |  |     GTiffRasterBand(GTiffDataset *, int);  | 
80  |  |     virtual ~GTiffRasterBand();  | 
81  |  |  | 
82  |  |     virtual bool IsBaseGTiffClass() const  | 
83  | 0  |     { | 
84  | 0  |         return true;  | 
85  | 0  |     }  | 
86  |  |  | 
87  |  |     virtual CPLErr IReadBlock(int, int, void *) override;  | 
88  |  |     virtual CPLErr IWriteBlock(int, int, void *) override;  | 
89  |  |  | 
90  |  |     virtual GDALSuggestedBlockAccessPattern  | 
91  |  |     GetSuggestedBlockAccessPattern() const override  | 
92  | 0  |     { | 
93  | 0  |         return GSBAP_RANDOM;  | 
94  | 0  |     }  | 
95  |  |  | 
96  |  |     virtual int IGetDataCoverageStatus(int nXOff, int nYOff, int nXSize,  | 
97  |  |                                        int nYSize, int nMaskFlagStop,  | 
98  |  |                                        double *pdfDataPct) override;  | 
99  |  |  | 
100  |  |     virtual CPLErr IRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff,  | 
101  |  |                              int nXSize, int nYSize, void *pData, int nBufXSize,  | 
102  |  |                              int nBufYSize, GDALDataType eBufType,  | 
103  |  |                              GSpacing nPixelSpace, GSpacing nLineSpace,  | 
104  |  |                              GDALRasterIOExtraArg *psExtraArg) override final;  | 
105  |  |  | 
106  |  |     virtual const char *GetDescription() const override final;  | 
107  |  |     virtual void SetDescription(const char *) override final;  | 
108  |  |  | 
109  |  |     virtual GDALColorInterp GetColorInterpretation() override /*final*/;  | 
110  |  |     virtual GDALColorTable *GetColorTable() override /*final*/;  | 
111  |  |     virtual CPLErr SetColorTable(GDALColorTable *) override final;  | 
112  |  |  | 
113  |  |     CPLErr SetNoDataValue(double) override final;  | 
114  |  |     CPLErr SetNoDataValueAsInt64(int64_t nNoData) override final;  | 
115  |  |     CPLErr SetNoDataValueAsUInt64(uint64_t nNoData) override final;  | 
116  |  |     double GetNoDataValue(int *pbSuccess = nullptr) override final;  | 
117  |  |     int64_t GetNoDataValueAsInt64(int *pbSuccess = nullptr) override final;  | 
118  |  |     uint64_t GetNoDataValueAsUInt64(int *pbSuccess = nullptr) override final;  | 
119  |  |     CPLErr DeleteNoDataValue() override final;  | 
120  |  |  | 
121  |  |     virtual double GetOffset(int *pbSuccess = nullptr) override final;  | 
122  |  |     virtual CPLErr SetOffset(double dfNewValue) override final;  | 
123  |  |     virtual double GetScale(int *pbSuccess = nullptr) override final;  | 
124  |  |     virtual CPLErr SetScale(double dfNewValue) override final;  | 
125  |  |     virtual const char *GetUnitType() override final;  | 
126  |  |     virtual CPLErr SetUnitType(const char *pszNewValue) override final;  | 
127  |  |     virtual CPLErr SetColorInterpretation(GDALColorInterp) override final;  | 
128  |  |  | 
129  |  |     virtual char **GetMetadataDomainList() override final;  | 
130  |  |     virtual CPLErr SetMetadata(char **, const char * = "") override final;  | 
131  |  |     virtual char **GetMetadata(const char *pszDomain = "") override final;  | 
132  |  |     virtual CPLErr SetMetadataItem(const char *, const char *,  | 
133  |  |                                    const char * = "") override final;  | 
134  |  |     virtual const char *  | 
135  |  |     GetMetadataItem(const char *pszName,  | 
136  |  |                     const char *pszDomain = "") override final;  | 
137  |  |     virtual int GetOverviewCount() override final;  | 
138  |  |     virtual GDALRasterBand *GetOverview(int) override final;  | 
139  |  |  | 
140  |  |     virtual GDALRasterBand *GetMaskBand() override final;  | 
141  |  |     virtual int GetMaskFlags() override final;  | 
142  |  |     virtual CPLErr CreateMaskBand(int nFlags) override final;  | 
143  |  |     virtual bool IsMaskBand() const override final;  | 
144  |  |     virtual GDALMaskValueRange GetMaskValueRange() const override final;  | 
145  |  |  | 
146  |  |     virtual CPLVirtualMem *  | 
147  |  |     GetVirtualMemAuto(GDALRWFlag eRWFlag, int *pnPixelSpace,  | 
148  |  |                       GIntBig *pnLineSpace, char **papszOptions) override final;  | 
149  |  |  | 
150  |  |     GDALRasterAttributeTable *GetDefaultRAT() override final;  | 
151  |  |     virtual CPLErr  | 
152  |  |     SetDefaultRAT(const GDALRasterAttributeTable *) override final;  | 
153  |  |     virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets,  | 
154  |  |                                 GUIntBig *panHistogram, int bIncludeOutOfRange,  | 
155  |  |                                 int bApproxOK, GDALProgressFunc,  | 
156  |  |                                 void *pProgressData) override final;  | 
157  |  |  | 
158  |  |     virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax,  | 
159  |  |                                        int *pnBuckets, GUIntBig **ppanHistogram,  | 
160  |  |                                        int bForce, GDALProgressFunc,  | 
161  |  |                                        void *pProgressData) override final;  | 
162  |  | };  | 
163  |  |  | 
164  |  | #endif  //  GTIFFRASTERBAND_H_INCLUDED  |