123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904 |
- /******************************************************************************
- * $Id: vrtdataset.h 29294 2015-06-05 08:52:15Z rouault $
- *
- * Project: Virtual GDAL Datasets
- * Purpose: Declaration of virtual gdal dataset classes.
- * Author: Frank Warmerdam, warmerdam@pobox.com
- *
- ******************************************************************************
- * Copyright (c) 2001, Frank Warmerdam <warmerdam@pobox.com>
- * Copyright (c) 2007-2013, Even Rouault <even dot rouault at mines-paris dot org>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- ****************************************************************************/
- #ifndef VIRTUALDATASET_H_INCLUDED
- #define VIRTUALDATASET_H_INCLUDED
- #include "gdal_priv.h"
- #include "gdal_pam.h"
- #include "gdal_vrt.h"
- #include "cpl_hash_set.h"
- int VRTApplyMetadata( CPLXMLNode *, GDALMajorObject * );
- CPLXMLNode *VRTSerializeMetadata( GDALMajorObject * );
- #if 0
- int VRTWarpedOverviewTransform( void *pTransformArg, int bDstToSrc,
- int nPointCount,
- double *padfX, double *padfY, double *padfZ,
- int *panSuccess );
- void* VRTDeserializeWarpedOverviewTransformer( CPLXMLNode *psTree );
- #endif
- /************************************************************************/
- /* VRTOverviewInfo() */
- /************************************************************************/
- class VRTOverviewInfo
- {
- public:
- CPLString osFilename;
- int nBand;
- GDALRasterBand *poBand;
- int bTriedToOpen;
-
- VRTOverviewInfo() : poBand(NULL), bTriedToOpen(FALSE) {}
- ~VRTOverviewInfo() {
- if( poBand == NULL )
- /* do nothing */;
- else if( poBand->GetDataset()->GetShared() )
- GDALClose( (GDALDatasetH) poBand->GetDataset() );
- else
- poBand->GetDataset()->Dereference();
- }
- };
- /************************************************************************/
- /* VRTSource */
- /************************************************************************/
- class CPL_DLL VRTSource
- {
- public:
- virtual ~VRTSource();
- virtual CPLErr RasterIO( int nXOff, int nYOff, int nXSize, int nYSize,
- void *pData, int nBufXSize, int nBufYSize,
- GDALDataType eBufType,
- GSpacing nPixelSpace, GSpacing nLineSpace,
- GDALRasterIOExtraArg* psExtraArg ) = 0;
- virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) = 0;
- virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) = 0;
- virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK, double* adfMinMax ) = 0;
- virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
- int bApproxOK,
- double *pdfMin, double *pdfMax,
- double *pdfMean, double *pdfStdDev,
- GDALProgressFunc pfnProgress, void *pProgressData ) = 0;
- virtual CPLErr GetHistogram( int nXSize, int nYSize,
- double dfMin, double dfMax,
- int nBuckets, GUIntBig * panHistogram,
- int bIncludeOutOfRange, int bApproxOK,
- GDALProgressFunc pfnProgress, void *pProgressData ) = 0;
- virtual CPLErr XMLInit( CPLXMLNode *psTree, const char * ) = 0;
- virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) = 0;
-
- virtual void GetFileList(char*** ppapszFileList, int *pnSize,
- int *pnMaxSize, CPLHashSet* hSetFiles);
- virtual int IsSimpleSource() { return FALSE; }
- };
- typedef VRTSource *(*VRTSourceParser)(CPLXMLNode *, const char *);
- VRTSource *VRTParseCoreSources( CPLXMLNode *psTree, const char * );
- VRTSource *VRTParseFilterSources( CPLXMLNode *psTree, const char * );
- /************************************************************************/
- /* VRTDataset */
- /************************************************************************/
- class VRTRasterBand;
- class CPL_DLL VRTDataset : public GDALDataset
- {
- friend class VRTRasterBand;
- char *pszProjection;
- int bGeoTransformSet;
- double adfGeoTransform[6];
- int nGCPCount;
- GDAL_GCP *pasGCPList;
- char *pszGCPProjection;
- int bNeedsFlush;
- int bWritable;
-
- char *pszVRTPath;
- VRTRasterBand *poMaskBand;
- int bCompatibleForDatasetIO;
- int CheckCompatibleForDatasetIO();
- protected:
- virtual int CloseDependentDatasets();
- public:
- VRTDataset(int nXSize, int nYSize);
- ~VRTDataset();
- void SetNeedsFlush() { bNeedsFlush = TRUE; }
- virtual void FlushCache();
-
- void SetWritable(int bWritable) { this->bWritable = bWritable; }
- virtual CPLErr CreateMaskBand( int nFlags );
- void SetMaskBand(VRTRasterBand* poMaskBand);
- virtual const char *GetProjectionRef(void);
- virtual CPLErr SetProjection( const char * );
- virtual CPLErr GetGeoTransform( double * );
- virtual CPLErr SetGeoTransform( double * );
- virtual CPLErr SetMetadata( char **papszMD, const char *pszDomain = "" );
- virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
- const char *pszDomain = "" );
- virtual int GetGCPCount();
- virtual const char *GetGCPProjection();
- virtual const GDAL_GCP *GetGCPs();
- virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
- const char *pszGCPProjection );
- virtual CPLErr AddBand( GDALDataType eType,
- char **papszOptions=NULL );
-
- virtual char **GetFileList();
- virtual CPLErr IRasterIO( GDALRWFlag eRWFlag,
- int nXOff, int nYOff, int nXSize, int nYSize,
- void * pData, int nBufXSize, int nBufYSize,
- GDALDataType eBufType,
- int nBandCount, int *panBandMap,
- GSpacing nPixelSpace, GSpacing nLineSpace,
- GSpacing nBandSpace,
- GDALRasterIOExtraArg* psExtraArg);
- virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath);
- virtual CPLErr XMLInit( CPLXMLNode *, const char * );
- /* Used by PDF driver for example */
- GDALDataset* GetSingleSimpleSource();
-
- void UnsetPreservedRelativeFilenames();
-
- static int Identify( GDALOpenInfo * );
- static GDALDataset *Open( GDALOpenInfo * );
- static GDALDataset *OpenXML( const char *, const char * = NULL, GDALAccess eAccess = GA_ReadOnly );
- static GDALDataset *Create( const char * pszName,
- int nXSize, int nYSize, int nBands,
- GDALDataType eType, char ** papszOptions );
- static CPLErr Delete( const char * pszFilename );
- };
- /************************************************************************/
- /* VRTWarpedDataset */
- /************************************************************************/
- class GDALWarpOperation;
- class VRTWarpedRasterBand;
- class CPL_DLL VRTWarpedDataset : public VRTDataset
- {
- int nBlockXSize;
- int nBlockYSize;
- GDALWarpOperation *poWarper;
- int nOverviewCount;
- VRTWarpedDataset **papoOverviews;
- int nSrcOvrLevel;
-
- void CreateImplicitOverviews();
- friend class VRTWarpedRasterBand;
- protected:
- virtual int CloseDependentDatasets();
- public:
- VRTWarpedDataset( int nXSize, int nYSize );
- ~VRTWarpedDataset();
- CPLErr Initialize( /* GDALWarpOptions */ void * );
- virtual CPLErr IBuildOverviews( const char *, int, int *,
- int, int *, GDALProgressFunc, void * );
-
- virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
- const char *pszDomain = "" );
- virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
- virtual CPLErr XMLInit( CPLXMLNode *, const char * );
- virtual CPLErr AddBand( GDALDataType eType,
- char **papszOptions=NULL );
-
- virtual char **GetFileList();
-
- CPLErr ProcessBlock( int iBlockX, int iBlockY );
- void GetBlockSize( int *, int * );
- };
- /************************************************************************/
- /* VRTRasterBand */
- /* */
- /* Provides support for all the various kinds of metadata but */
- /* no raster access. That is handled by derived classes. */
- /************************************************************************/
- class CPL_DLL VRTRasterBand : public GDALRasterBand
- {
- protected:
- int bIsMaskBand;
- int bNoDataValueSet;
- int bHideNoDataValue; // If set to true, will not report the existance of nodata
- double dfNoDataValue;
- GDALColorTable *poColorTable;
- GDALColorInterp eColorInterp;
- char *pszUnitType;
- char **papszCategoryNames;
-
- double dfOffset;
- double dfScale;
- CPLXMLNode *psSavedHistograms;
- void Initialize( int nXSize, int nYSize );
- std::vector<VRTOverviewInfo> apoOverviews;
- VRTRasterBand *poMaskBand;
- public:
- VRTRasterBand();
- virtual ~VRTRasterBand();
- virtual CPLErr XMLInit( CPLXMLNode *, const char * );
- virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath );
- virtual CPLErr SetNoDataValue( double );
- virtual double GetNoDataValue( int *pbSuccess = NULL );
- virtual CPLErr SetColorTable( GDALColorTable * );
- virtual GDALColorTable *GetColorTable();
- virtual CPLErr SetColorInterpretation( GDALColorInterp );
- virtual GDALColorInterp GetColorInterpretation();
- virtual const char *GetUnitType();
- CPLErr SetUnitType( const char * );
- virtual char **GetCategoryNames();
- virtual CPLErr SetCategoryNames( char ** );
- virtual CPLErr SetMetadata( char **papszMD, const char *pszDomain = "" );
- virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
- const char *pszDomain = "" );
- virtual double GetOffset( int *pbSuccess = NULL );
- CPLErr SetOffset( double );
- virtual double GetScale( int *pbSuccess = NULL );
- CPLErr SetScale( double );
- virtual int GetOverviewCount();
- virtual GDALRasterBand *GetOverview(int);
-
- virtual CPLErr GetHistogram( double dfMin, double dfMax,
- int nBuckets, GUIntBig * panHistogram,
- int bIncludeOutOfRange, int bApproxOK,
- GDALProgressFunc, void *pProgressData );
- virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
- int *pnBuckets, GUIntBig ** ppanHistogram,
- int bForce,
- GDALProgressFunc, void *pProgressData);
- virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
- int nBuckets, GUIntBig *panHistogram );
- CPLErr CopyCommonInfoFrom( GDALRasterBand * );
-
- virtual void GetFileList(char*** ppapszFileList, int *pnSize,
- int *pnMaxSize, CPLHashSet* hSetFiles);
-
- virtual void SetDescription( const char * );
- virtual GDALRasterBand *GetMaskBand();
- virtual int GetMaskFlags();
- virtual CPLErr CreateMaskBand( int nFlags );
-
- void SetMaskBand(VRTRasterBand* poMaskBand);
- void SetIsMaskBand();
- CPLErr UnsetNoDataValue();
- virtual int CloseDependentDatasets();
- virtual int IsSourcedRasterBand() { return FALSE; }
- };
- /************************************************************************/
- /* VRTSourcedRasterBand */
- /************************************************************************/
- class VRTSimpleSource;
- class CPL_DLL VRTSourcedRasterBand : public VRTRasterBand
- {
- private:
- int nRecursionCounter;
- CPLString osLastLocationInfo;
- char **papszSourceList;
- void Initialize( int nXSize, int nYSize );
- int CanUseSourcesMinMaxImplementations();
- public:
- int nSources;
- VRTSource **papoSources;
- int bEqualAreas;
- VRTSourcedRasterBand( GDALDataset *poDS, int nBand );
- VRTSourcedRasterBand( GDALDataType eType,
- int nXSize, int nYSize );
- VRTSourcedRasterBand( GDALDataset *poDS, int nBand,
- GDALDataType eType,
- int nXSize, int nYSize );
- virtual ~VRTSourcedRasterBand();
- virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
- void *, int, int, GDALDataType,
- GSpacing nPixelSpace, GSpacing nLineSpace,
- GDALRasterIOExtraArg* psExtraArg);
- virtual char **GetMetadataDomainList();
- virtual const char *GetMetadataItem( const char * pszName,
- const char * pszDomain = "" );
- virtual char **GetMetadata( const char * pszDomain = "" );
- virtual CPLErr SetMetadata( char ** papszMetadata,
- const char * pszDomain = "" );
- virtual CPLErr SetMetadataItem( const char * pszName,
- const char * pszValue,
- const char * pszDomain = "" );
- virtual CPLErr XMLInit( CPLXMLNode *, const char * );
- virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath );
- virtual double GetMinimum( int *pbSuccess = NULL );
- virtual double GetMaximum(int *pbSuccess = NULL );
- virtual CPLErr ComputeRasterMinMax( int bApproxOK, double* adfMinMax );
- virtual CPLErr ComputeStatistics( int bApproxOK,
- double *pdfMin, double *pdfMax,
- double *pdfMean, double *pdfStdDev,
- GDALProgressFunc pfnProgress, void *pProgressData );
- virtual CPLErr GetHistogram( double dfMin, double dfMax,
- int nBuckets, GUIntBig * panHistogram,
- int bIncludeOutOfRange, int bApproxOK,
- GDALProgressFunc pfnProgress, void *pProgressData );
- CPLErr AddSource( VRTSource * );
- CPLErr AddSimpleSource( GDALRasterBand *poSrcBand,
- int nSrcXOff=-1, int nSrcYOff=-1,
- int nSrcXSize=-1, int nSrcYSize=-1,
- int nDstXOff=-1, int nDstYOff=-1,
- int nDstXSize=-1, int nDstYSize=-1,
- const char *pszResampling = "near",
- double dfNoDataValue = VRT_NODATA_UNSET);
- CPLErr AddComplexSource( GDALRasterBand *poSrcBand,
- int nSrcXOff=-1, int nSrcYOff=-1,
- int nSrcXSize=-1, int nSrcYSize=-1,
- int nDstXOff=-1, int nDstYOff=-1,
- int nDstXSize=-1, int nDstYSize=-1,
- double dfScaleOff=0.0,
- double dfScaleRatio=1.0,
- double dfNoDataValue = VRT_NODATA_UNSET,
- int nColorTableComponent = 0);
- CPLErr AddMaskBandSource( GDALRasterBand *poSrcBand,
- int nSrcXOff=-1, int nSrcYOff=-1,
- int nSrcXSize=-1, int nSrcYSize=-1,
- int nDstXOff=-1, int nDstYOff=-1,
- int nDstXSize=-1, int nDstYSize=-1 );
- CPLErr AddFuncSource( VRTImageReadFunc pfnReadFunc, void *hCBData,
- double dfNoDataValue = VRT_NODATA_UNSET );
- void ConfigureSource(VRTSimpleSource *poSimpleSource,
- GDALRasterBand *poSrcBand,
- int bAddAsMaskBand,
- int nSrcXOff, int nSrcYOff,
- int nSrcXSize, int nSrcYSize,
- int nDstXOff, int nDstYOff,
- int nDstXSize, int nDstYSize);
- virtual CPLErr IReadBlock( int, int, void * );
-
- virtual void GetFileList(char*** ppapszFileList, int *pnSize,
- int *pnMaxSize, CPLHashSet* hSetFiles);
- virtual int CloseDependentDatasets();
- virtual int IsSourcedRasterBand() { return TRUE; }
- };
- /************************************************************************/
- /* VRTWarpedRasterBand */
- /************************************************************************/
- class CPL_DLL VRTWarpedRasterBand : public VRTRasterBand
- {
- public:
- VRTWarpedRasterBand( GDALDataset *poDS, int nBand,
- GDALDataType eType = GDT_Unknown );
- virtual ~VRTWarpedRasterBand();
- virtual CPLErr XMLInit( CPLXMLNode *, const char * );
- virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath );
- virtual CPLErr IReadBlock( int, int, void * );
- virtual CPLErr IWriteBlock( int, int, void * );
- virtual int GetOverviewCount();
- virtual GDALRasterBand *GetOverview(int);
- };
- /************************************************************************/
- /* VRTDerivedRasterBand */
- /************************************************************************/
- class CPL_DLL VRTDerivedRasterBand : public VRTSourcedRasterBand
- {
- public:
- char *pszFuncName;
- GDALDataType eSourceTransferType;
- VRTDerivedRasterBand(GDALDataset *poDS, int nBand);
- VRTDerivedRasterBand(GDALDataset *poDS, int nBand,
- GDALDataType eType, int nXSize, int nYSize);
- virtual ~VRTDerivedRasterBand();
- virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
- void *, int, int, GDALDataType,
- GSpacing nPixelSpace, GSpacing nLineSpace,
- GDALRasterIOExtraArg* psExtraArg );
- static CPLErr AddPixelFunction
- (const char *pszFuncName, GDALDerivedPixelFunc pfnPixelFunc);
- static GDALDerivedPixelFunc GetPixelFunction(const char *pszFuncName);
- void SetPixelFunctionName(const char *pszFuncName);
- void SetSourceTransferType(GDALDataType eDataType);
- virtual CPLErr XMLInit( CPLXMLNode *, const char * );
- virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath );
- };
- /************************************************************************/
- /* VRTRawRasterBand */
- /************************************************************************/
- class RawRasterBand;
- class CPL_DLL VRTRawRasterBand : public VRTRasterBand
- {
- RawRasterBand *poRawRaster;
- char *pszSourceFilename;
- int bRelativeToVRT;
- public:
- VRTRawRasterBand( GDALDataset *poDS, int nBand,
- GDALDataType eType = GDT_Unknown );
- virtual ~VRTRawRasterBand();
- virtual CPLErr XMLInit( CPLXMLNode *, const char * );
- virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath );
- virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
- void *, int, int, GDALDataType,
- GSpacing nPixelSpace, GSpacing nLineSpace,
- GDALRasterIOExtraArg* psExtraArg );
- virtual CPLErr IReadBlock( int, int, void * );
- virtual CPLErr IWriteBlock( int, int, void * );
- CPLErr SetRawLink( const char *pszFilename,
- const char *pszVRTPath,
- int bRelativeToVRT,
- vsi_l_offset nImageOffset,
- int nPixelOffset, int nLineOffset,
- const char *pszByteOrder );
- void ClearRawLink();
- virtual void GetFileList(char*** ppapszFileList, int *pnSize,
- int *pnMaxSize, CPLHashSet* hSetFiles);
- };
- /************************************************************************/
- /* VRTDriver */
- /************************************************************************/
- class VRTDriver : public GDALDriver
- {
- void *pDeserializerData;
- public:
- VRTDriver();
- ~VRTDriver();
- char **papszSourceParsers;
- virtual char **GetMetadataDomainList();
- virtual char **GetMetadata( const char * pszDomain = "" );
- virtual CPLErr SetMetadata( char ** papszMetadata,
- const char * pszDomain = "" );
- VRTSource *ParseSource( CPLXMLNode *psSrc, const char *pszVRTPath );
- void AddSourceParser( const char *pszElementName,
- VRTSourceParser pfnParser );
- };
- /************************************************************************/
- /* VRTSimpleSource */
- /************************************************************************/
- class CPL_DLL VRTSimpleSource : public VRTSource
- {
- protected:
- GDALRasterBand *poRasterBand;
- /* when poRasterBand is a mask band, poMaskBandMainBand is the band */
- /* from which the mask band is taken */
- GDALRasterBand *poMaskBandMainBand;
- int nSrcXOff;
- int nSrcYOff;
- int nSrcXSize;
- int nSrcYSize;
- int nDstXOff;
- int nDstYOff;
- int nDstXSize;
- int nDstYSize;
- int bNoDataSet;
- double dfNoDataValue;
- CPLString osResampling;
-
- int bRelativeToVRTOri;
- CPLString osSourceFileNameOri;
- public:
- VRTSimpleSource();
- virtual ~VRTSimpleSource();
- virtual CPLErr XMLInit( CPLXMLNode *psTree, const char * );
- virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
- void SetSrcBand( GDALRasterBand * );
- void SetSrcMaskBand( GDALRasterBand * );
- void SetSrcWindow( int, int, int, int );
- void SetDstWindow( int, int, int, int );
- void SetNoDataValue( double dfNoDataValue );
- const CPLString& GetResampling() const { return osResampling; }
- void SetResampling( const char* pszResampling );
- int GetSrcDstWindow( int, int, int, int, int, int,
- double *pdfReqXOff, double *pdfReqYOff,
- double *pdfReqXSize, double *pdfReqYSize,
- int *, int *, int *, int *,
- int *, int *, int *, int * );
- virtual CPLErr RasterIO( int nXOff, int nYOff, int nXSize, int nYSize,
- void *pData, int nBufXSize, int nBufYSize,
- GDALDataType eBufType,
- GSpacing nPixelSpace, GSpacing nLineSpace,
- GDALRasterIOExtraArg* psExtraArg );
- virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess );
- virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess );
- virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK, double* adfMinMax );
- virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
- int bApproxOK,
- double *pdfMin, double *pdfMax,
- double *pdfMean, double *pdfStdDev,
- GDALProgressFunc pfnProgress, void *pProgressData );
- virtual CPLErr GetHistogram( int nXSize, int nYSize,
- double dfMin, double dfMax,
- int nBuckets, GUIntBig * panHistogram,
- int bIncludeOutOfRange, int bApproxOK,
- GDALProgressFunc pfnProgress, void *pProgressData );
- void DstToSrc( double dfX, double dfY,
- double &dfXOut, double &dfYOut );
- void SrcToDst( double dfX, double dfY,
- double &dfXOut, double &dfYOut );
-
- virtual void GetFileList(char*** ppapszFileList, int *pnSize,
- int *pnMaxSize, CPLHashSet* hSetFiles);
- virtual int IsSimpleSource() { return TRUE; }
- virtual const char* GetType() { return "SimpleSource"; }
- GDALRasterBand* GetBand();
- int IsSameExceptBandNumber(VRTSimpleSource* poOtherSource);
- CPLErr DatasetRasterIO(
- int nXOff, int nYOff, int nXSize, int nYSize,
- void * pData, int nBufXSize, int nBufYSize,
- GDALDataType eBufType,
- int nBandCount, int *panBandMap,
- GSpacing nPixelSpace, GSpacing nLineSpace,
- GSpacing nBandSpace,
- GDALRasterIOExtraArg* psExtraArg);
- void UnsetPreservedRelativeFilenames();
- };
- /************************************************************************/
- /* VRTAveragedSource */
- /************************************************************************/
- class VRTAveragedSource : public VRTSimpleSource
- {
- public:
- VRTAveragedSource();
- virtual CPLErr RasterIO( int nXOff, int nYOff, int nXSize, int nYSize,
- void *pData, int nBufXSize, int nBufYSize,
- GDALDataType eBufType,
- GSpacing nPixelSpace, GSpacing nLineSpace,
- GDALRasterIOExtraArg* psExtraArg );
- virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess );
- virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess );
- virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK, double* adfMinMax );
- virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
- int bApproxOK,
- double *pdfMin, double *pdfMax,
- double *pdfMean, double *pdfStdDev,
- GDALProgressFunc pfnProgress, void *pProgressData );
- virtual CPLErr GetHistogram( int nXSize, int nYSize,
- double dfMin, double dfMax,
- int nBuckets, GUIntBig * panHistogram,
- int bIncludeOutOfRange, int bApproxOK,
- GDALProgressFunc pfnProgress, void *pProgressData );
- virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
- virtual const char* GetType() { return "AveragedSource"; }
- };
- /************************************************************************/
- /* VRTComplexSource */
- /************************************************************************/
- typedef enum
- {
- VRT_SCALING_NONE,
- VRT_SCALING_LINEAR,
- VRT_SCALING_EXPONENTIAL,
- } VRTComplexSourceScaling;
- class CPL_DLL VRTComplexSource : public VRTSimpleSource
- {
- protected:
- VRTComplexSourceScaling eScalingType;
- double dfScaleOff; /* for linear scaling */
- double dfScaleRatio; /* for linear scaling */
- /* For non-linear scaling with a power function. */
- int bSrcMinMaxDefined;
- double dfSrcMin;
- double dfSrcMax;
- double dfDstMin;
- double dfDstMax;
- double dfExponent;
- int nColorTableComponent;
- CPLErr RasterIOInternal( int nReqXOff, int nReqYOff,
- int nReqXSize, int nReqYSize,
- void *pData, int nOutXSize, int nOutYSize,
- GDALDataType eBufType,
- GSpacing nPixelSpace, GSpacing nLineSpace,
- GDALRasterIOExtraArg* psExtraArg );
- public:
- VRTComplexSource();
- virtual ~VRTComplexSource();
- virtual CPLErr RasterIO( int nXOff, int nYOff, int nXSize, int nYSize,
- void *pData, int nBufXSize, int nBufYSize,
- GDALDataType eBufType,
- GSpacing nPixelSpace, GSpacing nLineSpace,
- GDALRasterIOExtraArg* psExtraArg );
- virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess );
- virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess );
- virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK, double* adfMinMax );
- virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
- int bApproxOK,
- double *pdfMin, double *pdfMax,
- double *pdfMean, double *pdfStdDev,
- GDALProgressFunc pfnProgress, void *pProgressData );
- virtual CPLErr GetHistogram( int nXSize, int nYSize,
- double dfMin, double dfMax,
- int nBuckets, GUIntBig * panHistogram,
- int bIncludeOutOfRange, int bApproxOK,
- GDALProgressFunc pfnProgress, void *pProgressData );
- virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
- virtual CPLErr XMLInit( CPLXMLNode *, const char * );
- virtual const char* GetType() { return "ComplexSource"; }
- double LookupValue( double dfInput );
-
- void SetLinearScaling(double dfOffset, double dfScale);
- void SetPowerScaling(double dfExponent,
- double dfSrcMin,
- double dfSrcMax,
- double dfDstMin,
- double dfDstMax);
- void SetColorTableComponent(int nComponent);
- double *padfLUTInputs;
- double *padfLUTOutputs;
- int nLUTItemCount;
- };
- /************************************************************************/
- /* VRTFilteredSource */
- /************************************************************************/
- class VRTFilteredSource : public VRTComplexSource
- {
- private:
- int IsTypeSupported( GDALDataType eType );
- protected:
- int nSupportedTypesCount;
- GDALDataType aeSupportedTypes[20];
- int nExtraEdgePixels;
- public:
- VRTFilteredSource();
- virtual ~VRTFilteredSource();
- void SetExtraEdgePixels( int );
- void SetFilteringDataTypesSupported( int, GDALDataType * );
- virtual CPLErr FilterData( int nXSize, int nYSize, GDALDataType eType,
- GByte *pabySrcData, GByte *pabyDstData ) = 0;
- virtual CPLErr RasterIO( int nXOff, int nYOff, int nXSize, int nYSize,
- void *pData, int nBufXSize, int nBufYSize,
- GDALDataType eBufType,
- GSpacing nPixelSpace, GSpacing nLineSpace,
- GDALRasterIOExtraArg* psExtraArg );
- };
- /************************************************************************/
- /* VRTKernelFilteredSource */
- /************************************************************************/
- class VRTKernelFilteredSource : public VRTFilteredSource
- {
- protected:
- int nKernelSize;
- double *padfKernelCoefs;
- int bNormalized;
- public:
- VRTKernelFilteredSource();
- virtual ~VRTKernelFilteredSource();
- virtual CPLErr XMLInit( CPLXMLNode *psTree, const char * );
- virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
- virtual CPLErr FilterData( int nXSize, int nYSize, GDALDataType eType,
- GByte *pabySrcData, GByte *pabyDstData );
- CPLErr SetKernel( int nKernelSize, double *padfCoefs );
- void SetNormalized( int );
- };
- /************************************************************************/
- /* VRTAverageFilteredSource */
- /************************************************************************/
- class VRTAverageFilteredSource : public VRTKernelFilteredSource
- {
- public:
- VRTAverageFilteredSource( int nKernelSize );
- virtual ~VRTAverageFilteredSource();
- virtual CPLErr XMLInit( CPLXMLNode *psTree, const char * );
- virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
- };
- /************************************************************************/
- /* VRTFuncSource */
- /************************************************************************/
- class VRTFuncSource : public VRTSource
- {
- public:
- VRTFuncSource();
- virtual ~VRTFuncSource();
- virtual CPLErr XMLInit( CPLXMLNode *, const char *) { return CE_Failure; }
- virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
- virtual CPLErr RasterIO( int nXOff, int nYOff, int nXSize, int nYSize,
- void *pData, int nBufXSize, int nBufYSize,
- GDALDataType eBufType,
- GSpacing nPixelSpace, GSpacing nLineSpace,
- GDALRasterIOExtraArg* psExtraArg );
- virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess );
- virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess );
- virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK, double* adfMinMax );
- virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
- int bApproxOK,
- double *pdfMin, double *pdfMax,
- double *pdfMean, double *pdfStdDev,
- GDALProgressFunc pfnProgress, void *pProgressData );
- virtual CPLErr GetHistogram( int nXSize, int nYSize,
- double dfMin, double dfMax,
- int nBuckets, GUIntBig * panHistogram,
- int bIncludeOutOfRange, int bApproxOK,
- GDALProgressFunc pfnProgress, void *pProgressData );
- VRTImageReadFunc pfnReadFunc;
- void *pCBData;
- GDALDataType eType;
-
- float fNoDataValue;
- };
- #endif /* ndef VIRTUALDATASET_H_INCLUDED */
|