13#ifndef GDAL_PROXY_H_INCLUDED
14#define GDAL_PROXY_H_INCLUDED
36 virtual GDALDataset *RefUnderlyingDataset()
const = 0;
37 virtual void UnrefUnderlyingDataset(GDALDataset *poUnderlyingDataset)
const;
39 CPLErr IBuildOverviews(
const char *,
int,
const int *,
int,
const int *,
40 GDALProgressFunc,
void *,
44 GSpacing, GDALRasterIOExtraArg *psExtraArg)
override;
46 int nXSize,
int nYSize,
void *pData,
47 int nBufXSize,
int nBufYSize,
49 const int *panBandMap,
GSpacing nPixelSpace,
51 GDALRasterIOExtraArg *psExtraArg)
override;
58 const char *pszDomain)
override;
60 const char *pszDomain)
override;
76 const GDAL_GCP *
GetGCPs()
override;
78 const OGRSpatialReference *poGCP_SRS)
override;
82 int nBandCount,
int *panBandList,
83 char **papszOptions)
override;
89 int nBandCount,
const int *panBandList)
override;
91 int nYOff,
int nXSize,
int nYSize,
92 int nBandCount,
const int *panBandList,
93 void **ppBuffer,
size_t *pnBufferSize,
94 char **ppszDetailedFormat)
override;
107 GDALProxyRasterBand()
111 virtual GDALRasterBand *
112 RefUnderlyingRasterBand(
bool bForceOpen =
true)
const = 0;
114 UnrefUnderlyingRasterBand(GDALRasterBand *poUnderlyingRasterBand)
const;
116 CPLErr IReadBlock(
int,
int,
void *)
override;
117 CPLErr IWriteBlock(
int,
int,
void *)
override;
120 GDALRasterIOExtraArg *psExtraArg)
override;
122 int IGetDataCoverageStatus(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
123 int nMaskFlagStop,
double *pdfDataPct)
override;
127 char **
GetMetadata(
const char *pszDomain)
override;
130 const char *pszDomain)
override;
132 const char *pszDomain)
override;
134 GDALRasterBlock *GetLockedBlockRef(
int nXBlockOff,
int nYBlockOff,
135 int bJustInitialize)
override;
137 GDALRasterBlock *TryGetLockedBlockRef(
int nXBlockOff,
138 int nYBlockYOff)
override;
140 CPLErr FlushBlock(
int nXBlockOff,
int nYBlockOff,
141 int bWriteDirtyBlock)
override;
144 char **GetCategoryNames()
override;
145 double GetNoDataValue(
int *pbSuccess =
nullptr)
override;
146 double GetMinimum(
int *pbSuccess =
nullptr)
override;
147 double GetMaximum(
int *pbSuccess =
nullptr)
override;
148 double GetOffset(
int *pbSuccess =
nullptr)
override;
149 double GetScale(
int *pbSuccess =
nullptr)
override;
150 const char *GetUnitType()
override;
152 GDALColorTable *GetColorTable()
override;
153 CPLErr Fill(
double dfRealValue,
double dfImaginaryValue = 0)
override;
155 CPLErr SetCategoryNames(
char **)
override;
156 CPLErr SetNoDataValue(
double)
override;
157 CPLErr DeleteNoDataValue()
override;
158 CPLErr SetColorTable(GDALColorTable *)
override;
160 CPLErr SetOffset(
double)
override;
161 CPLErr SetScale(
double)
override;
162 CPLErr SetUnitType(
const char *)
override;
164 CPLErr GetStatistics(
int bApproxOK,
int bForce,
double *pdfMin,
165 double *pdfMax,
double *pdfMean,
166 double *padfStdDev)
override;
167 CPLErr ComputeStatistics(
int bApproxOK,
double *pdfMin,
double *pdfMax,
168 double *pdfMean,
double *pdfStdDev,
169 GDALProgressFunc,
void *pProgressData)
override;
170 CPLErr SetStatistics(
double dfMin,
double dfMax,
double dfMean,
171 double dfStdDev)
override;
172 CPLErr ComputeRasterMinMax(
int,
double *)
override;
174 int HasArbitraryOverviews()
override;
175 int GetOverviewCount()
override;
176 GDALRasterBand *GetOverview(
int)
override;
177 GDALRasterBand *GetRasterSampleOverview(
GUIntBig)
override;
183 char **papszOptions)
override;
185 CPLErr GetHistogram(
double dfMin,
double dfMax,
int nBuckets,
186 GUIntBig *panHistogram,
int bIncludeOutOfRange,
187 int bApproxOK, GDALProgressFunc,
188 void *pProgressData)
override;
190 CPLErr GetDefaultHistogram(
double *pdfMin,
double *pdfMax,
int *pnBuckets,
191 GUIntBig **ppanHistogram,
int bForce,
192 GDALProgressFunc,
void *pProgressData)
override;
193 CPLErr SetDefaultHistogram(
double dfMin,
double dfMax,
int nBuckets,
196 GDALRasterAttributeTable *GetDefaultRAT()
override;
197 CPLErr SetDefaultRAT(
const GDALRasterAttributeTable *)
override;
199 GDALRasterBand *GetMaskBand()
override;
200 int GetMaskFlags()
override;
202 bool IsMaskBand()
const override;
203 GDALMaskValueRange GetMaskValueRange()
const override;
207 char **papszOptions)
override;
209 CPLErr InterpolateAtPoint(
double dfPixel,
double dfLine,
211 double *pdfRealValue,
212 double *pdfImagValue)
const override;
214 void EnablePixelTypeSignedByteWarning(
bool b)
override;
224typedef struct _GDALProxyPoolCacheEntry GDALProxyPoolCacheEntry;
225class GDALProxyPoolRasterBand;
227class CPL_DLL GDALProxyPoolDataset :
public GDALProxyDataset
232 mutable char *pszProjectionRef =
nullptr;
233 mutable OGRSpatialReference *m_poSRS =
nullptr;
234 mutable OGRSpatialReference *m_poGCPSRS =
nullptr;
235 GDALGeoTransform m_gt{};
236 bool m_bHasSrcSRS =
false;
237 bool m_bHasSrcGeoTransform =
false;
238 char *pszGCPProjection =
nullptr;
240 GDAL_GCP *pasGCPList =
nullptr;
244 mutable GDALProxyPoolCacheEntry *cacheEntry =
nullptr;
245 char *m_pszOwner =
nullptr;
247 GDALDataset *RefUnderlyingDataset(
bool bForceOpen)
const;
249 GDALProxyPoolDataset(
const char *pszSourceDatasetDescription,
250 GDALAccess eAccess,
int bShared,
const char *pszOwner);
253 GDALDataset *RefUnderlyingDataset()
const override;
255 UnrefUnderlyingDataset(GDALDataset *poUnderlyingDataset)
const override;
257 friend class GDALProxyPoolRasterBand;
260 GDALProxyPoolDataset(
const char *pszSourceDatasetDescription,
261 int nRasterXSize,
int nRasterYSize,
263 const char *pszProjectionRef =
nullptr,
264 const GDALGeoTransform *pGT =
nullptr,
265 const char *pszOwner =
nullptr);
267 static GDALProxyPoolDataset *Create(
const char *pszSourceDatasetDescription,
271 const char *pszOwner =
nullptr);
273 ~GDALProxyPoolDataset()
override;
281 void AddSrcBandDescription(
GDALDataType eDataType,
int nBlockXSize,
288 void AddSrcBand(
int nBand,
GDALDataType eDataType,
int nBlockXSize,
301 char **
GetMetadata(
const char *pszDomain)
override;
303 const char *pszDomain)
override;
308 const GDAL_GCP *
GetGCPs()
override;
318class GDALProxyPoolOverviewRasterBand;
319class GDALProxyPoolMaskBand;
322 GDALProxyPoolRasterBand :
public GDALProxyRasterBand
327 char *pszUnitType =
nullptr;
328 char **papszCategoryNames =
nullptr;
329 GDALColorTable *poColorTable =
nullptr;
331 int nSizeProxyOverviewRasterBand = 0;
332 GDALProxyPoolOverviewRasterBand **papoProxyOverviewRasterBand =
nullptr;
333 GDALProxyPoolMaskBand *poProxyMaskBand =
nullptr;
337 RefUnderlyingRasterBand(
bool bForceOpen =
true)
const override;
338 void UnrefUnderlyingRasterBand(
339 GDALRasterBand *poUnderlyingRasterBand)
const override;
341 friend class GDALProxyPoolOverviewRasterBand;
342 friend class GDALProxyPoolMaskBand;
345 GDALProxyPoolRasterBand(GDALProxyPoolDataset *poDS,
int nBand,
348 GDALProxyPoolRasterBand(GDALProxyPoolDataset *poDS,
349 GDALRasterBand *poUnderlyingRasterBand);
350 ~GDALProxyPoolRasterBand()
override;
352 void AddSrcMaskBandDescription(
GDALDataType eDataType,
int nBlockXSize,
355 void AddSrcMaskBandDescriptionFromUnderlying();
360 char **
GetMetadata(
const char *pszDomain)
override;
362 const char *pszDomain)
override;
363 char **GetCategoryNames()
override;
364 const char *GetUnitType()
override;
365 GDALColorTable *GetColorTable()
override;
366 GDALRasterBand *GetOverview(
int)
override;
368 GetRasterSampleOverview(
GUIntBig nDesiredSamples)
override;
369 GDALRasterBand *GetMaskBand()
override;
381class GDALProxyPoolOverviewRasterBand final :
public GDALProxyPoolRasterBand
384 GDALProxyPoolRasterBand *poMainBand =
nullptr;
385 int nOverviewBand = 0;
387 mutable GDALRasterBand *poUnderlyingMainRasterBand =
nullptr;
388 mutable int nRefCountUnderlyingMainRasterBand = 0;
394 RefUnderlyingRasterBand(
bool bForceOpen =
true)
const override;
395 void UnrefUnderlyingRasterBand(
396 GDALRasterBand *poUnderlyingRasterBand)
const override;
399 GDALProxyPoolOverviewRasterBand(GDALProxyPoolDataset *poDS,
400 GDALRasterBand *poUnderlyingOverviewBand,
401 GDALProxyPoolRasterBand *poMainBand,
403 ~GDALProxyPoolOverviewRasterBand()
override;
410class GDALProxyPoolMaskBand final :
public GDALProxyPoolRasterBand
413 GDALProxyPoolRasterBand *poMainBand =
nullptr;
415 mutable GDALRasterBand *poUnderlyingMainRasterBand =
nullptr;
416 mutable int nRefCountUnderlyingMainRasterBand = 0;
422 RefUnderlyingRasterBand(
bool bForceOpen =
true)
const override;
423 void UnrefUnderlyingRasterBand(
424 GDALRasterBand *poUnderlyingRasterBand)
const override;
427 GDALProxyPoolMaskBand(GDALProxyPoolDataset *poDS,
428 GDALRasterBand *poUnderlyingMaskBand,
429 GDALProxyPoolRasterBand *poMainBand);
430 GDALProxyPoolMaskBand(GDALProxyPoolDataset *poDS,
431 GDALProxyPoolRasterBand *poMainBand,
434 ~GDALProxyPoolMaskBand()
override;
436 bool IsMaskBand()
const override
450typedef struct GDALProxyPoolDatasetHS *GDALProxyPoolDatasetH;
452GDALProxyPoolDatasetH CPL_DLL GDALProxyPoolDatasetCreate(
453 const char *pszSourceDatasetDescription,
int nRasterXSize,
int nRasterYSize,
454 GDALAccess eAccess,
int bShared,
const char *pszProjectionRef,
455 const double *padfGeoTransform);
458GDALProxyPoolDatasetDelete(GDALProxyPoolDatasetH hProxyPoolDataset);
460void CPL_DLL GDALProxyPoolDatasetAddSrcBandDescription(
461 GDALProxyPoolDatasetH hProxyPoolDataset,
GDALDataType eDataType,
462 int nBlockXSize,
int nBlockYSize);
464int CPL_DLL GDALGetMaxDatasetPoolSize(
void);
A set of associated raster bands, usually from one file.
Definition gdal_dataset.h:76
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:3359
char ** GetMetadataDomainList() override
Fetch list of metadata domains.
Definition gdaldataset.cpp:5057
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
Set single metadata item.
virtual void * GetInternalHandle(const char *pszHandleName)
Fetch a format specific internally meaningful handle.
Definition gdaldataset.cpp:1668
CPLErr BuildOverviews(const char *pszResampling, int nOverviews, const int *panOverviewList, int nListBands, const int *panBandList, GDALProgressFunc pfnProgress, void *pProgressData, CSLConstList papszOptions)
Build raster overview(s).
Definition gdaldataset.cpp:2343
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition gdaldataset.cpp:3679
virtual int GetGCPCount()
Get number of GCPs.
Definition gdaldataset.cpp:1983
virtual const OGRSpatialReference * GetGCPSpatialRef() const
Get output spatial reference system for GCPs.
Definition gdaldataset.cpp:2073
virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS)
Set the spatial reference system for this dataset.
Definition gdaldataset.cpp:1425
virtual CPLErr GetGeoTransform(GDALGeoTransform >) const
Fetch the affine transformation coefficients.
Definition gdaldataset.cpp:1506
virtual GDALDriver * GetDriver(void)
Fetch the driver to which this dataset relates.
Definition gdaldataset.cpp:1706
virtual CPLErr FlushCache(bool bAtClosing=false)
Flush all write cached data to disk.
Definition gdaldataset.cpp:600
virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList, const OGRSpatialReference *poGCP_SRS)
Assign GCPs.
Definition gdaldataset.cpp:2237
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch the spatial reference for this dataset.
Definition gdaldataset.cpp:1251
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:10588
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
void static void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition gdaldataset.cpp:4951
virtual const GDAL_GCP * GetGCPs()
Fetch GCPs.
Definition gdaldataset.cpp:2130
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition gdaldataset.cpp:3562
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:10818
virtual CPLErr SetGeoTransform(const GDALGeoTransform >)
Set the affine transformation coefficients.
Definition gdaldataset.cpp:1594
virtual const char * GetMetadataItem(const char *pszName, const char *pszDomain="")
Fetch single metadata item.
Definition gdalmajorobject.cpp:322
A single raster band (or channel).
Definition gdal_rasterband.h:105
CPLErr
Error category.
Definition cpl_error.h:37
struct _CPLHashSet CPLHashSet
Opaque type for a hash set.
Definition cpl_hash_set.h:35
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition cpl_port.h:208
#define CPL_C_END
Macro to end a block of C symbols.
Definition cpl_port.h:289
#define CPL_C_START
Macro to start a block of C symbols.
Definition cpl_port.h:285
#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:936
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1087
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:205
struct CPLVirtualMem CPLVirtualMem
Opaque type that represents a virtual memory mapping.
Definition cpl_virtualmem.h:45
Public (C callable) GDAL entry points.
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition gdal.h:386
GDALAccess
Definition gdal.h:118
@ GA_ReadOnly
Definition gdal.h:119
GDALDataType
Definition gdal.h:48
GDALRIOResampleAlg
RasterIO() resampling method.
Definition gdal.h:135
GDALColorInterp
Types of color interpretation for raster bands.
Definition gdal.h:270
GDALRWFlag
Definition gdal.h:125
This file is legacy since GDAL 3.12, but will be kept at least in the whole GDAL 3....