- Main Page
- Classes
- Files
- Related Pages

- File List
- File Members

# gdal_pam.h

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

Generated for GDAL by 1.5.1.