- Main Page
- Related Pages
- Classes
- Files

# vrtdataset.h

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

Generated for GDAL by 1.5.6.