- Main Page
- Classes
- Files
- Directories
- Related Pages

- File List
- File Members

# gdal_pam.h

    00001 /******************************************************************************
    00002  * $Id: gdal_pam.h,v 1.8 2006/02/08 06:03:40 fwarmerdam Exp $
    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  * $Log: gdal_pam.h,v $
    00031  * Revision 1.8  2006/02/08 06:03:40  fwarmerdam
    00032  * expose some PAM histo stuff for VRT, fixed InitFromXML() hist bug
    00033  *
    00034  * Revision 1.7  2005/10/13 01:19:57  fwarmerdam
    00035  * moved GDALMultiDomainMetadata into GDALMajorObject
    00036  *
    00037  * Revision 1.6  2005/09/24 19:02:15  fwarmerdam
    00038  * added RasterAttributeTable support
    00039  *
    00040  * Revision 1.5  2005/09/11 18:03:34  fwarmerdam
    00041  * added Clear() method on multidomainmetadata
    00042  *
    00043  * Revision 1.4  2005/05/22 08:14:06  fwarmerdam
    00044  * added multidomain metadata support
    00045  *
    00046  * Revision 1.3  2005/05/13 18:19:04  fwarmerdam
    00047  * Added SetDefaultHistogram
    00048  *
    00049  * Revision 1.2  2005/05/11 14:04:21  fwarmerdam
    00050  * added getdefaulthistogram
    00051  *
    00052  * Revision 1.1  2005/04/27 16:27:44  fwarmerdam
    00053  * New
    00054  *
    00055  */
    00056
    00057 #ifndef GDAL_PAM_H_INCLUDED
    00058 #define GDAL_PAM_H_INCLUDED
    00059
    00060 #include "gdal_priv.h"
    00061
    00062 class GDALPamRasterBand;
    00063
    00064 /* Clone Info Flags */
    00065
    00066 #define GCIF_GEOTRANSFORM       0x01
    00067 #define GCIF_PROJECTION         0x02
    00068 #define GCIF_METADATA           0x04
    00069 #define GCIF_GCPS               0x08
    00070
    00071 #define GCIF_NODATA             0x001000
    00072 #define GCIF_CATEGORYNAMES      0x002000
    00073 #define GCIF_MINMAX             0x004000
    00074 #define GCIF_SCALEOFFSET        0x008000
    00075 #define GCIF_UNITTYPE           0x010000
    00076 #define GCIF_COLORTABLE         0x020000
    00077 #define GCIF_COLORINTERP        0x020000
    00078 #define GCIF_BAND_METADATA      0x040000
    00079 #define GCIF_RAT                0x080000
    00080
    00081 #define GCIF_ONLY_IF_MISSING    0x10000000
    00082 #define GCIF_PROCESS_BANDS      0x20000000
    00083
    00084 #define GCIF_PAM_DEFAULT        (GCIF_GEOTRANSFORM | GCIF_PROJECTION |     \
    00085                                  GCIF_METADATA | GCIF_GCPS |               \
    00086                                  GCIF_NODATA | GCIF_CATEGORYNAMES |        \
    00087                                  GCIF_MINMAX | GCIF_SCALEOFFSET |          \
    00088                                  GCIF_UNITTYPE | GCIF_COLORTABLE |         \
    00089                                  GCIF_COLORINTERP | GCIF_BAND_METADATA |   \
    00090                                  GCIF_RAT |                                \
    00091                                  GCIF_ONLY_IF_MISSING | GCIF_PROCESS_BANDS )
    00092
    00093 /* GDAL PAM Flags */
    00094 #define GPF_DIRTY               0x01  // .pam file needs to be written on close
    00095 #define GPF_TRIED_READ_FAILED   0x02  // no need to keep trying to read .pam.
    00096 #define GPF_DISABLED            0x04  // do not try any PAM stuff.
    00097 #define GPF_AUXMODE             0x08  // store info in .aux (HFA) file.
    00098
    00099 /* ==================================================================== */
    00100 /*      GDALDatasetPamInfo                                              */
    00101 /*                                                                      */
    00102 /*      We make these things a seperate structure of information        */
    00103 /*      primarily so we can modify it without altering the size of      */
    00104 /*      the GDALPamDataset.  It is an effort to reduce ABI churn for    */
    00105 /*      driver plugins.                                                 */
    00106 /* ==================================================================== */
    00107 typedef struct {
    00108     char       *pszPamFilename;
    00109
    00110     char        *pszProjection;
    00111
    00112     int         bHaveGeoTransform;
    00113     double      adfGeoTransform[6];
    00114
    00115     int         nGCPCount;
    00116     GDAL_GCP   *pasGCPList;
    00117     char       *pszGCPProjection;
    00118
    00119 } GDALDatasetPamInfo;
    00120
    00121 /* ******************************************************************** */
    00122 /*                           GDALPamDataset                             */
    00123 /* ******************************************************************** */
    00124
    00125 class CPL_DLL GDALPamDataset : public GDALDataset
    00126 {
    00127     friend class GDALPamRasterBand;
    00128
    00129   protected:
    00130                 GDALPamDataset(void);
    00131
    00132     int         nPamFlags;
    00133     GDALDatasetPamInfo *psPam;
    00134
    00135     virtual CPLXMLNode *SerializeToXML( const char *);
    00136     virtual CPLErr      XMLInit( CPLXMLNode *, const char * );
    00137
    00138     virtual CPLErr TryLoadXML();
    00139     virtual CPLErr TrySaveXML();
    00140
    00141     CPLErr  TryLoadAux();
    00142     CPLErr  TrySaveAux();
    00143
    00144     virtual const char *BuildPamFilename();
    00145
    00146     void   PamInitialize();
    00147     void   PamClear();
    00148
    00149   public:
    00150     virtual     ~GDALPamDataset();
    00151
    00152     virtual void FlushCache(void);
    00153
    00154     virtual const char *GetProjectionRef(void);
    00155     virtual CPLErr SetProjection( const char * );
    00156
    00157     virtual CPLErr GetGeoTransform( double * );
    00158     virtual CPLErr SetGeoTransform( double * );
    00159
    00160     virtual int    GetGCPCount();
    00161     virtual const char *GetGCPProjection();
    00162     virtual const GDAL_GCP *GetGCPs();
    00163     virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
    00164                             const char *pszGCPProjection );
    00165
    00166     virtual CPLErr      SetMetadata( char ** papszMetadata,
    00167                                      const char * pszDomain = "" );
    00168     virtual CPLErr      SetMetadataItem( const char * pszName,
    00169                                          const char * pszValue,
    00170                                          const char * pszDomain = "" );
    00171
    00172     virtual CPLErr CloneInfo( GDALDataset *poSrcDS, int nCloneInfoFlags );
    00173
    00174
    00175     // "semi private" methods.
    00176     void   MarkPamDirty() { nPamFlags |= GPF_DIRTY; }
    00177     GDALDatasetPamInfo *GetPamInfo() { return psPam; }
    00178 };
    00179
    00180 /* ==================================================================== */
    00181 /*      GDALDatasetPamInfo                                              */
    00182 /*                                                                      */
    00183 /*      We make these things a seperate structure of information        */
    00184 /*      primarily so we can modify it without altering the size of      */
    00185 /*      the GDALPamDataset.  It is an effort to reduce ABI churn for    */
    00186 /*      driver plugins.                                                 */
    00187 /* ==================================================================== */
    00188 typedef struct {
    00189     GDALPamDataset *poParentDS;
    00190
    00191     int            bNoDataValueSet;
    00192     double         dfNoDataValue;
    00193
    00194     GDALColorTable *poColorTable;
    00195
    00196     GDALColorInterp eColorInterp;
    00197
    00198     char           *pszUnitType;
    00199     char           **papszCategoryNames;
    00200
    00201     double         dfOffset;
    00202     double         dfScale;
    00203
    00204     int            bHaveMinMax;
    00205     double         dfMin;
    00206     double         dfMax;
    00207
    00208     int            bHaveStats;
    00209     double         dfMean;
    00210     double         dfStdDev;
    00211
    00212     CPLXMLNode     *psSavedHistograms;
    00213
    00214     GDALRasterAttributeTable *poDefaultRAT;
    00215
    00216 } GDALRasterBandPamInfo;
    00217
    00218 /* ******************************************************************** */
    00219 /*                          GDALPamRasterBand                           */
    00220 /* ******************************************************************** */
    00221 class CPL_DLL GDALPamRasterBand : public GDALRasterBand
    00222 {
    00223     friend class GDALPamDataset;
    00224
    00225   protected:
    00226
    00227     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
    00228     virtual CPLErr      XMLInit( CPLXMLNode *, const char * );
    00229
    00230     void   PamInitialize();
    00231     void   PamClear();
    00232
    00233     GDALRasterBandPamInfo *psPam;
    00234
    00235   public:
    00236                 GDALPamRasterBand();
    00237     virtual     ~GDALPamRasterBand();
    00238
    00239     virtual CPLErr SetNoDataValue( double );
    00240     virtual double GetNoDataValue( int *pbSuccess = NULL );
    00241
    00242     virtual CPLErr SetColorTable( GDALColorTable * );
    00243     virtual GDALColorTable *GetColorTable();
    00244
    00245     virtual CPLErr SetColorInterpretation( GDALColorInterp );
    00246     virtual GDALColorInterp GetColorInterpretation();
    00247
    00248     virtual const char *GetUnitType();
    00249     CPLErr SetUnitType( const char * );
    00250
    00251     virtual char **GetCategoryNames();
    00252     virtual CPLErr SetCategoryNames( char ** );
    00253
    00254     virtual double GetOffset( int *pbSuccess = NULL );
    00255     CPLErr SetOffset( double );
    00256     virtual double GetScale( int *pbSuccess = NULL );
    00257     CPLErr SetScale( double );
    00258
    00259     virtual CPLErr  GetHistogram( double dfMin, double dfMax,
    00260                           int nBuckets, int * panHistogram,
    00261                           int bIncludeOutOfRange, int bApproxOK,
    00262                           GDALProgressFunc, void *pProgressData );
    00263
    00264     virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
    00265                                         int *pnBuckets, int ** ppanHistogram,
    00266                                         int bForce,
    00267                                         GDALProgressFunc, void *pProgressData);
    00268
    00269     virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
    00270                                         int nBuckets, int *panHistogram );
    00271
    00272     virtual CPLErr      SetMetadata( char ** papszMetadata,
    00273                                      const char * pszDomain = "" );
    00274     virtual CPLErr      SetMetadataItem( const char * pszName,
    00275                                          const char * pszValue,
    00276                                          const char * pszDomain = "" );
    00277
    00278     virtual const GDALRasterAttributeTable *GetDefaultRAT();
    00279     virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * );
    00280
    00281     // new in GDALPamRasterBand.
    00282     virtual CPLErr CloneInfo( GDALRasterBand *poSrcBand, int nCloneInfoFlags );
    00283
    00284     // "semi private" methods.
    00285     GDALRasterBandPamInfo *GetPamInfo() { return psPam; }
    00286 };
    00287
    00288 // These are mainly helper functions for internal use.
    00289 int CPL_DLL PamApplyMetadata( CPLXMLNode *psTree, GDALMajorObject *poMO );
    00290 CPLXMLNode CPL_DLL *PamSerializeMetadata( GDALMajorObject *poMO );
    00291 int CPL_DLL PamParseHistogram( CPLXMLNode *psHistItem,
    00292                                double *pdfMin, double *pdfMax,
    00293                                int *pnBuckets, int **ppanHistogram,
    00294                                int *pbIncludeOutOfRange, int *pbApproxOK );
    00295 CPLXMLNode CPL_DLL *
    00296 PamFindMatchingHistogram( CPLXMLNode *psSavedHistograms,
    00297                           double dfMin, double dfMax, int nBuckets,
    00298                           int bIncludeOutOfRange, int bApproxOK );
    00299 CPLXMLNode CPL_DLL *
    00300 PamHistogramToXMLTree( double dfMin, double dfMax,
    00301                        int nBuckets, int * panHistogram,
    00302                        int bIncludeOutOfRange, int bApprox );
    00303
    00304 #endif /* ndef GDAL_PAM_H_INCLUDED */

Generated for GDAL by 1.4.5.