LCOV - code coverage report
Current view: directory - frmts/vrt - vrtdataset.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 4 3 75.0 %
Date: 2010-01-09 Functions: 5 4 80.0 %

       1                 : /******************************************************************************
       2                 :  * $Id: vrtdataset.h 17902 2009-10-25 22:22:29Z rouault $
       3                 :  *
       4                 :  * Project:  Virtual GDAL Datasets
       5                 :  * Purpose:  Declaration of virtual gdal dataset classes.
       6                 :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 2001, Frank Warmerdam <warmerdam@pobox.com>
      10                 :  *
      11                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      12                 :  * copy of this software and associated documentation files (the "Software"),
      13                 :  * to deal in the Software without restriction, including without limitation
      14                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      15                 :  * and/or sell copies of the Software, and to permit persons to whom the
      16                 :  * Software is furnished to do so, subject to the following conditions:
      17                 :  *
      18                 :  * The above copyright notice and this permission notice shall be included
      19                 :  * in all copies or substantial portions of the Software.
      20                 :  *
      21                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      22                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      24                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      26                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      27                 :  * DEALINGS IN THE SOFTWARE.
      28                 :  ****************************************************************************/
      29                 : 
      30                 : #ifndef VIRTUALDATASET_H_INCLUDED
      31                 : #define VIRTUALDATASET_H_INCLUDED
      32                 : 
      33                 : #include "gdal_priv.h"
      34                 : #include "gdal_pam.h"
      35                 : #include "gdal_vrt.h"
      36                 : #include "cpl_hash_set.h"
      37                 : 
      38                 : int VRTApplyMetadata( CPLXMLNode *, GDALMajorObject * );
      39                 : CPLXMLNode *VRTSerializeMetadata( GDALMajorObject * );
      40                 : 
      41                 : /************************************************************************/
      42                 : /*                              VRTSource                               */
      43                 : /************************************************************************/
      44                 : 
      45                 : class VRTSource 
      46             299 : {
      47                 : public:
      48                 :     virtual ~VRTSource();
      49                 : 
      50                 :     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
      51                 :                               void *pData, int nBufXSize, int nBufYSize, 
      52                 :                               GDALDataType eBufType, 
      53                 :                               int nPixelSpace, int nLineSpace ) = 0;
      54                 : 
      55                 :     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * ) = 0;
      56                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) = 0;
      57                 :     
      58                 :     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
      59                 :                                int *pnMaxSize, CPLHashSet* hSetFiles);
      60                 : };
      61                 : 
      62                 : typedef VRTSource *(*VRTSourceParser)(CPLXMLNode *, const char *);
      63                 : 
      64                 : VRTSource *VRTParseCoreSources( CPLXMLNode *psTree, const char * );
      65                 : VRTSource *VRTParseFilterSources( CPLXMLNode *psTree, const char * );
      66                 : 
      67                 : /************************************************************************/
      68                 : /*                              VRTDataset                              */
      69                 : /************************************************************************/
      70                 : 
      71                 : class CPL_DLL VRTDataset : public GDALDataset
      72                 : {
      73                 :     char           *pszProjection;
      74                 : 
      75                 :     int            bGeoTransformSet;
      76                 :     double         adfGeoTransform[6];
      77                 : 
      78                 :     int           nGCPCount;
      79                 :     GDAL_GCP      *pasGCPList;
      80                 :     char          *pszGCPProjection;
      81                 : 
      82                 :     int            bNeedsFlush;
      83                 :     int            bWritable;
      84                 :     
      85                 :     char          *pszVRTPath;
      86                 : 
      87                 :   public:
      88                 :                  VRTDataset(int nXSize, int nYSize);
      89                 :                 ~VRTDataset();
      90                 : 
      91             791 :     void          SetNeedsFlush() { bNeedsFlush = TRUE; }
      92                 :     virtual void  FlushCache();
      93                 :     
      94                 :     void SetWritable(int bWritable) { this->bWritable = bWritable; }
      95                 : 
      96                 :     virtual const char *GetProjectionRef(void);
      97                 :     virtual CPLErr SetProjection( const char * );
      98                 :     virtual CPLErr GetGeoTransform( double * );
      99                 :     virtual CPLErr SetGeoTransform( double * );
     100                 : 
     101                 :     virtual CPLErr SetMetadata( char **papszMD, const char *pszDomain = "" );
     102                 :     virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
     103                 :                                     const char *pszDomain = "" );
     104                 : 
     105                 :     virtual int    GetGCPCount();
     106                 :     virtual const char *GetGCPProjection();
     107                 :     virtual const GDAL_GCP *GetGCPs();
     108                 :     virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
     109                 :                             const char *pszGCPProjection );
     110                 : 
     111                 :     virtual CPLErr AddBand( GDALDataType eType, 
     112                 :                             char **papszOptions=NULL );
     113                 :                             
     114                 :     virtual char      **GetFileList();
     115                 : 
     116                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath);
     117                 :     virtual CPLErr      XMLInit( CPLXMLNode *, const char * );
     118                 :  
     119                 :     static int          Identify( GDALOpenInfo * );
     120                 :     static GDALDataset *Open( GDALOpenInfo * );
     121                 :     static GDALDataset *OpenXML( const char *, const char * = NULL, GDALAccess eAccess = GA_ReadOnly );
     122                 :     static GDALDataset *Create( const char * pszName,
     123                 :                                 int nXSize, int nYSize, int nBands,
     124                 :                                 GDALDataType eType, char ** papszOptions );
     125                 :     static CPLErr       Delete( const char * pszFilename );
     126                 : };
     127                 : 
     128                 : /************************************************************************/
     129                 : /*                           VRTWarpedDataset                           */
     130                 : /************************************************************************/
     131                 : 
     132                 : class GDALWarpOperation;
     133                 : class VRTWarpedRasterBand;
     134                 : 
     135                 : class CPL_DLL VRTWarpedDataset : public VRTDataset
     136                 : {
     137                 :     int               nBlockXSize;
     138                 :     int               nBlockYSize;
     139                 :     GDALWarpOperation *poWarper;
     140                 : 
     141                 :     friend class VRTWarpedRasterBand;
     142                 : 
     143                 : public:
     144                 :     int               nOverviewCount;
     145                 :     VRTWarpedDataset  **papoOverviews;
     146                 : 
     147                 : public:
     148                 :                       VRTWarpedDataset( int nXSize, int nYSize );
     149                 :                      ~VRTWarpedDataset();
     150                 : 
     151                 :     CPLErr            Initialize( /* GDALWarpOptions */ void * );
     152                 : 
     153                 :     virtual CPLErr IBuildOverviews( const char *, int, int *,
     154                 :                                     int, int *, GDALProgressFunc, void * );
     155                 :     
     156                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
     157                 :     virtual CPLErr    XMLInit( CPLXMLNode *, const char * );
     158                 : 
     159                 :     virtual CPLErr AddBand( GDALDataType eType, 
     160                 :                             char **papszOptions=NULL );
     161                 :                             
     162                 :     virtual char      **GetFileList();
     163                 :     
     164                 :     CPLErr            ProcessBlock( int iBlockX, int iBlockY );
     165                 : 
     166                 :     void              GetBlockSize( int *, int * );
     167                 : };
     168                 : 
     169                 : /************************************************************************/
     170                 : /*                            VRTRasterBand                             */
     171                 : /*                                                                      */
     172                 : /*      Provides support for all the various kinds of metadata but      */
     173                 : /*      no raster access.  That is handled by derived classes.          */
     174                 : /************************************************************************/
     175                 : 
     176                 : class CPL_DLL VRTRasterBand : public GDALRasterBand
     177                 : {
     178                 :   protected:
     179                 :     int            bNoDataValueSet;
     180                 :     double         dfNoDataValue;
     181                 : 
     182                 :     GDALColorTable *poColorTable;
     183                 : 
     184                 :     GDALColorInterp eColorInterp;
     185                 : 
     186                 :     char           *pszUnitType;
     187                 :     char           **papszCategoryNames;
     188                 :     
     189                 :     double         dfOffset;
     190                 :     double         dfScale;
     191                 : 
     192                 :     CPLXMLNode    *psSavedHistograms;
     193                 : 
     194                 :     void           Initialize( int nXSize, int nYSize );
     195                 : 
     196                 :   public:
     197                 : 
     198                 :                     VRTRasterBand();
     199                 :     virtual        ~VRTRasterBand();
     200                 : 
     201                 :     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
     202                 :     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
     203                 : 
     204                 :     virtual CPLErr SetNoDataValue( double );
     205                 :     virtual double GetNoDataValue( int *pbSuccess = NULL );
     206                 : 
     207                 :     virtual CPLErr SetColorTable( GDALColorTable * ); 
     208                 :     virtual GDALColorTable *GetColorTable();
     209                 : 
     210                 :     virtual CPLErr SetColorInterpretation( GDALColorInterp );
     211                 :     virtual GDALColorInterp GetColorInterpretation();
     212                 : 
     213                 :     virtual const char *GetUnitType();
     214                 :     CPLErr SetUnitType( const char * ); 
     215                 : 
     216                 :     virtual char **GetCategoryNames();
     217                 :     virtual CPLErr SetCategoryNames( char ** );
     218                 : 
     219                 :     virtual CPLErr SetMetadata( char **papszMD, const char *pszDomain = "" );
     220                 :     virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
     221                 :                                     const char *pszDomain = "" );
     222                 : 
     223                 :     virtual double GetOffset( int *pbSuccess = NULL );
     224                 :     CPLErr SetOffset( double );
     225                 :     virtual double GetScale( int *pbSuccess = NULL );
     226                 :     CPLErr SetScale( double );
     227                 :     
     228                 :     virtual CPLErr  GetHistogram( double dfMin, double dfMax,
     229                 :                           int nBuckets, int * panHistogram,
     230                 :                           int bIncludeOutOfRange, int bApproxOK,
     231                 :                           GDALProgressFunc, void *pProgressData );
     232                 : 
     233                 :     virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
     234                 :                                         int *pnBuckets, int ** ppanHistogram,
     235                 :                                         int bForce,
     236                 :                                         GDALProgressFunc, void *pProgressData);
     237                 : 
     238                 :     virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
     239                 :                                         int nBuckets, int *panHistogram );
     240                 : 
     241                 :     CPLErr         CopyCommonInfoFrom( GDALRasterBand * );
     242                 :     
     243                 :     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
     244                 :                                int *pnMaxSize, CPLHashSet* hSetFiles);
     245                 : };
     246                 : 
     247                 : /************************************************************************/
     248                 : /*                         VRTSourcedRasterBand                         */
     249                 : /************************************************************************/
     250                 : 
     251                 : class CPL_DLL VRTSourcedRasterBand : public VRTRasterBand
     252                 : {
     253                 :     int            bAlreadyInIRasterIO;
     254                 :     
     255                 :     void           Initialize( int nXSize, int nYSize );
     256                 : 
     257                 :   public:
     258                 :     int            nSources;
     259                 :     VRTSource    **papoSources;
     260                 :     int            bEqualAreas;
     261                 : 
     262                 :                    VRTSourcedRasterBand( GDALDataset *poDS, int nBand );
     263                 :                    VRTSourcedRasterBand( GDALDataType eType, 
     264                 :                                          int nXSize, int nYSize );
     265                 :                    VRTSourcedRasterBand( GDALDataset *poDS, int nBand, 
     266                 :                                          GDALDataType eType, 
     267                 :                                          int nXSize, int nYSize );
     268                 :     virtual        ~VRTSourcedRasterBand();
     269                 : 
     270                 :     virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
     271                 :                               void *, int, int, GDALDataType,
     272                 :                               int, int );
     273                 : 
     274                 :     virtual char      **GetMetadata( const char * pszDomain = "" );
     275                 :     virtual CPLErr      SetMetadata( char ** papszMetadata,
     276                 :                                      const char * pszDomain = "" );
     277                 :     virtual CPLErr      SetMetadataItem( const char * pszName,
     278                 :                                          const char * pszValue,
     279                 :                                          const char * pszDomain = "" );
     280                 : 
     281                 :     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
     282                 :     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
     283                 : 
     284                 :     CPLErr         AddSource( VRTSource * );
     285                 :     CPLErr         AddSimpleSource( GDALRasterBand *poSrcBand, 
     286                 :                                     int nSrcXOff=-1, int nSrcYOff=-1, 
     287                 :                                     int nSrcXSize=-1, int nSrcYSize=-1, 
     288                 :                                     int nDstXOff=-1, int nDstYOff=-1, 
     289                 :                                     int nDstXSize=-1, int nDstYSize=-1,
     290                 :                                     const char *pszResampling = "near",
     291                 :                                     double dfNoDataValue = VRT_NODATA_UNSET);
     292                 :     CPLErr         AddComplexSource( GDALRasterBand *poSrcBand, 
     293                 :                                      int nSrcXOff=-1, int nSrcYOff=-1, 
     294                 :                                      int nSrcXSize=-1, int nSrcYSize=-1, 
     295                 :                                      int nDstXOff=-1, int nDstYOff=-1, 
     296                 :                                      int nDstXSize=-1, int nDstYSize=-1,
     297                 :                                      double dfScaleOff=0.0, 
     298                 :                                      double dfScaleRatio=1.0,
     299                 :                                      double dfNoDataValue = VRT_NODATA_UNSET,
     300                 :                                      int nColorTableComponent = 0);
     301                 : 
     302                 :     CPLErr         AddFuncSource( VRTImageReadFunc pfnReadFunc, void *hCBData,
     303                 :                                   double dfNoDataValue = VRT_NODATA_UNSET );
     304                 : 
     305                 : 
     306                 :     virtual CPLErr IReadBlock( int, int, void * );
     307                 :     
     308                 :     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
     309                 :                                int *pnMaxSize, CPLHashSet* hSetFiles);
     310                 : };
     311                 : 
     312                 : /************************************************************************/
     313                 : /*                         VRTWarpedRasterBand                          */
     314                 : /************************************************************************/
     315                 : 
     316                 : class CPL_DLL VRTWarpedRasterBand : public VRTRasterBand
     317                 : {
     318                 :   public:
     319                 :                    VRTWarpedRasterBand( GDALDataset *poDS, int nBand,
     320                 :                                      GDALDataType eType = GDT_Unknown );
     321                 :     virtual        ~VRTWarpedRasterBand();
     322                 : 
     323                 :     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
     324                 :     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
     325                 : 
     326                 :     virtual CPLErr IReadBlock( int, int, void * );
     327                 :     virtual CPLErr IWriteBlock( int, int, void * );
     328                 : 
     329                 :     virtual int GetOverviewCount();
     330                 :     virtual GDALRasterBand *GetOverview(int);
     331                 : };
     332                 : 
     333                 : /************************************************************************/
     334                 : /*                         VRTDerivedRasterBand                         */
     335                 : /************************************************************************/
     336                 : 
     337                 : class CPL_DLL VRTDerivedRasterBand : public VRTSourcedRasterBand
     338                 : {
     339                 : 
     340                 :  public:
     341                 :     char *pszFuncName;
     342                 :     GDALDataType eSourceTransferType;
     343                 : 
     344                 :     VRTDerivedRasterBand(GDALDataset *poDS, int nBand);
     345                 :     VRTDerivedRasterBand(GDALDataset *poDS, int nBand, 
     346                 :                          GDALDataType eType, int nXSize, int nYSize);
     347                 :     virtual        ~VRTDerivedRasterBand();
     348                 : 
     349                 :     virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
     350                 :                               void *, int, int, GDALDataType,
     351                 :                               int, int );
     352                 : 
     353                 :     static CPLErr AddPixelFunction
     354                 :         (const char *pszFuncName, GDALDerivedPixelFunc pfnPixelFunc);
     355                 :     static GDALDerivedPixelFunc GetPixelFunction(const char *pszFuncName);
     356                 : 
     357                 :     void SetPixelFunctionName(const char *pszFuncName);
     358                 :     void SetSourceTransferType(GDALDataType eDataType);
     359                 : 
     360                 :     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
     361                 :     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
     362                 : 
     363                 : };
     364                 : 
     365                 : /************************************************************************/
     366                 : /*                           VRTRawRasterBand                           */
     367                 : /************************************************************************/
     368                 : 
     369                 : class RawRasterBand;
     370                 : 
     371                 : class CPL_DLL VRTRawRasterBand : public VRTRasterBand
     372                 : {
     373                 :     RawRasterBand  *poRawRaster;
     374                 : 
     375                 :     char           *pszSourceFilename;
     376                 :     int            bRelativeToVRT;
     377                 : 
     378                 :   public:
     379                 :                    VRTRawRasterBand( GDALDataset *poDS, int nBand,
     380                 :                                      GDALDataType eType = GDT_Unknown );
     381                 :     virtual        ~VRTRawRasterBand();
     382                 : 
     383                 :     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
     384                 :     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
     385                 : 
     386                 :     virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
     387                 :                               void *, int, int, GDALDataType,
     388                 :                               int, int );
     389                 : 
     390                 :     virtual CPLErr IReadBlock( int, int, void * );
     391                 :     virtual CPLErr IWriteBlock( int, int, void * );
     392                 : 
     393                 :     CPLErr         SetRawLink( const char *pszFilename, 
     394                 :                                const char *pszVRTPath,
     395                 :                                int bRelativeToVRT, 
     396                 :                                vsi_l_offset nImageOffset, 
     397                 :                                int nPixelOffset, int nLineOffset, 
     398                 :                                const char *pszByteOrder );
     399                 : 
     400                 :     void           ClearRawLink();
     401                 : 
     402                 :     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
     403                 :                                int *pnMaxSize, CPLHashSet* hSetFiles);
     404                 : };
     405                 : 
     406                 : /************************************************************************/
     407                 : /*                              VRTDriver                               */
     408                 : /************************************************************************/
     409                 : 
     410                 : class VRTDriver : public GDALDriver
     411                 : {
     412                 :   public:
     413                 :                  VRTDriver();
     414                 :                  ~VRTDriver();
     415                 : 
     416                 :     char         **papszSourceParsers;
     417                 : 
     418                 :     virtual char      **GetMetadata( const char * pszDomain = "" );
     419                 :     virtual CPLErr      SetMetadata( char ** papszMetadata,
     420                 :                                      const char * pszDomain = "" );
     421                 : 
     422                 :     VRTSource   *ParseSource( CPLXMLNode *psSrc, const char *pszVRTPath );
     423                 :     void         AddSourceParser( const char *pszElementName, 
     424                 :                                   VRTSourceParser pfnParser );
     425                 : };
     426                 : 
     427                 : /************************************************************************/
     428                 : /*                           VRTSimpleSource                            */
     429                 : /************************************************************************/
     430                 : 
     431                 : class VRTSimpleSource : public VRTSource
     432                 : {
     433                 : protected:
     434                 :     GDALRasterBand      *poRasterBand;
     435                 : 
     436                 :     int                 nSrcXOff;
     437                 :     int                 nSrcYOff;
     438                 :     int                 nSrcXSize;
     439                 :     int                 nSrcYSize;
     440                 : 
     441                 :     int                 nDstXOff;
     442                 :     int                 nDstYOff;
     443                 :     int                 nDstXSize;
     444                 :     int                 nDstYSize;
     445                 : 
     446                 :     int                 bNoDataSet;
     447                 :     double              dfNoDataValue;
     448                 : 
     449                 : public:
     450                 :             VRTSimpleSource();
     451                 :     virtual ~VRTSimpleSource();
     452                 : 
     453                 :     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * );
     454                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
     455                 : 
     456                 :     void           SetSrcBand( GDALRasterBand * );
     457                 :     void           SetSrcWindow( int, int, int, int );
     458                 :     void           SetDstWindow( int, int, int, int );
     459                 :     void           SetNoDataValue( double dfNoDataValue );
     460                 : 
     461                 :     int            GetSrcDstWindow( int, int, int, int, int, int, 
     462                 :                                     int *, int *, int *, int *,
     463                 :                                     int *, int *, int *, int * );
     464                 : 
     465                 :     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
     466                 :                               void *pData, int nBufXSize, int nBufYSize, 
     467                 :                               GDALDataType eBufType, 
     468                 :                               int nPixelSpace, int nLineSpace );
     469                 : 
     470                 :     void            DstToSrc( double dfX, double dfY,
     471                 :                               double &dfXOut, double &dfYOut );
     472                 :     void            SrcToDst( double dfX, double dfY,
     473                 :                               double &dfXOut, double &dfYOut );
     474                 :     
     475                 :     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
     476                 :                                int *pnMaxSize, CPLHashSet* hSetFiles);
     477                 : };
     478                 : 
     479                 : /************************************************************************/
     480                 : /*                          VRTAveragedSource                           */
     481                 : /************************************************************************/
     482                 : 
     483                 : class VRTAveragedSource : public VRTSimpleSource
     484               4 : {
     485                 : public:
     486                 :                     VRTAveragedSource();
     487                 :     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
     488                 :                               void *pData, int nBufXSize, int nBufYSize, 
     489                 :                               GDALDataType eBufType, 
     490                 :                               int nPixelSpace, int nLineSpace );
     491                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
     492                 : };
     493                 : 
     494                 : /************************************************************************/
     495                 : /*                           VRTComplexSource                           */
     496                 : /************************************************************************/
     497                 : 
     498                 : class VRTComplexSource : public VRTSimpleSource
     499                 : {
     500                 : public:
     501                 :                    VRTComplexSource();
     502                 :     virtual        ~VRTComplexSource();
     503                 : 
     504                 :     virtual CPLErr RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
     505                 :                              void *pData, int nBufXSize, int nBufYSize, 
     506                 :                              GDALDataType eBufType, 
     507                 :                              int nPixelSpace, int nLineSpace );
     508                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
     509                 :     virtual CPLErr XMLInit( CPLXMLNode *, const char * );
     510                 :     double  LookupValue( double dfInput );
     511                 : 
     512                 :     int            bDoScaling;
     513                 :     double         dfScaleOff;
     514                 :     double         dfScaleRatio;
     515                 :     double         *padfLUTInputs;
     516                 :     double         *padfLUTOutputs;
     517                 :     int            nLUTItemCount;
     518                 :     int            nColorTableComponent;
     519                 : };
     520                 : 
     521                 : /************************************************************************/
     522                 : /*                           VRTFilteredSource                          */
     523                 : /************************************************************************/
     524                 : 
     525                 : class VRTFilteredSource : public VRTComplexSource
     526                 : {
     527                 : private:
     528                 :     int          IsTypeSupported( GDALDataType eType );
     529                 : 
     530                 : protected:
     531                 :     int          nSupportedTypesCount;
     532                 :     GDALDataType aeSupportedTypes[20];
     533                 : 
     534                 :     int          nExtraEdgePixels;
     535                 : 
     536                 : public:
     537                 :             VRTFilteredSource();
     538                 :     virtual ~VRTFilteredSource();
     539                 : 
     540                 :     void    SetExtraEdgePixels( int );
     541                 :     void    SetFilteringDataTypesSupported( int, GDALDataType * );
     542                 : 
     543                 :     virtual CPLErr  FilterData( int nXSize, int nYSize, GDALDataType eType, 
     544                 :                                 GByte *pabySrcData, GByte *pabyDstData ) = 0;
     545                 : 
     546                 :     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
     547                 :                               void *pData, int nBufXSize, int nBufYSize, 
     548                 :                               GDALDataType eBufType, 
     549                 :                               int nPixelSpace, int nLineSpace );
     550                 : };
     551                 : 
     552                 : /************************************************************************/
     553                 : /*                       VRTKernelFilteredSource                        */
     554                 : /************************************************************************/
     555                 : 
     556                 : class VRTKernelFilteredSource : public VRTFilteredSource
     557                 : {
     558                 : protected:
     559                 :     int     nKernelSize;
     560                 : 
     561                 :     double  *padfKernelCoefs;
     562                 : 
     563                 :     int     bNormalized;
     564                 : 
     565                 : public:
     566                 :             VRTKernelFilteredSource();
     567                 :     virtual ~VRTKernelFilteredSource();
     568                 : 
     569                 :     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * );
     570                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
     571                 : 
     572                 :     virtual CPLErr  FilterData( int nXSize, int nYSize, GDALDataType eType, 
     573                 :                                 GByte *pabySrcData, GByte *pabyDstData );
     574                 : 
     575                 :     CPLErr          SetKernel( int nKernelSize, double *padfCoefs );
     576                 :     void            SetNormalized( int );
     577                 : };
     578                 : 
     579                 : /************************************************************************/
     580                 : /*                       VRTAverageFilteredSource                       */
     581                 : /************************************************************************/
     582                 : 
     583                 : class VRTAverageFilteredSource : public VRTKernelFilteredSource
     584                 : {
     585                 : public:
     586                 :             VRTAverageFilteredSource( int nKernelSize );
     587                 :     virtual ~VRTAverageFilteredSource();
     588                 : 
     589                 :     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * );
     590                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
     591                 : };
     592                 : 
     593                 : /************************************************************************/
     594                 : /*                            VRTFuncSource                             */
     595                 : /************************************************************************/
     596                 : class VRTFuncSource : public VRTSource
     597                 : {
     598                 : public:
     599                 :             VRTFuncSource();
     600                 :     virtual ~VRTFuncSource();
     601                 : 
     602               0 :     virtual CPLErr  XMLInit( CPLXMLNode *, const char *) { return CE_Failure; }
     603                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
     604                 : 
     605                 :     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
     606                 :                               void *pData, int nBufXSize, int nBufYSize, 
     607                 :                               GDALDataType eBufType, 
     608                 :                               int nPixelSpace, int nLineSpace );
     609                 : 
     610                 :     VRTImageReadFunc    pfnReadFunc;
     611                 :     void               *pCBData;
     612                 :     GDALDataType        eType;
     613                 :     
     614                 :     float               fNoDataValue;
     615                 : };
     616                 : 
     617                 : #endif /* ndef VIRTUALDATASET_H_INCLUDED */

Generated by: LCOV version 1.7