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;
54 CPLErr Close(GDALProgressFunc,
void *)
override;
55 bool GetCloseReportsProgress()
const override;
57 char **GetMetadataDomainList()
override;
58 CSLConstList GetMetadata(
const char *pszDomain)
override;
60 const char *pszDomain)
override;
61 const char *GetMetadataItem(
const char *pszName,
62 const char *pszDomain)
override;
63 CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
64 const char *pszDomain)
override;
66 CPLErr FlushCache(
bool bAtClosing)
override;
68 const OGRSpatialReference *GetSpatialRef()
const override;
69 CPLErr SetSpatialRef(
const OGRSpatialReference *poSRS)
override;
71 CPLErr GetGeoTransform(GDALGeoTransform &)
const override;
72 CPLErr SetGeoTransform(
const GDALGeoTransform &)
override;
74 void *GetInternalHandle(
const char *)
override;
75 GDALDriver *GetDriver()
const override;
76 char **GetFileList()
override;
78 int GetGCPCount()
override;
79 const OGRSpatialReference *GetGCPSpatialRef()
const override;
80 const GDAL_GCP *GetGCPs()
override;
81 CPLErr SetGCPs(
int nGCPCount,
const GDAL_GCP *pasGCPList,
82 const OGRSpatialReference *poGCP_SRS)
override;
84 CPLErr AdviseRead(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
86 int nBandCount,
int *panBandList,
89 CPLErr CreateMaskBand(
int nFlags)
override;
92 GetCompressionFormats(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
93 int nBandCount,
const int *panBandList)
override;
94 virtual CPLErr ReadCompressedData(
const char *pszFormat,
int nXOff,
95 int nYOff,
int nXSize,
int nYSize,
96 int nBandCount,
const int *panBandList,
97 void **ppBuffer,
size_t *pnBufferSize,
98 char **ppszDetailedFormat)
override;
111 GDALProxyRasterBand()
115 virtual GDALRasterBand *
116 RefUnderlyingRasterBand(
bool bForceOpen =
true)
const = 0;
118 UnrefUnderlyingRasterBand(GDALRasterBand *poUnderlyingRasterBand)
const;
120 CPLErr IReadBlock(
int,
int,
void *)
override;
121 CPLErr IWriteBlock(
int,
int,
void *)
override;
124 GDALRasterIOExtraArg *psExtraArg)
override;
126 int IGetDataCoverageStatus(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
127 int nMaskFlagStop,
double *pdfDataPct)
override;
130 char **GetMetadataDomainList()
override;
131 CSLConstList GetMetadata(
const char *pszDomain)
override;
133 const char *pszDomain)
override;
134 const char *GetMetadataItem(
const char *pszName,
135 const char *pszDomain)
override;
136 CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
137 const char *pszDomain)
override;
139 GDALRasterBlock *GetLockedBlockRef(
int nXBlockOff,
int nYBlockOff,
140 int bJustInitialize)
override;
142 GDALRasterBlock *TryGetLockedBlockRef(
int nXBlockOff,
143 int nYBlockYOff)
override;
145 CPLErr FlushBlock(
int nXBlockOff,
int nYBlockOff,
146 int bWriteDirtyBlock)
override;
148 CPLErr FlushCache(
bool bAtClosing)
override;
149 char **GetCategoryNames()
override;
150 double GetNoDataValue(
int *pbSuccess =
nullptr)
override;
151 double GetMinimum(
int *pbSuccess =
nullptr)
override;
152 double GetMaximum(
int *pbSuccess =
nullptr)
override;
153 double GetOffset(
int *pbSuccess =
nullptr)
override;
154 double GetScale(
int *pbSuccess =
nullptr)
override;
155 const char *GetUnitType()
override;
157 GDALColorTable *GetColorTable()
override;
158 CPLErr Fill(
double dfRealValue,
double dfImaginaryValue = 0)
override;
160 CPLErr SetCategoryNames(
char **)
override;
161 CPLErr SetNoDataValue(
double)
override;
162 CPLErr DeleteNoDataValue()
override;
163 CPLErr SetColorTable(GDALColorTable *)
override;
165 CPLErr SetOffset(
double)
override;
166 CPLErr SetScale(
double)
override;
167 CPLErr SetUnitType(
const char *)
override;
169 CPLErr GetStatistics(
int bApproxOK,
int bForce,
double *pdfMin,
170 double *pdfMax,
double *pdfMean,
171 double *padfStdDev)
override;
172 CPLErr ComputeStatistics(
int bApproxOK,
double *pdfMin,
double *pdfMax,
173 double *pdfMean,
double *pdfStdDev,
174 GDALProgressFunc,
void *pProgressData)
override;
175 CPLErr SetStatistics(
double dfMin,
double dfMax,
double dfMean,
176 double dfStdDev)
override;
177 CPLErr ComputeRasterMinMax(
int,
double *)
override;
179 int HasArbitraryOverviews()
override;
180 int GetOverviewCount()
override;
181 GDALRasterBand *GetOverview(
int)
override;
182 GDALRasterBand *GetRasterSampleOverview(
GUIntBig)
override;
183 CPLErr BuildOverviews(
const char *,
int,
const int *, GDALProgressFunc,
186 CPLErr AdviseRead(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
190 CPLErr GetHistogram(
double dfMin,
double dfMax,
int nBuckets,
191 GUIntBig *panHistogram,
int bIncludeOutOfRange,
192 int bApproxOK, GDALProgressFunc,
193 void *pProgressData)
override;
195 CPLErr GetDefaultHistogram(
double *pdfMin,
double *pdfMax,
int *pnBuckets,
196 GUIntBig **ppanHistogram,
int bForce,
197 GDALProgressFunc,
void *pProgressData)
override;
198 CPLErr SetDefaultHistogram(
double dfMin,
double dfMax,
int nBuckets,
201 GDALRasterAttributeTable *GetDefaultRAT()
override;
202 CPLErr SetDefaultRAT(
const GDALRasterAttributeTable *)
override;
204 GDALRasterBand *GetMaskBand()
override;
205 int GetMaskFlags()
override;
206 CPLErr CreateMaskBand(
int nFlags)
override;
207 bool IsMaskBand()
const override;
208 GDALMaskValueRange GetMaskValueRange()
const override;
214 CPLErr InterpolateAtPoint(
double dfPixel,
double dfLine,
216 double *pdfRealValue,
217 double *pdfImagValue)
const override;
219 void EnablePixelTypeSignedByteWarning(
bool b)
override;
229typedef struct _GDALProxyPoolCacheEntry GDALProxyPoolCacheEntry;
230class GDALProxyPoolRasterBand;
232class CPL_DLL GDALProxyPoolDataset :
public GDALProxyDataset
237 mutable char *pszProjectionRef =
nullptr;
238 mutable OGRSpatialReference *m_poSRS =
nullptr;
239 mutable OGRSpatialReference *m_poGCPSRS =
nullptr;
240 GDALGeoTransform m_gt{};
241 bool m_bHasSrcSRS =
false;
242 bool m_bHasSrcGeoTransform =
false;
243 char *pszGCPProjection =
nullptr;
245 GDAL_GCP *pasGCPList =
nullptr;
249 mutable GDALProxyPoolCacheEntry *cacheEntry =
nullptr;
250 char *m_pszOwner =
nullptr;
252 GDALDataset *RefUnderlyingDataset(
bool bForceOpen)
const;
254 GDALProxyPoolDataset(
const char *pszSourceDatasetDescription,
255 GDALAccess eAccess,
int bShared,
const char *pszOwner);
258 GDALDataset *RefUnderlyingDataset()
const override;
260 UnrefUnderlyingDataset(GDALDataset *poUnderlyingDataset)
const override;
262 friend class GDALProxyPoolRasterBand;
265 GDALProxyPoolDataset(
const char *pszSourceDatasetDescription,
266 int nRasterXSize,
int nRasterYSize,
268 const char *pszProjectionRef =
nullptr,
269 const GDALGeoTransform *pGT =
nullptr,
270 const char *pszOwner =
nullptr);
272 static GDALProxyPoolDataset *Create(
const char *pszSourceDatasetDescription,
276 const char *pszOwner =
nullptr);
278 ~GDALProxyPoolDataset()
override;
286 void AddSrcBandDescription(
GDALDataType eDataType,
int nBlockXSize,
293 void AddSrcBand(
int nBand,
GDALDataType eDataType,
int nBlockXSize,
295 CPLErr FlushCache(
bool bAtClosing)
override;
297 const OGRSpatialReference *GetSpatialRef()
const override;
298 CPLErr SetSpatialRef(
const OGRSpatialReference *poSRS)
override;
300 CPLErr GetGeoTransform(GDALGeoTransform &)
const override;
301 CPLErr SetGeoTransform(
const GDALGeoTransform &)
override;
306 CSLConstList GetMetadata(
const char *pszDomain)
override;
307 const char *GetMetadataItem(
const char *pszName,
308 const char *pszDomain)
override;
310 void *GetInternalHandle(
const char *pszRequest)
override;
312 const OGRSpatialReference *GetGCPSpatialRef()
const override;
313 const GDAL_GCP *GetGCPs()
override;
323class GDALProxyPoolOverviewRasterBand;
324class GDALProxyPoolMaskBand;
327 GDALProxyPoolRasterBand :
public GDALProxyRasterBand
332 char *pszUnitType =
nullptr;
333 char **papszCategoryNames =
nullptr;
334 GDALColorTable *poColorTable =
nullptr;
336 int nSizeProxyOverviewRasterBand = 0;
337 GDALProxyPoolOverviewRasterBand **papoProxyOverviewRasterBand =
nullptr;
338 GDALProxyPoolMaskBand *poProxyMaskBand =
nullptr;
342 RefUnderlyingRasterBand(
bool bForceOpen =
true)
const override;
343 void UnrefUnderlyingRasterBand(
344 GDALRasterBand *poUnderlyingRasterBand)
const override;
346 friend class GDALProxyPoolOverviewRasterBand;
347 friend class GDALProxyPoolMaskBand;
350 GDALProxyPoolRasterBand(GDALProxyPoolDataset *poDS,
int nBand,
353 GDALProxyPoolRasterBand(GDALProxyPoolDataset *poDS,
354 GDALRasterBand *poUnderlyingRasterBand);
355 ~GDALProxyPoolRasterBand()
override;
357 void AddSrcMaskBandDescription(
GDALDataType eDataType,
int nBlockXSize,
360 void AddSrcMaskBandDescriptionFromUnderlying();
365 CSLConstList GetMetadata(
const char *pszDomain)
override;
366 const char *GetMetadataItem(
const char *pszName,
367 const char *pszDomain)
override;
368 char **GetCategoryNames()
override;
369 const char *GetUnitType()
override;
370 GDALColorTable *GetColorTable()
override;
371 GDALRasterBand *GetOverview(
int)
override;
373 GetRasterSampleOverview(
GUIntBig nDesiredSamples)
override;
374 GDALRasterBand *GetMaskBand()
override;
376 CPLErr FlushCache(
bool bAtClosing)
override;
386class GDALProxyPoolOverviewRasterBand final :
public GDALProxyPoolRasterBand
389 GDALProxyPoolRasterBand *poMainBand =
nullptr;
390 int nOverviewBand = 0;
392 mutable GDALRasterBand *poUnderlyingMainRasterBand =
nullptr;
393 mutable int nRefCountUnderlyingMainRasterBand = 0;
399 RefUnderlyingRasterBand(
bool bForceOpen =
true)
const override;
400 void UnrefUnderlyingRasterBand(
401 GDALRasterBand *poUnderlyingRasterBand)
const override;
404 GDALProxyPoolOverviewRasterBand(GDALProxyPoolDataset *poDS,
405 GDALRasterBand *poUnderlyingOverviewBand,
406 GDALProxyPoolRasterBand *poMainBand,
408 ~GDALProxyPoolOverviewRasterBand()
override;
415class GDALProxyPoolMaskBand final :
public GDALProxyPoolRasterBand
418 GDALProxyPoolRasterBand *poMainBand =
nullptr;
420 mutable GDALRasterBand *poUnderlyingMainRasterBand =
nullptr;
421 mutable int nRefCountUnderlyingMainRasterBand = 0;
427 RefUnderlyingRasterBand(
bool bForceOpen =
true)
const override;
428 void UnrefUnderlyingRasterBand(
429 GDALRasterBand *poUnderlyingRasterBand)
const override;
432 GDALProxyPoolMaskBand(GDALProxyPoolDataset *poDS,
433 GDALRasterBand *poUnderlyingMaskBand,
434 GDALProxyPoolRasterBand *poMainBand);
435 GDALProxyPoolMaskBand(GDALProxyPoolDataset *poDS,
436 GDALProxyPoolRasterBand *poMainBand,
439 ~GDALProxyPoolMaskBand()
override;
441 bool IsMaskBand()
const override
455typedef struct GDALProxyPoolDatasetHS *GDALProxyPoolDatasetH;
457GDALProxyPoolDatasetH CPL_DLL GDALProxyPoolDatasetCreate(
458 const char *pszSourceDatasetDescription,
int nRasterXSize,
int nRasterYSize,
459 GDALAccess eAccess,
int bShared,
const char *pszProjectionRef,
460 const double *padfGeoTransform);
463GDALProxyPoolDatasetDelete(GDALProxyPoolDatasetH hProxyPoolDataset);
465void CPL_DLL GDALProxyPoolDatasetAddSrcBandDescription(
466 GDALProxyPoolDatasetH hProxyPoolDataset,
GDALDataType eDataType,
467 int nBlockXSize,
int nBlockYSize);
469int CPL_DLL GDALGetMaxDatasetPoolSize(
void);
A set of associated raster bands, usually from one file.
Definition gdal_dataset.h:77
A single raster band (or channel).
Definition gdal_rasterband.h:108
CPLErr
Error category / error level.
Definition cpl_error.h:45
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:198
#define CPL_C_END
Macro to end a block of C symbols.
Definition cpl_port.h:279
#define CPL_C_START
Macro to start a block of C symbols.
Definition cpl_port.h:275
#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:1101
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1252
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:195
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:412
GDALAccess
Definition gdal.h:120
@ GA_ReadOnly
Definition gdal.h:121
GDALDataType
Definition gdal.h:48
GDALRIOResampleAlg
RasterIO() resampling method.
Definition gdal.h:137
GDALColorInterp
Types of color interpretation for raster bands.
Definition gdal.h:294
GDALRWFlag
Definition gdal.h:127
This file is legacy since GDAL 3.12, but will be kept at least in the whole GDAL 3....