GDAL

- Main Page
- Related Pages
- Classes
- Files
- Download
- Issue Tracker

- File List
- File Members

gdal_pam.h
1 /******************************************************************************
2 * $Id: gdal_pam.h 36501 2016-11-25 14:09:24Z rouault $
3 *
4 * Project: GDAL Core
5 * Purpose: Declaration for Peristable Auxiliary Metadata classes.
6 * Author: Frank Warmerdam, warmerdam@pobox.com
7 *
8 ******************************************************************************
9 * Copyright (c) 2005, Frank Warmerdam <warmerdam@pobox.com>
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included
19 * in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 * DEALINGS IN THE SOFTWARE.
28 ****************************************************************************/
29
30 #ifndef GDAL_PAM_H_INCLUDED
31 #define GDAL_PAM_H_INCLUDED
32
34
35 #include "gdal_priv.h"
36
37 class GDALPamRasterBand;
38
39 /* Clone Info Flags */
40
41 #define GCIF_GEOTRANSFORM 0x01
42 #define GCIF_PROJECTION 0x02
43 #define GCIF_METADATA 0x04
44 #define GCIF_GCPS 0x08
45
46 #define GCIF_NODATA 0x001000
47 #define GCIF_CATEGORYNAMES 0x002000
48 #define GCIF_MINMAX 0x004000
49 #define GCIF_SCALEOFFSET 0x008000
50 #define GCIF_UNITTYPE 0x010000
51 #define GCIF_COLORTABLE 0x020000
52 #define GCIF_COLORINTERP 0x020000
53 #define GCIF_BAND_METADATA 0x040000
54 #define GCIF_RAT 0x080000
55 #define GCIF_MASK 0x100000
56 #define GCIF_BAND_DESCRIPTION 0x200000
57
58 #define GCIF_ONLY_IF_MISSING 0x10000000
59 #define GCIF_PROCESS_BANDS 0x20000000
60
61 #define GCIF_PAM_DEFAULT (GCIF_GEOTRANSFORM | GCIF_PROJECTION | \
62 GCIF_METADATA | GCIF_GCPS | \
63 GCIF_NODATA | GCIF_CATEGORYNAMES | \
64 GCIF_MINMAX | GCIF_SCALEOFFSET | \
65 GCIF_UNITTYPE | GCIF_COLORTABLE | \
66 GCIF_COLORINTERP | GCIF_BAND_METADATA | \
67 GCIF_RAT | GCIF_MASK | \
68 GCIF_ONLY_IF_MISSING | GCIF_PROCESS_BANDS|\
69 GCIF_BAND_DESCRIPTION)
70
71 /* GDAL PAM Flags */
72 /* ERO 2011/04/13 : GPF_AUXMODE seems to be unimplemented */
73 #define GPF_DIRTY 0x01 // .pam file needs to be written on close
74 #define GPF_TRIED_READ_FAILED 0x02 // no need to keep trying to read .pam.
75 #define GPF_DISABLED 0x04 // do not try any PAM stuff.
76 #define GPF_AUXMODE 0x08 // store info in .aux (HFA) file.
77 #define GPF_NOSAVE 0x10 // do not try to save pam info.
78
79 /* ==================================================================== */
80 /* GDALDatasetPamInfo */
81 /* */
82 /* We make these things a separate structure of information */
83 /* primarily so we can modify it without altering the size of */
84 /* the GDALPamDataset. It is an effort to reduce ABI churn for */
85 /* driver plugins. */
86 /* ==================================================================== */
87 class GDALDatasetPamInfo
88 {
89 public:
90 char *pszPamFilename;
91
92 char *pszProjection;
93
94 int bHaveGeoTransform;
95 double adfGeoTransform[6];
96
97 int nGCPCount;
98 GDAL_GCP *pasGCPList;
99 char *pszGCPProjection;
100
101 CPLString osPhysicalFilename;
102 CPLString osSubdatasetName;
103 CPLString osAuxFilename;
104
105 int bHasMetadata;
106 };
108
109 /* ******************************************************************** */
110 /* GDALPamDataset */
111 /* ******************************************************************** */
112
114 class CPL_DLL GDALPamDataset : public GDALDataset
115 {
116 friend class GDALPamRasterBand;
117
118 private:
119 int IsPamFilenameAPotentialSiblingFile();
120
121 protected:
122
123 GDALPamDataset(void);
125 int nPamFlags;
126 GDALDatasetPamInfo *psPam;
127
128 virtual CPLXMLNode *SerializeToXML( const char *);
129 virtual CPLErr XMLInit( CPLXMLNode *, const char * );
130
131 virtual CPLErr TryLoadXML(char **papszSiblingFiles = NULL);
132 virtual CPLErr TrySaveXML();
133
134 CPLErr TryLoadAux(char **papszSiblingFiles = NULL);
135 CPLErr TrySaveAux();
136
137 virtual const char *BuildPamFilename();
138
139 void PamInitialize();
140 void PamClear();
141
142 void SetPhysicalFilename( const char * );
143 const char *GetPhysicalFilename();
144 void SetSubdatasetName( const char *);
145 const char *GetSubdatasetName();
147
148 public:
149 virtual ~GDALPamDataset();
150
151 virtual void FlushCache(void) CPL_OVERRIDE;
152
153 virtual const char *GetProjectionRef(void) CPL_OVERRIDE;
154 virtual CPLErr SetProjection( const char * ) CPL_OVERRIDE;
155
156 virtual CPLErr GetGeoTransform( double * ) CPL_OVERRIDE;
157 virtual CPLErr SetGeoTransform( double * ) CPL_OVERRIDE;
158
159 virtual int GetGCPCount() CPL_OVERRIDE;
160 virtual const char *GetGCPProjection() CPL_OVERRIDE;
161 virtual const GDAL_GCP *GetGCPs() CPL_OVERRIDE;
162 virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
163 const char *pszGCPProjection ) CPL_OVERRIDE;
164
165 virtual CPLErr SetMetadata( char ** papszMetadata,
166 const char * pszDomain = "" ) CPL_OVERRIDE;
167 virtual CPLErr SetMetadataItem( const char * pszName,
168 const char * pszValue,
169 const char * pszDomain = "" ) CPL_OVERRIDE;
170 virtual char **GetMetadata( const char * pszDomain = "" ) CPL_OVERRIDE;
171 virtual const char *GetMetadataItem( const char * pszName,
172 const char * pszDomain = "" ) CPL_OVERRIDE;
173
174 virtual char **GetFileList(void) CPL_OVERRIDE;
175
177 virtual CPLErr CloneInfo( GDALDataset *poSrcDS, int nCloneInfoFlags );
178
179 virtual CPLErr IBuildOverviews( const char *pszResampling,
180 int nOverviews, int *panOverviewList,
181 int nListBands, int *panBandList,
182 GDALProgressFunc pfnProgress,
183 void * pProgressData ) CPL_OVERRIDE;
184
185 // "semi private" methods.
186 void MarkPamDirty() { nPamFlags |= GPF_DIRTY; }
187 GDALDatasetPamInfo *GetPamInfo() { return psPam; }
188 int GetPamFlags() { return nPamFlags; }
189 void SetPamFlags(int nValue ) { nPamFlags = nValue; }
191
192 private:
193 CPL_DISALLOW_COPY_ASSIGN(GDALPamDataset)
194 };
195
197 /* ==================================================================== */
198 /* GDALRasterBandPamInfo */
199 /* */
200 /* We make these things a separate structure of information */
201 /* primarily so we can modify it without altering the size of */
202 /* the GDALPamDataset. It is an effort to reduce ABI churn for */
203 /* driver plugins. */
204 /* ==================================================================== */
205 typedef struct {
206 GDALPamDataset *poParentDS;
207
208 int bNoDataValueSet;
209 double dfNoDataValue;
210
211 GDALColorTable *poColorTable;
212
213 GDALColorInterp eColorInterp;
214
215 char *pszUnitType;
216 char **papszCategoryNames;
217
218 double dfOffset;
219 double dfScale;
220
221 int bHaveMinMax;
222 double dfMin;
223 double dfMax;
224
225 int bHaveStats;
226 double dfMean;
227 double dfStdDev;
228
229 CPLXMLNode *psSavedHistograms;
230
231 GDALRasterAttributeTable *poDefaultRAT;
232
233 } GDALRasterBandPamInfo;
235 /* ******************************************************************** */
236 /* GDALPamRasterBand */
237 /* ******************************************************************** */
238
240 class CPL_DLL GDALPamRasterBand : public GDALRasterBand
241 {
242 friend class GDALPamDataset;
243
244 protected:
246 virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
247 virtual CPLErr XMLInit( CPLXMLNode *, const char * );
248
249 void PamInitialize();
250 void PamClear();
251
252 GDALRasterBandPamInfo *psPam;
254
255 public:
256 GDALPamRasterBand();
258 explicit GDALPamRasterBand(int bForceCachedIO);
260 virtual ~GDALPamRasterBand();
261
262 virtual void SetDescription( const char * ) CPL_OVERRIDE;
263
264 virtual CPLErr SetNoDataValue( double ) CPL_OVERRIDE;
265 virtual double GetNoDataValue( int *pbSuccess = NULL ) CPL_OVERRIDE;
266 virtual CPLErr DeleteNoDataValue() CPL_OVERRIDE;
267
268 virtual CPLErr SetColorTable( GDALColorTable * ) CPL_OVERRIDE;
269 virtual GDALColorTable *GetColorTable() CPL_OVERRIDE;
270
271 virtual CPLErr SetColorInterpretation( GDALColorInterp ) CPL_OVERRIDE;
272 virtual GDALColorInterp GetColorInterpretation() CPL_OVERRIDE;
273
274 virtual const char *GetUnitType() CPL_OVERRIDE;
275 CPLErr SetUnitType( const char * ) CPL_OVERRIDE;
276
277 virtual char **GetCategoryNames() CPL_OVERRIDE;
278 virtual CPLErr SetCategoryNames( char ** ) CPL_OVERRIDE;
279
280 virtual double GetOffset( int *pbSuccess = NULL ) CPL_OVERRIDE;
281 CPLErr SetOffset( double ) CPL_OVERRIDE;
282 virtual double GetScale( int *pbSuccess = NULL ) CPL_OVERRIDE;
283 CPLErr SetScale( double ) CPL_OVERRIDE;
284
285 virtual CPLErr GetHistogram( double dfMin, double dfMax,
286 int nBuckets, GUIntBig * panHistogram,
287 int bIncludeOutOfRange, int bApproxOK,
288 GDALProgressFunc, void *pProgressData ) CPL_OVERRIDE;
289
290 virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
291 int *pnBuckets, GUIntBig ** ppanHistogram,
292 int bForce,
293 GDALProgressFunc, void *pProgressData) CPL_OVERRIDE;
294
295 virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
296 int nBuckets, GUIntBig *panHistogram ) CPL_OVERRIDE;
297
298 virtual CPLErr SetMetadata( char ** papszMetadata,
299 const char * pszDomain = "" ) CPL_OVERRIDE;
300 virtual CPLErr SetMetadataItem( const char * pszName,
301 const char * pszValue,
302 const char * pszDomain = "" ) CPL_OVERRIDE;
303
304 virtual GDALRasterAttributeTable *GetDefaultRAT() CPL_OVERRIDE;
305 virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * ) CPL_OVERRIDE;
306
308 // new in GDALPamRasterBand.
309 virtual CPLErr CloneInfo( GDALRasterBand *poSrcBand, int nCloneInfoFlags );
310
311 // "semi private" methods.
312 GDALRasterBandPamInfo *GetPamInfo() { return psPam; }
314 private:
315 CPL_DISALLOW_COPY_ASSIGN(GDALPamRasterBand)
316 };
317
319 // These are mainly helper functions for internal use.
320 int CPL_DLL PamParseHistogram( CPLXMLNode *psHistItem,
321 double *pdfMin, double *pdfMax,
322 int *pnBuckets, GUIntBig **ppanHistogram,
323 int *pbIncludeOutOfRange, int *pbApproxOK );
324 CPLXMLNode CPL_DLL *
325 PamFindMatchingHistogram( CPLXMLNode *psSavedHistograms,
326 double dfMin, double dfMax, int nBuckets,
327 int bIncludeOutOfRange, int bApproxOK );
328 CPLXMLNode CPL_DLL *
329 PamHistogramToXMLTree( double dfMin, double dfMax,
330 int nBuckets, GUIntBig * panHistogram,
331 int bIncludeOutOfRange, int bApprox );
332
333 // For managing the proxy file database.
334 const char CPL_DLL * PamGetProxy( const char * );
335 const char CPL_DLL * PamAllocateProxy( const char * );
336 const char CPL_DLL * PamDeallocateProxy( const char * );
337 void CPL_DLL PamCleanProxyDB( void );
338
340
341 #endif /* ndef GDAL_PAM_H_INCLUDED */
GDALRasterAttributeTable
The GDALRasterAttributeTable (or RAT) class is used to encapsulate a table used to provide attribute ...
Definition: gdal_rat.h:46
GDALDataset::GetMetadata
void virtual char ** GetMetadata(const char *pszDomain="") CPL_OVERRIDE
Fetch metadata.
Definition: gdaldataset.cpp:3465
GDALDataset::GetGeoTransform
virtual CPLErr GetGeoTransform(double *padfTransform)
Fetch the affine transformation coefficients.
Definition: gdaldataset.cpp:955
GDALRasterBand::SetCategoryNames
virtual CPLErr SetCategoryNames(char **papszNames)
Set the category names for this band.
Definition: gdalrasterband.cpp:1569
GDALRasterBand::GetScale
virtual double GetScale(int *pbSuccess=NULL)
Fetch the raster value scale.
Definition: gdalrasterband.cpp:2528
CPLXMLNode
Document node structure.
Definition: cpl_minixml.h:66
GDALRasterBand::SetMetadataItem
virtual CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) CPL_OVERRIDE
Set single metadata item.
GDALRasterBand::GetNoDataValue
virtual double GetNoDataValue(int *pbSuccess=NULL)
Fetch the no data value for this band.
Definition: gdalrasterband.cpp:1618
GDALRasterBand::GetCategoryNames
virtual char ** GetCategoryNames()
Fetch the list of category names for this raster.
Definition: gdalrasterband.cpp:1521
GDALMajorObject::SetDescription
virtual void SetDescription(const char *)
Set object description.
Definition: gdalmajorobject.cpp:120
GDALDataset::FlushCache
virtual void FlushCache(void)
Flush all write cached data to disk.
Definition: gdaldataset.cpp:430
GDALRasterBand::GetDefaultHistogram
virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax, int *pnBuckets, GUIntBig **ppanHistogram, int bForce, GDALProgressFunc, void *pProgressData)
Fetch default raster histogram.
Definition: gdalrasterband.cpp:3454
gdal_priv.h
C++ GDAL entry points.
CPL_OVERRIDE
#define CPL_OVERRIDE
To be used in public headers only.
Definition: cpl_port.h:1055
GDALDataset::SetMetadataItem
virtual CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) CPL_OVERRIDE
Set single metadata item.
GDALRasterBand::GetColorInterpretation
virtual GDALColorInterp GetColorInterpretation()
How should this band be interpreted as color?
Definition: gdalrasterband.cpp:1961
GDALRasterBand::GetOffset
virtual double GetOffset(int *pbSuccess=NULL)
Fetch the raster value offset.
Definition: gdalrasterband.cpp:2425
GDALDataset::GetProjectionRef
virtual const char * GetProjectionRef(void)
Fetch the projection definition string for this dataset.
Definition: gdaldataset.cpp:857
GDALRasterBand::SetDefaultRAT
virtual CPLErr SetDefaultRAT(const GDALRasterAttributeTable *poRAT)
Set default Raster Attribute Table.
Definition: gdalrasterband.cpp:5855
GDALRasterBand::GetDefaultRAT
virtual GDALRasterAttributeTable * GetDefaultRAT()
Fetch default Raster Attribute Table.
Definition: gdalrasterband.cpp:5807
GDALRasterBand::GetHistogram
virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram, int bIncludeOutOfRange, int bApproxOK, GDALProgressFunc, void *pProgressData)
Compute raster histogram.
Definition: gdalrasterband.cpp:2902
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:338
GDALDataset::SetGCPs
virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList, const char *pszGCPProjection)
Assign GCPs.
Definition: gdaldataset.cpp:1416
GDALRasterBand::SetOffset
virtual CPLErr SetOffset(double dfNewOffset)
Set scaling offset.
Definition: gdalrasterband.cpp:2474
GDALRasterBand::SetMetadata
virtual CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) CPL_OVERRIDE
Set metadata.
GDALRasterBand::SetDefaultHistogram
virtual CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets, GUIntBig *panHistogram)
Set default histogram.
Definition: gdalrasterband.cpp:5708
GDALPamRasterBand
PAM raster band.
Definition: gdal_pam.h:240
GDALDataset::GetGCPs
virtual const GDAL_GCP * GetGCPs()
Fetch GCPs.
Definition: gdaldataset.cpp:1366
GDALDataset::GetMetadataItem
virtual const char * GetMetadataItem(const char *pszName, const char *pszDomain) CPL_OVERRIDE
Fetch single metadata item.
GDALRasterBand::DeleteNoDataValue
virtual CPLErr DeleteNoDataValue()
Remove the no data value for this band.
Definition: gdalrasterband.cpp:1731
GDALDataset::SetGeoTransform
virtual CPLErr SetGeoTransform(double *padfTransform)
Set the affine transformation coefficients.
Definition: gdaldataset.cpp:1010
GDALDataset::GetGCPCount
virtual int GetGCPCount()
Get number of GCPs.
Definition: gdaldataset.cpp:1298
GDALDataset::SetMetadata
virtual CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) CPL_OVERRIDE
Set metadata.
GDALRasterBand::SetColorInterpretation
virtual CPLErr SetColorInterpretation(GDALColorInterp eColorInterp)
Set color interpretation of a band.
Definition: gdalrasterband.cpp:2006
GDALRasterBand::GetUnitType
virtual const char * GetUnitType()
Return raster unit type.
Definition: gdalrasterband.cpp:2624
GDALPamDataset
PAM dataset.
Definition: gdal_pam.h:114
GDALRasterBand::SetColorTable
virtual CPLErr SetColorTable(GDALColorTable *poCT)
Set the raster color table.
Definition: gdalrasterband.cpp:2102
GDALRasterBand::GetColorTable
virtual GDALColorTable * GetColorTable()
Fetch the color table associated with band.
Definition: gdalrasterband.cpp:2053
GUIntBig
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:253
GDALDataset::GetFileList
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition: gdaldataset.cpp:2374
GDALDataset::SetProjection
virtual CPLErr SetProjection(const char *pszProjection)
Set the projection reference string for this dataset.
Definition: gdaldataset.cpp:897
GDALDataset::GetGCPProjection
virtual const char * GetGCPProjection()
Get output projection for GCPs.
Definition: gdaldataset.cpp:1333
GDALRasterBand::SetScale
virtual CPLErr SetScale(double dfNewScale)
Set scaling ratio.
Definition: gdalrasterband.cpp:2577
GDALRasterBand::SetUnitType
virtual CPLErr SetUnitType(const char *pszNewValue)
Set unit type.
Definition: gdalrasterband.cpp:2672
GDALRasterBand
A single raster band (or channel).
Definition: gdal_priv.h:829
GDALDataset
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:322
GDALColorInterp
GDALColorInterp
Definition: gdal.h:176
GDALRasterBand::SetNoDataValue
virtual CPLErr SetNoDataValue(double dfNoData)
Set the no data value for this band.
Definition: gdalrasterband.cpp:1677
GDALColorTable
A color table / palette.
Definition: gdal_priv.h:749
GDAL_GCP
Ground Control Point.
Definition: gdal.h:514
CPLErr
CPLErr
Error category.
Definition: cpl_error.h:52
CPL_DISALLOW_COPY_ASSIGN
#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:1085

Generated for GDAL by 1.8.9.1.