30 #ifndef GDAL_PROXY_H_INCLUDED
31 #define GDAL_PROXY_H_INCLUDED
53 virtual GDALDataset *RefUnderlyingDataset()
const = 0;
54 virtual void UnrefUnderlyingDataset(
GDALDataset *poUnderlyingDataset)
const;
56 CPLErr IBuildOverviews(
const char *,
int,
const int *,
int,
const int *,
57 GDALProgressFunc,
void *,
68 const char *pszDomain)
override;
70 const char *pszDomain)
override;
92 int nBandCount,
int *panBandList,
93 char **papszOptions)
override;
99 int nBandCount,
const int *panBandList)
override;
101 int nYOff,
int nXSize,
int nYSize,
102 int nBandCount,
const int *panBandList,
103 void **ppBuffer,
size_t *pnBufferSize,
104 char **ppszDetailedFormat)
override;
117 GDALProxyRasterBand()
122 RefUnderlyingRasterBand(
bool bForceOpen =
true)
const = 0;
124 UnrefUnderlyingRasterBand(
GDALRasterBand *poUnderlyingRasterBand)
const;
134 char **
GetMetadata(
const char *pszDomain)
override;
137 const char *pszDomain)
override;
139 const char *pszDomain)
override;
143 double GetMinimum(
int *pbSuccess =
nullptr)
override;
144 double GetMaximum(
int *pbSuccess =
nullptr)
override;
145 double GetOffset(
int *pbSuccess =
nullptr)
override;
146 double GetScale(
int *pbSuccess =
nullptr)
override;
150 CPLErr Fill(
double dfRealValue,
double dfImaginaryValue = 0)
override;
162 double *pdfMax,
double *pdfMean,
163 double *padfStdDev)
override;
165 double *pdfMean,
double *pdfStdDev,
166 GDALProgressFunc,
void *pProgressData)
override;
168 double dfStdDev)
override;
180 char **papszOptions)
override;
183 GUIntBig *panHistogram,
int bIncludeOutOfRange,
184 int bApproxOK, GDALProgressFunc,
185 void *pProgressData)
override;
188 GUIntBig **ppanHistogram,
int bForce,
189 GDALProgressFunc,
void *pProgressData)
override;
204 char **papszOptions)
override;
214 typedef struct _GDALProxyPoolCacheEntry GDALProxyPoolCacheEntry;
215 class GDALProxyPoolRasterBand;
217 class CPL_DLL GDALProxyPoolDataset :
public GDALProxyDataset
222 mutable char *pszProjectionRef =
nullptr;
225 double adfGeoTransform[6]{0, 1, 0, 0, 0, 1};
226 bool m_bHasSrcSRS =
false;
227 bool bHasSrcGeoTransform =
false;
228 char *pszGCPProjection =
nullptr;
234 mutable GDALProxyPoolCacheEntry *cacheEntry =
nullptr;
235 char *m_pszOwner =
nullptr;
237 GDALDataset *RefUnderlyingDataset(
bool bForceOpen)
const;
239 GDALProxyPoolDataset(
const char *pszSourceDatasetDescription,
240 GDALAccess eAccess,
int bShared,
const char *pszOwner);
243 GDALDataset *RefUnderlyingDataset()
const override;
245 UnrefUnderlyingDataset(
GDALDataset *poUnderlyingDataset)
const override;
247 friend class GDALProxyPoolRasterBand;
250 GDALProxyPoolDataset(
const char *pszSourceDatasetDescription,
251 int nRasterXSize,
int nRasterYSize,
253 const char *pszProjectionRef =
nullptr,
254 double *padfGeoTransform =
nullptr,
255 const char *pszOwner =
nullptr);
257 static GDALProxyPoolDataset *Create(
const char *pszSourceDatasetDescription,
261 const char *pszOwner =
nullptr);
263 ~GDALProxyPoolDataset()
override;
271 void AddSrcBandDescription(
GDALDataType eDataType,
int nBlockXSize,
278 void AddSrcBand(
int nBand,
GDALDataType eDataType,
int nBlockXSize,
280 CPLErr FlushCache(
bool bAtClosing)
override;
285 CPLErr GetGeoTransform(
double *)
override;
286 CPLErr SetGeoTransform(
double *)
override;
291 char **GetMetadata(
const char *pszDomain)
override;
292 const char *GetMetadataItem(
const char *pszName,
293 const char *pszDomain)
override;
295 void *GetInternalHandle(
const char *pszRequest)
override;
308 class GDALProxyPoolOverviewRasterBand;
309 class GDALProxyPoolMaskBand;
311 class CPL_DLL GDALProxyPoolRasterBand :
public GDALProxyRasterBand
316 char *pszUnitType =
nullptr;
317 char **papszCategoryNames =
nullptr;
320 int nSizeProxyOverviewRasterBand = 0;
321 GDALProxyPoolOverviewRasterBand **papoProxyOverviewRasterBand =
nullptr;
322 GDALProxyPoolMaskBand *poProxyMaskBand =
nullptr;
326 RefUnderlyingRasterBand(
bool bForceOpen =
true)
const override;
327 void UnrefUnderlyingRasterBand(
330 friend class GDALProxyPoolOverviewRasterBand;
331 friend class GDALProxyPoolMaskBand;
334 GDALProxyPoolRasterBand(GDALProxyPoolDataset *poDS,
int nBand,
337 GDALProxyPoolRasterBand(GDALProxyPoolDataset *poDS,
339 ~GDALProxyPoolRasterBand()
override;
341 void AddSrcMaskBandDescription(
GDALDataType eDataType,
int nBlockXSize,
344 void AddSrcMaskBandDescriptionFromUnderlying();
349 char **GetMetadata(
const char *pszDomain)
override;
350 const char *GetMetadataItem(
const char *pszName,
351 const char *pszDomain)
override;
352 char **GetCategoryNames()
override;
353 const char *GetUnitType()
override;
357 GetRasterSampleOverview(
GUIntBig nDesiredSamples)
override;
360 CPLErr FlushCache(
bool bAtClosing)
override;
370 class GDALProxyPoolOverviewRasterBand :
public GDALProxyPoolRasterBand
373 GDALProxyPoolRasterBand *poMainBand =
nullptr;
374 int nOverviewBand = 0;
377 mutable int nRefCountUnderlyingMainRasterBand = 0;
383 RefUnderlyingRasterBand(
bool bForceOpen =
true)
const override;
384 void UnrefUnderlyingRasterBand(
388 GDALProxyPoolOverviewRasterBand(GDALProxyPoolDataset *poDS,
390 GDALProxyPoolRasterBand *poMainBand,
392 ~GDALProxyPoolOverviewRasterBand()
override;
399 class GDALProxyPoolMaskBand :
public GDALProxyPoolRasterBand
402 GDALProxyPoolRasterBand *poMainBand =
nullptr;
405 mutable int nRefCountUnderlyingMainRasterBand = 0;
411 RefUnderlyingRasterBand(
bool bForceOpen =
true)
const override;
412 void UnrefUnderlyingRasterBand(
416 GDALProxyPoolMaskBand(GDALProxyPoolDataset *poDS,
418 GDALProxyPoolRasterBand *poMainBand);
419 GDALProxyPoolMaskBand(GDALProxyPoolDataset *poDS,
420 GDALProxyPoolRasterBand *poMainBand,
423 ~GDALProxyPoolMaskBand()
override;
425 bool IsMaskBand()
const override
439 typedef struct GDALProxyPoolDatasetHS *GDALProxyPoolDatasetH;
441 GDALProxyPoolDatasetH CPL_DLL GDALProxyPoolDatasetCreate(
442 const char *pszSourceDatasetDescription,
int nRasterXSize,
int nRasterYSize,
443 GDALAccess eAccess,
int bShared,
const char *pszProjectionRef,
444 double *padfGeoTransform);
447 GDALProxyPoolDatasetDelete(GDALProxyPoolDatasetH hProxyPoolDataset);
449 void CPL_DLL GDALProxyPoolDatasetAddSrcBandDescription(
450 GDALProxyPoolDatasetH hProxyPoolDataset,
GDALDataType eDataType,
451 int nBlockXSize,
int nBlockYSize);
virtual CPLErr IWriteBlock(int nBlockXOff, int nBlockYOff, void *pData)
Definition: gdalrasterband.cpp:649
virtual int HasArbitraryOverviews()
Check for arbitrary overviews.
Definition: gdalrasterband.cpp:2557
virtual CPLErr SetNoDataValue(double dfNoData)
Set the no data value for this band.
Definition: gdalrasterband.cpp:1911
virtual GDALColorTable * GetColorTable()
Fetch the color table associated with band.
Definition: gdalrasterband.cpp:2460
virtual GDALMaskValueRange GetMaskValueRange() const
Returns the range of values that a mask band can take.
Definition: gdalrasterband.cpp:7569
virtual CPLErr ComputeStatistics(int bApproxOK, double *pdfMin, double *pdfMax, double *pdfMean, double *pdfStdDev, GDALProgressFunc, void *pProgressData)
Compute image statistics.
Definition: gdalrasterband.cpp:5612
virtual const char * GetUnitType()
Return raster unit type.
Definition: gdalrasterband.cpp:3041
virtual CPLErr DeleteNoDataValue()
Remove the no data value for this band.
Definition: gdalrasterband.cpp:2113
virtual double GetOffset(int *pbSuccess=nullptr)
Fetch the raster value offset.
Definition: gdalrasterband.cpp:2840
virtual CPLErr SetColorTable(GDALColorTable *poCT)
Set the raster color table.
Definition: gdalrasterband.cpp:2509
virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax, int *pnBuckets, GUIntBig **ppanHistogram, int bForce, GDALProgressFunc, void *pProgressData)
Fetch default raster histogram.
Definition: gdalrasterband.cpp:4005
virtual bool IsMaskBand() const
Returns whether a band is a mask band.
Definition: gdalrasterband.cpp:7518
virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue=0)
Fill this band with a constant value.
Definition: gdalrasterband.cpp:1470
virtual CPLVirtualMem * GetVirtualMemAuto(GDALRWFlag eRWFlag, int *pnPixelSpace, GIntBig *pnLineSpace, char **papszOptions)
Create a CPLVirtualMem object from a GDAL raster band object.
Definition: gdalrasterband.cpp:7895
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:437
virtual GDALDriver * GetDriver(void)
Fetch the driver to which this dataset relates.
Definition: gdaldataset.cpp:1417
Format specific driver.
Definition: gdal_priv.h:1700
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:166
virtual CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram)
Set default histogram.
Definition: gdalrasterband.cpp:6825
virtual CPLErr SetUnitType(const char *pszNewValue)
Set unit type.
Definition: gdalrasterband.cpp:3089
virtual GDALColorInterp GetColorInterpretation()
How should this band be interpreted as color?
Definition: gdalrasterband.cpp:2371
virtual char ** GetCategoryNames()
Fetch the list of category names for this raster.
Definition: gdalrasterband.cpp:1622
GDALColorInterp
Definition: gdal.h:226
A single raster band (or channel).
Definition: gdal_priv.h:1270
GDALMaskValueRange
Range of values found in a mask band.
Definition: gdal_priv.h:1241
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:2926
void static void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition: gdaldataset.cpp:4362
GDALDataType
Definition: gdal.h:63
virtual const char * GetMetadataItem(const char *pszName, const char *pszDomain="")
Fetch single metadata item.
Definition: gdalmajorobject.cpp:341
virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList, const OGRSpatialReference *poGCP_SRS)
Assign GCPs.
Definition: gdaldataset.cpp:1914
virtual const GDAL_GCP * GetGCPs()
Fetch GCPs.
Definition: gdaldataset.cpp:1807
virtual CPLStringList GetCompressionFormats(int nXOff, int nYOff, int nXSize, int nYSize, int nBandCount, const int *panBandList)
Return the compression formats that can be natively obtained for the window of interest and requested...
Definition: gdaldataset.cpp:9362
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:348
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:306
virtual CPLErr ReadCompressedData(const char *pszFormat, int nXOff, int nYOff, int nXSize, int nYSize, int nBands, const int *panBandList, void **ppBuffer, size_t *pnBufferSize, char **ppszDetailedFormat)
Return the compressed content that can be natively obtained for the window of interest and requested ...
Definition: gdaldataset.cpp:9592
virtual int GetOverviewCount()
Return the number of overview layers available.
Definition: gdalrasterband.cpp:2594
virtual CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT)
Set default Raster Attribute Table.
Definition: gdalrasterband.cpp:6972
virtual void * GetInternalHandle(const char *pszHandleName)
Fetch a format specific internally meaningful handle.
Definition: gdaldataset.cpp:1379
virtual GDALRasterBand * GetMaskBand()
Return the mask band associated with the band.
Definition: gdalrasterband.cpp:7052
virtual char ** GetMetadata(const char *pszDomain="")
Fetch metadata.
Definition: gdalmajorobject.cpp:247
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1178
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:4221
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:229
virtual GDALRasterBand * GetRasterSampleOverview(GUIntBig)
Fetch best sampling overview.
Definition: gdalrasterband.cpp:2689
virtual const OGRSpatialReference * GetGCPSpatialRef() const
Get output spatial reference system for GCPs.
Definition: gdaldataset.cpp:1750
virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS)
Set the spatial reference system for this dataset.
Definition: gdaldataset.cpp:1202
Ground Control Point.
Definition: gdal.h:1051
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:310
virtual CPLErr IReadBlock(int nBlockXOff, int nBlockYOff, void *pData)=0
virtual int GetGCPCount()
Get number of GCPs.
Definition: gdaldataset.cpp:1665
virtual GDALRasterBand * GetOverview(int)
Fetch overview raster band object.
Definition: gdalrasterband.cpp:2637
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:6473
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:2995
virtual CPLErr BuildOverviews(const char *pszResampling, int nOverviews, const int *panOverviewList, GDALProgressFunc pfnProgress, void *pProgressData, CSLConstList papszOptions)
Definition: gdalrasterband.cpp:2798
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:3238
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:315
virtual double GetNoDataValue(int *pbSuccess=nullptr)
Fetch the no data value for this band.
Definition: gdalrasterband.cpp:1726
GDALAccess
Definition: gdal.h:124
virtual CPLErr GetStatistics(int bApproxOK, int bForce, double *pdfMin, double *pdfMax, double *pdfMean, double *padfStdDev)
Fetch image statistics.
Definition: gdalrasterband.cpp:4307
@ GA_ReadOnly
Definition: gdal.h:126
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch the spatial reference for this dataset.
Definition: gdaldataset.cpp:1097
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:226
virtual CPLErr FlushCache(bool bAtClosing=false)
Flush raster data cache.
Definition: gdalrasterband.cpp:1103
virtual CPLErr SetGeoTransform(double *padfTransform)
Set the affine transformation coefficients.
Definition: gdaldataset.cpp:1335
virtual const char * GetMetadataItem(const char *pszName, const char *pszDomain="") override
Fetch single metadata item.
Definition: gdalrasterband.cpp:8328
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition: gdaldataset.cpp:3117
virtual GDALRasterAttributeTable * GetDefaultRAT()
Fetch default Raster Attribute Table.
Definition: gdalrasterband.cpp:6923
virtual double GetMinimum(int *pbSuccess=nullptr)
Fetch the minimum value for this band.
Definition: gdalrasterband.cpp:2267
virtual double GetScale(int *pbSuccess=nullptr)
Fetch the raster value scale.
Definition: gdalrasterband.cpp:2946
GDALRWFlag
Definition: gdal.h:131
virtual CPLErr SetColorInterpretation(GDALColorInterp eColorInterp)
Set color interpretation of a band.
Definition: gdalrasterband.cpp:2415
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:207
virtual CPLErr SetStatistics(double dfMin, double dfMax, double dfMean, double dfStdDev)
Set statistics on band.
Definition: gdalrasterband.cpp:6175
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:1670
virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram, int bIncludeOutOfRange, int bApproxOK, GDALProgressFunc, void *pProgressData)
Compute raster histogram.
Definition: gdalrasterband.cpp:3342
virtual int GetMaskFlags()
Return the status flags of the mask band associated with the band.
Definition: gdalrasterband.cpp:7377
virtual CPLErr GetGeoTransform(double *padfTransform)
Fetch the affine transformation coefficients.
Definition: gdaldataset.cpp:1281
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the current band.
Definition: gdalrasterband.cpp:7458
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Definition: gdal_rat.h:47
virtual double GetMaximum(int *pbSuccess=nullptr)
Fetch the maximum value for this band.
Definition: gdalrasterband.cpp:2162
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
virtual CPLErr SetOffset(double dfNewOffset)
Set scaling offset.
Definition: gdalrasterband.cpp:2889
char ** GetMetadataDomainList() override
Fetch list of metadata domains.
Definition: gdaldataset.cpp:4463
#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:1042
A color table / palette.
Definition: gdal_priv.h:1121
virtual CPLErr FlushCache(bool bAtClosing=false)
Flush all write cached data to disk.
Definition: gdaldataset.cpp:556