00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef GDAL_PROXY_H_INCLUDED
00031 #define GDAL_PROXY_H_INCLUDED
00032
00033 #include "gdal.h"
00034
00035 #ifdef __cplusplus
00036
00037 #include "gdal_priv.h"
00038 #include "cpl_hash_set.h"
00039
00040
00041
00042
00043
00044 class CPL_DLL GDALProxyDataset : public GDALDataset
00045 {
00046 protected:
00047 virtual GDALDataset *RefUnderlyingDataset() = 0;
00048 virtual void UnrefUnderlyingDataset(GDALDataset* poUnderlyingDataset);
00049
00050 virtual CPLErr IBuildOverviews( const char *, int, int *,
00051 int, int *, GDALProgressFunc, void * );
00052 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
00053 void *, int, int, GDALDataType,
00054 int, int *, int, int, int );
00055 public:
00056
00057 virtual char **GetMetadataDomainList();
00058 virtual char **GetMetadata( const char * pszDomain );
00059 virtual CPLErr SetMetadata( char ** papszMetadata,
00060 const char * pszDomain );
00061 virtual const char *GetMetadataItem( const char * pszName,
00062 const char * pszDomain );
00063 virtual CPLErr SetMetadataItem( const char * pszName,
00064 const char * pszValue,
00065 const char * pszDomain );
00066
00067 virtual void FlushCache(void);
00068
00069 virtual const char *GetProjectionRef(void);
00070 virtual CPLErr SetProjection( const char * );
00071
00072 virtual CPLErr GetGeoTransform( double * );
00073 virtual CPLErr SetGeoTransform( double * );
00074
00075 virtual void *GetInternalHandle( const char * );
00076 virtual GDALDriver *GetDriver(void);
00077 virtual char **GetFileList(void);
00078
00079 virtual int GetGCPCount();
00080 virtual const char *GetGCPProjection();
00081 virtual const GDAL_GCP *GetGCPs();
00082 virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
00083 const char *pszGCPProjection );
00084
00085 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
00086 int nBufXSize, int nBufYSize,
00087 GDALDataType eDT,
00088 int nBandCount, int *panBandList,
00089 char **papszOptions );
00090
00091 virtual CPLErr CreateMaskBand( int nFlags );
00092
00093 };
00094
00095
00096
00097
00098
00099 class CPL_DLL GDALProxyRasterBand : public GDALRasterBand
00100 {
00101 protected:
00102 virtual GDALRasterBand* RefUnderlyingRasterBand() = 0;
00103 virtual void UnrefUnderlyingRasterBand(GDALRasterBand* poUnderlyingRasterBand);
00104
00105 virtual CPLErr IReadBlock( int, int, void * );
00106 virtual CPLErr IWriteBlock( int, int, void * );
00107 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
00108 void *, int, int, GDALDataType,
00109 int, int );
00110
00111 public:
00112
00113 virtual char **GetMetadataDomainList();
00114 virtual char **GetMetadata( const char * pszDomain );
00115 virtual CPLErr SetMetadata( char ** papszMetadata,
00116 const char * pszDomain );
00117 virtual const char *GetMetadataItem( const char * pszName,
00118 const char * pszDomain );
00119 virtual CPLErr SetMetadataItem( const char * pszName,
00120 const char * pszValue,
00121 const char * pszDomain );
00122 virtual CPLErr FlushCache();
00123 virtual char **GetCategoryNames();
00124 virtual double GetNoDataValue( int *pbSuccess = NULL );
00125 virtual double GetMinimum( int *pbSuccess = NULL );
00126 virtual double GetMaximum(int *pbSuccess = NULL );
00127 virtual double GetOffset( int *pbSuccess = NULL );
00128 virtual double GetScale( int *pbSuccess = NULL );
00129 virtual const char *GetUnitType();
00130 virtual GDALColorInterp GetColorInterpretation();
00131 virtual GDALColorTable *GetColorTable();
00132 virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0);
00133
00134 virtual CPLErr SetCategoryNames( char ** );
00135 virtual CPLErr SetNoDataValue( double );
00136 virtual CPLErr SetColorTable( GDALColorTable * );
00137 virtual CPLErr SetColorInterpretation( GDALColorInterp );
00138 virtual CPLErr SetOffset( double );
00139 virtual CPLErr SetScale( double );
00140 virtual CPLErr SetUnitType( const char * );
00141
00142 virtual CPLErr GetStatistics( int bApproxOK, int bForce,
00143 double *pdfMin, double *pdfMax,
00144 double *pdfMean, double *padfStdDev );
00145 virtual CPLErr ComputeStatistics( int bApproxOK,
00146 double *pdfMin, double *pdfMax,
00147 double *pdfMean, double *pdfStdDev,
00148 GDALProgressFunc, void *pProgressData );
00149 virtual CPLErr SetStatistics( double dfMin, double dfMax,
00150 double dfMean, double dfStdDev );
00151 virtual CPLErr ComputeRasterMinMax( int, double* );
00152
00153 virtual int HasArbitraryOverviews();
00154 virtual int GetOverviewCount();
00155 virtual GDALRasterBand *GetOverview(int);
00156 virtual GDALRasterBand *GetRasterSampleOverview( int );
00157 virtual CPLErr BuildOverviews( const char *, int, int *,
00158 GDALProgressFunc, void * );
00159
00160 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
00161 int nBufXSize, int nBufYSize,
00162 GDALDataType eDT, char **papszOptions );
00163
00164 virtual CPLErr GetHistogram( double dfMin, double dfMax,
00165 int nBuckets, int * panHistogram,
00166 int bIncludeOutOfRange, int bApproxOK,
00167 GDALProgressFunc, void *pProgressData );
00168
00169 virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
00170 int *pnBuckets, int ** ppanHistogram,
00171 int bForce,
00172 GDALProgressFunc, void *pProgressData);
00173 virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
00174 int nBuckets, int *panHistogram );
00175
00176 virtual GDALRasterAttributeTable *GetDefaultRAT();
00177 virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * );
00178
00179 virtual GDALRasterBand *GetMaskBand();
00180 virtual int GetMaskFlags();
00181 virtual CPLErr CreateMaskBand( int nFlags );
00182
00183 virtual CPLVirtualMem *GetVirtualMemAuto( GDALRWFlag eRWFlag,
00184 int *pnPixelSpace,
00185 GIntBig *pnLineSpace,
00186 char **papszOptions );
00187 };
00188
00189
00190
00191
00192
00193
00194 typedef struct _GDALProxyPoolCacheEntry GDALProxyPoolCacheEntry;
00195 class GDALProxyPoolRasterBand;
00196
00197 class CPL_DLL GDALProxyPoolDataset : public GDALProxyDataset
00198 {
00199 private:
00200 GIntBig responsiblePID;
00201
00202 char *pszProjectionRef;
00203 double adfGeoTransform[6];
00204 int bHasSrcProjection;
00205 int bHasSrcGeoTransform;
00206 char *pszGCPProjection;
00207 int nGCPCount;
00208 GDAL_GCP *pasGCPList;
00209 CPLHashSet *metadataSet;
00210 CPLHashSet *metadataItemSet;
00211
00212 GDALProxyPoolCacheEntry* cacheEntry;
00213
00214 protected:
00215 virtual GDALDataset *RefUnderlyingDataset();
00216 virtual void UnrefUnderlyingDataset(GDALDataset* poUnderlyingDataset);
00217
00218 friend class GDALProxyPoolRasterBand;
00219
00220 public:
00221 GDALProxyPoolDataset(const char* pszSourceDatasetDescription,
00222 int nRasterXSize, int nRasterYSize,
00223 GDALAccess eAccess = GA_ReadOnly,
00224 int bShared = FALSE,
00225 const char * pszProjectionRef = NULL,
00226 double * padfGeoTransform = NULL);
00227 ~GDALProxyPoolDataset();
00228
00229 void AddSrcBandDescription( GDALDataType eDataType, int nBlockXSize, int nBlockYSize);
00230
00231 virtual const char *GetProjectionRef(void);
00232 virtual CPLErr SetProjection( const char * );
00233
00234 virtual CPLErr GetGeoTransform( double * );
00235 virtual CPLErr SetGeoTransform( double * );
00236
00237
00238
00239
00240 virtual char **GetMetadata( const char * pszDomain );
00241 virtual const char *GetMetadataItem( const char * pszName,
00242 const char * pszDomain );
00243
00244 virtual void *GetInternalHandle( const char * pszRequest );
00245
00246 virtual const char *GetGCPProjection();
00247 virtual const GDAL_GCP *GetGCPs();
00248 };
00249
00250
00251
00252
00253
00254 class GDALProxyPoolOverviewRasterBand;
00255 class GDALProxyPoolMaskBand;
00256
00257 class CPL_DLL GDALProxyPoolRasterBand : public GDALProxyRasterBand
00258 {
00259 private:
00260 CPLHashSet *metadataSet;
00261 CPLHashSet *metadataItemSet;
00262 char *pszUnitType;
00263 char **papszCategoryNames;
00264 GDALColorTable *poColorTable;
00265
00266 int nSizeProxyOverviewRasterBand;
00267 GDALProxyPoolOverviewRasterBand **papoProxyOverviewRasterBand;
00268 GDALProxyPoolMaskBand *poProxyMaskBand;
00269
00270 void Init();
00271
00272 protected:
00273 virtual GDALRasterBand* RefUnderlyingRasterBand();
00274 virtual void UnrefUnderlyingRasterBand(GDALRasterBand* poUnderlyingRasterBand);
00275
00276 friend class GDALProxyPoolOverviewRasterBand;
00277 friend class GDALProxyPoolMaskBand;
00278
00279 public:
00280 GDALProxyPoolRasterBand(GDALProxyPoolDataset* poDS, int nBand,
00281 GDALDataType eDataType,
00282 int nBlockXSize, int nBlockYSize);
00283 GDALProxyPoolRasterBand(GDALProxyPoolDataset* poDS,
00284 GDALRasterBand* poUnderlyingRasterBand);
00285 ~GDALProxyPoolRasterBand();
00286
00287 void AddSrcMaskBandDescription( GDALDataType eDataType, int nBlockXSize, int nBlockYSize);
00288
00289
00290
00291
00292 virtual char **GetMetadata( const char * pszDomain );
00293 virtual const char *GetMetadataItem( const char * pszName,
00294 const char * pszDomain );
00295 virtual char **GetCategoryNames();
00296 virtual const char *GetUnitType();
00297 virtual GDALColorTable *GetColorTable();
00298 virtual GDALRasterBand *GetOverview(int);
00299 virtual GDALRasterBand *GetRasterSampleOverview( int nDesiredSamples);
00300 virtual GDALRasterBand *GetMaskBand();
00301
00302 };
00303
00304
00305
00306
00307
00308 class GDALProxyPoolOverviewRasterBand : public GDALProxyPoolRasterBand
00309 {
00310 private:
00311 GDALProxyPoolRasterBand *poMainBand;
00312 int nOverviewBand;
00313
00314 GDALRasterBand *poUnderlyingMainRasterBand;
00315 int nRefCountUnderlyingMainRasterBand;
00316
00317 protected:
00318 virtual GDALRasterBand* RefUnderlyingRasterBand();
00319 virtual void UnrefUnderlyingRasterBand(GDALRasterBand* poUnderlyingRasterBand);
00320
00321 public:
00322 GDALProxyPoolOverviewRasterBand(GDALProxyPoolDataset* poDS,
00323 GDALRasterBand* poUnderlyingOverviewBand,
00324 GDALProxyPoolRasterBand* poMainBand,
00325 int nOverviewBand);
00326 ~GDALProxyPoolOverviewRasterBand();
00327 };
00328
00329
00330
00331
00332
00333 class GDALProxyPoolMaskBand : public GDALProxyPoolRasterBand
00334 {
00335 private:
00336 GDALProxyPoolRasterBand *poMainBand;
00337
00338 GDALRasterBand *poUnderlyingMainRasterBand;
00339 int nRefCountUnderlyingMainRasterBand;
00340
00341 protected:
00342 virtual GDALRasterBand* RefUnderlyingRasterBand();
00343 virtual void UnrefUnderlyingRasterBand(GDALRasterBand* poUnderlyingRasterBand);
00344
00345 public:
00346 GDALProxyPoolMaskBand(GDALProxyPoolDataset* poDS,
00347 GDALRasterBand* poUnderlyingMaskBand,
00348 GDALProxyPoolRasterBand* poMainBand);
00349 GDALProxyPoolMaskBand(GDALProxyPoolDataset* poDS,
00350 GDALProxyPoolRasterBand* poMainBand,
00351 GDALDataType eDataType,
00352 int nBlockXSize, int nBlockYSize);
00353 ~GDALProxyPoolMaskBand();
00354 };
00355
00356 #endif
00357
00358
00359
00360
00361
00362
00363
00364 CPL_C_START
00365
00366 typedef struct GDALProxyPoolDatasetHS *GDALProxyPoolDatasetH;
00367
00368 GDALProxyPoolDatasetH CPL_DLL GDALProxyPoolDatasetCreate(const char* pszSourceDatasetDescription,
00369 int nRasterXSize, int nRasterYSize,
00370 GDALAccess eAccess, int bShared,
00371 const char * pszProjectionRef,
00372 double * padfGeoTransform);
00373
00374 void CPL_DLL GDALProxyPoolDatasetDelete(GDALProxyPoolDatasetH hProxyPoolDataset);
00375
00376 void CPL_DLL GDALProxyPoolDatasetAddSrcBandDescription( GDALProxyPoolDatasetH hProxyPoolDataset,
00377 GDALDataType eDataType,
00378 int nBlockXSize, int nBlockYSize);
00379
00380 CPL_C_END
00381
00382 #endif