30 #ifndef GDAL_PROXY_H_INCLUDED
31 #define GDAL_PROXY_H_INCLUDED
51 virtual GDALDataset *RefUnderlyingDataset()
const = 0;
52 virtual void UnrefUnderlyingDataset(
GDALDataset* poUnderlyingDataset)
const;
54 CPLErr IBuildOverviews(
const char *,
57 GDALProgressFunc,
void *,
66 char **
GetMetadata(
const char * pszDomain )
override;
68 const char * pszDomain )
override;
70 const char * pszDomain )
override;
72 const char * pszValue,
73 const char * pszDomain )
override;
94 int nBufXSize,
int nBufYSize,
96 int nBandCount,
int *panBandList,
97 char **papszOptions )
override;
112 GDALProxyRasterBand() {}
115 virtual void UnrefUnderlyingRasterBand(
GDALRasterBand* poUnderlyingRasterBand)
const;
125 char **
GetMetadata(
const char * pszDomain )
override;
127 const char * pszDomain )
override;
129 const char * pszDomain )
override;
131 const char * pszValue,
132 const char * pszDomain )
override;
136 double GetMinimum(
int *pbSuccess =
nullptr )
override;
137 double GetMaximum(
int *pbSuccess =
nullptr )
override;
138 double GetOffset(
int *pbSuccess =
nullptr )
override;
139 double GetScale(
int *pbSuccess =
nullptr )
override;
143 CPLErr Fill(
double dfRealValue,
double dfImaginaryValue = 0)
override;
155 double *pdfMin,
double *pdfMax,
156 double *pdfMean,
double *padfStdDev )
override;
158 double *pdfMin,
double *pdfMax,
159 double *pdfMean,
double *pdfStdDev,
160 GDALProgressFunc,
void *pProgressData )
override;
162 double dfMean,
double dfStdDev )
override;
170 GDALProgressFunc,
void *,
CSLConstList papszOptions )
override;
173 int nBufXSize,
int nBufYSize,
177 int nBuckets,
GUIntBig * panHistogram,
178 int bIncludeOutOfRange,
int bApproxOK,
179 GDALProgressFunc,
void *pProgressData )
override;
182 int *pnBuckets,
GUIntBig ** ppanHistogram,
184 GDALProgressFunc,
void *pProgressData)
override;
186 int nBuckets,
GUIntBig *panHistogram )
override;
200 char **papszOptions )
override;
210 typedef struct _GDALProxyPoolCacheEntry GDALProxyPoolCacheEntry;
211 class GDALProxyPoolRasterBand;
213 class CPL_DLL GDALProxyPoolDataset :
public GDALProxyDataset
218 mutable char *pszProjectionRef =
nullptr;
221 double adfGeoTransform[6]{0,1,0,0,0,1};
222 bool m_bHasSrcSRS =
false;
223 bool bHasSrcGeoTransform =
false;
224 char *pszGCPProjection =
nullptr;
230 mutable GDALProxyPoolCacheEntry* cacheEntry =
nullptr;
231 char *m_pszOwner =
nullptr;
233 GDALDataset *RefUnderlyingDataset(
bool bForceOpen)
const;
235 GDALProxyPoolDataset(
const char* pszSourceDatasetDescription,
238 const char* pszOwner );
241 GDALDataset *RefUnderlyingDataset()
const override;
242 void UnrefUnderlyingDataset(
GDALDataset* poUnderlyingDataset)
const override;
244 friend class GDALProxyPoolRasterBand;
247 GDALProxyPoolDataset(
const char* pszSourceDatasetDescription,
248 int nRasterXSize,
int nRasterYSize,
251 const char * pszProjectionRef =
nullptr,
252 double * padfGeoTransform =
nullptr,
253 const char* pszOwner =
nullptr );
256 static GDALProxyPoolDataset* Create(
const char* pszSourceDatasetDescription,
260 const char* pszOwner =
nullptr );
262 ~GDALProxyPoolDataset()
override;
270 void AddSrcBandDescription(
GDALDataType eDataType,
int nBlockXSize,
276 void AddSrcBand(
int nBand,
GDALDataType eDataType,
int nBlockXSize,
278 void FlushCache(
bool bAtClosing)
override;
283 CPLErr GetGeoTransform(
double * )
override;
284 CPLErr SetGeoTransform(
double * )
override;
289 char **GetMetadata(
const char * pszDomain )
override;
290 const char *GetMetadataItem(
const char * pszName,
291 const char * pszDomain )
override;
293 void *GetInternalHandle(
const char * pszRequest )
override;
306 class GDALProxyPoolOverviewRasterBand;
307 class GDALProxyPoolMaskBand;
309 class CPL_DLL GDALProxyPoolRasterBand :
public GDALProxyRasterBand
314 char *pszUnitType =
nullptr;
315 char **papszCategoryNames =
nullptr;
318 int nSizeProxyOverviewRasterBand = 0;
319 GDALProxyPoolOverviewRasterBand **papoProxyOverviewRasterBand =
nullptr;
320 GDALProxyPoolMaskBand *poProxyMaskBand =
nullptr;
326 void UnrefUnderlyingRasterBand(
GDALRasterBand* poUnderlyingRasterBand )
329 friend class GDALProxyPoolOverviewRasterBand;
330 friend class GDALProxyPoolMaskBand;
333 GDALProxyPoolRasterBand( GDALProxyPoolDataset* poDS,
int nBand,
335 int nBlockXSize,
int nBlockYSize );
336 GDALProxyPoolRasterBand( GDALProxyPoolDataset* poDS,
338 ~GDALProxyPoolRasterBand()
override;
340 void AddSrcMaskBandDescription(
GDALDataType eDataType,
int nBlockXSize,
343 void AddSrcMaskBandDescriptionFromUnderlying();
348 char **GetMetadata(
const char * pszDomain )
override;
349 const char *GetMetadataItem(
const char * pszName,
350 const char * pszDomain )
override;
351 char **GetCategoryNames()
override;
352 const char *GetUnitType()
override;
358 CPLErr FlushCache(
bool bAtClosing)
override;
368 class GDALProxyPoolOverviewRasterBand :
public GDALProxyPoolRasterBand
371 GDALProxyPoolRasterBand *poMainBand =
nullptr;
372 int nOverviewBand = 0;
375 mutable int nRefCountUnderlyingMainRasterBand = 0;
381 void UnrefUnderlyingRasterBand(
GDALRasterBand* poUnderlyingRasterBand )
385 GDALProxyPoolOverviewRasterBand( GDALProxyPoolDataset* poDS,
387 GDALProxyPoolRasterBand* poMainBand,
389 ~GDALProxyPoolOverviewRasterBand()
override;
396 class GDALProxyPoolMaskBand :
public GDALProxyPoolRasterBand
399 GDALProxyPoolRasterBand *poMainBand =
nullptr;
402 mutable int nRefCountUnderlyingMainRasterBand = 0;
408 void UnrefUnderlyingRasterBand(
GDALRasterBand* poUnderlyingRasterBand )
412 GDALProxyPoolMaskBand( GDALProxyPoolDataset* poDS,
414 GDALProxyPoolRasterBand* poMainBand );
415 GDALProxyPoolMaskBand( GDALProxyPoolDataset* poDS,
416 GDALProxyPoolRasterBand* poMainBand,
418 int nBlockXSize,
int nBlockYSize );
419 ~GDALProxyPoolMaskBand()
override;
421 bool IsMaskBand()
const override {
return true; }
432 typedef struct GDALProxyPoolDatasetHS *GDALProxyPoolDatasetH;
434 GDALProxyPoolDatasetH CPL_DLL GDALProxyPoolDatasetCreate(
const char* pszSourceDatasetDescription,
435 int nRasterXSize,
int nRasterYSize,
437 const char * pszProjectionRef,
438 double * padfGeoTransform);
440 void CPL_DLL GDALProxyPoolDatasetDelete(GDALProxyPoolDatasetH hProxyPoolDataset);
442 void CPL_DLL GDALProxyPoolDatasetAddSrcBandDescription( GDALProxyPoolDatasetH hProxyPoolDataset,
444 int nBlockXSize,
int nBlockYSize);
virtual CPLErr IWriteBlock(int nBlockXOff, int nBlockYOff, void *pData)
Definition: gdalrasterband.cpp:615
virtual int HasArbitraryOverviews()
Check for arbitrary overviews.
Definition: gdalrasterband.cpp:2471
virtual CPLErr SetNoDataValue(double dfNoData)
Set the no data value for this band.
Definition: gdalrasterband.cpp:1850
virtual GDALColorTable * GetColorTable()
Fetch the color table associated with band.
Definition: gdalrasterband.cpp:2374
virtual GDALMaskValueRange GetMaskValueRange() const
Returns the range of values that a mask band can take.
Definition: gdalrasterband.cpp:7232
virtual CPLErr ComputeStatistics(int bApproxOK, double *pdfMin, double *pdfMax, double *pdfMean, double *pdfStdDev, GDALProgressFunc, void *pProgressData)
Compute image statistics.
Definition: gdalrasterband.cpp:5390
virtual const char * GetUnitType()
Return raster unit type.
Definition: gdalrasterband.cpp:2954
virtual CPLErr DeleteNoDataValue()
Remove the no data value for this band.
Definition: gdalrasterband.cpp:2052
virtual double GetOffset(int *pbSuccess=nullptr)
Fetch the raster value offset.
Definition: gdalrasterband.cpp:2752
virtual CPLErr SetColorTable(GDALColorTable *poCT)
Set the raster color table.
Definition: gdalrasterband.cpp:2423
virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax, int *pnBuckets, GUIntBig **ppanHistogram, int bForce, GDALProgressFunc, void *pProgressData)
Fetch default raster histogram.
Definition: gdalrasterband.cpp:3825
virtual bool IsMaskBand() const
Returns whether a band is a mask band.
Definition: gdalrasterband.cpp:7182
virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue=0)
Fill this band with a constant value.
Definition: gdalrasterband.cpp:1415
virtual CPLVirtualMem * GetVirtualMemAuto(GDALRWFlag eRWFlag, int *pnPixelSpace, GIntBig *pnLineSpace, char **papszOptions)
Create a CPLVirtualMem object from a GDAL raster band object.
Definition: gdalrasterband.cpp:7554
virtual GDALDriver * GetDriver(void)
Fetch the driver to which this dataset relates.
Definition: gdaldataset.cpp:1234
Format specific driver.
Definition: gdal_priv.h:1558
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:157
virtual CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram)
Set default histogram.
Definition: gdalrasterband.cpp:6488
virtual CPLErr SetUnitType(const char *pszNewValue)
Set unit type.
Definition: gdalrasterband.cpp:3002
virtual GDALColorInterp GetColorInterpretation()
How should this band be interpreted as color?
Definition: gdalrasterband.cpp:2282
virtual char ** GetCategoryNames()
Fetch the list of category names for this raster.
Definition: gdalrasterband.cpp:1561
GDALColorInterp
Definition: gdal.h:204
A single raster band (or channel).
Definition: gdal_priv.h:1179
GDALMaskValueRange
Range of values found in a mask band.
Definition: gdal_priv.h:1152
virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize, GDALDataType eDT, int nBandCount, int *panBandList, char **papszOptions)
Advise driver of upcoming read requests.
Definition: gdaldataset.cpp:2722
void static void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition: gdaldataset.cpp:4113
GDALDataType
Definition: gdal.h:63
virtual const char * GetMetadataItem(const char *pszName, const char *pszDomain="")
Fetch single metadata item.
Definition: gdalmajorobject.cpp:343
virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList, const OGRSpatialReference *poGCP_SRS)
Assign GCPs.
Definition: gdaldataset.cpp:1714
virtual const GDAL_GCP * GetGCPs()
Fetch GCPs.
Definition: gdaldataset.cpp:1609
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:342
struct _CPLHashSet CPLHashSet
Opaque type for a hash set.
Definition: cpl_hash_set.h:52
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:304
virtual int GetOverviewCount()
Return the number of overview layers available.
Definition: gdalrasterband.cpp:2508
virtual CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT)
Set default Raster Attribute Table.
Definition: gdalrasterband.cpp:6635
virtual void * GetInternalHandle(const char *pszHandleName)
Fetch a format specific internally meaningful handle.
Definition: gdaldataset.cpp:1196
virtual GDALRasterBand * GetMaskBand()
Return the mask band associated with the band.
Definition: gdalrasterband.cpp:6720
virtual char ** GetMetadata(const char *pszDomain="")
Fetch metadata.
Definition: gdalmajorobject.cpp:248
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1056
virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize, GDALDataType eBufType, char **papszOptions)
Advise driver of upcoming read requests.
Definition: gdalrasterband.cpp:4040
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:233
virtual GDALRasterBand * GetRasterSampleOverview(GUIntBig)
Fetch best sampling overview.
Definition: gdalrasterband.cpp:2600
virtual const OGRSpatialReference * GetGCPSpatialRef() const
Get output spatial reference system for GCPs.
Definition: gdaldataset.cpp:1551
virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS)
Set the spatial reference system for this dataset.
Definition: gdaldataset.cpp:1017
Ground Control Point.
Definition: gdal.h:892
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:306
virtual CPLErr IReadBlock(int nBlockXOff, int nBlockYOff, void *pData)=0
Read a block of data.
virtual int GetGCPCount()
Get number of GCPs.
Definition: gdaldataset.cpp:1468
virtual GDALRasterBand * GetOverview(int)
Fetch overview raster band object.
Definition: gdalrasterband.cpp:2550
virtual char ** GetMetadataDomainList()
Fetch list of metadata domains.
Definition: gdalmajorobject.cpp:160
virtual CPLErr ComputeRasterMinMax(int, double *)
Compute the min/max values for a band.
Definition: gdalrasterband.cpp:6164
struct CPLVirtualMem CPLVirtualMem
Opaque type that represents a virtual memory mapping.
Definition: cpl_virtualmem.h:62
virtual CPLErr SetScale(double dfNewScale)
Set scaling ratio.
Definition: gdalrasterband.cpp:2907
virtual CPLErr BuildOverviews(const char *pszResampling, int nOverviews, const int *panOverviewList, GDALProgressFunc pfnProgress, void *pProgressData, CSLConstList papszOptions)
Build raster overview(s)
Definition: gdalrasterband.cpp:2710
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:3028
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:292
virtual double GetNoDataValue(int *pbSuccess=nullptr)
Fetch the no data value for this band.
Definition: gdalrasterband.cpp:1665
GDALAccess
Definition: gdal.h:116
virtual CPLErr GetStatistics(int bApproxOK, int bForce, double *pdfMin, double *pdfMax, double *pdfMean, double *padfStdDev)
Fetch image statistics.
Definition: gdalrasterband.cpp:4120
@ GA_ReadOnly
Definition: gdal.h:117
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch the spatial reference for this dataset.
Definition: gdaldataset.cpp:911
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:230
virtual CPLErr FlushCache(bool bAtClosing=false)
Flush raster data cache.
Definition: gdalrasterband.cpp:1058
virtual CPLErr SetGeoTransform(double *padfTransform)
Set the affine transformation coefficients.
Definition: gdaldataset.cpp:1151
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition: gdaldataset.cpp:2907
virtual GDALRasterAttributeTable * GetDefaultRAT()
Fetch default Raster Attribute Table.
Definition: gdalrasterband.cpp:6587
virtual void FlushCache(bool bAtClosing=false)
Flush all write cached data to disk.
Definition: gdaldataset.cpp:434
virtual double GetMinimum(int *pbSuccess=nullptr)
Fetch the minimum value for this band.
Definition: gdalrasterband.cpp:2195
virtual double GetScale(int *pbSuccess=nullptr)
Fetch the raster value scale.
Definition: gdalrasterband.cpp:2858
GDALRWFlag
Definition: gdal.h:122
virtual CPLErr SetColorInterpretation(GDALColorInterp eColorInterp)
Set color interpretation of a band.
Definition: gdalrasterband.cpp:2327
virtual CPLErr IRasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType, GSpacing, GSpacing, GDALRasterIOExtraArg *psExtraArg)
Read/write a region of image data for this band.
Definition: rasterio.cpp:208
virtual CPLErr SetStatistics(double dfMin, double dfMax, double dfMean, double dfStdDev)
Set statistics on band.
Definition: gdalrasterband.cpp:5888
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
Set single metadata item.
CPLErr
Error category.
Definition: cpl_error.h:52
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
virtual CPLErr SetCategoryNames(char **papszNames)
Set the category names for this band.
Definition: gdalrasterband.cpp:1609
virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram, int bIncludeOutOfRange, int bApproxOK, GDALProgressFunc, void *pProgressData)
Compute raster histogram.
Definition: gdalrasterband.cpp:3254
virtual int GetMaskFlags()
Return the status flags of the mask band associated with the band.
Definition: gdalrasterband.cpp:7041
virtual CPLErr GetGeoTransform(double *padfTransform)
Fetch the affine transformation coefficients.
Definition: gdaldataset.cpp:1096
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the current band.
Definition: gdalrasterband.cpp:7122
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
Definition: gdal_rat.h:47
virtual double GetMaximum(int *pbSuccess=nullptr)
Fetch the maximum value for this band.
Definition: gdalrasterband.cpp:2102
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
Set single metadata item.
virtual CPLErr SetOffset(double dfNewOffset)
Set scaling offset.
Definition: gdalrasterband.cpp:2801
char ** GetMetadataDomainList() override
Fetch list of metadata domains.
Definition: gdaldataset.cpp:4214
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:930
A color table / palette.
Definition: gdal_priv.h:1044