30 #ifndef VIRTUALDATASET_H_INCLUDED
31 #define VIRTUALDATASET_H_INCLUDED
33 #include "gdal_priv.h"
41 int VRTWarpedOverviewTransform(
void *pTransformArg,
int bDstToSrc,
43 double *padfX,
double *padfY,
double *padfZ,
45 void* VRTDeserializeWarpedOverviewTransformer(
CPLXMLNode *psTree );
79 virtual CPLErr RasterIO(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
80 void *pData,
int nBufXSize,
int nBufYSize,
82 int nPixelSpace,
int nLineSpace ) = 0;
84 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess ) = 0;
85 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess ) = 0;
87 virtual CPLErr XMLInit(
CPLXMLNode *psTree,
const char * ) = 0;
88 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath ) = 0;
90 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
93 virtual int IsSimpleSource() {
return FALSE; }
113 int bGeoTransformSet;
114 double adfGeoTransform[6];
118 char *pszGCPProjection;
127 int bCompatibleForDatasetIO;
128 int CheckCompatibleForDatasetIO();
137 void SetNeedsFlush() { bNeedsFlush = TRUE; }
140 void SetWritable(
int bWritable) { this->bWritable = bWritable; }
150 virtual CPLErr
SetMetadata(
char **papszMD,
const char *pszDomain =
"" );
151 virtual CPLErr
SetMetadataItem(
const char *pszName,
const char *pszValue,
152 const char *pszDomain =
"" );
158 const char *pszGCPProjection );
161 char **papszOptions=NULL );
166 int nXOff,
int nYOff,
int nXSize,
int nYSize,
167 void * pData,
int nBufXSize,
int nBufYSize,
169 int nBandCount,
int *panBandMap,
170 int nPixelSpace,
int nLineSpace,
int nBandSpace);
172 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath);
173 virtual CPLErr XMLInit(
CPLXMLNode *,
const char * );
179 int nXSize,
int nYSize,
int nBands,
181 static CPLErr Delete(
const char * pszFilename );
210 CPLErr Initialize(
void * );
212 virtual CPLErr IBuildOverviews(
const char *,
int,
int *,
215 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath );
216 virtual CPLErr XMLInit(
CPLXMLNode *,
const char * );
219 char **papszOptions=NULL );
223 CPLErr ProcessBlock(
int iBlockX,
int iBlockY );
241 int bHideNoDataValue;
242 double dfNoDataValue;
249 char **papszCategoryNames;
256 void Initialize(
int nXSize,
int nYSize );
258 std::vector<VRTOverviewInfo> apoOverviews;
267 virtual CPLErr XMLInit(
CPLXMLNode *,
const char * );
268 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath );
285 virtual CPLErr
SetMetadata(
char **papszMD,
const char *pszDomain =
"" );
286 virtual CPLErr
SetMetadataItem(
const char *pszName,
const char *pszValue,
287 const char *pszDomain =
"" );
289 virtual double GetOffset(
int *pbSuccess = NULL );
291 virtual double GetScale(
int *pbSuccess = NULL );
297 virtual CPLErr
GetHistogram(
double dfMin,
double dfMax,
298 int nBuckets,
int * panHistogram,
299 int bIncludeOutOfRange,
int bApproxOK,
303 int *pnBuckets,
int ** ppanHistogram,
308 int nBuckets,
int *panHistogram );
312 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
324 void SetIsMaskBand();
326 CPLErr UnsetNoDataValue();
328 virtual int CloseDependentDatasets();
330 virtual int IsSourcedRasterBand() {
return FALSE; }
340 int bAntiRecursionFlag;
343 void Initialize(
int nXSize,
int nYSize );
352 int nXSize,
int nYSize );
355 int nXSize,
int nYSize );
358 virtual CPLErr IRasterIO(
GDALRWFlag,
int,
int,
int,
int,
363 const char * pszDomain =
"" );
364 virtual char **
GetMetadata(
const char * pszDomain =
"" );
366 const char * pszDomain =
"" );
368 const char * pszValue,
369 const char * pszDomain =
"" );
371 virtual CPLErr XMLInit(
CPLXMLNode *,
const char * );
372 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath );
374 virtual double GetMinimum(
int *pbSuccess = NULL );
375 virtual double GetMaximum(
int *pbSuccess = NULL );
379 int nSrcXOff=-1,
int nSrcYOff=-1,
380 int nSrcXSize=-1,
int nSrcYSize=-1,
381 int nDstXOff=-1,
int nDstYOff=-1,
382 int nDstXSize=-1,
int nDstYSize=-1,
383 const char *pszResampling =
"near",
384 double dfNoDataValue = VRT_NODATA_UNSET);
386 int nSrcXOff=-1,
int nSrcYOff=-1,
387 int nSrcXSize=-1,
int nSrcYSize=-1,
388 int nDstXOff=-1,
int nDstYOff=-1,
389 int nDstXSize=-1,
int nDstYSize=-1,
390 double dfScaleOff=0.0,
391 double dfScaleRatio=1.0,
392 double dfNoDataValue = VRT_NODATA_UNSET,
393 int nColorTableComponent = 0);
396 int nSrcXOff=-1,
int nSrcYOff=-1,
397 int nSrcXSize=-1,
int nSrcYSize=-1,
398 int nDstXOff=-1,
int nDstYOff=-1,
399 int nDstXSize=-1,
int nDstYSize=-1 );
401 CPLErr AddFuncSource( VRTImageReadFunc pfnReadFunc,
void *hCBData,
402 double dfNoDataValue = VRT_NODATA_UNSET );
405 virtual CPLErr IReadBlock(
int,
int,
void * );
407 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
410 virtual int CloseDependentDatasets();
412 virtual int IsSourcedRasterBand() {
return TRUE; }
426 virtual CPLErr XMLInit(
CPLXMLNode *,
const char * );
427 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath );
429 virtual CPLErr IReadBlock(
int,
int,
void * );
430 virtual CPLErr IWriteBlock(
int,
int,
void * );
452 virtual CPLErr IRasterIO(
GDALRWFlag,
int,
int,
int,
int,
456 static CPLErr AddPixelFunction
457 (
const char *pszFuncName, GDALDerivedPixelFunc pfnPixelFunc);
458 static GDALDerivedPixelFunc GetPixelFunction(
const char *pszFuncName);
460 void SetPixelFunctionName(
const char *pszFuncName);
463 virtual CPLErr XMLInit(
CPLXMLNode *,
const char * );
464 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath );
476 RawRasterBand *poRawRaster;
478 char *pszSourceFilename;
486 virtual CPLErr XMLInit(
CPLXMLNode *,
const char * );
487 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath );
489 virtual CPLErr IRasterIO(
GDALRWFlag,
int,
int,
int,
int,
493 virtual CPLErr IReadBlock(
int,
int,
void * );
494 virtual CPLErr IWriteBlock(
int,
int,
void * );
496 CPLErr SetRawLink(
const char *pszFilename,
497 const char *pszVRTPath,
499 vsi_l_offset nImageOffset,
500 int nPixelOffset,
int nLineOffset,
501 const char *pszByteOrder );
505 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
515 void *pDeserializerData;
521 char **papszSourceParsers;
523 virtual char **
GetMetadata(
const char * pszDomain =
"" );
525 const char * pszDomain =
"" );
528 void AddSourceParser(
const char *pszElementName,
529 VRTSourceParser pfnParser );
556 double dfNoDataValue;
562 virtual CPLErr XMLInit(
CPLXMLNode *psTree,
const char * );
563 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath );
567 void SetSrcWindow(
int,
int,
int,
int );
568 void SetDstWindow(
int,
int,
int,
int );
569 void SetNoDataValue(
double dfNoDataValue );
571 int GetSrcDstWindow(
int,
int,
int,
int,
int,
int,
572 int *,
int *,
int *,
int *,
573 int *,
int *,
int *,
int * );
575 virtual CPLErr RasterIO(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
576 void *pData,
int nBufXSize,
int nBufYSize,
578 int nPixelSpace,
int nLineSpace );
580 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess );
581 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess );
583 void DstToSrc(
double dfX,
double dfY,
584 double &dfXOut,
double &dfYOut );
585 void SrcToDst(
double dfX,
double dfY,
586 double &dfXOut,
double &dfYOut );
588 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
591 virtual int IsSimpleSource() {
return TRUE; }
592 virtual const char* GetType() {
return "SimpleSource"; }
596 CPLErr DatasetRasterIO(
597 int nXOff,
int nYOff,
int nXSize,
int nYSize,
598 void * pData,
int nBufXSize,
int nBufYSize,
600 int nBandCount,
int *panBandMap,
601 int nPixelSpace,
int nLineSpace,
int nBandSpace);
612 virtual CPLErr RasterIO(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
613 void *pData,
int nBufXSize,
int nBufYSize,
615 int nPixelSpace,
int nLineSpace );
617 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess );
618 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess );
620 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath );
621 virtual const char* GetType() {
return "AveragedSource"; }
634 virtual CPLErr RasterIO(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
635 void *pData,
int nBufXSize,
int nBufYSize,
637 int nPixelSpace,
int nLineSpace );
639 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess );
640 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess );
642 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath );
643 virtual CPLErr XMLInit(
CPLXMLNode *,
const char * );
644 virtual const char* GetType() {
return "ComplexSource"; }
646 double LookupValue(
double dfInput );
651 double *padfLUTInputs;
652 double *padfLUTOutputs;
654 int nColorTableComponent;
667 int nSupportedTypesCount;
670 int nExtraEdgePixels;
676 void SetExtraEdgePixels(
int );
677 void SetFilteringDataTypesSupported(
int,
GDALDataType * );
679 virtual CPLErr FilterData(
int nXSize,
int nYSize,
GDALDataType eType,
680 GByte *pabySrcData, GByte *pabyDstData ) = 0;
682 virtual CPLErr RasterIO(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
683 void *pData,
int nBufXSize,
int nBufYSize,
685 int nPixelSpace,
int nLineSpace );
697 double *padfKernelCoefs;
705 virtual CPLErr XMLInit(
CPLXMLNode *psTree,
const char * );
706 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath );
708 virtual CPLErr FilterData(
int nXSize,
int nYSize,
GDALDataType eType,
709 GByte *pabySrcData, GByte *pabyDstData );
711 CPLErr SetKernel(
int nKernelSize,
double *padfCoefs );
712 void SetNormalized(
int );
725 virtual CPLErr XMLInit(
CPLXMLNode *psTree,
const char * );
726 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath );
738 virtual CPLErr XMLInit(
CPLXMLNode *,
const char *) {
return CE_Failure; }
739 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath );
741 virtual CPLErr RasterIO(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
742 void *pData,
int nBufXSize,
int nBufYSize,
744 int nPixelSpace,
int nLineSpace );
746 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess );
747 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess );
749 VRTImageReadFunc pfnReadFunc;