GDAL

vrtdataset.h

00001 /******************************************************************************
00002  * $Id: vrtdataset.h 21290 2010-12-19 10:41:00Z rouault $
00003  *
00004  * Project:  Virtual GDAL Datasets
00005  * Purpose:  Declaration of virtual gdal dataset classes.
00006  * Author:   Frank Warmerdam, warmerdam@pobox.com
00007  *
00008  ******************************************************************************
00009  * Copyright (c) 2001, 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 VIRTUALDATASET_H_INCLUDED
00031 #define VIRTUALDATASET_H_INCLUDED
00032 
00033 #include "gdal_priv.h"
00034 #include "gdal_pam.h"
00035 #include "gdal_vrt.h"
00036 #include "cpl_hash_set.h"
00037 
00038 int VRTApplyMetadata( CPLXMLNode *, GDALMajorObject * );
00039 CPLXMLNode *VRTSerializeMetadata( GDALMajorObject * );
00040 
00041 int VRTWarpedOverviewTransform( void *pTransformArg, int bDstToSrc,
00042                                 int nPointCount,
00043                                 double *padfX, double *padfY, double *padfZ,
00044                                 int *panSuccess );
00045 void* VRTDeserializeWarpedOverviewTransformer( CPLXMLNode *psTree );
00046 
00047 /************************************************************************/
00048 /*                          VRTOverviewInfo()                           */
00049 /************************************************************************/
00050 class VRTOverviewInfo
00051 {
00052 public:
00053     CPLString       osFilename;
00054     int             nBand;
00055     GDALRasterBand *poBand;
00056     int             bTriedToOpen;
00057     
00058     VRTOverviewInfo() : poBand(NULL), bTriedToOpen(FALSE) {}
00059     ~VRTOverviewInfo() {
00060         if( poBand == NULL ) 
00061             /* do nothing */;
00062         else if( poBand->GetDataset()->GetShared() )
00063             GDALClose( (GDALDatasetH) poBand->GetDataset() );
00064         else
00065             poBand->GetDataset()->Dereference();
00066     }
00067 };
00068 
00069 
00070 /************************************************************************/
00071 /*                              VRTSource                               */
00072 /************************************************************************/
00073 
00074 class VRTSource 
00075 {
00076 public:
00077     virtual ~VRTSource();
00078 
00079     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
00080                               void *pData, int nBufXSize, int nBufYSize, 
00081                               GDALDataType eBufType, 
00082                               int nPixelSpace, int nLineSpace ) = 0;
00083 
00084     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * ) = 0;
00085     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) = 0;
00086     
00087     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
00088                                int *pnMaxSize, CPLHashSet* hSetFiles);
00089 };
00090 
00091 typedef VRTSource *(*VRTSourceParser)(CPLXMLNode *, const char *);
00092 
00093 VRTSource *VRTParseCoreSources( CPLXMLNode *psTree, const char * );
00094 VRTSource *VRTParseFilterSources( CPLXMLNode *psTree, const char * );
00095 
00096 /************************************************************************/
00097 /*                              VRTDataset                              */
00098 /************************************************************************/
00099 
00100 class VRTRasterBand;
00101 
00102 class CPL_DLL VRTDataset : public GDALDataset
00103 {
00104     friend class VRTRasterBand;
00105 
00106     char           *pszProjection;
00107 
00108     int            bGeoTransformSet;
00109     double         adfGeoTransform[6];
00110 
00111     int           nGCPCount;
00112     GDAL_GCP      *pasGCPList;
00113     char          *pszGCPProjection;
00114 
00115     int            bNeedsFlush;
00116     int            bWritable;
00117     
00118     char          *pszVRTPath;
00119 
00120     VRTRasterBand *poMaskBand;
00121 
00122   public:
00123                  VRTDataset(int nXSize, int nYSize);
00124                 ~VRTDataset();
00125 
00126     void          SetNeedsFlush() { bNeedsFlush = TRUE; }
00127     virtual void  FlushCache();
00128     
00129     void SetWritable(int bWritable) { this->bWritable = bWritable; }
00130 
00131     virtual CPLErr          CreateMaskBand( int nFlags );
00132     void SetMaskBand(VRTRasterBand* poMaskBand);
00133 
00134     virtual const char *GetProjectionRef(void);
00135     virtual CPLErr SetProjection( const char * );
00136     virtual CPLErr GetGeoTransform( double * );
00137     virtual CPLErr SetGeoTransform( double * );
00138 
00139     virtual CPLErr SetMetadata( char **papszMD, const char *pszDomain = "" );
00140     virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
00141                                     const char *pszDomain = "" );
00142 
00143     virtual int    GetGCPCount();
00144     virtual const char *GetGCPProjection();
00145     virtual const GDAL_GCP *GetGCPs();
00146     virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
00147                             const char *pszGCPProjection );
00148 
00149     virtual CPLErr AddBand( GDALDataType eType, 
00150                             char **papszOptions=NULL );
00151                             
00152     virtual char      **GetFileList();
00153 
00154     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath);
00155     virtual CPLErr      XMLInit( CPLXMLNode *, const char * );
00156  
00157     static int          Identify( GDALOpenInfo * );
00158     static GDALDataset *Open( GDALOpenInfo * );
00159     static GDALDataset *OpenXML( const char *, const char * = NULL, GDALAccess eAccess = GA_ReadOnly );
00160     static GDALDataset *Create( const char * pszName,
00161                                 int nXSize, int nYSize, int nBands,
00162                                 GDALDataType eType, char ** papszOptions );
00163     static CPLErr       Delete( const char * pszFilename );
00164 };
00165 
00166 /************************************************************************/
00167 /*                           VRTWarpedDataset                           */
00168 /************************************************************************/
00169 
00170 class GDALWarpOperation;
00171 class VRTWarpedRasterBand;
00172 
00173 class CPL_DLL VRTWarpedDataset : public VRTDataset
00174 {
00175     int               nBlockXSize;
00176     int               nBlockYSize;
00177     GDALWarpOperation *poWarper;
00178 
00179     friend class VRTWarpedRasterBand;
00180 
00181 public:
00182     int               nOverviewCount;
00183     VRTWarpedDataset  **papoOverviews;
00184 
00185 public:
00186                       VRTWarpedDataset( int nXSize, int nYSize );
00187                      ~VRTWarpedDataset();
00188 
00189     CPLErr            Initialize( /* GDALWarpOptions */ void * );
00190 
00191     virtual CPLErr IBuildOverviews( const char *, int, int *,
00192                                     int, int *, GDALProgressFunc, void * );
00193     
00194     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
00195     virtual CPLErr    XMLInit( CPLXMLNode *, const char * );
00196 
00197     virtual CPLErr AddBand( GDALDataType eType, 
00198                             char **papszOptions=NULL );
00199                             
00200     virtual char      **GetFileList();
00201     
00202     CPLErr            ProcessBlock( int iBlockX, int iBlockY );
00203 
00204     void              GetBlockSize( int *, int * );
00205 };
00206 
00207 /************************************************************************/
00208 /*                            VRTRasterBand                             */
00209 /*                                                                      */
00210 /*      Provides support for all the various kinds of metadata but      */
00211 /*      no raster access.  That is handled by derived classes.          */
00212 /************************************************************************/
00213 
00214 class CPL_DLL VRTRasterBand : public GDALRasterBand
00215 {
00216   protected:
00217     int            bIsMaskBand;
00218 
00219     int            bNoDataValueSet;
00220     int            bHideNoDataValue; // If set to true, will not report the existance of nodata
00221     double         dfNoDataValue;
00222 
00223     GDALColorTable *poColorTable;
00224 
00225     GDALColorInterp eColorInterp;
00226 
00227     char           *pszUnitType;
00228     char           **papszCategoryNames;
00229     
00230     double         dfOffset;
00231     double         dfScale;
00232 
00233     CPLXMLNode    *psSavedHistograms;
00234 
00235     void           Initialize( int nXSize, int nYSize );
00236 
00237     std::vector<VRTOverviewInfo> apoOverviews;
00238 
00239     VRTRasterBand *poMaskBand;
00240 
00241   public:
00242 
00243                     VRTRasterBand();
00244     virtual        ~VRTRasterBand();
00245 
00246     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
00247     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
00248 
00249     virtual CPLErr SetNoDataValue( double );
00250     virtual double GetNoDataValue( int *pbSuccess = NULL );
00251 
00252     virtual CPLErr SetColorTable( GDALColorTable * ); 
00253     virtual GDALColorTable *GetColorTable();
00254 
00255     virtual CPLErr SetColorInterpretation( GDALColorInterp );
00256     virtual GDALColorInterp GetColorInterpretation();
00257 
00258     virtual const char *GetUnitType();
00259     CPLErr SetUnitType( const char * ); 
00260 
00261     virtual char **GetCategoryNames();
00262     virtual CPLErr SetCategoryNames( char ** );
00263 
00264     virtual CPLErr SetMetadata( char **papszMD, const char *pszDomain = "" );
00265     virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
00266                                     const char *pszDomain = "" );
00267 
00268     virtual double GetOffset( int *pbSuccess = NULL );
00269     CPLErr SetOffset( double );
00270     virtual double GetScale( int *pbSuccess = NULL );
00271     CPLErr SetScale( double );
00272 
00273     virtual int GetOverviewCount();
00274     virtual GDALRasterBand *GetOverview(int);
00275     
00276     virtual CPLErr  GetHistogram( double dfMin, double dfMax,
00277                           int nBuckets, int * panHistogram,
00278                           int bIncludeOutOfRange, int bApproxOK,
00279                           GDALProgressFunc, void *pProgressData );
00280 
00281     virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
00282                                         int *pnBuckets, int ** ppanHistogram,
00283                                         int bForce,
00284                                         GDALProgressFunc, void *pProgressData);
00285 
00286     virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
00287                                         int nBuckets, int *panHistogram );
00288 
00289     CPLErr         CopyCommonInfoFrom( GDALRasterBand * );
00290     
00291     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
00292                                int *pnMaxSize, CPLHashSet* hSetFiles);
00293     
00294     virtual void   SetDescription( const char * );
00295 
00296     virtual GDALRasterBand *GetMaskBand();
00297     virtual int             GetMaskFlags();
00298 
00299     virtual CPLErr          CreateMaskBand( int nFlags );
00300     
00301     void SetMaskBand(VRTRasterBand* poMaskBand);
00302 
00303     void SetIsMaskBand();
00304 
00305     CPLErr UnsetNoDataValue();
00306 };
00307 
00308 /************************************************************************/
00309 /*                         VRTSourcedRasterBand                         */
00310 /************************************************************************/
00311 
00312 class CPL_DLL VRTSourcedRasterBand : public VRTRasterBand
00313 {
00314   private:
00315     int            bAlreadyInIRasterIO;
00316     CPLString      osLastLocationInfo;
00317 
00318     void           Initialize( int nXSize, int nYSize );
00319 
00320   public:
00321     int            nSources;
00322     VRTSource    **papoSources;
00323     int            bEqualAreas;
00324 
00325                    VRTSourcedRasterBand( GDALDataset *poDS, int nBand );
00326                    VRTSourcedRasterBand( GDALDataType eType, 
00327                                          int nXSize, int nYSize );
00328                    VRTSourcedRasterBand( GDALDataset *poDS, int nBand, 
00329                                          GDALDataType eType, 
00330                                          int nXSize, int nYSize );
00331     virtual        ~VRTSourcedRasterBand();
00332 
00333     virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
00334                               void *, int, int, GDALDataType,
00335                               int, int );
00336 
00337     virtual const char *GetMetadataItem( const char * pszName,
00338                                          const char * pszDomain = "" );
00339     virtual char      **GetMetadata( const char * pszDomain = "" );
00340     virtual CPLErr      SetMetadata( char ** papszMetadata,
00341                                      const char * pszDomain = "" );
00342     virtual CPLErr      SetMetadataItem( const char * pszName,
00343                                          const char * pszValue,
00344                                          const char * pszDomain = "" );
00345 
00346     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
00347     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
00348 
00349     CPLErr         AddSource( VRTSource * );
00350     CPLErr         AddSimpleSource( GDALRasterBand *poSrcBand, 
00351                                     int nSrcXOff=-1, int nSrcYOff=-1, 
00352                                     int nSrcXSize=-1, int nSrcYSize=-1, 
00353                                     int nDstXOff=-1, int nDstYOff=-1, 
00354                                     int nDstXSize=-1, int nDstYSize=-1,
00355                                     const char *pszResampling = "near",
00356                                     double dfNoDataValue = VRT_NODATA_UNSET);
00357     CPLErr         AddComplexSource( GDALRasterBand *poSrcBand, 
00358                                      int nSrcXOff=-1, int nSrcYOff=-1, 
00359                                      int nSrcXSize=-1, int nSrcYSize=-1, 
00360                                      int nDstXOff=-1, int nDstYOff=-1, 
00361                                      int nDstXSize=-1, int nDstYSize=-1,
00362                                      double dfScaleOff=0.0, 
00363                                      double dfScaleRatio=1.0,
00364                                      double dfNoDataValue = VRT_NODATA_UNSET,
00365                                      int nColorTableComponent = 0);
00366 
00367     CPLErr         AddMaskBandSource( GDALRasterBand *poSrcBand,
00368                                       int nSrcXOff=-1, int nSrcYOff=-1,
00369                                       int nSrcXSize=-1, int nSrcYSize=-1,
00370                                       int nDstXOff=-1, int nDstYOff=-1,
00371                                       int nDstXSize=-1, int nDstYSize=-1 );
00372 
00373     CPLErr         AddFuncSource( VRTImageReadFunc pfnReadFunc, void *hCBData,
00374                                   double dfNoDataValue = VRT_NODATA_UNSET );
00375 
00376 
00377     virtual CPLErr IReadBlock( int, int, void * );
00378     
00379     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
00380                                int *pnMaxSize, CPLHashSet* hSetFiles);
00381 };
00382 
00383 /************************************************************************/
00384 /*                         VRTWarpedRasterBand                          */
00385 /************************************************************************/
00386 
00387 class CPL_DLL VRTWarpedRasterBand : public VRTRasterBand
00388 {
00389   public:
00390                    VRTWarpedRasterBand( GDALDataset *poDS, int nBand,
00391                                      GDALDataType eType = GDT_Unknown );
00392     virtual        ~VRTWarpedRasterBand();
00393 
00394     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
00395     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
00396 
00397     virtual CPLErr IReadBlock( int, int, void * );
00398     virtual CPLErr IWriteBlock( int, int, void * );
00399 
00400     virtual int GetOverviewCount();
00401     virtual GDALRasterBand *GetOverview(int);
00402 };
00403 
00404 /************************************************************************/
00405 /*                         VRTDerivedRasterBand                         */
00406 /************************************************************************/
00407 
00408 class CPL_DLL VRTDerivedRasterBand : public VRTSourcedRasterBand
00409 {
00410 
00411  public:
00412     char *pszFuncName;
00413     GDALDataType eSourceTransferType;
00414 
00415     VRTDerivedRasterBand(GDALDataset *poDS, int nBand);
00416     VRTDerivedRasterBand(GDALDataset *poDS, int nBand, 
00417                          GDALDataType eType, int nXSize, int nYSize);
00418     virtual        ~VRTDerivedRasterBand();
00419 
00420     virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
00421                               void *, int, int, GDALDataType,
00422                               int, int );
00423 
00424     static CPLErr AddPixelFunction
00425         (const char *pszFuncName, GDALDerivedPixelFunc pfnPixelFunc);
00426     static GDALDerivedPixelFunc GetPixelFunction(const char *pszFuncName);
00427 
00428     void SetPixelFunctionName(const char *pszFuncName);
00429     void SetSourceTransferType(GDALDataType eDataType);
00430 
00431     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
00432     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
00433 
00434 };
00435 
00436 /************************************************************************/
00437 /*                           VRTRawRasterBand                           */
00438 /************************************************************************/
00439 
00440 class RawRasterBand;
00441 
00442 class CPL_DLL VRTRawRasterBand : public VRTRasterBand
00443 {
00444     RawRasterBand  *poRawRaster;
00445 
00446     char           *pszSourceFilename;
00447     int            bRelativeToVRT;
00448 
00449   public:
00450                    VRTRawRasterBand( GDALDataset *poDS, int nBand,
00451                                      GDALDataType eType = GDT_Unknown );
00452     virtual        ~VRTRawRasterBand();
00453 
00454     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
00455     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
00456 
00457     virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
00458                               void *, int, int, GDALDataType,
00459                               int, int );
00460 
00461     virtual CPLErr IReadBlock( int, int, void * );
00462     virtual CPLErr IWriteBlock( int, int, void * );
00463 
00464     CPLErr         SetRawLink( const char *pszFilename, 
00465                                const char *pszVRTPath,
00466                                int bRelativeToVRT, 
00467                                vsi_l_offset nImageOffset, 
00468                                int nPixelOffset, int nLineOffset, 
00469                                const char *pszByteOrder );
00470 
00471     void           ClearRawLink();
00472 
00473     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
00474                                int *pnMaxSize, CPLHashSet* hSetFiles);
00475 };
00476 
00477 /************************************************************************/
00478 /*                              VRTDriver                               */
00479 /************************************************************************/
00480 
00481 class VRTDriver : public GDALDriver
00482 {
00483     void        *pDeserializerData;
00484 
00485   public:
00486                  VRTDriver();
00487                  ~VRTDriver();
00488 
00489     char         **papszSourceParsers;
00490 
00491     virtual char      **GetMetadata( const char * pszDomain = "" );
00492     virtual CPLErr      SetMetadata( char ** papszMetadata,
00493                                      const char * pszDomain = "" );
00494 
00495     VRTSource   *ParseSource( CPLXMLNode *psSrc, const char *pszVRTPath );
00496     void         AddSourceParser( const char *pszElementName, 
00497                                   VRTSourceParser pfnParser );
00498 };
00499 
00500 /************************************************************************/
00501 /*                           VRTSimpleSource                            */
00502 /************************************************************************/
00503 
00504 class VRTSimpleSource : public VRTSource
00505 {
00506 protected:
00507     GDALRasterBand      *poRasterBand;
00508 
00509     /* when poRasterBand is a mask band, poMaskBandMainBand is the band */
00510     /* from which the mask band is taken */
00511     GDALRasterBand      *poMaskBandMainBand; 
00512 
00513     int                 nSrcXOff;
00514     int                 nSrcYOff;
00515     int                 nSrcXSize;
00516     int                 nSrcYSize;
00517 
00518     int                 nDstXOff;
00519     int                 nDstYOff;
00520     int                 nDstXSize;
00521     int                 nDstYSize;
00522 
00523     int                 bNoDataSet;
00524     double              dfNoDataValue;
00525 
00526 public:
00527             VRTSimpleSource();
00528     virtual ~VRTSimpleSource();
00529 
00530     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * );
00531     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
00532 
00533     void           SetSrcBand( GDALRasterBand * );
00534     void           SetSrcMaskBand( GDALRasterBand * );
00535     void           SetSrcWindow( int, int, int, int );
00536     void           SetDstWindow( int, int, int, int );
00537     void           SetNoDataValue( double dfNoDataValue );
00538 
00539     int            GetSrcDstWindow( int, int, int, int, int, int, 
00540                                     int *, int *, int *, int *,
00541                                     int *, int *, int *, int * );
00542 
00543     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
00544                               void *pData, int nBufXSize, int nBufYSize, 
00545                               GDALDataType eBufType, 
00546                               int nPixelSpace, int nLineSpace );
00547 
00548     void            DstToSrc( double dfX, double dfY,
00549                               double &dfXOut, double &dfYOut );
00550     void            SrcToDst( double dfX, double dfY,
00551                               double &dfXOut, double &dfYOut );
00552     
00553     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
00554                                int *pnMaxSize, CPLHashSet* hSetFiles);
00555 };
00556 
00557 /************************************************************************/
00558 /*                          VRTAveragedSource                           */
00559 /************************************************************************/
00560 
00561 class VRTAveragedSource : public VRTSimpleSource
00562 {
00563 public:
00564                     VRTAveragedSource();
00565     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
00566                               void *pData, int nBufXSize, int nBufYSize, 
00567                               GDALDataType eBufType, 
00568                               int nPixelSpace, int nLineSpace );
00569     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
00570 };
00571 
00572 /************************************************************************/
00573 /*                           VRTComplexSource                           */
00574 /************************************************************************/
00575 
00576 class VRTComplexSource : public VRTSimpleSource
00577 {
00578 public:
00579                    VRTComplexSource();
00580     virtual        ~VRTComplexSource();
00581 
00582     virtual CPLErr RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
00583                              void *pData, int nBufXSize, int nBufYSize, 
00584                              GDALDataType eBufType, 
00585                              int nPixelSpace, int nLineSpace );
00586     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
00587     virtual CPLErr XMLInit( CPLXMLNode *, const char * );
00588     double  LookupValue( double dfInput );
00589 
00590     int            bDoScaling;
00591     double         dfScaleOff;
00592     double         dfScaleRatio;
00593     double         *padfLUTInputs;
00594     double         *padfLUTOutputs;
00595     int            nLUTItemCount;
00596     int            nColorTableComponent;
00597 };
00598 
00599 /************************************************************************/
00600 /*                           VRTFilteredSource                          */
00601 /************************************************************************/
00602 
00603 class VRTFilteredSource : public VRTComplexSource
00604 {
00605 private:
00606     int          IsTypeSupported( GDALDataType eType );
00607 
00608 protected:
00609     int          nSupportedTypesCount;
00610     GDALDataType aeSupportedTypes[20];
00611 
00612     int          nExtraEdgePixels;
00613 
00614 public:
00615             VRTFilteredSource();
00616     virtual ~VRTFilteredSource();
00617 
00618     void    SetExtraEdgePixels( int );
00619     void    SetFilteringDataTypesSupported( int, GDALDataType * );
00620 
00621     virtual CPLErr  FilterData( int nXSize, int nYSize, GDALDataType eType, 
00622                                 GByte *pabySrcData, GByte *pabyDstData ) = 0;
00623 
00624     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
00625                               void *pData, int nBufXSize, int nBufYSize, 
00626                               GDALDataType eBufType, 
00627                               int nPixelSpace, int nLineSpace );
00628 };
00629 
00630 /************************************************************************/
00631 /*                       VRTKernelFilteredSource                        */
00632 /************************************************************************/
00633 
00634 class VRTKernelFilteredSource : public VRTFilteredSource
00635 {
00636 protected:
00637     int     nKernelSize;
00638 
00639     double  *padfKernelCoefs;
00640 
00641     int     bNormalized;
00642 
00643 public:
00644             VRTKernelFilteredSource();
00645     virtual ~VRTKernelFilteredSource();
00646 
00647     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * );
00648     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
00649 
00650     virtual CPLErr  FilterData( int nXSize, int nYSize, GDALDataType eType, 
00651                                 GByte *pabySrcData, GByte *pabyDstData );
00652 
00653     CPLErr          SetKernel( int nKernelSize, double *padfCoefs );
00654     void            SetNormalized( int );
00655 };
00656 
00657 /************************************************************************/
00658 /*                       VRTAverageFilteredSource                       */
00659 /************************************************************************/
00660 
00661 class VRTAverageFilteredSource : public VRTKernelFilteredSource
00662 {
00663 public:
00664             VRTAverageFilteredSource( int nKernelSize );
00665     virtual ~VRTAverageFilteredSource();
00666 
00667     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * );
00668     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
00669 };
00670 
00671 /************************************************************************/
00672 /*                            VRTFuncSource                             */
00673 /************************************************************************/
00674 class VRTFuncSource : public VRTSource
00675 {
00676 public:
00677             VRTFuncSource();
00678     virtual ~VRTFuncSource();
00679 
00680     virtual CPLErr  XMLInit( CPLXMLNode *, const char *) { return CE_Failure; }
00681     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
00682 
00683     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
00684                               void *pData, int nBufXSize, int nBufYSize, 
00685                               GDALDataType eBufType, 
00686                               int nPixelSpace, int nLineSpace );
00687 
00688     VRTImageReadFunc    pfnReadFunc;
00689     void               *pCBData;
00690     GDALDataType        eType;
00691     
00692     float               fNoDataValue;
00693 };
00694 
00695 #endif /* ndef VIRTUALDATASET_H_INCLUDED */

Generated for GDAL by doxygen 1.7.3.