- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

# gdal_pam.h

    00001 /******************************************************************************
    00002  * $Id: gdal_pam.h 22920 2011-08-10 21:08:07Z rouault $
    00003  *
    00004  * Project:  GDAL Core
    00005  * Purpose:  Declaration for Peristable Auxilary Metadata classes.
    00006  * Author:   Frank Warmerdam, warmerdam@pobox.com
    00007  *
    00008  ******************************************************************************
    00009  * Copyright (c) 2005, Frank Warmerdam <warmerdam@pobox.com>
    00010  *
    00011  * Permission is hereby granted, free of charge, to any person obtaining a
    00012  * copy of this software and associated documentation files (the "Software"),
    00013  * to deal in the Software without restriction, including without limitation
    00014  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
    00015  * and/or sell copies of the Software, and to permit persons to whom the
    00016  * Software is furnished to do so, subject to the following conditions:
    00017  *
    00018  * The above copyright notice and this permission notice shall be included
    00019  * in all copies or substantial portions of the Software.
    00020  *
    00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    00022  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00023  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    00024  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00025  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    00026  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    00027  * DEALINGS IN THE SOFTWARE.
    00028  ****************************************************************************/
    00029
    00030 #ifndef GDAL_PAM_H_INCLUDED
    00031 #define GDAL_PAM_H_INCLUDED
    00032
    00033 #include "gdal_priv.h"
    00034
    00035 class GDALPamRasterBand;
    00036
    00037 /* Clone Info Flags */
    00038
    00039 #define GCIF_GEOTRANSFORM       0x01
    00040 #define GCIF_PROJECTION         0x02
    00041 #define GCIF_METADATA           0x04
    00042 #define GCIF_GCPS               0x08
    00043
    00044 #define GCIF_NODATA             0x001000
    00045 #define GCIF_CATEGORYNAMES      0x002000
    00046 #define GCIF_MINMAX             0x004000
    00047 #define GCIF_SCALEOFFSET        0x008000
    00048 #define GCIF_UNITTYPE           0x010000
    00049 #define GCIF_COLORTABLE         0x020000
    00050 #define GCIF_COLORINTERP        0x020000
    00051 #define GCIF_BAND_METADATA      0x040000
    00052 #define GCIF_RAT                0x080000
    00053 #define GCIF_MASK               0x100000
    00054 #define GCIF_BAND_DESCRIPTION   0x200000
    00055
    00056 #define GCIF_ONLY_IF_MISSING    0x10000000
    00057 #define GCIF_PROCESS_BANDS      0x20000000
    00058
    00059 #define GCIF_PAM_DEFAULT        (GCIF_GEOTRANSFORM | GCIF_PROJECTION |     \
    00060                                  GCIF_METADATA | GCIF_GCPS |               \
    00061                                  GCIF_NODATA | GCIF_CATEGORYNAMES |        \
    00062                                  GCIF_MINMAX | GCIF_SCALEOFFSET |          \
    00063                                  GCIF_UNITTYPE | GCIF_COLORTABLE |         \
    00064                                  GCIF_COLORINTERP | GCIF_BAND_METADATA |   \
    00065                                  GCIF_RAT | GCIF_MASK |                    \
    00066                                  GCIF_ONLY_IF_MISSING | GCIF_PROCESS_BANDS|\
    00067                                  GCIF_BAND_DESCRIPTION)
    00068
    00069 /* GDAL PAM Flags */
    00070 /* ERO 2011/04/13 : GPF_AUXMODE seems to be unimplemented */
    00071 #define GPF_DIRTY               0x01  // .pam file needs to be written on close
    00072 #define GPF_TRIED_READ_FAILED   0x02  // no need to keep trying to read .pam.
    00073 #define GPF_DISABLED            0x04  // do not try any PAM stuff.
    00074 #define GPF_AUXMODE             0x08  // store info in .aux (HFA) file.
    00075 #define GPF_NOSAVE              0x10  // do not try to save pam info.
    00076
    00077 /* ==================================================================== */
    00078 /*      GDALDatasetPamInfo                                              */
    00079 /*                                                                      */
    00080 /*      We make these things a seperate structure of information        */
    00081 /*      primarily so we can modify it without altering the size of      */
    00082 /*      the GDALPamDataset.  It is an effort to reduce ABI churn for    */
    00083 /*      driver plugins.                                                 */
    00084 /* ==================================================================== */
    00085 class GDALDatasetPamInfo
    00086 {
    00087 public:
    00088     char        *pszPamFilename;
    00089
    00090     char        *pszProjection;
    00091
    00092     int         bHaveGeoTransform;
    00093     double      adfGeoTransform[6];
    00094
    00095     int         nGCPCount;
    00096     GDAL_GCP   *pasGCPList;
    00097     char       *pszGCPProjection;
    00098
    00099     CPLString   osPhysicalFilename;
    00100     CPLString   osSubdatasetName;
    00101     CPLString   osAuxFilename;
    00102 };
    00103
    00104 /* ******************************************************************** */
    00105 /*                           GDALPamDataset                             */
    00106 /* ******************************************************************** */
    00107
    00108 class CPL_DLL GDALPamDataset : public GDALDataset
    00109 {
    00110     friend class GDALPamRasterBand;
    00111
    00112   private:
    00113     int IsPamFilenameAPotentialSiblingFile();
    00114
    00115   protected:
    00116                 GDALPamDataset(void);
    00117
    00118     int         nPamFlags;
    00119     GDALDatasetPamInfo *psPam;
    00120
    00121     virtual CPLXMLNode *SerializeToXML( const char *);
    00122     virtual CPLErr      XMLInit( CPLXMLNode *, const char * );
    00123
    00124     virtual CPLErr TryLoadXML(char **papszSiblingFiles = NULL);
    00125     virtual CPLErr TrySaveXML();
    00126
    00127     CPLErr  TryLoadAux(char **papszSiblingFiles = NULL);
    00128     CPLErr  TrySaveAux();
    00129
    00130     virtual const char *BuildPamFilename();
    00131
    00132     void   PamInitialize();
    00133     void   PamClear();
    00134
    00135     void   SetPhysicalFilename( const char * );
    00136     const char *GetPhysicalFilename();
    00137     void   SetSubdatasetName( const char *);
    00138     const char *GetSubdatasetName();
    00139
    00140   public:
    00141     virtual     ~GDALPamDataset();
    00142
    00143     virtual void FlushCache(void);
    00144
    00145     virtual const char *GetProjectionRef(void);
    00146     virtual CPLErr SetProjection( const char * );
    00147
    00148     virtual CPLErr GetGeoTransform( double * );
    00149     virtual CPLErr SetGeoTransform( double * );
    00150
    00151     virtual int    GetGCPCount();
    00152     virtual const char *GetGCPProjection();
    00153     virtual const GDAL_GCP *GetGCPs();
    00154     virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
    00155                             const char *pszGCPProjection );
    00156
    00157     virtual CPLErr      SetMetadata( char ** papszMetadata,
    00158                                      const char * pszDomain = "" );
    00159     virtual CPLErr      SetMetadataItem( const char * pszName,
    00160                                          const char * pszValue,
    00161                                          const char * pszDomain = "" );
    00162     virtual char      **GetMetadata( const char * pszDomain = "" );
    00163     virtual const char *GetMetadataItem( const char * pszName,
    00164                                          const char * pszDomain = "" );
    00165
    00166     virtual char      **GetFileList(void);
    00167
    00168     virtual CPLErr CloneInfo( GDALDataset *poSrcDS, int nCloneInfoFlags );
    00169
    00170     virtual CPLErr IBuildOverviews( const char *pszResampling,
    00171                                     int nOverviews, int *panOverviewList,
    00172                                     int nListBands, int *panBandList,
    00173                                     GDALProgressFunc pfnProgress,
    00174                                     void * pProgressData );
    00175
    00176
    00177     // "semi private" methods.
    00178     void   MarkPamDirty() { nPamFlags |= GPF_DIRTY; }
    00179     GDALDatasetPamInfo *GetPamInfo() { return psPam; }
    00180     int    GetPamFlags() { return nPamFlags; }
    00181     void   SetPamFlags(int nValue ) { nPamFlags = nValue; }
    00182 };
    00183
    00184 /* ==================================================================== */
    00185 /*      GDALRasterBandPamInfo                                           */
    00186 /*                                                                      */
    00187 /*      We make these things a seperate structure of information        */
    00188 /*      primarily so we can modify it without altering the size of      */
    00189 /*      the GDALPamDataset.  It is an effort to reduce ABI churn for    */
    00190 /*      driver plugins.                                                 */
    00191 /* ==================================================================== */
    00192 typedef struct {
    00193     GDALPamDataset *poParentDS;
    00194
    00195     int            bNoDataValueSet;
    00196     double         dfNoDataValue;
    00197
    00198     GDALColorTable *poColorTable;
    00199
    00200     GDALColorInterp eColorInterp;
    00201
    00202     char           *pszUnitType;
    00203     char           **papszCategoryNames;
    00204
    00205     double         dfOffset;
    00206     double         dfScale;
    00207
    00208     int            bHaveMinMax;
    00209     double         dfMin;
    00210     double         dfMax;
    00211
    00212     int            bHaveStats;
    00213     double         dfMean;
    00214     double         dfStdDev;
    00215
    00216     CPLXMLNode     *psSavedHistograms;
    00217
    00218     GDALRasterAttributeTable *poDefaultRAT;
    00219
    00220 } GDALRasterBandPamInfo;
    00221
    00222 /* ******************************************************************** */
    00223 /*                          GDALPamRasterBand                           */
    00224 /* ******************************************************************** */
    00225 class CPL_DLL GDALPamRasterBand : public GDALRasterBand
    00226 {
    00227     friend class GDALPamDataset;
    00228
    00229   protected:
    00230
    00231     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
    00232     virtual CPLErr      XMLInit( CPLXMLNode *, const char * );
    00233
    00234     void   PamInitialize();
    00235     void   PamClear();
    00236
    00237     GDALRasterBandPamInfo *psPam;
    00238
    00239   public:
    00240                 GDALPamRasterBand();
    00241     virtual     ~GDALPamRasterBand();
    00242
    00243     virtual void        SetDescription( const char * );
    00244
    00245     virtual CPLErr SetNoDataValue( double );
    00246     virtual double GetNoDataValue( int *pbSuccess = NULL );
    00247
    00248     virtual CPLErr SetColorTable( GDALColorTable * );
    00249     virtual GDALColorTable *GetColorTable();
    00250
    00251     virtual CPLErr SetColorInterpretation( GDALColorInterp );
    00252     virtual GDALColorInterp GetColorInterpretation();
    00253
    00254     virtual const char *GetUnitType();
    00255     CPLErr SetUnitType( const char * );
    00256
    00257     virtual char **GetCategoryNames();
    00258     virtual CPLErr SetCategoryNames( char ** );
    00259
    00260     virtual double GetOffset( int *pbSuccess = NULL );
    00261     CPLErr SetOffset( double );
    00262     virtual double GetScale( int *pbSuccess = NULL );
    00263     CPLErr SetScale( double );
    00264
    00265     virtual CPLErr  GetHistogram( double dfMin, double dfMax,
    00266                           int nBuckets, int * panHistogram,
    00267                           int bIncludeOutOfRange, int bApproxOK,
    00268                           GDALProgressFunc, void *pProgressData );
    00269
    00270     virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
    00271                                         int *pnBuckets, int ** ppanHistogram,
    00272                                         int bForce,
    00273                                         GDALProgressFunc, void *pProgressData);
    00274
    00275     virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
    00276                                         int nBuckets, int *panHistogram );
    00277
    00278     virtual CPLErr      SetMetadata( char ** papszMetadata,
    00279                                      const char * pszDomain = "" );
    00280     virtual CPLErr      SetMetadataItem( const char * pszName,
    00281                                          const char * pszValue,
    00282                                          const char * pszDomain = "" );
    00283
    00284     virtual const GDALRasterAttributeTable *GetDefaultRAT();
    00285     virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * );
    00286
    00287     // new in GDALPamRasterBand.
    00288     virtual CPLErr CloneInfo( GDALRasterBand *poSrcBand, int nCloneInfoFlags );
    00289
    00290     // "semi private" methods.
    00291     GDALRasterBandPamInfo *GetPamInfo() { return psPam; }
    00292 };
    00293
    00294 // These are mainly helper functions for internal use.
    00295 int CPL_DLL PamParseHistogram( CPLXMLNode *psHistItem,
    00296                                double *pdfMin, double *pdfMax,
    00297                                int *pnBuckets, int **ppanHistogram,
    00298                                int *pbIncludeOutOfRange, int *pbApproxOK );
    00299 CPLXMLNode CPL_DLL *
    00300 PamFindMatchingHistogram( CPLXMLNode *psSavedHistograms,
    00301                           double dfMin, double dfMax, int nBuckets,
    00302                           int bIncludeOutOfRange, int bApproxOK );
    00303 CPLXMLNode CPL_DLL *
    00304 PamHistogramToXMLTree( double dfMin, double dfMax,
    00305                        int nBuckets, int * panHistogram,
    00306                        int bIncludeOutOfRange, int bApprox );
    00307
    00308 // For managing the proxy file database.
    00309 const char CPL_DLL * PamGetProxy( const char * );
    00310 const char CPL_DLL * PamAllocateProxy( const char * );
    00311 const char CPL_DLL * PamDeallocateProxy( const char * );
    00312 void CPL_DLL PamCleanProxyDB( void );
    00313
    00314 #endif /* ndef GDAL_PAM_H_INCLUDED */

Generated for GDAL by 1.7.1.