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-05-18 15:15:27 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             :  * Permission is hereby granted, free of charge, to any person obtaining a
      12             :  * copy of this software and associated documentation files (the "Software"),
      13             :  * to deal in the Software without restriction, including without limitation
      14             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      15             :  * and/or sell copies of the Software, and to permit persons to whom the
      16             :  * Software is furnished to do so, subject to the following conditions:
      17             :  *
      18             :  * The above copyright notice and this permission notice shall be included
      19             :  * in all copies or substantial portions of the Software.
      20             :  *
      21             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      22             :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      24             :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      26             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      27             :  * DEALINGS IN THE SOFTWARE.
      28             :  ****************************************************************************/
      29             : 
      30             : #ifndef GTIFFRASTERBAND_H_INCLUDED
      31             : #define GTIFFRASTERBAND_H_INCLUDED
      32             : 
      33             : #include "gdal_pam.h"
      34             : 
      35             : #include "gtiff.h"
      36             : 
      37             : #include <set>
      38             : 
      39             : /************************************************************************/
      40             : /* ==================================================================== */
      41             : /*                            GTiffRasterBand                           */
      42             : /* ==================================================================== */
      43             : /************************************************************************/
      44             : 
      45             : class GTiffDataset;
      46             : 
      47             : class GTiffRasterBand CPL_NON_FINAL : public GDALPamRasterBand
      48             : {
      49             :     CPL_DISALLOW_COPY_ASSIGN(GTiffRasterBand)
      50             : 
      51             :     friend class GTiffDataset;
      52             : 
      53             :     double m_dfOffset = 0;
      54             :     double m_dfScale = 1;
      55             :     CPLString m_osUnitType{};
      56             :     CPLString m_osDescription{};
      57             :     GDALColorInterp m_eBandInterp = GCI_Undefined;
      58             :     std::set<GTiffRasterBand **> m_aSetPSelf{};
      59             :     bool m_bHaveOffsetScale = false;
      60             : 
      61             :     int DirectIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize,
      62             :                  int nYSize, void *pData, int nBufXSize, int nBufYSize,
      63             :                  GDALDataType eBufType, GSpacing nPixelSpace,
      64             :                  GSpacing nLineSpace, GDALRasterIOExtraArg *psExtraArg);
      65             : 
      66             :     static void DropReferenceVirtualMem(void *pUserData);
      67             :     CPLVirtualMem *GetVirtualMemAutoInternal(GDALRWFlag eRWFlag,
      68             :                                              int *pnPixelSpace,
      69             :                                              GIntBig *pnLineSpace,
      70             :                                              char **papszOptions);
      71             : 
      72             :     void *CacheMultiRange(int nXOff, int nYOff, int nXSize, int nYSize,
      73             :                           int nBufXSize, int nBufYSize,
      74             :                           GDALRasterIOExtraArg *psExtraArg);
      75             : 
      76             :   protected:
      77             :     GTiffDataset *m_poGDS = nullptr;
      78             :     GDALMultiDomainMetadata m_oGTiffMDMD{};
      79             : 
      80             :     double m_dfNoDataValue = DEFAULT_NODATA_VALUE;
      81             :     bool m_bNoDataSet = false;
      82             : 
      83             :     int64_t m_nNoDataValueInt64 = GDAL_PAM_DEFAULT_NODATA_VALUE_INT64;
      84             :     bool m_bNoDataSetAsInt64 = false;
      85             : 
      86             :     uint64_t m_nNoDataValueUInt64 = GDAL_PAM_DEFAULT_NODATA_VALUE_UINT64;
      87             :     bool m_bNoDataSetAsUInt64 = false;
      88             : 
      89             :     void NullBlock(void *pData);
      90             :     CPLErr FillCacheForOtherBands(int nBlockXOff, int nBlockYOff);
      91             :     void CacheMaskForBlock(int nBlockXOff, int nBlockYOff);
      92             :     void ResetNoDataValues(bool bResetDatasetToo);
      93             : 
      94             :     int ComputeBlockId(int nBlockXOff, int nBlockYOff) const;
      95             : 
      96             :   public:
      97             :     GTiffRasterBand(GTiffDataset *, int);
      98             :     virtual ~GTiffRasterBand();
      99             : 
     100        1972 :     virtual bool IsBaseGTiffClass() const
     101             :     {
     102        1972 :         return true;
     103             :     }
     104             : 
     105             :     virtual CPLErr IReadBlock(int, int, void *) override;
     106             :     virtual CPLErr IWriteBlock(int, int, void *) override;
     107             : 
     108             :     virtual GDALSuggestedBlockAccessPattern
     109         631 :     GetSuggestedBlockAccessPattern() const override
     110             :     {
     111         631 :         return GSBAP_RANDOM;
     112             :     }
     113             : 
     114             :     virtual int IGetDataCoverageStatus(int nXOff, int nYOff, int nXSize,
     115             :                                        int nYSize, int nMaskFlagStop,
     116             :                                        double *pdfDataPct) override;
     117             : 
     118             :     virtual CPLErr IRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff,
     119             :                              int nXSize, int nYSize, void *pData, int nBufXSize,
     120             :                              int nBufYSize, GDALDataType eBufType,
     121             :                              GSpacing nPixelSpace, GSpacing nLineSpace,
     122             :                              GDALRasterIOExtraArg *psExtraArg) override final;
     123             : 
     124             :     virtual const char *GetDescription() const override final;
     125             :     virtual void SetDescription(const char *) override final;
     126             : 
     127             :     virtual GDALColorInterp GetColorInterpretation() override /*final*/;
     128             :     virtual GDALColorTable *GetColorTable() override /*final*/;
     129             :     virtual CPLErr SetColorTable(GDALColorTable *) override final;
     130             : 
     131             :     CPLErr SetNoDataValue(double) override final;
     132             :     CPLErr SetNoDataValueAsInt64(int64_t nNoData) override final;
     133             :     CPLErr SetNoDataValueAsUInt64(uint64_t nNoData) override final;
     134             :     double GetNoDataValue(int *pbSuccess = nullptr) override final;
     135             :     int64_t GetNoDataValueAsInt64(int *pbSuccess = nullptr) override final;
     136             :     uint64_t GetNoDataValueAsUInt64(int *pbSuccess = nullptr) override final;
     137             :     CPLErr DeleteNoDataValue() override final;
     138             : 
     139             :     virtual double GetOffset(int *pbSuccess = nullptr) override final;
     140             :     virtual CPLErr SetOffset(double dfNewValue) override final;
     141             :     virtual double GetScale(int *pbSuccess = nullptr) override final;
     142             :     virtual CPLErr SetScale(double dfNewValue) override final;
     143             :     virtual const char *GetUnitType() override final;
     144             :     virtual CPLErr SetUnitType(const char *pszNewValue) override final;
     145             :     virtual CPLErr SetColorInterpretation(GDALColorInterp) override final;
     146             : 
     147             :     virtual char **GetMetadataDomainList() override final;
     148             :     virtual CPLErr SetMetadata(char **, const char * = "") override final;
     149             :     virtual char **GetMetadata(const char *pszDomain = "") override final;
     150             :     virtual CPLErr SetMetadataItem(const char *, const char *,
     151             :                                    const char * = "") override final;
     152             :     virtual const char *
     153             :     GetMetadataItem(const char *pszName,
     154             :                     const char *pszDomain = "") override final;
     155             :     virtual int GetOverviewCount() override final;
     156             :     virtual GDALRasterBand *GetOverview(int) override final;
     157             : 
     158             :     virtual GDALRasterBand *GetMaskBand() override final;
     159             :     virtual int GetMaskFlags() override final;
     160             :     virtual CPLErr CreateMaskBand(int nFlags) override final;
     161             :     virtual bool IsMaskBand() const override final;
     162             :     virtual GDALMaskValueRange GetMaskValueRange() const override final;
     163             : 
     164             :     virtual CPLVirtualMem *
     165             :     GetVirtualMemAuto(GDALRWFlag eRWFlag, int *pnPixelSpace,
     166             :                       GIntBig *pnLineSpace, char **papszOptions) override final;
     167             : 
     168             :     GDALRasterAttributeTable *GetDefaultRAT() override final;
     169             :     virtual CPLErr
     170             :     SetDefaultRAT(const GDALRasterAttributeTable *) override final;
     171             :     virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets,
     172             :                                 GUIntBig *panHistogram, int bIncludeOutOfRange,
     173             :                                 int bApproxOK, GDALProgressFunc,
     174             :                                 void *pProgressData) override final;
     175             : 
     176             :     virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax,
     177             :                                        int *pnBuckets, GUIntBig **ppanHistogram,
     178             :                                        int bForce, GDALProgressFunc,
     179             :                                        void *pProgressData) override final;
     180             : };
     181             : 
     182             : #endif  //  GTIFFRASTERBAND_H_INCLUDED

Generated by: LCOV version 1.14