LTP GCOV extension - code coverage report
Current view: directory - frmts/vrt - vrtdataset.h
Test: gdal_filtered.info
Date: 2010-07-12 Instrumented lines: 13
Code covered: 84.6 % Executed lines: 11

       1                 : /******************************************************************************
       2                 :  * $Id: vrtdataset.h 19814 2010-06-07 21:41:58Z 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                 : /*                          VRTOverviewInfo()                           */
      43                 : /************************************************************************/
      44                 : class VRTOverviewInfo
      45               3 : {
      46                 : public:
      47                 :     CPLString       osFilename;
      48                 :     int             nBand;
      49                 :     GDALRasterBand *poBand;
      50                 :     int             bTriedToOpen;
      51                 :     
      52               3 :     VRTOverviewInfo() : poBand(NULL), bTriedToOpen(FALSE) {}
      53               6 :     ~VRTOverviewInfo() {
      54               6 :         if( poBand == NULL ) 
      55                 :             /* do nothing */;
      56               2 :         else if( poBand->GetDataset()->GetShared() )
      57               2 :             GDALClose( (GDALDatasetH) poBand->GetDataset() );
      58                 :         else
      59               0 :             poBand->GetDataset()->Dereference();
      60               6 :     }
      61                 : };
      62                 : 
      63                 : 
      64                 : /************************************************************************/
      65                 : /*                              VRTSource                               */
      66                 : /************************************************************************/
      67                 : 
      68                 : class VRTSource 
      69             339 : {
      70                 : public:
      71                 :     virtual ~VRTSource();
      72                 : 
      73                 :     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
      74                 :                               void *pData, int nBufXSize, int nBufYSize, 
      75                 :                               GDALDataType eBufType, 
      76                 :                               int nPixelSpace, int nLineSpace ) = 0;
      77                 : 
      78                 :     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * ) = 0;
      79                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) = 0;
      80                 :     
      81                 :     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
      82                 :                                int *pnMaxSize, CPLHashSet* hSetFiles);
      83                 : };
      84                 : 
      85                 : typedef VRTSource *(*VRTSourceParser)(CPLXMLNode *, const char *);
      86                 : 
      87                 : VRTSource *VRTParseCoreSources( CPLXMLNode *psTree, const char * );
      88                 : VRTSource *VRTParseFilterSources( CPLXMLNode *psTree, const char * );
      89                 : 
      90                 : /************************************************************************/
      91                 : /*                              VRTDataset                              */
      92                 : /************************************************************************/
      93                 : 
      94                 : class CPL_DLL VRTDataset : public GDALDataset
      95                 : {
      96                 :     char           *pszProjection;
      97                 : 
      98                 :     int            bGeoTransformSet;
      99                 :     double         adfGeoTransform[6];
     100                 : 
     101                 :     int           nGCPCount;
     102                 :     GDAL_GCP      *pasGCPList;
     103                 :     char          *pszGCPProjection;
     104                 : 
     105                 :     int            bNeedsFlush;
     106                 :     int            bWritable;
     107                 :     
     108                 :     char          *pszVRTPath;
     109                 : 
     110                 :   public:
     111                 :                  VRTDataset(int nXSize, int nYSize);
     112                 :                 ~VRTDataset();
     113                 : 
     114            2281 :     void          SetNeedsFlush() { bNeedsFlush = TRUE; }
     115                 :     virtual void  FlushCache();
     116                 :     
     117               9 :     void SetWritable(int bWritable) { this->bWritable = bWritable; }
     118                 : 
     119                 :     virtual const char *GetProjectionRef(void);
     120                 :     virtual CPLErr SetProjection( const char * );
     121                 :     virtual CPLErr GetGeoTransform( double * );
     122                 :     virtual CPLErr SetGeoTransform( double * );
     123                 : 
     124                 :     virtual CPLErr SetMetadata( char **papszMD, const char *pszDomain = "" );
     125                 :     virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
     126                 :                                     const char *pszDomain = "" );
     127                 : 
     128                 :     virtual int    GetGCPCount();
     129                 :     virtual const char *GetGCPProjection();
     130                 :     virtual const GDAL_GCP *GetGCPs();
     131                 :     virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
     132                 :                             const char *pszGCPProjection );
     133                 : 
     134                 :     virtual CPLErr AddBand( GDALDataType eType, 
     135                 :                             char **papszOptions=NULL );
     136                 :                             
     137                 :     virtual char      **GetFileList();
     138                 : 
     139                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath);
     140                 :     virtual CPLErr      XMLInit( CPLXMLNode *, const char * );
     141                 :  
     142                 :     static int          Identify( GDALOpenInfo * );
     143                 :     static GDALDataset *Open( GDALOpenInfo * );
     144                 :     static GDALDataset *OpenXML( const char *, const char * = NULL, GDALAccess eAccess = GA_ReadOnly );
     145                 :     static GDALDataset *Create( const char * pszName,
     146                 :                                 int nXSize, int nYSize, int nBands,
     147                 :                                 GDALDataType eType, char ** papszOptions );
     148                 :     static CPLErr       Delete( const char * pszFilename );
     149                 : };
     150                 : 
     151                 : /************************************************************************/
     152                 : /*                           VRTWarpedDataset                           */
     153                 : /************************************************************************/
     154                 : 
     155                 : class GDALWarpOperation;
     156                 : class VRTWarpedRasterBand;
     157                 : 
     158                 : class CPL_DLL VRTWarpedDataset : public VRTDataset
     159                 : {
     160                 :     int               nBlockXSize;
     161                 :     int               nBlockYSize;
     162                 :     GDALWarpOperation *poWarper;
     163                 : 
     164                 :     friend class VRTWarpedRasterBand;
     165                 : 
     166                 : public:
     167                 :     int               nOverviewCount;
     168                 :     VRTWarpedDataset  **papoOverviews;
     169                 : 
     170                 : public:
     171                 :                       VRTWarpedDataset( int nXSize, int nYSize );
     172                 :                      ~VRTWarpedDataset();
     173                 : 
     174                 :     CPLErr            Initialize( /* GDALWarpOptions */ void * );
     175                 : 
     176                 :     virtual CPLErr IBuildOverviews( const char *, int, int *,
     177                 :                                     int, int *, GDALProgressFunc, void * );
     178                 :     
     179                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
     180                 :     virtual CPLErr    XMLInit( CPLXMLNode *, const char * );
     181                 : 
     182                 :     virtual CPLErr AddBand( GDALDataType eType, 
     183                 :                             char **papszOptions=NULL );
     184                 :                             
     185                 :     virtual char      **GetFileList();
     186                 :     
     187                 :     CPLErr            ProcessBlock( int iBlockX, int iBlockY );
     188                 : 
     189                 :     void              GetBlockSize( int *, int * );
     190                 : };
     191                 : 
     192                 : /************************************************************************/
     193                 : /*                            VRTRasterBand                             */
     194                 : /*                                                                      */
     195                 : /*      Provides support for all the various kinds of metadata but      */
     196                 : /*      no raster access.  That is handled by derived classes.          */
     197                 : /************************************************************************/
     198                 : 
     199                 : class CPL_DLL VRTRasterBand : public GDALRasterBand
     200                 : {
     201                 :   protected:
     202                 :     int            bNoDataValueSet;
     203                 :     int            bHideNoDataValue; // If set to true, will not report the existance of nodata
     204                 :     double         dfNoDataValue;
     205                 : 
     206                 :     GDALColorTable *poColorTable;
     207                 : 
     208                 :     GDALColorInterp eColorInterp;
     209                 : 
     210                 :     char           *pszUnitType;
     211                 :     char           **papszCategoryNames;
     212                 :     
     213                 :     double         dfOffset;
     214                 :     double         dfScale;
     215                 : 
     216                 :     CPLXMLNode    *psSavedHistograms;
     217                 : 
     218                 :     void           Initialize( int nXSize, int nYSize );
     219                 : 
     220                 :     std::vector<VRTOverviewInfo> apoOverviews;
     221                 : 
     222                 :   public:
     223                 : 
     224                 :                     VRTRasterBand();
     225                 :     virtual        ~VRTRasterBand();
     226                 : 
     227                 :     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
     228                 :     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
     229                 : 
     230                 :     virtual CPLErr SetNoDataValue( double );
     231                 :     virtual double GetNoDataValue( int *pbSuccess = NULL );
     232                 : 
     233                 :     virtual CPLErr SetColorTable( GDALColorTable * ); 
     234                 :     virtual GDALColorTable *GetColorTable();
     235                 : 
     236                 :     virtual CPLErr SetColorInterpretation( GDALColorInterp );
     237                 :     virtual GDALColorInterp GetColorInterpretation();
     238                 : 
     239                 :     virtual const char *GetUnitType();
     240                 :     CPLErr SetUnitType( const char * ); 
     241                 : 
     242                 :     virtual char **GetCategoryNames();
     243                 :     virtual CPLErr SetCategoryNames( char ** );
     244                 : 
     245                 :     virtual CPLErr SetMetadata( char **papszMD, const char *pszDomain = "" );
     246                 :     virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
     247                 :                                     const char *pszDomain = "" );
     248                 : 
     249                 :     virtual double GetOffset( int *pbSuccess = NULL );
     250                 :     CPLErr SetOffset( double );
     251                 :     virtual double GetScale( int *pbSuccess = NULL );
     252                 :     CPLErr SetScale( double );
     253                 : 
     254                 :     virtual int GetOverviewCount();
     255                 :     virtual GDALRasterBand *GetOverview(int);
     256                 :     
     257                 :     virtual CPLErr  GetHistogram( double dfMin, double dfMax,
     258                 :                           int nBuckets, int * panHistogram,
     259                 :                           int bIncludeOutOfRange, int bApproxOK,
     260                 :                           GDALProgressFunc, void *pProgressData );
     261                 : 
     262                 :     virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
     263                 :                                         int *pnBuckets, int ** ppanHistogram,
     264                 :                                         int bForce,
     265                 :                                         GDALProgressFunc, void *pProgressData);
     266                 : 
     267                 :     virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
     268                 :                                         int nBuckets, int *panHistogram );
     269                 : 
     270                 :     CPLErr         CopyCommonInfoFrom( GDALRasterBand * );
     271                 :     
     272                 :     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
     273                 :                                int *pnMaxSize, CPLHashSet* hSetFiles);
     274                 :     
     275                 :     virtual void   SetDescription( const char * );
     276                 : };
     277                 : 
     278                 : /************************************************************************/
     279                 : /*                         VRTSourcedRasterBand                         */
     280                 : /************************************************************************/
     281                 : 
     282                 : class CPL_DLL VRTSourcedRasterBand : public VRTRasterBand
     283                 : {
     284                 :     int            bAlreadyInIRasterIO;
     285                 :     
     286                 :     void           Initialize( int nXSize, int nYSize );
     287                 : 
     288                 :   public:
     289                 :     int            nSources;
     290                 :     VRTSource    **papoSources;
     291                 :     int            bEqualAreas;
     292                 : 
     293                 :                    VRTSourcedRasterBand( GDALDataset *poDS, int nBand );
     294                 :                    VRTSourcedRasterBand( GDALDataType eType, 
     295                 :                                          int nXSize, int nYSize );
     296                 :                    VRTSourcedRasterBand( GDALDataset *poDS, int nBand, 
     297                 :                                          GDALDataType eType, 
     298                 :                                          int nXSize, int nYSize );
     299                 :     virtual        ~VRTSourcedRasterBand();
     300                 : 
     301                 :     virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
     302                 :                               void *, int, int, GDALDataType,
     303                 :                               int, int );
     304                 : 
     305                 :     virtual char      **GetMetadata( const char * pszDomain = "" );
     306                 :     virtual CPLErr      SetMetadata( char ** papszMetadata,
     307                 :                                      const char * pszDomain = "" );
     308                 :     virtual CPLErr      SetMetadataItem( const char * pszName,
     309                 :                                          const char * pszValue,
     310                 :                                          const char * pszDomain = "" );
     311                 : 
     312                 :     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
     313                 :     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
     314                 : 
     315                 :     CPLErr         AddSource( VRTSource * );
     316                 :     CPLErr         AddSimpleSource( GDALRasterBand *poSrcBand, 
     317                 :                                     int nSrcXOff=-1, int nSrcYOff=-1, 
     318                 :                                     int nSrcXSize=-1, int nSrcYSize=-1, 
     319                 :                                     int nDstXOff=-1, int nDstYOff=-1, 
     320                 :                                     int nDstXSize=-1, int nDstYSize=-1,
     321                 :                                     const char *pszResampling = "near",
     322                 :                                     double dfNoDataValue = VRT_NODATA_UNSET);
     323                 :     CPLErr         AddComplexSource( GDALRasterBand *poSrcBand, 
     324                 :                                      int nSrcXOff=-1, int nSrcYOff=-1, 
     325                 :                                      int nSrcXSize=-1, int nSrcYSize=-1, 
     326                 :                                      int nDstXOff=-1, int nDstYOff=-1, 
     327                 :                                      int nDstXSize=-1, int nDstYSize=-1,
     328                 :                                      double dfScaleOff=0.0, 
     329                 :                                      double dfScaleRatio=1.0,
     330                 :                                      double dfNoDataValue = VRT_NODATA_UNSET,
     331                 :                                      int nColorTableComponent = 0);
     332                 : 
     333                 :     CPLErr         AddFuncSource( VRTImageReadFunc pfnReadFunc, void *hCBData,
     334                 :                                   double dfNoDataValue = VRT_NODATA_UNSET );
     335                 : 
     336                 : 
     337                 :     virtual CPLErr IReadBlock( int, int, void * );
     338                 :     
     339                 :     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
     340                 :                                int *pnMaxSize, CPLHashSet* hSetFiles);
     341                 : };
     342                 : 
     343                 : /************************************************************************/
     344                 : /*                         VRTWarpedRasterBand                          */
     345                 : /************************************************************************/
     346                 : 
     347                 : class CPL_DLL VRTWarpedRasterBand : public VRTRasterBand
     348                 : {
     349                 :   public:
     350                 :                    VRTWarpedRasterBand( GDALDataset *poDS, int nBand,
     351                 :                                      GDALDataType eType = GDT_Unknown );
     352                 :     virtual        ~VRTWarpedRasterBand();
     353                 : 
     354                 :     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
     355                 :     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
     356                 : 
     357                 :     virtual CPLErr IReadBlock( int, int, void * );
     358                 :     virtual CPLErr IWriteBlock( int, int, void * );
     359                 : 
     360                 :     virtual int GetOverviewCount();
     361                 :     virtual GDALRasterBand *GetOverview(int);
     362                 : };
     363                 : 
     364                 : /************************************************************************/
     365                 : /*                         VRTDerivedRasterBand                         */
     366                 : /************************************************************************/
     367                 : 
     368                 : class CPL_DLL VRTDerivedRasterBand : public VRTSourcedRasterBand
     369                 : {
     370                 : 
     371                 :  public:
     372                 :     char *pszFuncName;
     373                 :     GDALDataType eSourceTransferType;
     374                 : 
     375                 :     VRTDerivedRasterBand(GDALDataset *poDS, int nBand);
     376                 :     VRTDerivedRasterBand(GDALDataset *poDS, int nBand, 
     377                 :                          GDALDataType eType, int nXSize, int nYSize);
     378                 :     virtual        ~VRTDerivedRasterBand();
     379                 : 
     380                 :     virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
     381                 :                               void *, int, int, GDALDataType,
     382                 :                               int, int );
     383                 : 
     384                 :     static CPLErr AddPixelFunction
     385                 :         (const char *pszFuncName, GDALDerivedPixelFunc pfnPixelFunc);
     386                 :     static GDALDerivedPixelFunc GetPixelFunction(const char *pszFuncName);
     387                 : 
     388                 :     void SetPixelFunctionName(const char *pszFuncName);
     389                 :     void SetSourceTransferType(GDALDataType eDataType);
     390                 : 
     391                 :     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
     392                 :     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
     393                 : 
     394                 : };
     395                 : 
     396                 : /************************************************************************/
     397                 : /*                           VRTRawRasterBand                           */
     398                 : /************************************************************************/
     399                 : 
     400                 : class RawRasterBand;
     401                 : 
     402                 : class CPL_DLL VRTRawRasterBand : public VRTRasterBand
     403                 : {
     404                 :     RawRasterBand  *poRawRaster;
     405                 : 
     406                 :     char           *pszSourceFilename;
     407                 :     int            bRelativeToVRT;
     408                 : 
     409                 :   public:
     410                 :                    VRTRawRasterBand( GDALDataset *poDS, int nBand,
     411                 :                                      GDALDataType eType = GDT_Unknown );
     412                 :     virtual        ~VRTRawRasterBand();
     413                 : 
     414                 :     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
     415                 :     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
     416                 : 
     417                 :     virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
     418                 :                               void *, int, int, GDALDataType,
     419                 :                               int, int );
     420                 : 
     421                 :     virtual CPLErr IReadBlock( int, int, void * );
     422                 :     virtual CPLErr IWriteBlock( int, int, void * );
     423                 : 
     424                 :     CPLErr         SetRawLink( const char *pszFilename, 
     425                 :                                const char *pszVRTPath,
     426                 :                                int bRelativeToVRT, 
     427                 :                                vsi_l_offset nImageOffset, 
     428                 :                                int nPixelOffset, int nLineOffset, 
     429                 :                                const char *pszByteOrder );
     430                 : 
     431                 :     void           ClearRawLink();
     432                 : 
     433                 :     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
     434                 :                                int *pnMaxSize, CPLHashSet* hSetFiles);
     435                 : };
     436                 : 
     437                 : /************************************************************************/
     438                 : /*                              VRTDriver                               */
     439                 : /************************************************************************/
     440                 : 
     441                 : class VRTDriver : public GDALDriver
     442                 : {
     443                 :   public:
     444                 :                  VRTDriver();
     445                 :                  ~VRTDriver();
     446                 : 
     447                 :     char         **papszSourceParsers;
     448                 : 
     449                 :     virtual char      **GetMetadata( const char * pszDomain = "" );
     450                 :     virtual CPLErr      SetMetadata( char ** papszMetadata,
     451                 :                                      const char * pszDomain = "" );
     452                 : 
     453                 :     VRTSource   *ParseSource( CPLXMLNode *psSrc, const char *pszVRTPath );
     454                 :     void         AddSourceParser( const char *pszElementName, 
     455                 :                                   VRTSourceParser pfnParser );
     456                 : };
     457                 : 
     458                 : /************************************************************************/
     459                 : /*                           VRTSimpleSource                            */
     460                 : /************************************************************************/
     461                 : 
     462                 : class VRTSimpleSource : public VRTSource
     463                 : {
     464                 : protected:
     465                 :     GDALRasterBand      *poRasterBand;
     466                 : 
     467                 :     int                 nSrcXOff;
     468                 :     int                 nSrcYOff;
     469                 :     int                 nSrcXSize;
     470                 :     int                 nSrcYSize;
     471                 : 
     472                 :     int                 nDstXOff;
     473                 :     int                 nDstYOff;
     474                 :     int                 nDstXSize;
     475                 :     int                 nDstYSize;
     476                 : 
     477                 :     int                 bNoDataSet;
     478                 :     double              dfNoDataValue;
     479                 : 
     480                 : public:
     481                 :             VRTSimpleSource();
     482                 :     virtual ~VRTSimpleSource();
     483                 : 
     484                 :     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * );
     485                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
     486                 : 
     487                 :     void           SetSrcBand( GDALRasterBand * );
     488                 :     void           SetSrcWindow( int, int, int, int );
     489                 :     void           SetDstWindow( int, int, int, int );
     490                 :     void           SetNoDataValue( double dfNoDataValue );
     491                 : 
     492                 :     int            GetSrcDstWindow( int, int, int, int, int, int, 
     493                 :                                     int *, int *, int *, int *,
     494                 :                                     int *, int *, int *, int * );
     495                 : 
     496                 :     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
     497                 :                               void *pData, int nBufXSize, int nBufYSize, 
     498                 :                               GDALDataType eBufType, 
     499                 :                               int nPixelSpace, int nLineSpace );
     500                 : 
     501                 :     void            DstToSrc( double dfX, double dfY,
     502                 :                               double &dfXOut, double &dfYOut );
     503                 :     void            SrcToDst( double dfX, double dfY,
     504                 :                               double &dfXOut, double &dfYOut );
     505                 :     
     506                 :     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
     507                 :                                int *pnMaxSize, CPLHashSet* hSetFiles);
     508                 : };
     509                 : 
     510                 : /************************************************************************/
     511                 : /*                          VRTAveragedSource                           */
     512                 : /************************************************************************/
     513                 : 
     514                 : class VRTAveragedSource : public VRTSimpleSource
     515               2 : {
     516                 : public:
     517                 :                     VRTAveragedSource();
     518                 :     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
     519                 :                               void *pData, int nBufXSize, int nBufYSize, 
     520                 :                               GDALDataType eBufType, 
     521                 :                               int nPixelSpace, int nLineSpace );
     522                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
     523                 : };
     524                 : 
     525                 : /************************************************************************/
     526                 : /*                           VRTComplexSource                           */
     527                 : /************************************************************************/
     528                 : 
     529                 : class VRTComplexSource : public VRTSimpleSource
     530                 : {
     531                 : public:
     532                 :                    VRTComplexSource();
     533                 :     virtual        ~VRTComplexSource();
     534                 : 
     535                 :     virtual CPLErr RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
     536                 :                              void *pData, int nBufXSize, int nBufYSize, 
     537                 :                              GDALDataType eBufType, 
     538                 :                              int nPixelSpace, int nLineSpace );
     539                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
     540                 :     virtual CPLErr XMLInit( CPLXMLNode *, const char * );
     541                 :     double  LookupValue( double dfInput );
     542                 : 
     543                 :     int            bDoScaling;
     544                 :     double         dfScaleOff;
     545                 :     double         dfScaleRatio;
     546                 :     double         *padfLUTInputs;
     547                 :     double         *padfLUTOutputs;
     548                 :     int            nLUTItemCount;
     549                 :     int            nColorTableComponent;
     550                 : };
     551                 : 
     552                 : /************************************************************************/
     553                 : /*                           VRTFilteredSource                          */
     554                 : /************************************************************************/
     555                 : 
     556                 : class VRTFilteredSource : public VRTComplexSource
     557                 : {
     558                 : private:
     559                 :     int          IsTypeSupported( GDALDataType eType );
     560                 : 
     561                 : protected:
     562                 :     int          nSupportedTypesCount;
     563                 :     GDALDataType aeSupportedTypes[20];
     564                 : 
     565                 :     int          nExtraEdgePixels;
     566                 : 
     567                 : public:
     568                 :             VRTFilteredSource();
     569                 :     virtual ~VRTFilteredSource();
     570                 : 
     571                 :     void    SetExtraEdgePixels( int );
     572                 :     void    SetFilteringDataTypesSupported( int, GDALDataType * );
     573                 : 
     574                 :     virtual CPLErr  FilterData( int nXSize, int nYSize, GDALDataType eType, 
     575                 :                                 GByte *pabySrcData, GByte *pabyDstData ) = 0;
     576                 : 
     577                 :     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
     578                 :                               void *pData, int nBufXSize, int nBufYSize, 
     579                 :                               GDALDataType eBufType, 
     580                 :                               int nPixelSpace, int nLineSpace );
     581                 : };
     582                 : 
     583                 : /************************************************************************/
     584                 : /*                       VRTKernelFilteredSource                        */
     585                 : /************************************************************************/
     586                 : 
     587                 : class VRTKernelFilteredSource : public VRTFilteredSource
     588                 : {
     589                 : protected:
     590                 :     int     nKernelSize;
     591                 : 
     592                 :     double  *padfKernelCoefs;
     593                 : 
     594                 :     int     bNormalized;
     595                 : 
     596                 : public:
     597                 :             VRTKernelFilteredSource();
     598                 :     virtual ~VRTKernelFilteredSource();
     599                 : 
     600                 :     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * );
     601                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
     602                 : 
     603                 :     virtual CPLErr  FilterData( int nXSize, int nYSize, GDALDataType eType, 
     604                 :                                 GByte *pabySrcData, GByte *pabyDstData );
     605                 : 
     606                 :     CPLErr          SetKernel( int nKernelSize, double *padfCoefs );
     607                 :     void            SetNormalized( int );
     608                 : };
     609                 : 
     610                 : /************************************************************************/
     611                 : /*                       VRTAverageFilteredSource                       */
     612                 : /************************************************************************/
     613                 : 
     614                 : class VRTAverageFilteredSource : public VRTKernelFilteredSource
     615                 : {
     616                 : public:
     617                 :             VRTAverageFilteredSource( int nKernelSize );
     618                 :     virtual ~VRTAverageFilteredSource();
     619                 : 
     620                 :     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * );
     621                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
     622                 : };
     623                 : 
     624                 : /************************************************************************/
     625                 : /*                            VRTFuncSource                             */
     626                 : /************************************************************************/
     627                 : class VRTFuncSource : public VRTSource
     628                 : {
     629                 : public:
     630                 :             VRTFuncSource();
     631                 :     virtual ~VRTFuncSource();
     632                 : 
     633               0 :     virtual CPLErr  XMLInit( CPLXMLNode *, const char *) { return CE_Failure; }
     634                 :     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
     635                 : 
     636                 :     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize, 
     637                 :                               void *pData, int nBufXSize, int nBufYSize, 
     638                 :                               GDALDataType eBufType, 
     639                 :                               int nPixelSpace, int nLineSpace );
     640                 : 
     641                 :     VRTImageReadFunc    pfnReadFunc;
     642                 :     void               *pCBData;
     643                 :     GDALDataType        eType;
     644                 :     
     645                 :     float               fNoDataValue;
     646                 : };
     647                 : 
     648                 : #endif /* ndef VIRTUALDATASET_H_INCLUDED */

Generated by: LTP GCOV extension version 1.5