GDAL
vrtdataset.h
00001 /******************************************************************************
00002  * $Id: vrtdataset.h 37723 2017-03-16 17:07:53Z 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  * Copyright (c) 2007-2013, Even Rouault <even dot rouault at mines-paris dot org>
00011  *
00012  * Permission is hereby granted, free of charge, to any person obtaining a
00013  * copy of this software and associated documentation files (the "Software"),
00014  * to deal in the Software without restriction, including without limitation
00015  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00016  * and/or sell copies of the Software, and to permit persons to whom the
00017  * Software is furnished to do so, subject to the following conditions:
00018  *
00019  * The above copyright notice and this permission notice shall be included
00020  * in all copies or substantial portions of the Software.
00021  *
00022  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00023  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00024  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00025  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00026  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00027  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00028  * DEALINGS IN THE SOFTWARE.
00029  ****************************************************************************/
00030 
00031 #ifndef VIRTUALDATASET_H_INCLUDED
00032 #define VIRTUALDATASET_H_INCLUDED
00033 
00034 #ifndef DOXYGEN_SKIP
00035 
00036 #include "cpl_hash_set.h"
00037 #include "gdal_pam.h"
00038 #include "gdal_priv.h"
00039 #include "gdal_vrt.h"
00040 
00041 #include <map>
00042 #include <vector>
00043 
00044 int VRTApplyMetadata( CPLXMLNode *, GDALMajorObject * );
00045 CPLXMLNode *VRTSerializeMetadata( GDALMajorObject * );
00046 CPLErr GDALRegisterDefaultPixelFunc();
00047 
00048 #if 0
00049 int VRTWarpedOverviewTransform( void *pTransformArg, int bDstToSrc,
00050                                 int nPointCount,
00051                                 double *padfX, double *padfY, double *padfZ,
00052                                 int *panSuccess );
00053 void* VRTDeserializeWarpedOverviewTransformer( CPLXMLNode *psTree );
00054 #endif
00055 
00056 /************************************************************************/
00057 /*                          VRTOverviewInfo()                           */
00058 /************************************************************************/
00059 class VRTOverviewInfo
00060 {
00061 public:
00062     CPLString       osFilename;
00063     int             nBand;
00064     GDALRasterBand *poBand;
00065     int             bTriedToOpen;
00066 
00067     VRTOverviewInfo() : nBand(0), poBand(NULL), bTriedToOpen(FALSE) {}
00068     ~VRTOverviewInfo() {
00069         if( poBand == NULL )
00070             /* do nothing */;
00071         else if( poBand->GetDataset()->GetShared() )
00072             GDALClose( /* (GDALDatasetH) */ poBand->GetDataset() );
00073         else
00074             poBand->GetDataset()->Dereference();
00075     }
00076 };
00077 
00078 /************************************************************************/
00079 /*                              VRTSource                               */
00080 /************************************************************************/
00081 
00082 class CPL_DLL VRTSource
00083 {
00084 public:
00085     virtual ~VRTSource();
00086 
00087     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize,
00088                               void *pData, int nBufXSize, int nBufYSize,
00089                               GDALDataType eBufType,
00090                               GSpacing nPixelSpace, GSpacing nLineSpace,
00091                               GDALRasterIOExtraArg* psExtraArg ) = 0;
00092 
00093     virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) = 0;
00094     virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) = 0;
00095     virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
00096                                         double* adfMinMax ) = 0;
00097     virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
00098                                       int bApproxOK,
00099                                       double *pdfMin, double *pdfMax,
00100                                       double *pdfMean, double *pdfStdDev,
00101                                       GDALProgressFunc pfnProgress,
00102                                       void *pProgressData ) = 0;
00103     virtual CPLErr  GetHistogram( int nXSize, int nYSize,
00104                                   double dfMin, double dfMax,
00105                                   int nBuckets, GUIntBig * panHistogram,
00106                                   int bIncludeOutOfRange, int bApproxOK,
00107                                   GDALProgressFunc pfnProgress,
00108                                   void *pProgressData ) = 0;
00109 
00110     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * ) = 0;
00111     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) = 0;
00112 
00113     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
00114                                int *pnMaxSize, CPLHashSet* hSetFiles);
00115 
00116     virtual int    IsSimpleSource() { return FALSE; }
00117 };
00118 
00119 typedef VRTSource *(*VRTSourceParser)(CPLXMLNode *, const char *);
00120 
00121 VRTSource *VRTParseCoreSources( CPLXMLNode *psTree, const char * );
00122 VRTSource *VRTParseFilterSources( CPLXMLNode *psTree, const char * );
00123 
00124 /************************************************************************/
00125 /*                              VRTDataset                              */
00126 /************************************************************************/
00127 
00128 class VRTRasterBand;
00129 
00130 class CPL_DLL VRTDataset : public GDALDataset
00131 {
00132     friend class VRTRasterBand;
00133 
00134     char           *m_pszProjection;
00135 
00136     int            m_bGeoTransformSet;
00137     double         m_adfGeoTransform[6];
00138 
00139     int            m_nGCPCount;
00140     GDAL_GCP      *m_pasGCPList;
00141     char          *m_pszGCPProjection;
00142 
00143     int            m_bNeedsFlush;
00144     int            m_bWritable;
00145 
00146     char          *m_pszVRTPath;
00147 
00148     VRTRasterBand *m_poMaskBand;
00149 
00150     int            m_bCompatibleForDatasetIO;
00151     int            CheckCompatibleForDatasetIO();
00152     std::vector<GDALDataset*> m_apoOverviews;
00153     std::vector<GDALDataset*> m_apoOverviewsBak;
00154     char         **m_papszXMLVRTMetadata;
00155 
00156   protected:
00157     virtual int         CloseDependentDatasets() CPL_OVERRIDE;
00158 
00159   public:
00160                  VRTDataset(int nXSize, int nYSize);
00161     virtual ~VRTDataset();
00162 
00163     void          SetNeedsFlush() { m_bNeedsFlush = TRUE; }
00164     virtual void  FlushCache() CPL_OVERRIDE;
00165 
00166     void SetWritable(int bWritableIn) { m_bWritable = bWritableIn; }
00167 
00168     virtual CPLErr          CreateMaskBand( int nFlags ) CPL_OVERRIDE;
00169     void SetMaskBand(VRTRasterBand* poMaskBand);
00170 
00171     virtual const char *GetProjectionRef() CPL_OVERRIDE;
00172     virtual CPLErr SetProjection( const char * ) CPL_OVERRIDE;
00173     virtual CPLErr GetGeoTransform( double * ) CPL_OVERRIDE;
00174     virtual CPLErr SetGeoTransform( double * ) CPL_OVERRIDE;
00175 
00176     virtual CPLErr SetMetadata( char **papszMD, const char *pszDomain = "" ) CPL_OVERRIDE;
00177     virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
00178                                     const char *pszDomain = "" ) CPL_OVERRIDE;
00179 
00180     virtual char** GetMetadata( const char *pszDomain = "" ) CPL_OVERRIDE;
00181 
00182     virtual int    GetGCPCount() CPL_OVERRIDE;
00183     virtual const char *GetGCPProjection() CPL_OVERRIDE;
00184     virtual const GDAL_GCP *GetGCPs() CPL_OVERRIDE;
00185     virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
00186                             const char *pszGCPProjection ) CPL_OVERRIDE;
00187 
00188     virtual CPLErr AddBand( GDALDataType eType,
00189                             char **papszOptions=NULL ) CPL_OVERRIDE;
00190 
00191     virtual char      **GetFileList() CPL_OVERRIDE;
00192 
00193     virtual CPLErr  IRasterIO( GDALRWFlag eRWFlag,
00194                                int nXOff, int nYOff, int nXSize, int nYSize,
00195                                void * pData, int nBufXSize, int nBufYSize,
00196                                GDALDataType eBufType,
00197                                int nBandCount, int *panBandMap,
00198                                GSpacing nPixelSpace, GSpacing nLineSpace,
00199                                GSpacing nBandSpace,
00200                                GDALRasterIOExtraArg* psExtraArg) CPL_OVERRIDE;
00201 
00202     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath);
00203     virtual CPLErr      XMLInit( CPLXMLNode *, const char * );
00204 
00205     virtual CPLErr IBuildOverviews( const char *, int, int *,
00206                                     int, int *, GDALProgressFunc, void * ) CPL_OVERRIDE;
00207 
00208     /* Used by PDF driver for example */
00209     GDALDataset*        GetSingleSimpleSource();
00210     void                BuildVirtualOverviews();
00211 
00212     void                UnsetPreservedRelativeFilenames();
00213 
00214     static int          Identify( GDALOpenInfo * );
00215     static GDALDataset *Open( GDALOpenInfo * );
00216     static GDALDataset *OpenXML( const char *, const char * = NULL,
00217                                  GDALAccess eAccess = GA_ReadOnly );
00218     static GDALDataset *Create( const char * pszName,
00219                                 int nXSize, int nYSize, int nBands,
00220                                 GDALDataType eType, char ** papszOptions );
00221     static CPLErr       Delete( const char * pszFilename );
00222 };
00223 
00224 /************************************************************************/
00225 /*                           VRTWarpedDataset                           */
00226 /************************************************************************/
00227 
00228 class GDALWarpOperation;
00229 class VRTWarpedRasterBand;
00230 
00231 class CPL_DLL VRTWarpedDataset : public VRTDataset
00232 {
00233     int               m_nBlockXSize;
00234     int               m_nBlockYSize;
00235     GDALWarpOperation *m_poWarper;
00236 
00237     int               m_nOverviewCount;
00238     VRTWarpedDataset **m_papoOverviews;
00239     int               m_nSrcOvrLevel;
00240 
00241     void              CreateImplicitOverviews();
00242 
00243     struct VerticalShiftGrid
00244     {
00245         CPLString osVGrids;
00246         int       bInverse;
00247         double    dfToMeterSrc;
00248         double    dfToMeterDest;
00249         CPLStringList aosOptions;
00250     };
00251     std::vector<VerticalShiftGrid> m_aoVerticalShiftGrids;
00252 
00253     friend class VRTWarpedRasterBand;
00254 
00255   protected:
00256     virtual int         CloseDependentDatasets() CPL_OVERRIDE;
00257 
00258 public:
00259                       VRTWarpedDataset( int nXSize, int nYSize );
00260     virtual ~VRTWarpedDataset();
00261 
00262     CPLErr            Initialize( /* GDALWarpOptions */ void * );
00263 
00264     virtual CPLErr IBuildOverviews( const char *, int, int *,
00265                                     int, int *, GDALProgressFunc, void * ) CPL_OVERRIDE;
00266 
00267     virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
00268                                     const char *pszDomain = "" ) CPL_OVERRIDE;
00269 
00270     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) CPL_OVERRIDE;
00271     virtual CPLErr    XMLInit( CPLXMLNode *, const char * ) CPL_OVERRIDE;
00272 
00273     virtual CPLErr AddBand( GDALDataType eType,
00274                             char **papszOptions=NULL ) CPL_OVERRIDE;
00275 
00276     virtual char      **GetFileList() CPL_OVERRIDE;
00277 
00278     CPLErr            ProcessBlock( int iBlockX, int iBlockY );
00279 
00280     void              GetBlockSize( int *, int * );
00281 
00282     void              SetApplyVerticalShiftGrid(const char* pszVGrids,
00283                                              int bInverse,
00284                                              double dfToMeterSrc,
00285                                              double dfToMeterDest,
00286                                              char** papszOptions );
00287 };
00288 
00289 /************************************************************************/
00290 /*                        VRTPansharpenedDataset                        */
00291 /************************************************************************/
00292 
00293 class GDALPansharpenOperation;
00294 
00295 typedef enum
00296 {
00297     GTAdjust_Union,
00298     GTAdjust_Intersection,
00299     GTAdjust_None,
00300     GTAdjust_NoneWithoutWarning
00301 } GTAdjustment;
00302 
00303 class VRTPansharpenedDataset : public VRTDataset
00304 {
00305     friend class      VRTPansharpenedRasterBand;
00306 
00307     int               m_nBlockXSize;
00308     int               m_nBlockYSize;
00309     GDALPansharpenOperation* m_poPansharpener;
00310     VRTPansharpenedDataset* m_poMainDataset;
00311     std::vector<VRTPansharpenedDataset*> m_apoOverviewDatasets;
00312     // Map from absolute to relative.
00313     std::map<CPLString,CPLString> m_oMapToRelativeFilenames;
00314 
00315     int               m_bLoadingOtherBands;
00316 
00317     GByte            *m_pabyLastBufferBandRasterIO;
00318     int               m_nLastBandRasterIOXOff;
00319     int               m_nLastBandRasterIOYOff;
00320     int               m_nLastBandRasterIOXSize;
00321     int               m_nLastBandRasterIOYSize;
00322     GDALDataType      m_eLastBandRasterIODataType;
00323 
00324     GTAdjustment      m_eGTAdjustment;
00325     int               m_bNoDataDisabled;
00326 
00327     std::vector<GDALDataset*> m_apoDatasetsToClose;
00328 
00329   protected:
00330     virtual int         CloseDependentDatasets() CPL_OVERRIDE;
00331 
00332 public:
00333                       VRTPansharpenedDataset( int nXSize, int nYSize );
00334     virtual ~VRTPansharpenedDataset();
00335 
00336     virtual CPLErr    XMLInit( CPLXMLNode *, const char * ) CPL_OVERRIDE;
00337     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath ) CPL_OVERRIDE;
00338 
00339     CPLErr            XMLInit( CPLXMLNode *psTree, const char *pszVRTPath,
00340                                GDALRasterBandH hPanchroBandIn,
00341                                int nInputSpectralBandsIn,
00342                                GDALRasterBandH* pahInputSpectralBandsIn );
00343 
00344     virtual CPLErr AddBand( GDALDataType eType,
00345                             char **papszOptions=NULL ) CPL_OVERRIDE;
00346 
00347     virtual char      **GetFileList() CPL_OVERRIDE;
00348 
00349     virtual CPLErr  IRasterIO( GDALRWFlag eRWFlag,
00350                                int nXOff, int nYOff, int nXSize, int nYSize,
00351                                void * pData, int nBufXSize, int nBufYSize,
00352                                GDALDataType eBufType,
00353                                int nBandCount, int *panBandMap,
00354                                GSpacing nPixelSpace, GSpacing nLineSpace,
00355                                GSpacing nBandSpace,
00356                                GDALRasterIOExtraArg* psExtraArg) CPL_OVERRIDE;
00357 
00358     void              GetBlockSize( int *, int * );
00359 
00360     GDALPansharpenOperation* GetPansharpener() { return m_poPansharpener; }
00361 };
00362 
00363 /************************************************************************/
00364 /*                            VRTRasterBand                             */
00365 /*                                                                      */
00366 /*      Provides support for all the various kinds of metadata but      */
00367 /*      no raster access.  That is handled by derived classes.          */
00368 /************************************************************************/
00369 
00370 class CPL_DLL VRTRasterBand : public GDALRasterBand
00371 {
00372   protected:
00373     int            m_bIsMaskBand;
00374 
00375     int            m_bNoDataValueSet;
00376     // If set to true, will not report the existence of nodata.
00377     int            m_bHideNoDataValue;
00378     double         m_dfNoDataValue;
00379 
00380     GDALColorTable *m_poColorTable;
00381 
00382     GDALColorInterp m_eColorInterp;
00383 
00384     char           *m_pszUnitType;
00385     char           **m_papszCategoryNames;
00386 
00387     double         m_dfOffset;
00388     double         m_dfScale;
00389 
00390     CPLXMLNode    *m_psSavedHistograms;
00391 
00392     void           Initialize( int nXSize, int nYSize );
00393 
00394     std::vector<VRTOverviewInfo> m_apoOverviews;
00395 
00396     VRTRasterBand *m_poMaskBand;
00397 
00398   public:
00399 
00400                     VRTRasterBand();
00401     virtual        ~VRTRasterBand();
00402 
00403     virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
00404     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
00405 
00406     virtual CPLErr SetNoDataValue( double ) CPL_OVERRIDE;
00407     virtual double GetNoDataValue( int *pbSuccess = NULL ) CPL_OVERRIDE;
00408     virtual CPLErr DeleteNoDataValue() CPL_OVERRIDE;
00409 
00410     virtual CPLErr SetColorTable( GDALColorTable * ) CPL_OVERRIDE;
00411     virtual GDALColorTable *GetColorTable() CPL_OVERRIDE;
00412 
00413     virtual CPLErr SetColorInterpretation( GDALColorInterp ) CPL_OVERRIDE;
00414     virtual GDALColorInterp GetColorInterpretation() CPL_OVERRIDE;
00415 
00416     virtual const char *GetUnitType() CPL_OVERRIDE;
00417     CPLErr SetUnitType( const char * ) CPL_OVERRIDE;
00418 
00419     virtual char **GetCategoryNames() CPL_OVERRIDE;
00420     virtual CPLErr SetCategoryNames( char ** ) CPL_OVERRIDE;
00421 
00422     virtual CPLErr SetMetadata( char **papszMD, const char *pszDomain = "" ) CPL_OVERRIDE;
00423     virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
00424                                     const char *pszDomain = "" ) CPL_OVERRIDE;
00425 
00426     virtual double GetOffset( int *pbSuccess = NULL ) CPL_OVERRIDE;
00427     CPLErr SetOffset( double ) CPL_OVERRIDE;
00428     virtual double GetScale( int *pbSuccess = NULL ) CPL_OVERRIDE;
00429     CPLErr SetScale( double ) CPL_OVERRIDE;
00430 
00431     virtual int GetOverviewCount() CPL_OVERRIDE;
00432     virtual GDALRasterBand *GetOverview(int) CPL_OVERRIDE;
00433 
00434     virtual CPLErr  GetHistogram( double dfMin, double dfMax,
00435                                   int nBuckets, GUIntBig * panHistogram,
00436                                   int bIncludeOutOfRange, int bApproxOK,
00437                                   GDALProgressFunc, void *pProgressData ) CPL_OVERRIDE;
00438 
00439     virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
00440                                         int *pnBuckets, GUIntBig ** ppanHistogram,
00441                                         int bForce,
00442                                         GDALProgressFunc, void *pProgressData) CPL_OVERRIDE;
00443 
00444     virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
00445                                         int nBuckets, GUIntBig *panHistogram ) CPL_OVERRIDE;
00446 
00447     CPLErr         CopyCommonInfoFrom( GDALRasterBand * );
00448 
00449     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
00450                                int *pnMaxSize, CPLHashSet* hSetFiles);
00451 
00452     virtual void   SetDescription( const char * ) CPL_OVERRIDE;
00453 
00454     virtual GDALRasterBand *GetMaskBand() CPL_OVERRIDE;
00455     virtual int             GetMaskFlags() CPL_OVERRIDE;
00456 
00457     virtual CPLErr          CreateMaskBand( int nFlags ) CPL_OVERRIDE;
00458 
00459     void SetMaskBand(VRTRasterBand* poMaskBand);
00460 
00461     void SetIsMaskBand();
00462 
00463     CPLErr UnsetNoDataValue();
00464 
00465     virtual int         CloseDependentDatasets();
00466 
00467     virtual int         IsSourcedRasterBand() { return FALSE; }
00468     virtual int         IsPansharpenRasterBand() { return FALSE; }
00469 };
00470 
00471 /************************************************************************/
00472 /*                         VRTSourcedRasterBand                         */
00473 /************************************************************************/
00474 
00475 class VRTSimpleSource;
00476 
00477 class CPL_DLL VRTSourcedRasterBand : public VRTRasterBand
00478 {
00479   private:
00480     int            m_nRecursionCounter;
00481     CPLString      m_osLastLocationInfo;
00482     char         **m_papszSourceList;
00483 
00484     bool           CanUseSourcesMinMaxImplementations();
00485     void           CheckSource( VRTSimpleSource *poSS );
00486 
00487   public:
00488     int            nSources;
00489     VRTSource    **papoSources;
00490     int            bSkipBufferInitialization;
00491 
00492                    VRTSourcedRasterBand( GDALDataset *poDS, int nBand );
00493                    VRTSourcedRasterBand( GDALDataType eType,
00494                                          int nXSize, int nYSize );
00495                    VRTSourcedRasterBand( GDALDataset *poDS, int nBand,
00496                                          GDALDataType eType,
00497                                          int nXSize, int nYSize );
00498     virtual        ~VRTSourcedRasterBand();
00499 
00500     virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
00501                               void *, int, int, GDALDataType,
00502                               GSpacing nPixelSpace, GSpacing nLineSpace,
00503                               GDALRasterIOExtraArg* psExtraArg) CPL_OVERRIDE;
00504 
00505     virtual int IGetDataCoverageStatus( int nXOff, int nYOff,
00506                                         int nXSize, int nYSize,
00507                                         int nMaskFlagStop,
00508                                         double* pdfDataPct) CPL_OVERRIDE;
00509 
00510     virtual char      **GetMetadataDomainList() CPL_OVERRIDE;
00511     virtual const char *GetMetadataItem( const char * pszName,
00512                                          const char * pszDomain = "" ) CPL_OVERRIDE;
00513     virtual char      **GetMetadata( const char * pszDomain = "" ) CPL_OVERRIDE;
00514     virtual CPLErr      SetMetadata( char ** papszMetadata,
00515                                      const char * pszDomain = "" ) CPL_OVERRIDE;
00516     virtual CPLErr      SetMetadataItem( const char * pszName,
00517                                          const char * pszValue,
00518                                          const char * pszDomain = "" ) CPL_OVERRIDE;
00519 
00520     virtual CPLErr         XMLInit( CPLXMLNode *, const char * ) CPL_OVERRIDE;
00521     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath ) CPL_OVERRIDE;
00522 
00523     virtual double GetMinimum( int *pbSuccess = NULL ) CPL_OVERRIDE;
00524     virtual double GetMaximum(int *pbSuccess = NULL ) CPL_OVERRIDE;
00525     virtual CPLErr ComputeRasterMinMax( int bApproxOK, double* adfMinMax ) CPL_OVERRIDE;
00526     virtual CPLErr ComputeStatistics( int bApproxOK,
00527                                       double *pdfMin, double *pdfMax,
00528                                       double *pdfMean, double *pdfStdDev,
00529                                       GDALProgressFunc pfnProgress,
00530                                       void *pProgressData ) CPL_OVERRIDE;
00531     virtual CPLErr  GetHistogram( double dfMin, double dfMax,
00532                                   int nBuckets, GUIntBig * panHistogram,
00533                                   int bIncludeOutOfRange, int bApproxOK,
00534                                   GDALProgressFunc pfnProgress,
00535                                   void *pProgressData ) CPL_OVERRIDE;
00536 
00537     CPLErr         AddSource( VRTSource * );
00538     CPLErr         AddSimpleSource( GDALRasterBand *poSrcBand,
00539                                     double dfSrcXOff=-1, double dfSrcYOff=-1,
00540                                     double dfSrcXSize=-1, double dfSrcYSize=-1,
00541                                     double dfDstXOff=-1, double dfDstYOff=-1,
00542                                     double dfDstXSize=-1, double dfDstYSize=-1,
00543                                     const char *pszResampling = "near",
00544                                     double dfNoDataValue = VRT_NODATA_UNSET);
00545     CPLErr         AddComplexSource( GDALRasterBand *poSrcBand,
00546                                      double dfSrcXOff=-1, double dfSrcYOff=-1,
00547                                      double dfSrcXSize=-1, double dfSrcYSize=-1,
00548                                      double dfDstXOff=-1, double dfDstYOff=-1,
00549                                      double dfDstXSize=-1, double dfDstYSize=-1,
00550                                      double dfScaleOff=0.0,
00551                                      double dfScaleRatio=1.0,
00552                                      double dfNoDataValue = VRT_NODATA_UNSET,
00553                                      int nColorTableComponent = 0);
00554 
00555     CPLErr         AddMaskBandSource( GDALRasterBand *poSrcBand,
00556                                       double dfSrcXOff=-1, double dfSrcYOff=-1,
00557                                       double dfSrcXSize=-1,
00558                                       double dfSrcYSize=-1,
00559                                       double dfDstXOff=-1, double dfDstYOff=-1,
00560                                       double dfDstXSize=-1,
00561                                       double dfDstYSize=-1 );
00562 
00563     CPLErr         AddFuncSource( VRTImageReadFunc pfnReadFunc, void *hCBData,
00564                                   double dfNoDataValue = VRT_NODATA_UNSET );
00565 
00566     void           ConfigureSource(VRTSimpleSource *poSimpleSource,
00567                                    GDALRasterBand *poSrcBand,
00568                                    int bAddAsMaskBand,
00569                                    double dfSrcXOff, double dfSrcYOff,
00570                                    double dfSrcXSize, double dfSrcYSize,
00571                                    double dfDstXOff, double dfDstYOff,
00572                                    double dfDstXSize, double dfDstYSize );
00573 
00574     virtual CPLErr IReadBlock( int, int, void * ) CPL_OVERRIDE;
00575 
00576     virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
00577                                int *pnMaxSize, CPLHashSet* hSetFiles) CPL_OVERRIDE;
00578 
00579     virtual int         CloseDependentDatasets() CPL_OVERRIDE;
00580 
00581     virtual int         IsSourcedRasterBand() CPL_OVERRIDE { return TRUE; }
00582 };
00583 
00584 /************************************************************************/
00585 /*                         VRTWarpedRasterBand                          */
00586 /************************************************************************/
00587 
00588 class CPL_DLL VRTWarpedRasterBand : public VRTRasterBand
00589 {
00590   public:
00591                    VRTWarpedRasterBand( GDALDataset *poDS, int nBand,
00592                                         GDALDataType eType = GDT_Unknown );
00593     virtual        ~VRTWarpedRasterBand();
00594 
00595     virtual CPLErr         XMLInit( CPLXMLNode *, const char * ) CPL_OVERRIDE;
00596     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath ) CPL_OVERRIDE;
00597 
00598     virtual CPLErr IReadBlock( int, int, void * ) CPL_OVERRIDE;
00599     virtual CPLErr IWriteBlock( int, int, void * ) CPL_OVERRIDE;
00600 
00601     virtual int GetOverviewCount() CPL_OVERRIDE;
00602     virtual GDALRasterBand *GetOverview(int) CPL_OVERRIDE;
00603 };
00604 /************************************************************************/
00605 /*                        VRTPansharpenedRasterBand                     */
00606 /************************************************************************/
00607 
00608 class VRTPansharpenedRasterBand : public VRTRasterBand
00609 {
00610     int               m_nIndexAsPansharpenedBand;
00611 
00612   public:
00613                    VRTPansharpenedRasterBand(
00614                        GDALDataset *poDS, int nBand,
00615                        GDALDataType eDataType = GDT_Unknown );
00616     virtual        ~VRTPansharpenedRasterBand();
00617 
00618     virtual CPLErr         XMLInit( CPLXMLNode *, const char * ) CPL_OVERRIDE;
00619     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath ) CPL_OVERRIDE;
00620 
00621     virtual CPLErr IReadBlock( int, int, void * ) CPL_OVERRIDE;
00622 
00623     virtual CPLErr  IRasterIO( GDALRWFlag eRWFlag,
00624                                int nXOff, int nYOff, int nXSize, int nYSize,
00625                                void * pData, int nBufXSize, int nBufYSize,
00626                                GDALDataType eBufType,
00627                                GSpacing nPixelSpace, GSpacing nLineSpace,
00628                                GDALRasterIOExtraArg* psExtraArg) CPL_OVERRIDE;
00629 
00630     virtual int GetOverviewCount() CPL_OVERRIDE;
00631     virtual GDALRasterBand *GetOverview(int) CPL_OVERRIDE;
00632 
00633     virtual int         IsPansharpenRasterBand() CPL_OVERRIDE { return TRUE; }
00634 
00635     void                SetIndexAsPansharpenedBand( int nIdx )
00636         { m_nIndexAsPansharpenedBand = nIdx; }
00637     int                 GetIndexAsPansharpenedBand() const
00638         { return m_nIndexAsPansharpenedBand; }
00639 };
00640 
00641 /************************************************************************/
00642 /*                         VRTDerivedRasterBand                         */
00643 /************************************************************************/
00644 
00645 class VRTDerivedRasterBandPrivateData;
00646 
00647 class CPL_DLL VRTDerivedRasterBand : public VRTSourcedRasterBand
00648 {
00649     VRTDerivedRasterBandPrivateData* m_poPrivate;
00650     bool InitializePython();
00651 
00652  public:
00653     char *pszFuncName;
00654     GDALDataType eSourceTransferType;
00655 
00656     VRTDerivedRasterBand( GDALDataset *poDS, int nBand );
00657     VRTDerivedRasterBand( GDALDataset *poDS, int nBand,
00658                           GDALDataType eType, int nXSize, int nYSize );
00659     virtual        ~VRTDerivedRasterBand();
00660 
00661     virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
00662                               void *, int, int, GDALDataType,
00663                               GSpacing nPixelSpace, GSpacing nLineSpace,
00664                               GDALRasterIOExtraArg* psExtraArg ) CPL_OVERRIDE;
00665 
00666     virtual int IGetDataCoverageStatus( int nXOff, int nYOff,
00667                                         int nXSize, int nYSize,
00668                                         int nMaskFlagStop,
00669                                         double* pdfDataPct) CPL_OVERRIDE;
00670 
00671     static CPLErr AddPixelFunction( const char *pszFuncName,
00672                                     GDALDerivedPixelFunc pfnPixelFunc );
00673     static GDALDerivedPixelFunc GetPixelFunction( const char *pszFuncName );
00674 
00675     void SetPixelFunctionName( const char *pszFuncName );
00676     void SetSourceTransferType( GDALDataType eDataType );
00677 
00678     virtual CPLErr         XMLInit( CPLXMLNode *, const char * ) CPL_OVERRIDE;
00679     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath ) CPL_OVERRIDE;
00680 
00681     virtual double GetMinimum( int *pbSuccess = NULL ) CPL_OVERRIDE;
00682     virtual double GetMaximum(int *pbSuccess = NULL ) CPL_OVERRIDE;
00683     virtual CPLErr ComputeRasterMinMax( int bApproxOK, double* adfMinMax ) CPL_OVERRIDE;
00684     virtual CPLErr ComputeStatistics( int bApproxOK,
00685                                       double *pdfMin, double *pdfMax,
00686                                       double *pdfMean, double *pdfStdDev,
00687                                       GDALProgressFunc pfnProgress,
00688                                       void *pProgressData ) CPL_OVERRIDE;
00689     virtual CPLErr  GetHistogram( double dfMin, double dfMax,
00690                                   int nBuckets, GUIntBig * panHistogram,
00691                                   int bIncludeOutOfRange, int bApproxOK,
00692                                   GDALProgressFunc pfnProgress,
00693                                   void *pProgressData ) CPL_OVERRIDE;
00694 
00695     static void Cleanup();
00696 };
00697 
00698 /************************************************************************/
00699 /*                           VRTRawRasterBand                           */
00700 /************************************************************************/
00701 
00702 class RawRasterBand;
00703 
00704 class CPL_DLL VRTRawRasterBand : public VRTRasterBand
00705 {
00706     RawRasterBand  *m_poRawRaster;
00707 
00708     char           *m_pszSourceFilename;
00709     int            m_bRelativeToVRT;
00710 
00711   public:
00712                    VRTRawRasterBand( GDALDataset *poDS, int nBand,
00713                                      GDALDataType eType = GDT_Unknown );
00714     virtual        ~VRTRawRasterBand();
00715 
00716     virtual CPLErr         XMLInit( CPLXMLNode *, const char * ) CPL_OVERRIDE;
00717     virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath ) CPL_OVERRIDE;
00718 
00719     virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
00720                               void *, int, int, GDALDataType,
00721                               GSpacing nPixelSpace, GSpacing nLineSpace,
00722                               GDALRasterIOExtraArg* psExtraArg ) CPL_OVERRIDE;
00723 
00724     virtual CPLErr IReadBlock( int, int, void * ) CPL_OVERRIDE;
00725     virtual CPLErr IWriteBlock( int, int, void * ) CPL_OVERRIDE;
00726 
00727     CPLErr         SetRawLink( const char *pszFilename,
00728                                const char *pszVRTPath,
00729                                int bRelativeToVRT,
00730                                vsi_l_offset nImageOffset,
00731                                int nPixelOffset, int nLineOffset,
00732                                const char *pszByteOrder );
00733 
00734     void           ClearRawLink();
00735 
00736     virtual void   GetFileList( char*** ppapszFileList, int *pnSize,
00737                                 int *pnMaxSize, CPLHashSet* hSetFiles ) CPL_OVERRIDE;
00738 };
00739 
00740 /************************************************************************/
00741 /*                              VRTDriver                               */
00742 /************************************************************************/
00743 
00744 class VRTDriver : public GDALDriver
00745 {
00746   public:
00747                  VRTDriver();
00748     virtual ~VRTDriver();
00749 
00750     char         **papszSourceParsers;
00751 
00752     virtual char      **GetMetadataDomainList() CPL_OVERRIDE;
00753     virtual char      **GetMetadata( const char * pszDomain = "" ) CPL_OVERRIDE;
00754     virtual CPLErr      SetMetadata( char ** papszMetadata,
00755                                      const char * pszDomain = "" ) CPL_OVERRIDE;
00756 
00757     VRTSource   *ParseSource( CPLXMLNode *psSrc, const char *pszVRTPath );
00758     void         AddSourceParser( const char *pszElementName,
00759                                   VRTSourceParser pfnParser );
00760 };
00761 
00762 /************************************************************************/
00763 /*                           VRTSimpleSource                            */
00764 /************************************************************************/
00765 
00766 class CPL_DLL VRTSimpleSource : public VRTSource
00767 {
00768 protected:
00769     friend class VRTSourcedRasterBand;
00770 
00771     GDALRasterBand      *m_poRasterBand;
00772 
00773     // When poRasterBand is a mask band, poMaskBandMainBand is the band
00774     // from which the mask band is taken.
00775     GDALRasterBand      *m_poMaskBandMainBand;
00776 
00777     double              m_dfSrcXOff;
00778     double              m_dfSrcYOff;
00779     double              m_dfSrcXSize;
00780     double              m_dfSrcYSize;
00781 
00782     double              m_dfDstXOff;
00783     double              m_dfDstYOff;
00784     double              m_dfDstXSize;
00785     double              m_dfDstYSize;
00786 
00787     int                 m_bNoDataSet;
00788     double              m_dfNoDataValue;
00789     CPLString           m_osResampling;
00790 
00791     int                 m_nMaxValue;
00792 
00793     int                 m_bRelativeToVRTOri;
00794     CPLString           m_osSourceFileNameOri;
00795 
00796     int                 NeedMaxValAdjustment() const;
00797 
00798 public:
00799             VRTSimpleSource();
00800             VRTSimpleSource( const VRTSimpleSource* poSrcSource,
00801                              double dfXDstRatio, double dfYDstRatio );
00802     virtual ~VRTSimpleSource();
00803 
00804     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * ) CPL_OVERRIDE;
00805     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) CPL_OVERRIDE;
00806 
00807     void           SetSrcBand( GDALRasterBand * );
00808     void           SetSrcMaskBand( GDALRasterBand * );
00809     void           SetSrcWindow( double, double, double, double );
00810     void           SetDstWindow( double, double, double, double );
00811     void           SetNoDataValue( double dfNoDataValue );
00812     const CPLString& GetResampling() const { return m_osResampling; }
00813     void           SetResampling( const char* pszResampling );
00814 
00815     int            GetSrcDstWindow( int, int, int, int, int, int,
00816                                     double *pdfReqXOff, double *pdfReqYOff,
00817                                     double *pdfReqXSize, double *pdfReqYSize,
00818                                     int *, int *, int *, int *,
00819                                     int *, int *, int *, int * );
00820 
00821     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize,
00822                               void *pData, int nBufXSize, int nBufYSize,
00823                               GDALDataType eBufType,
00824                               GSpacing nPixelSpace, GSpacing nLineSpace,
00825                               GDALRasterIOExtraArg* psExtraArg ) CPL_OVERRIDE;
00826 
00827     virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) CPL_OVERRIDE;
00828     virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) CPL_OVERRIDE;
00829     virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
00830                                         double* adfMinMax ) CPL_OVERRIDE;
00831     virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
00832                                       int bApproxOK,
00833                                       double *pdfMin, double *pdfMax,
00834                                       double *pdfMean, double *pdfStdDev,
00835                                       GDALProgressFunc pfnProgress,
00836                                       void *pProgressData ) CPL_OVERRIDE;
00837     virtual CPLErr  GetHistogram( int nXSize, int nYSize,
00838                                   double dfMin, double dfMax,
00839                                   int nBuckets, GUIntBig * panHistogram,
00840                                   int bIncludeOutOfRange, int bApproxOK,
00841                                   GDALProgressFunc pfnProgress,
00842                                   void *pProgressData ) CPL_OVERRIDE;
00843 
00844     void            DstToSrc( double dfX, double dfY,
00845                               double &dfXOut, double &dfYOut );
00846     void            SrcToDst( double dfX, double dfY,
00847                               double &dfXOut, double &dfYOut );
00848 
00849     virtual void   GetFileList( char*** ppapszFileList, int *pnSize,
00850                                 int *pnMaxSize, CPLHashSet* hSetFiles ) CPL_OVERRIDE;
00851 
00852     virtual int    IsSimpleSource() CPL_OVERRIDE { return TRUE; }
00853     virtual const char* GetType() { return "SimpleSource"; }
00854 
00855     GDALRasterBand* GetBand();
00856     int             IsSameExceptBandNumber( VRTSimpleSource* poOtherSource );
00857     CPLErr          DatasetRasterIO(
00858                                int nXOff, int nYOff, int nXSize, int nYSize,
00859                                void * pData, int nBufXSize, int nBufYSize,
00860                                GDALDataType eBufType,
00861                                int nBandCount, int *panBandMap,
00862                                GSpacing nPixelSpace, GSpacing nLineSpace,
00863                                GSpacing nBandSpace,
00864                                GDALRasterIOExtraArg* psExtraArg );
00865 
00866     void             UnsetPreservedRelativeFilenames();
00867 
00868     void             SetMaxValue( int nVal ) { m_nMaxValue = nVal; }
00869 };
00870 
00871 /************************************************************************/
00872 /*                          VRTAveragedSource                           */
00873 /************************************************************************/
00874 
00875 class VRTAveragedSource : public VRTSimpleSource
00876 {
00877 public:
00878                     VRTAveragedSource();
00879     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize,
00880                               void *pData, int nBufXSize, int nBufYSize,
00881                               GDALDataType eBufType,
00882                               GSpacing nPixelSpace, GSpacing nLineSpace,
00883                               GDALRasterIOExtraArg* psExtraArg ) CPL_OVERRIDE;
00884 
00885     virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) CPL_OVERRIDE;
00886     virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) CPL_OVERRIDE;
00887     virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
00888                                         double* adfMinMax ) CPL_OVERRIDE;
00889     virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
00890                                       int bApproxOK,
00891                                       double *pdfMin, double *pdfMax,
00892                                       double *pdfMean, double *pdfStdDev,
00893                                       GDALProgressFunc pfnProgress,
00894                                       void *pProgressData ) CPL_OVERRIDE;
00895     virtual CPLErr  GetHistogram( int nXSize, int nYSize,
00896                                   double dfMin, double dfMax,
00897                                   int nBuckets, GUIntBig * panHistogram,
00898                                   int bIncludeOutOfRange, int bApproxOK,
00899                                   GDALProgressFunc pfnProgress,
00900                                   void *pProgressData ) CPL_OVERRIDE;
00901 
00902     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) CPL_OVERRIDE;
00903     virtual const char* GetType() CPL_OVERRIDE { return "AveragedSource"; }
00904 };
00905 
00906 /************************************************************************/
00907 /*                           VRTComplexSource                           */
00908 /************************************************************************/
00909 
00910 typedef enum
00911 {
00912     VRT_SCALING_NONE,
00913     VRT_SCALING_LINEAR,
00914     VRT_SCALING_EXPONENTIAL,
00915 } VRTComplexSourceScaling;
00916 
00917 class CPL_DLL VRTComplexSource : public VRTSimpleSource
00918 {
00919 protected:
00920     VRTComplexSourceScaling m_eScalingType;
00921     double         m_dfScaleOff;  // For linear scaling.
00922     double         m_dfScaleRatio;  // For linear scaling.
00923 
00924     // For non-linear scaling with a power function.
00925     int            m_bSrcMinMaxDefined;
00926     double         m_dfSrcMin;
00927     double         m_dfSrcMax;
00928     double         m_dfDstMin;
00929     double         m_dfDstMax;
00930     double         m_dfExponent;
00931 
00932     int            m_nColorTableComponent;
00933 
00934     template <class WorkingDT>
00935     CPLErr          RasterIOInternal( int nReqXOff, int nReqYOff,
00936                                       int nReqXSize, int nReqYSize,
00937                                       void *pData, int nOutXSize, int nOutYSize,
00938                                       GDALDataType eBufType,
00939                                       GSpacing nPixelSpace, GSpacing nLineSpace,
00940                                       GDALRasterIOExtraArg* psExtraArg,
00941                                       GDALDataType eWrkDataType );
00942 
00943 public:
00944                    VRTComplexSource();
00945                    VRTComplexSource(const VRTComplexSource* poSrcSource,
00946                                     double dfXDstRatio, double dfYDstRatio);
00947     virtual        ~VRTComplexSource();
00948 
00949     virtual CPLErr RasterIO( int nXOff, int nYOff, int nXSize, int nYSize,
00950                              void *pData, int nBufXSize, int nBufYSize,
00951                              GDALDataType eBufType,
00952                              GSpacing nPixelSpace, GSpacing nLineSpace,
00953                              GDALRasterIOExtraArg* psExtraArg ) CPL_OVERRIDE;
00954 
00955     virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) CPL_OVERRIDE;
00956     virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) CPL_OVERRIDE;
00957     virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
00958                                         double* adfMinMax ) CPL_OVERRIDE;
00959     virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
00960                                       int bApproxOK,
00961                                       double *pdfMin, double *pdfMax,
00962                                       double *pdfMean, double *pdfStdDev,
00963                                       GDALProgressFunc pfnProgress,
00964                                       void *pProgressData ) CPL_OVERRIDE;
00965     virtual CPLErr  GetHistogram( int nXSize, int nYSize,
00966                                   double dfMin, double dfMax,
00967                                   int nBuckets, GUIntBig * panHistogram,
00968                                   int bIncludeOutOfRange, int bApproxOK,
00969                                   GDALProgressFunc pfnProgress,
00970                                   void *pProgressData ) CPL_OVERRIDE;
00971 
00972     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) CPL_OVERRIDE;
00973     virtual CPLErr XMLInit( CPLXMLNode *, const char * ) CPL_OVERRIDE;
00974     virtual const char* GetType() CPL_OVERRIDE { return "ComplexSource"; }
00975 
00976     double  LookupValue( double dfInput );
00977 
00978     void    SetLinearScaling( double dfOffset, double dfScale );
00979     void    SetPowerScaling( double dfExponent,
00980                              double dfSrcMin,
00981                              double dfSrcMax,
00982                              double dfDstMin,
00983                              double dfDstMax );
00984     void    SetColorTableComponent( int nComponent );
00985 
00986     double         *m_padfLUTInputs;
00987     double         *m_padfLUTOutputs;
00988     int            m_nLUTItemCount;
00989 };
00990 
00991 /************************************************************************/
00992 /*                           VRTFilteredSource                          */
00993 /************************************************************************/
00994 
00995 class VRTFilteredSource : public VRTComplexSource
00996 {
00997 private:
00998     int          IsTypeSupported( GDALDataType eType );
00999 
01000 protected:
01001     int          m_nSupportedTypesCount;
01002     GDALDataType m_aeSupportedTypes[20];
01003 
01004     int          m_nExtraEdgePixels;
01005 
01006 public:
01007             VRTFilteredSource();
01008     virtual ~VRTFilteredSource();
01009 
01010     void    SetExtraEdgePixels( int );
01011     void    SetFilteringDataTypesSupported( int, GDALDataType * );
01012 
01013     virtual CPLErr  FilterData( int nXSize, int nYSize, GDALDataType eType,
01014                                 GByte *pabySrcData, GByte *pabyDstData ) = 0;
01015 
01016     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize,
01017                               void *pData, int nBufXSize, int nBufYSize,
01018                               GDALDataType eBufType,
01019                               GSpacing nPixelSpace, GSpacing nLineSpace,
01020                               GDALRasterIOExtraArg* psExtraArg ) CPL_OVERRIDE;
01021 };
01022 
01023 /************************************************************************/
01024 /*                       VRTKernelFilteredSource                        */
01025 /************************************************************************/
01026 
01027 class VRTKernelFilteredSource : public VRTFilteredSource
01028 {
01029 protected:
01030     int     m_nKernelSize;
01031 
01032     double  *m_padfKernelCoefs;
01033 
01034     int     m_bNormalized;
01035 
01036 public:
01037             VRTKernelFilteredSource();
01038     virtual ~VRTKernelFilteredSource();
01039 
01040     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * ) CPL_OVERRIDE;
01041     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) CPL_OVERRIDE;
01042 
01043     virtual CPLErr  FilterData( int nXSize, int nYSize, GDALDataType eType,
01044                                 GByte *pabySrcData, GByte *pabyDstData ) CPL_OVERRIDE;
01045 
01046     CPLErr          SetKernel( int nKernelSize, double *padfCoefs );
01047     void            SetNormalized( int );
01048 };
01049 
01050 /************************************************************************/
01051 /*                       VRTAverageFilteredSource                       */
01052 /************************************************************************/
01053 
01054 class VRTAverageFilteredSource : public VRTKernelFilteredSource
01055 {
01056 public:
01057             explicit VRTAverageFilteredSource( int nKernelSize );
01058     virtual ~VRTAverageFilteredSource();
01059 
01060     virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * ) CPL_OVERRIDE;
01061     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) CPL_OVERRIDE;
01062 };
01063 
01064 /************************************************************************/
01065 /*                            VRTFuncSource                             */
01066 /************************************************************************/
01067 class VRTFuncSource : public VRTSource
01068 {
01069 public:
01070             VRTFuncSource();
01071     virtual ~VRTFuncSource();
01072 
01073     virtual CPLErr  XMLInit( CPLXMLNode *, const char *) CPL_OVERRIDE { return CE_Failure; }
01074     virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) CPL_OVERRIDE;
01075 
01076     virtual CPLErr  RasterIO( int nXOff, int nYOff, int nXSize, int nYSize,
01077                               void *pData, int nBufXSize, int nBufYSize,
01078                               GDALDataType eBufType,
01079                               GSpacing nPixelSpace, GSpacing nLineSpace,
01080                               GDALRasterIOExtraArg* psExtraArg ) CPL_OVERRIDE;
01081 
01082     virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) CPL_OVERRIDE;
01083     virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) CPL_OVERRIDE;
01084     virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
01085                                         double* adfMinMax ) CPL_OVERRIDE;
01086     virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
01087                                       int bApproxOK,
01088                                       double *pdfMin, double *pdfMax,
01089                                       double *pdfMean, double *pdfStdDev,
01090                                       GDALProgressFunc pfnProgress,
01091                                       void *pProgressData ) CPL_OVERRIDE;
01092     virtual CPLErr  GetHistogram( int nXSize, int nYSize,
01093                                   double dfMin, double dfMax,
01094                                   int nBuckets, GUIntBig * panHistogram,
01095                                   int bIncludeOutOfRange, int bApproxOK,
01096                                   GDALProgressFunc pfnProgress,
01097                                   void *pProgressData ) CPL_OVERRIDE;
01098 
01099     VRTImageReadFunc    pfnReadFunc;
01100     void               *pCBData;
01101     GDALDataType        eType;
01102 
01103     float               fNoDataValue;
01104 };
01105 
01106 #endif /* #ifndef DOXYGEN_SKIP */
01107 
01108 #endif /* ndef VIRTUALDATASET_H_INCLUDED */

Generated for GDAL by doxygen 1.7.6.1.