30 #ifndef GDAL_PAM_H_INCLUDED
31 #define GDAL_PAM_H_INCLUDED
42 #define GCIF_GEOTRANSFORM 0x01
43 #define GCIF_PROJECTION 0x02
44 #define GCIF_METADATA 0x04
45 #define GCIF_GCPS 0x08
47 #define GCIF_NODATA 0x001000
48 #define GCIF_CATEGORYNAMES 0x002000
49 #define GCIF_MINMAX 0x004000
50 #define GCIF_SCALEOFFSET 0x008000
51 #define GCIF_UNITTYPE 0x010000
52 #define GCIF_COLORTABLE 0x020000
53 #define GCIF_COLORINTERP 0x020000
54 #define GCIF_BAND_METADATA 0x040000
55 #define GCIF_RAT 0x080000
56 #define GCIF_MASK 0x100000
57 #define GCIF_BAND_DESCRIPTION 0x200000
59 #define GCIF_ONLY_IF_MISSING 0x10000000
60 #define GCIF_PROCESS_BANDS 0x20000000
62 #define GCIF_PAM_DEFAULT (GCIF_GEOTRANSFORM | GCIF_PROJECTION | \
63 GCIF_METADATA | GCIF_GCPS | \
64 GCIF_NODATA | GCIF_CATEGORYNAMES | \
65 GCIF_MINMAX | GCIF_SCALEOFFSET | \
66 GCIF_UNITTYPE | GCIF_COLORTABLE | \
67 GCIF_COLORINTERP | GCIF_BAND_METADATA | \
68 GCIF_RAT | GCIF_MASK | \
69 GCIF_ONLY_IF_MISSING | GCIF_PROCESS_BANDS|\
70 GCIF_BAND_DESCRIPTION)
74 #define GPF_DIRTY 0x01
75 #define GPF_TRIED_READ_FAILED 0x02
76 #define GPF_DISABLED 0x04
77 #define GPF_AUXMODE 0x08
78 #define GPF_NOSAVE 0x10
88 class GDALDatasetPamInfo
91 char *pszPamFilename =
nullptr;
95 int bHaveGeoTransform =
false;
96 double adfGeoTransform[6]{0,0,0,0,0,0};
106 int bHasMetadata =
false;
117 std::map<CPLString, Statistics> oMapMDArrayStatistics{};
131 int IsPamFilenameAPotentialSiblingFile();
138 GDALDatasetPamInfo *psPam =
nullptr;
140 virtual const char *_GetProjectionRef()
override;
141 virtual const char *_GetGCPProjection()
override;
142 virtual CPLErr _SetProjection(
const char * pszProjection )
override;
143 virtual CPLErr _SetGCPs(
int nGCPCount,
const GDAL_GCP *pasGCPList,
144 const char *pszGCPProjection )
override;
146 virtual CPLXMLNode *SerializeToXML(
const char *);
149 virtual CPLErr TryLoadXML(
char **papszSiblingFiles =
nullptr);
150 virtual CPLErr TrySaveXML();
152 CPLErr TryLoadAux(
char **papszSiblingFiles =
nullptr);
155 void SerializeMDArrayStatistics(
CPLXMLNode* psDSTree);
157 virtual const char *BuildPamFilename();
159 void PamInitialize();
162 void SetPhysicalFilename(
const char * );
163 const char *GetPhysicalFilename();
164 void SetSubdatasetName(
const char *);
165 const char *GetSubdatasetName();
187 const char * pszDomain =
"" )
override;
189 const char * pszValue,
190 const char * pszDomain =
"" )
override;
191 char **
GetMetadata(
const char * pszDomain =
"" )
override;
193 const char * pszDomain =
"" )
override;
202 CPLErr IBuildOverviews(
const char *pszResampling,
203 int nOverviews,
int *panOverviewList,
204 int nListBands,
int *panBandList,
205 GDALProgressFunc pfnProgress,
206 void * pProgressData )
override;
208 bool GetMDArrayStatistics(
const char* pszMDArrayId,
210 double *pdfMin,
double *pdfMax,
211 double *pdfMean,
double *pdfStdDev,
214 void StoreMDArrayStatistics(
const char* pszMDArrayId,
216 double dfMin,
double dfMax,
217 double dfMean,
double dfStdDev,
221 void MarkPamDirty() { nPamFlags |= GPF_DIRTY; }
222 GDALDatasetPamInfo *GetPamInfo() {
return psPam; }
223 int GetPamFlags() {
return nPamFlags; }
224 void SetPamFlags(
int nValue ) { nPamFlags = nValue; }
244 double dfNoDataValue;
251 char **papszCategoryNames;
270 } GDALRasterBandPamInfo;
283 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath );
286 void PamInitialize();
289 GDALRasterBandPamInfo *psPam =
nullptr;
301 CPLErr SetNoDataValue(
double )
override;
302 double GetNoDataValue(
int *pbSuccess =
nullptr )
override;
303 CPLErr DeleteNoDataValue()
override;
311 const char *GetUnitType()
override;
312 CPLErr SetUnitType(
const char * )
override;
314 char **GetCategoryNames()
override;
315 CPLErr SetCategoryNames(
char ** )
override;
317 double GetOffset(
int *pbSuccess =
nullptr )
override;
318 CPLErr SetOffset(
double )
override;
319 double GetScale(
int *pbSuccess =
nullptr )
override;
320 CPLErr SetScale(
double )
override;
322 CPLErr GetHistogram(
double dfMin,
double dfMax,
323 int nBuckets,
GUIntBig * panHistogram,
324 int bIncludeOutOfRange,
int bApproxOK,
325 GDALProgressFunc,
void *pProgressData )
override;
327 CPLErr GetDefaultHistogram(
double *pdfMin,
double *pdfMax,
328 int *pnBuckets,
GUIntBig ** ppanHistogram,
330 GDALProgressFunc,
void *pProgressData)
override;
332 CPLErr SetDefaultHistogram(
double dfMin,
double dfMax,
333 int nBuckets,
GUIntBig *panHistogram )
override;
336 const char * pszDomain =
"" )
override;
338 const char * pszValue,
339 const char * pszDomain =
"" )
override;
349 GDALRasterBandPamInfo *GetPamInfo() {
return psPam; }
357 int CPL_DLL PamParseHistogram(
CPLXMLNode *psHistItem,
358 double *pdfMin,
double *pdfMax,
359 int *pnBuckets,
GUIntBig **ppanHistogram,
360 int *pbIncludeOutOfRange,
int *pbApproxOK );
362 PamFindMatchingHistogram(
CPLXMLNode *psSavedHistograms,
363 double dfMin,
double dfMax,
int nBuckets,
364 int bIncludeOutOfRange,
int bApproxOK );
366 PamHistogramToXMLTree(
double dfMin,
double dfMax,
367 int nBuckets,
GUIntBig * panHistogram,
368 int bIncludeOutOfRange,
int bApprox );
371 const char CPL_DLL * PamGetProxy(
const char * );
372 const char CPL_DLL * PamAllocateProxy(
const char * );
373 const char CPL_DLL * PamDeallocateProxy(
const char * );
374 void CPL_DLL PamCleanProxyDB(
void );
Convenient string class based on std::string.
Definition: cpl_string.h:333
A color table / palette.
Definition: gdal_priv.h:1021
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:340
virtual int GetGCPCount()
Get number of GCPs.
Definition: gdaldataset.cpp:1505
virtual CPLErr GetGeoTransform(double *padfTransform)
Fetch the affine transformation coefficients.
Definition: gdaldataset.cpp:1163
virtual const OGRSpatialReference * GetGCPSpatialRef() const
Get output spatial reference system for GCPs.
Definition: gdaldataset.cpp:1602
virtual void ClearStatistics()
Clear statistics.
Definition: gdaldataset.cpp:8285
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS)
Set the spatial reference system for this dataset.
Definition: gdaldataset.cpp:1045
virtual CPLErr SetGeoTransform(double *padfTransform)
Set the affine transformation coefficients.
Definition: gdaldataset.cpp:1218
virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList, const OGRSpatialReference *poGCP_SRS)
Assign GCPs.
Definition: gdaldataset.cpp:1790
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch the spatial reference for this dataset.
Definition: gdaldataset.cpp:914
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
Set single metadata item.
virtual void FlushCache(void)
Flush all write cached data to disk.
Definition: gdaldataset.cpp:421
void static void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition: gdaldataset.cpp:4147
virtual const GDAL_GCP * GetGCPs()
Fetch GCPs.
Definition: gdaldataset.cpp:1685
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition: gdaldataset.cpp:2950
virtual const char * GetMetadataItem(const char *pszName, const char *pszDomain="")
Fetch single metadata item.
Definition: gdalmajorobject.cpp:344
virtual void SetDescription(const char *)
Set object description.
Definition: gdalmajorobject.cpp:120
PAM dataset.
Definition: gdal_pam.h:127
PAM raster band.
Definition: gdal_pam.h:278
The GDALRasterAttributeTable (or RAT) class is used to encapsulate a table used to provide attribute ...
Definition: gdal_rat.h:48
A single raster band (or channel).
Definition: gdal_priv.h:1127
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:158
CPLErr
Error category.
Definition: cpl_error.h:53
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:251
#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:1007
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:269
GDALColorInterp
Definition: gdal.h:204
Document node structure.
Definition: cpl_minixml.h:70
Ground Control Point.
Definition: gdal.h:679