123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384 |
- /******************************************************************************
- * $Id: gdal_proxy.h 28899 2015-04-14 09:27:00Z rouault $
- *
- * Project: GDAL Core
- * Purpose: GDAL Core C++/Private declarations
- * Author: Even Rouault <even dot rouault at mines dash paris dot org>
- *
- ******************************************************************************
- * Copyright (c) 2008-2014, 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 GDAL_PROXY_H_INCLUDED
- #define GDAL_PROXY_H_INCLUDED
- #include "gdal.h"
- #ifdef __cplusplus
- #include "gdal_priv.h"
- #include "cpl_hash_set.h"
- /* ******************************************************************** */
- /* GDALProxyDataset */
- /* ******************************************************************** */
- class CPL_DLL GDALProxyDataset : public GDALDataset
- {
- protected:
- virtual GDALDataset *RefUnderlyingDataset() = 0;
- virtual void UnrefUnderlyingDataset(GDALDataset* poUnderlyingDataset);
- virtual CPLErr IBuildOverviews( const char *, int, int *,
- int, int *, GDALProgressFunc, void * );
- virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
- void *, int, int, GDALDataType,
- int, int *, GSpacing, GSpacing, GSpacing,
- GDALRasterIOExtraArg* psExtraArg );
- public:
- virtual char **GetMetadataDomainList();
- virtual char **GetMetadata( const char * pszDomain );
- virtual CPLErr SetMetadata( char ** papszMetadata,
- const char * pszDomain );
- virtual const char *GetMetadataItem( const char * pszName,
- const char * pszDomain );
- virtual CPLErr SetMetadataItem( const char * pszName,
- const char * pszValue,
- const char * pszDomain );
- virtual void FlushCache(void);
- virtual const char *GetProjectionRef(void);
- virtual CPLErr SetProjection( const char * );
- virtual CPLErr GetGeoTransform( double * );
- virtual CPLErr SetGeoTransform( double * );
- virtual void *GetInternalHandle( const char * );
- virtual GDALDriver *GetDriver(void);
- virtual char **GetFileList(void);
- 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 AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
- int nBufXSize, int nBufYSize,
- GDALDataType eDT,
- int nBandCount, int *panBandList,
- char **papszOptions );
- virtual CPLErr CreateMaskBand( int nFlags );
- };
- /* ******************************************************************** */
- /* GDALProxyRasterBand */
- /* ******************************************************************** */
- class CPL_DLL GDALProxyRasterBand : public GDALRasterBand
- {
- protected:
- virtual GDALRasterBand* RefUnderlyingRasterBand() = 0;
- virtual void UnrefUnderlyingRasterBand(GDALRasterBand* poUnderlyingRasterBand);
- virtual CPLErr IReadBlock( int, int, void * );
- virtual CPLErr IWriteBlock( int, int, void * );
- virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
- void *, int, int, GDALDataType,
- GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg );
- public:
- virtual char **GetMetadataDomainList();
- virtual char **GetMetadata( const char * pszDomain );
- virtual CPLErr SetMetadata( char ** papszMetadata,
- const char * pszDomain );
- virtual const char *GetMetadataItem( const char * pszName,
- const char * pszDomain );
- virtual CPLErr SetMetadataItem( const char * pszName,
- const char * pszValue,
- const char * pszDomain );
- virtual CPLErr FlushCache();
- virtual char **GetCategoryNames();
- virtual double GetNoDataValue( int *pbSuccess = NULL );
- virtual double GetMinimum( int *pbSuccess = NULL );
- virtual double GetMaximum(int *pbSuccess = NULL );
- virtual double GetOffset( int *pbSuccess = NULL );
- virtual double GetScale( int *pbSuccess = NULL );
- virtual const char *GetUnitType();
- virtual GDALColorInterp GetColorInterpretation();
- virtual GDALColorTable *GetColorTable();
- virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0);
- virtual CPLErr SetCategoryNames( char ** );
- virtual CPLErr SetNoDataValue( double );
- virtual CPLErr SetColorTable( GDALColorTable * );
- virtual CPLErr SetColorInterpretation( GDALColorInterp );
- virtual CPLErr SetOffset( double );
- virtual CPLErr SetScale( double );
- virtual CPLErr SetUnitType( const char * );
- virtual CPLErr GetStatistics( int bApproxOK, int bForce,
- double *pdfMin, double *pdfMax,
- double *pdfMean, double *padfStdDev );
- virtual CPLErr ComputeStatistics( int bApproxOK,
- double *pdfMin, double *pdfMax,
- double *pdfMean, double *pdfStdDev,
- GDALProgressFunc, void *pProgressData );
- virtual CPLErr SetStatistics( double dfMin, double dfMax,
- double dfMean, double dfStdDev );
- virtual CPLErr ComputeRasterMinMax( int, double* );
- virtual int HasArbitraryOverviews();
- virtual int GetOverviewCount();
- virtual GDALRasterBand *GetOverview(int);
- virtual GDALRasterBand *GetRasterSampleOverview( GUIntBig );
- virtual CPLErr BuildOverviews( const char *, int, int *,
- GDALProgressFunc, void * );
- virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
- int nBufXSize, int nBufYSize,
- GDALDataType eDT, char **papszOptions );
- 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 );
- virtual GDALRasterAttributeTable *GetDefaultRAT();
- virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * );
- virtual GDALRasterBand *GetMaskBand();
- virtual int GetMaskFlags();
- virtual CPLErr CreateMaskBand( int nFlags );
- virtual CPLVirtualMem *GetVirtualMemAuto( GDALRWFlag eRWFlag,
- int *pnPixelSpace,
- GIntBig *pnLineSpace,
- char **papszOptions );
- };
- /* ******************************************************************** */
- /* GDALProxyPoolDataset */
- /* ******************************************************************** */
- typedef struct _GDALProxyPoolCacheEntry GDALProxyPoolCacheEntry;
- class GDALProxyPoolRasterBand;
- class CPL_DLL GDALProxyPoolDataset : public GDALProxyDataset
- {
- private:
- GIntBig responsiblePID;
- char *pszProjectionRef;
- double adfGeoTransform[6];
- int bHasSrcProjection;
- int bHasSrcGeoTransform;
- char *pszGCPProjection;
- int nGCPCount;
- GDAL_GCP *pasGCPList;
- CPLHashSet *metadataSet;
- CPLHashSet *metadataItemSet;
- GDALProxyPoolCacheEntry* cacheEntry;
- protected:
- virtual GDALDataset *RefUnderlyingDataset();
- virtual void UnrefUnderlyingDataset(GDALDataset* poUnderlyingDataset);
- friend class GDALProxyPoolRasterBand;
- public:
- GDALProxyPoolDataset(const char* pszSourceDatasetDescription,
- int nRasterXSize, int nRasterYSize,
- GDALAccess eAccess = GA_ReadOnly,
- int bShared = FALSE,
- const char * pszProjectionRef = NULL,
- double * padfGeoTransform = NULL);
- ~GDALProxyPoolDataset();
- void SetOpenOptions(char** papszOpenOptions);
- void AddSrcBandDescription( GDALDataType eDataType, int nBlockXSize, int nBlockYSize);
- virtual const char *GetProjectionRef(void);
- virtual CPLErr SetProjection( const char * );
- virtual CPLErr GetGeoTransform( double * );
- virtual CPLErr SetGeoTransform( double * );
- /* Special behaviour for the following methods : they return a pointer */
- /* data type, that must be cached by the proxy, so it doesn't become invalid */
- /* when the underlying object get closed */
- virtual char **GetMetadata( const char * pszDomain );
- virtual const char *GetMetadataItem( const char * pszName,
- const char * pszDomain );
- virtual void *GetInternalHandle( const char * pszRequest );
- virtual const char *GetGCPProjection();
- virtual const GDAL_GCP *GetGCPs();
- };
- /* ******************************************************************** */
- /* GDALProxyPoolRasterBand */
- /* ******************************************************************** */
- class GDALProxyPoolOverviewRasterBand;
- class GDALProxyPoolMaskBand;
- class CPL_DLL GDALProxyPoolRasterBand : public GDALProxyRasterBand
- {
- private:
- CPLHashSet *metadataSet;
- CPLHashSet *metadataItemSet;
- char *pszUnitType;
- char **papszCategoryNames;
- GDALColorTable *poColorTable;
- int nSizeProxyOverviewRasterBand;
- GDALProxyPoolOverviewRasterBand **papoProxyOverviewRasterBand;
- GDALProxyPoolMaskBand *poProxyMaskBand;
- void Init();
- protected:
- virtual GDALRasterBand* RefUnderlyingRasterBand();
- virtual void UnrefUnderlyingRasterBand(GDALRasterBand* poUnderlyingRasterBand);
- friend class GDALProxyPoolOverviewRasterBand;
- friend class GDALProxyPoolMaskBand;
- public:
- GDALProxyPoolRasterBand(GDALProxyPoolDataset* poDS, int nBand,
- GDALDataType eDataType,
- int nBlockXSize, int nBlockYSize);
- GDALProxyPoolRasterBand(GDALProxyPoolDataset* poDS,
- GDALRasterBand* poUnderlyingRasterBand);
- ~GDALProxyPoolRasterBand();
- void AddSrcMaskBandDescription( GDALDataType eDataType, int nBlockXSize, int nBlockYSize);
- /* Special behaviour for the following methods : they return a pointer */
- /* data type, that must be cached by the proxy, so it doesn't become invalid */
- /* when the underlying object get closed */
- virtual char **GetMetadata( const char * pszDomain );
- virtual const char *GetMetadataItem( const char * pszName,
- const char * pszDomain );
- virtual char **GetCategoryNames();
- virtual const char *GetUnitType();
- virtual GDALColorTable *GetColorTable();
- virtual GDALRasterBand *GetOverview(int);
- virtual GDALRasterBand *GetRasterSampleOverview( GUIntBig nDesiredSamples); // TODO
- virtual GDALRasterBand *GetMaskBand();
- };
- /* ******************************************************************** */
- /* GDALProxyPoolOverviewRasterBand */
- /* ******************************************************************** */
- class GDALProxyPoolOverviewRasterBand : public GDALProxyPoolRasterBand
- {
- private:
- GDALProxyPoolRasterBand *poMainBand;
- int nOverviewBand;
- GDALRasterBand *poUnderlyingMainRasterBand;
- int nRefCountUnderlyingMainRasterBand;
- protected:
- virtual GDALRasterBand* RefUnderlyingRasterBand();
- virtual void UnrefUnderlyingRasterBand(GDALRasterBand* poUnderlyingRasterBand);
- public:
- GDALProxyPoolOverviewRasterBand(GDALProxyPoolDataset* poDS,
- GDALRasterBand* poUnderlyingOverviewBand,
- GDALProxyPoolRasterBand* poMainBand,
- int nOverviewBand);
- ~GDALProxyPoolOverviewRasterBand();
- };
- /* ******************************************************************** */
- /* GDALProxyPoolMaskBand */
- /* ******************************************************************** */
- class GDALProxyPoolMaskBand : public GDALProxyPoolRasterBand
- {
- private:
- GDALProxyPoolRasterBand *poMainBand;
- GDALRasterBand *poUnderlyingMainRasterBand;
- int nRefCountUnderlyingMainRasterBand;
- protected:
- virtual GDALRasterBand* RefUnderlyingRasterBand();
- virtual void UnrefUnderlyingRasterBand(GDALRasterBand* poUnderlyingRasterBand);
- public:
- GDALProxyPoolMaskBand(GDALProxyPoolDataset* poDS,
- GDALRasterBand* poUnderlyingMaskBand,
- GDALProxyPoolRasterBand* poMainBand);
- GDALProxyPoolMaskBand(GDALProxyPoolDataset* poDS,
- GDALProxyPoolRasterBand* poMainBand,
- GDALDataType eDataType,
- int nBlockXSize, int nBlockYSize);
- ~GDALProxyPoolMaskBand();
- };
- #endif
- /* ******************************************************************** */
- /* C types and methods declarations */
- /* ******************************************************************** */
- CPL_C_START
- typedef struct GDALProxyPoolDatasetHS *GDALProxyPoolDatasetH;
- GDALProxyPoolDatasetH CPL_DLL GDALProxyPoolDatasetCreate(const char* pszSourceDatasetDescription,
- int nRasterXSize, int nRasterYSize,
- GDALAccess eAccess, int bShared,
- const char * pszProjectionRef,
- double * padfGeoTransform);
- void CPL_DLL GDALProxyPoolDatasetDelete(GDALProxyPoolDatasetH hProxyPoolDataset);
- void CPL_DLL GDALProxyPoolDatasetAddSrcBandDescription( GDALProxyPoolDatasetH hProxyPoolDataset,
- GDALDataType eDataType,
- int nBlockXSize, int nBlockYSize);
- CPL_C_END
- #endif /* GDAL_PROXY_H_INCLUDED */
|