LCOV - code coverage report
Current view: top level - frmts/gtiff - gtiffrasterband.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 4 4 100.0 %
Date: 2024-11-21 22:18:42 Functions: 2 2 100.0 %

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

Generated by: LCOV version 1.14