31 #ifndef VIRTUALDATASET_H_INCLUDED
32 #define VIRTUALDATASET_H_INCLUDED
36 #include "cpl_hash_set.h"
38 #include "gdal_priv.h"
46 int VRTApplyMetadata( CPLXMLNode *, GDALMajorObject * );
47 CPLXMLNode *VRTSerializeMetadata( GDALMajorObject * );
48 CPLErr GDALRegisterDefaultPixelFunc();
51 int VRTWarpedOverviewTransform(
void *pTransformArg,
int bDstToSrc,
53 double *padfX,
double *padfY,
double *padfZ,
55 void* VRTDeserializeWarpedOverviewTransformer( CPLXMLNode *psTree );
66 GDALRasterBand *poBand;
71 if( poBand ==
nullptr )
73 else if( poBand->GetDataset()->GetShared() )
74 GDALClose( poBand->GetDataset() );
76 poBand->GetDataset()->Dereference();
89 virtual CPLErr RasterIO( GDALDataType eBandDataType,
90 int nXOff,
int nYOff,
int nXSize,
int nYSize,
91 void *pData,
int nBufXSize,
int nBufYSize,
92 GDALDataType eBufType,
93 GSpacing nPixelSpace, GSpacing nLineSpace,
94 GDALRasterIOExtraArg* psExtraArg ) = 0;
96 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess ) = 0;
97 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess ) = 0;
98 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
99 double* adfMinMax ) = 0;
100 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
102 double *pdfMin,
double *pdfMax,
103 double *pdfMean,
double *pdfStdDev,
104 GDALProgressFunc pfnProgress,
105 void *pProgressData ) = 0;
106 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
107 double dfMin,
double dfMax,
108 int nBuckets, GUIntBig * panHistogram,
109 int bIncludeOutOfRange,
int bApproxOK,
110 GDALProgressFunc pfnProgress,
111 void *pProgressData ) = 0;
113 virtual CPLErr XMLInit( CPLXMLNode *psTree,
const char *,
void* ) = 0;
114 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath ) = 0;
116 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
117 int *pnMaxSize, CPLHashSet* hSetFiles);
119 virtual int IsSimpleSource() {
return FALSE; }
120 virtual CPLErr FlushCache() {
return CE_None; }
123 typedef VRTSource *(*VRTSourceParser)(CPLXMLNode *,
const char *,
void* pUniqueHandle);
125 VRTSource *VRTParseCoreSources( CPLXMLNode *psTree,
const char *,
void* pUniqueHandle );
126 VRTSource *VRTParseFilterSources( CPLXMLNode *psTree,
const char *,
void* pUniqueHandle );
138 char *m_pszProjection;
140 int m_bGeoTransformSet;
141 double m_adfGeoTransform[6];
144 GDAL_GCP *m_pasGCPList;
145 char *m_pszGCPProjection;
154 int m_bCompatibleForDatasetIO;
155 int CheckCompatibleForDatasetIO();
156 std::vector<GDALDataset*> m_apoOverviews;
157 std::vector<GDALDataset*> m_apoOverviewsBak;
158 char **m_papszXMLVRTMetadata;
161 bool bAllowPansharpened);
164 virtual int CloseDependentDatasets()
override;
170 void SetNeedsFlush() { m_bNeedsFlush = TRUE; }
171 virtual void FlushCache()
override;
173 void SetWritable(
int bWritableIn) { m_bWritable = bWritableIn; }
175 virtual CPLErr CreateMaskBand(
int nFlags )
override;
178 virtual const char *GetProjectionRef()
override;
179 virtual CPLErr SetProjection(
const char * )
override;
180 virtual CPLErr GetGeoTransform(
double * )
override;
181 virtual CPLErr SetGeoTransform(
double * )
override;
183 virtual CPLErr SetMetadata(
char **papszMetadata,
184 const char *pszDomain =
"" )
override;
185 virtual CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
186 const char *pszDomain =
"" )
override;
188 virtual char** GetMetadata(
const char *pszDomain =
"" )
override;
190 virtual int GetGCPCount()
override;
191 virtual const char *GetGCPProjection()
override;
192 virtual const GDAL_GCP *GetGCPs()
override;
193 virtual CPLErr SetGCPs(
int nGCPCount,
const GDAL_GCP *pasGCPList,
194 const char *pszGCPProjection )
override;
196 virtual CPLErr AddBand( GDALDataType eType,
197 char **papszOptions=
nullptr )
override;
199 virtual char **GetFileList()
override;
201 virtual CPLErr IRasterIO( GDALRWFlag eRWFlag,
202 int nXOff,
int nYOff,
int nXSize,
int nYSize,
203 void * pData,
int nBufXSize,
int nBufYSize,
204 GDALDataType eBufType,
205 int nBandCount,
int *panBandMap,
206 GSpacing nPixelSpace, GSpacing nLineSpace,
208 GDALRasterIOExtraArg* psExtraArg)
override;
210 virtual CPLErr AdviseRead(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
211 int nBufXSize,
int nBufYSize,
213 int nBandCount,
int *panBandList,
214 char **papszOptions )
override;
216 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath);
217 virtual CPLErr XMLInit( CPLXMLNode *,
const char * );
219 virtual CPLErr IBuildOverviews(
const char *,
int,
int *,
220 int,
int *, GDALProgressFunc,
void * )
override;
223 GDALDataset* GetSingleSimpleSource();
224 void BuildVirtualOverviews();
226 void UnsetPreservedRelativeFilenames();
228 static int Identify( GDALOpenInfo * );
229 static GDALDataset *Open( GDALOpenInfo * );
230 static GDALDataset *OpenXML(
const char *,
const char * =
nullptr,
231 GDALAccess eAccess = GA_ReadOnly );
232 static GDALDataset *Create(
const char * pszName,
233 int nXSize,
int nYSize,
int nBands,
234 GDALDataType eType,
char ** papszOptions );
235 static CPLErr Delete(
const char * pszFilename );
242 class GDALWarpOperation;
249 GDALWarpOperation *m_poWarper;
251 int m_nOverviewCount;
255 void CreateImplicitOverviews();
257 struct VerticalShiftGrid
262 double dfToMeterDest;
263 CPLStringList aosOptions;
265 std::vector<VerticalShiftGrid> m_aoVerticalShiftGrids;
270 virtual int CloseDependentDatasets()
override;
276 CPLErr Initialize(
void * );
278 virtual CPLErr IBuildOverviews(
const char *,
int,
int *,
279 int,
int *, GDALProgressFunc,
void * )
override;
281 virtual CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
282 const char *pszDomain =
"" )
override;
284 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
285 virtual CPLErr XMLInit( CPLXMLNode *,
const char * )
override;
287 virtual CPLErr AddBand( GDALDataType eType,
288 char **papszOptions=
nullptr )
override;
290 virtual char **GetFileList()
override;
292 CPLErr ProcessBlock(
int iBlockX,
int iBlockY );
294 void GetBlockSize(
int *,
int * )
const;
296 void SetApplyVerticalShiftGrid(
const char* pszVGrids,
299 double dfToMeterDest,
300 char** papszOptions );
307 class GDALPansharpenOperation;
312 GTAdjust_Intersection,
314 GTAdjust_NoneWithoutWarning
323 GDALPansharpenOperation* m_poPansharpener;
325 std::vector<VRTPansharpenedDataset*> m_apoOverviewDatasets;
327 std::map<CPLString,CPLString> m_oMapToRelativeFilenames;
329 int m_bLoadingOtherBands;
331 GByte *m_pabyLastBufferBandRasterIO;
332 int m_nLastBandRasterIOXOff;
333 int m_nLastBandRasterIOYOff;
334 int m_nLastBandRasterIOXSize;
335 int m_nLastBandRasterIOYSize;
336 GDALDataType m_eLastBandRasterIODataType;
338 GTAdjustment m_eGTAdjustment;
339 int m_bNoDataDisabled;
341 std::vector<GDALDataset*> m_apoDatasetsToClose;
344 virtual int CloseDependentDatasets()
override;
350 virtual CPLErr XMLInit( CPLXMLNode *,
const char * )
override;
351 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
353 CPLErr XMLInit( CPLXMLNode *psTree,
const char *pszVRTPath,
354 GDALRasterBandH hPanchroBandIn,
355 int nInputSpectralBandsIn,
356 GDALRasterBandH* pahInputSpectralBandsIn );
358 virtual CPLErr AddBand( GDALDataType eType,
359 char **papszOptions=
nullptr )
override;
361 virtual char **GetFileList()
override;
363 virtual CPLErr IRasterIO( GDALRWFlag eRWFlag,
364 int nXOff,
int nYOff,
int nXSize,
int nYSize,
365 void * pData,
int nBufXSize,
int nBufYSize,
366 GDALDataType eBufType,
367 int nBandCount,
int *panBandMap,
368 GSpacing nPixelSpace, GSpacing nLineSpace,
370 GDALRasterIOExtraArg* psExtraArg)
override;
372 void GetBlockSize(
int *,
int * )
const;
374 GDALPansharpenOperation* GetPansharpener() {
return m_poPansharpener; }
389 int m_bNoDataValueSet;
391 int m_bHideNoDataValue;
392 double m_dfNoDataValue;
394 std::unique_ptr<GDALColorTable> m_poColorTable;
396 GDALColorInterp m_eColorInterp;
399 char **m_papszCategoryNames;
404 CPLXMLNode *m_psSavedHistograms;
406 void Initialize(
int nXSize,
int nYSize );
408 std::vector<VRTOverviewInfo> m_apoOverviews;
412 std::unique_ptr<GDALRasterAttributeTable> m_poRAT;
419 virtual CPLErr XMLInit( CPLXMLNode *,
const char *,
void* );
420 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath );
422 virtual CPLErr SetNoDataValue(
double )
override;
423 virtual double GetNoDataValue(
int *pbSuccess =
nullptr )
override;
424 virtual CPLErr DeleteNoDataValue()
override;
426 virtual CPLErr SetColorTable( GDALColorTable * )
override;
427 virtual GDALColorTable *GetColorTable()
override;
429 virtual GDALRasterAttributeTable *GetDefaultRAT()
override;
430 virtual CPLErr SetDefaultRAT(
const GDALRasterAttributeTable * poRAT )
override;
432 virtual CPLErr SetColorInterpretation( GDALColorInterp )
override;
433 virtual GDALColorInterp GetColorInterpretation()
override;
435 virtual const char *GetUnitType()
override;
436 CPLErr SetUnitType(
const char * )
override;
438 virtual char **GetCategoryNames()
override;
439 virtual CPLErr SetCategoryNames(
char ** )
override;
441 virtual CPLErr SetMetadata(
char **papszMD,
const char *pszDomain =
"" )
override;
442 virtual CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
443 const char *pszDomain =
"" )
override;
445 virtual double GetOffset(
int *pbSuccess =
nullptr )
override;
446 CPLErr SetOffset(
double )
override;
447 virtual double GetScale(
int *pbSuccess =
nullptr )
override;
448 CPLErr SetScale(
double )
override;
450 virtual int GetOverviewCount()
override;
451 virtual GDALRasterBand *GetOverview(
int)
override;
453 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
454 int nBuckets, GUIntBig * panHistogram,
455 int bIncludeOutOfRange,
int bApproxOK,
456 GDALProgressFunc,
void *pProgressData )
override;
458 virtual CPLErr GetDefaultHistogram(
double *pdfMin,
double *pdfMax,
459 int *pnBuckets, GUIntBig ** ppanHistogram,
461 GDALProgressFunc,
void *pProgressData)
override;
463 virtual CPLErr SetDefaultHistogram(
double dfMin,
double dfMax,
464 int nBuckets, GUIntBig *panHistogram )
override;
466 CPLErr CopyCommonInfoFrom( GDALRasterBand * );
468 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
469 int *pnMaxSize, CPLHashSet* hSetFiles);
471 virtual void SetDescription(
const char * )
override;
473 virtual GDALRasterBand *GetMaskBand()
override;
474 virtual int GetMaskFlags()
override;
476 virtual CPLErr CreateMaskBand(
int nFlagsIn )
override;
480 void SetIsMaskBand();
482 CPLErr UnsetNoDataValue();
484 virtual int CloseDependentDatasets();
486 virtual int IsSourcedRasterBand() {
return FALSE; }
487 virtual int IsPansharpenRasterBand() {
return FALSE; }
499 int m_nRecursionCounter;
500 CPLString m_osLastLocationInfo;
501 char **m_papszSourceList;
503 bool CanUseSourcesMinMaxImplementations();
509 int bSkipBufferInitialization;
513 int nXSize,
int nYSize );
516 int nXSize,
int nYSize );
519 virtual CPLErr IRasterIO( GDALRWFlag,
int,
int,
int,
int,
520 void *,
int,
int, GDALDataType,
521 GSpacing nPixelSpace, GSpacing nLineSpace,
522 GDALRasterIOExtraArg* psExtraArg)
override;
524 virtual int IGetDataCoverageStatus(
int nXOff,
int nYOff,
525 int nXSize,
int nYSize,
527 double* pdfDataPct)
override;
529 virtual char **GetMetadataDomainList()
override;
530 virtual const char *GetMetadataItem(
const char * pszName,
531 const char * pszDomain =
"" )
override;
532 virtual char **GetMetadata(
const char * pszDomain =
"" )
override;
533 virtual CPLErr SetMetadata(
char ** papszMetadata,
534 const char * pszDomain =
"" )
override;
535 virtual CPLErr SetMetadataItem(
const char * pszName,
536 const char * pszValue,
537 const char * pszDomain =
"" )
override;
539 virtual CPLErr XMLInit( CPLXMLNode *,
const char *,
void* )
override;
540 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
542 virtual double GetMinimum(
int *pbSuccess =
nullptr )
override;
543 virtual double GetMaximum(
int *pbSuccess =
nullptr )
override;
544 virtual CPLErr ComputeRasterMinMax(
int bApproxOK,
double* adfMinMax )
override;
545 virtual CPLErr ComputeStatistics(
int bApproxOK,
546 double *pdfMin,
double *pdfMax,
547 double *pdfMean,
double *pdfStdDev,
548 GDALProgressFunc pfnProgress,
549 void *pProgressData )
override;
550 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
551 int nBuckets, GUIntBig * panHistogram,
552 int bIncludeOutOfRange,
int bApproxOK,
553 GDALProgressFunc pfnProgress,
554 void *pProgressData )
override;
557 CPLErr AddSimpleSource( GDALRasterBand *poSrcBand,
558 double dfSrcXOff=-1,
double dfSrcYOff=-1,
559 double dfSrcXSize=-1,
double dfSrcYSize=-1,
560 double dfDstXOff=-1,
double dfDstYOff=-1,
561 double dfDstXSize=-1,
double dfDstYSize=-1,
562 const char *pszResampling =
"near",
564 CPLErr AddComplexSource( GDALRasterBand *poSrcBand,
565 double dfSrcXOff=-1,
double dfSrcYOff=-1,
566 double dfSrcXSize=-1,
double dfSrcYSize=-1,
567 double dfDstXOff=-1,
double dfDstYOff=-1,
568 double dfDstXSize=-1,
double dfDstYSize=-1,
569 double dfScaleOff=0.0,
570 double dfScaleRatio=1.0,
572 int nColorTableComponent = 0);
574 CPLErr AddMaskBandSource( GDALRasterBand *poSrcBand,
575 double dfSrcXOff=-1,
double dfSrcYOff=-1,
576 double dfSrcXSize=-1,
577 double dfSrcYSize=-1,
578 double dfDstXOff=-1,
double dfDstYOff=-1,
579 double dfDstXSize=-1,
580 double dfDstYSize=-1 );
586 GDALRasterBand *poSrcBand,
588 double dfSrcXOff,
double dfSrcYOff,
589 double dfSrcXSize,
double dfSrcYSize,
590 double dfDstXOff,
double dfDstYOff,
591 double dfDstXSize,
double dfDstYSize );
593 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
595 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
596 int *pnMaxSize, CPLHashSet* hSetFiles)
override;
598 virtual int CloseDependentDatasets()
override;
600 virtual int IsSourcedRasterBand()
override {
return TRUE; }
602 virtual CPLErr FlushCache()
override;
613 GDALDataType eType = GDT_Unknown );
616 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
618 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
619 virtual CPLErr IWriteBlock(
int,
int,
void * )
override;
621 virtual int GetOverviewCount()
override;
622 virtual GDALRasterBand *GetOverview(
int)
override;
630 int m_nIndexAsPansharpenedBand;
634 GDALDataset *poDS,
int nBand,
635 GDALDataType eDataType = GDT_Unknown );
638 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
640 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
642 virtual CPLErr IRasterIO( GDALRWFlag eRWFlag,
643 int nXOff,
int nYOff,
int nXSize,
int nYSize,
644 void * pData,
int nBufXSize,
int nBufYSize,
645 GDALDataType eBufType,
646 GSpacing nPixelSpace, GSpacing nLineSpace,
647 GDALRasterIOExtraArg* psExtraArg)
override;
649 virtual int GetOverviewCount()
override;
650 virtual GDALRasterBand *GetOverview(
int)
override;
652 virtual int IsPansharpenRasterBand()
override {
return TRUE; }
654 void SetIndexAsPansharpenedBand(
int nIdx )
655 { m_nIndexAsPansharpenedBand = nIdx; }
656 int GetIndexAsPansharpenedBand()
const
657 {
return m_nIndexAsPansharpenedBand; }
664 class VRTDerivedRasterBandPrivateData;
668 VRTDerivedRasterBandPrivateData* m_poPrivate;
669 bool InitializePython();
673 GDALDataType eSourceTransferType;
677 GDALDataType eType,
int nXSize,
int nYSize );
680 virtual CPLErr IRasterIO( GDALRWFlag,
int,
int,
int,
int,
681 void *,
int,
int, GDALDataType,
682 GSpacing nPixelSpace, GSpacing nLineSpace,
683 GDALRasterIOExtraArg* psExtraArg )
override;
685 virtual int IGetDataCoverageStatus(
int nXOff,
int nYOff,
686 int nXSize,
int nYSize,
688 double* pdfDataPct)
override;
690 static CPLErr AddPixelFunction(
const char *pszFuncName,
691 GDALDerivedPixelFunc pfnPixelFunc );
692 static GDALDerivedPixelFunc GetPixelFunction(
const char *pszFuncName );
694 void SetPixelFunctionName(
const char *pszFuncName );
695 void SetSourceTransferType( GDALDataType eDataType );
696 void SetPixelFunctionLanguage(
const char* pszLanguage );
698 virtual CPLErr XMLInit( CPLXMLNode *,
const char *,
void* )
override;
699 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
701 virtual double GetMinimum(
int *pbSuccess =
nullptr )
override;
702 virtual double GetMaximum(
int *pbSuccess =
nullptr )
override;
703 virtual CPLErr ComputeRasterMinMax(
int bApproxOK,
double* adfMinMax )
override;
704 virtual CPLErr ComputeStatistics(
int bApproxOK,
705 double *pdfMin,
double *pdfMax,
706 double *pdfMean,
double *pdfStdDev,
707 GDALProgressFunc pfnProgress,
708 void *pProgressData )
override;
709 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
710 int nBuckets, GUIntBig * panHistogram,
711 int bIncludeOutOfRange,
int bApproxOK,
712 GDALProgressFunc pfnProgress,
713 void *pProgressData )
override;
715 static void Cleanup();
726 RawRasterBand *m_poRawRaster;
728 char *m_pszSourceFilename;
729 int m_bRelativeToVRT;
733 GDALDataType eType = GDT_Unknown );
736 virtual CPLErr XMLInit( CPLXMLNode *,
const char *,
void* )
override;
737 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
739 virtual CPLErr IRasterIO( GDALRWFlag,
int,
int,
int,
int,
740 void *,
int,
int, GDALDataType,
741 GSpacing nPixelSpace, GSpacing nLineSpace,
742 GDALRasterIOExtraArg* psExtraArg )
override;
744 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
745 virtual CPLErr IWriteBlock(
int,
int,
void * )
override;
747 CPLErr SetRawLink(
const char *pszFilename,
748 const char *pszVRTPath,
750 vsi_l_offset nImageOffset,
751 int nPixelOffset,
int nLineOffset,
752 const char *pszByteOrder );
756 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
757 int *pnMaxSize, CPLHashSet* hSetFiles )
override;
770 char **papszSourceParsers;
772 virtual char **GetMetadataDomainList()
override;
773 virtual char **GetMetadata(
const char * pszDomain =
"" )
override;
774 virtual CPLErr SetMetadata(
char ** papszMetadata,
775 const char * pszDomain =
"" )
override;
777 VRTSource *ParseSource( CPLXMLNode *psSrc,
const char *pszVRTPath,
778 void* pUniqueHandle );
779 void AddSourceParser(
const char *pszElementName,
780 VRTSourceParser pfnParser );
792 GDALRasterBand *m_poRasterBand;
796 GDALRasterBand *m_poMaskBandMainBand;
809 double m_dfNoDataValue;
810 CPLString m_osResampling;
814 int m_bRelativeToVRTOri;
815 CPLString m_osSourceFileNameOri;
816 int m_nExplicitSharedStatus;
818 int NeedMaxValAdjustment()
const;
823 double dfXDstRatio,
double dfYDstRatio );
826 virtual CPLErr XMLInit( CPLXMLNode *psTree,
const char *,
void* )
override;
827 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
829 void SetSrcBand( GDALRasterBand * );
830 void SetSrcMaskBand( GDALRasterBand * );
831 void SetSrcWindow(
double,
double,
double,
double );
832 void SetDstWindow(
double,
double,
double,
double );
833 void SetNoDataValue(
double dfNoDataValue );
834 const CPLString& GetResampling()
const {
return m_osResampling; }
835 void SetResampling(
const char* pszResampling );
837 int GetSrcDstWindow(
int,
int,
int,
int,
int,
int,
838 double *pdfReqXOff,
double *pdfReqYOff,
839 double *pdfReqXSize,
double *pdfReqYSize,
840 int *,
int *,
int *,
int *,
841 int *,
int *,
int *,
int * );
843 virtual CPLErr RasterIO( GDALDataType eBandDataType,
844 int nXOff,
int nYOff,
int nXSize,
int nYSize,
845 void *pData,
int nBufXSize,
int nBufYSize,
846 GDALDataType eBufType,
847 GSpacing nPixelSpace, GSpacing nLineSpace,
848 GDALRasterIOExtraArg* psExtraArgIn )
override;
850 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
851 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
852 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
853 double* adfMinMax )
override;
854 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
856 double *pdfMin,
double *pdfMax,
857 double *pdfMean,
double *pdfStdDev,
858 GDALProgressFunc pfnProgress,
859 void *pProgressData )
override;
860 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
861 double dfMin,
double dfMax,
862 int nBuckets, GUIntBig * panHistogram,
863 int bIncludeOutOfRange,
int bApproxOK,
864 GDALProgressFunc pfnProgress,
865 void *pProgressData )
override;
867 void DstToSrc(
double dfX,
double dfY,
868 double &dfXOut,
double &dfYOut )
const;
869 void SrcToDst(
double dfX,
double dfY,
870 double &dfXOut,
double &dfYOut )
const;
872 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
873 int *pnMaxSize, CPLHashSet* hSetFiles )
override;
875 virtual int IsSimpleSource()
override {
return TRUE; }
876 virtual const char* GetType() {
return "SimpleSource"; }
877 virtual CPLErr FlushCache()
override;
879 GDALRasterBand* GetBand();
881 CPLErr DatasetRasterIO(
882 GDALDataType eBandDataType,
883 int nXOff,
int nYOff,
int nXSize,
int nYSize,
884 void * pData,
int nBufXSize,
int nBufYSize,
885 GDALDataType eBufType,
886 int nBandCount,
int *panBandMap,
887 GSpacing nPixelSpace, GSpacing nLineSpace,
889 GDALRasterIOExtraArg* psExtraArg );
891 void UnsetPreservedRelativeFilenames();
893 void SetMaxValue(
int nVal ) { m_nMaxValue = nVal; }
904 virtual CPLErr RasterIO( GDALDataType eBandDataType,
905 int nXOff,
int nYOff,
int nXSize,
int nYSize,
906 void *pData,
int nBufXSize,
int nBufYSize,
907 GDALDataType eBufType,
908 GSpacing nPixelSpace, GSpacing nLineSpace,
909 GDALRasterIOExtraArg* psExtraArgIn )
override;
911 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
912 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
913 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
914 double* adfMinMax )
override;
915 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
917 double *pdfMin,
double *pdfMax,
918 double *pdfMean,
double *pdfStdDev,
919 GDALProgressFunc pfnProgress,
920 void *pProgressData )
override;
921 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
922 double dfMin,
double dfMax,
923 int nBuckets, GUIntBig * panHistogram,
924 int bIncludeOutOfRange,
int bApproxOK,
925 GDALProgressFunc pfnProgress,
926 void *pProgressData )
override;
928 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
929 virtual const char* GetType()
override {
return "AveragedSource"; }
940 VRT_SCALING_EXPONENTIAL,
941 } VRTComplexSourceScaling;
945 bool AreValuesUnchanged()
const;
948 VRTComplexSourceScaling m_eScalingType;
950 double m_dfScaleRatio;
953 int m_bSrcMinMaxDefined;
960 int m_nColorTableComponent;
962 template <
class WorkingDT>
963 CPLErr RasterIOInternal(
int nReqXOff,
int nReqYOff,
964 int nReqXSize,
int nReqYSize,
965 void *pData,
int nOutXSize,
int nOutYSize,
966 GDALDataType eBufType,
967 GSpacing nPixelSpace, GSpacing nLineSpace,
968 GDALRasterIOExtraArg* psExtraArg,
969 GDALDataType eWrkDataType );
974 double dfXDstRatio,
double dfYDstRatio);
977 virtual CPLErr RasterIO( GDALDataType eBandDataType,
978 int nXOff,
int nYOff,
int nXSize,
int nYSize,
979 void *pData,
int nBufXSize,
int nBufYSize,
980 GDALDataType eBufType,
981 GSpacing nPixelSpace, GSpacing nLineSpace,
982 GDALRasterIOExtraArg* psExtraArgIn )
override;
984 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
985 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
986 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
987 double* adfMinMax )
override;
988 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
990 double *pdfMin,
double *pdfMax,
991 double *pdfMean,
double *pdfStdDev,
992 GDALProgressFunc pfnProgress,
993 void *pProgressData )
override;
994 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
995 double dfMin,
double dfMax,
996 int nBuckets, GUIntBig * panHistogram,
997 int bIncludeOutOfRange,
int bApproxOK,
998 GDALProgressFunc pfnProgress,
999 void *pProgressData )
override;
1001 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1002 virtual CPLErr XMLInit( CPLXMLNode *,
const char *,
void* )
override;
1003 virtual const char* GetType()
override {
return "ComplexSource"; }
1005 double LookupValue(
double dfInput );
1007 void SetLinearScaling(
double dfOffset,
double dfScale );
1008 void SetPowerScaling(
double dfExponent,
1013 void SetColorTableComponent(
int nComponent );
1015 double *m_padfLUTInputs;
1016 double *m_padfLUTOutputs;
1017 int m_nLUTItemCount;
1027 int IsTypeSupported( GDALDataType eTestType )
const;
1030 int m_nSupportedTypesCount;
1031 GDALDataType m_aeSupportedTypes[20];
1033 int m_nExtraEdgePixels;
1039 void SetExtraEdgePixels(
int );
1040 void SetFilteringDataTypesSupported(
int, GDALDataType * );
1042 virtual CPLErr FilterData(
int nXSize,
int nYSize, GDALDataType eType,
1043 GByte *pabySrcData, GByte *pabyDstData ) = 0;
1045 virtual CPLErr RasterIO( GDALDataType eBandDataType,
1046 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1047 void *pData,
int nBufXSize,
int nBufYSize,
1048 GDALDataType eBufType,
1049 GSpacing nPixelSpace, GSpacing nLineSpace,
1050 GDALRasterIOExtraArg* psExtraArg )
override;
1064 double *m_padfKernelCoefs;
1072 virtual CPLErr XMLInit( CPLXMLNode *psTree,
const char *,
void* )
override;
1073 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1075 virtual CPLErr FilterData(
int nXSize,
int nYSize, GDALDataType eType,
1076 GByte *pabySrcData, GByte *pabyDstData )
override;
1078 CPLErr SetKernel(
int nKernelSize,
bool bSeparable,
double *padfCoefs );
1079 void SetNormalized(
int );
1092 virtual CPLErr XMLInit( CPLXMLNode *psTree,
const char *,
void* )
override;
1093 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1105 virtual CPLErr XMLInit( CPLXMLNode *,
const char *,
void* )
override {
return CE_Failure; }
1106 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1108 virtual CPLErr RasterIO( GDALDataType eBandDataType,
1109 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1110 void *pData,
int nBufXSize,
int nBufYSize,
1111 GDALDataType eBufType,
1112 GSpacing nPixelSpace, GSpacing nLineSpace,
1113 GDALRasterIOExtraArg* psExtraArg )
override;
1115 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1116 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1117 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
1118 double* adfMinMax )
override;
1119 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
1121 double *pdfMin,
double *pdfMax,
1122 double *pdfMean,
double *pdfStdDev,
1123 GDALProgressFunc pfnProgress,
1124 void *pProgressData )
override;
1125 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1126 double dfMin,
double dfMax,
1127 int nBuckets, GUIntBig * panHistogram,
1128 int bIncludeOutOfRange,
int bApproxOK,
1129 GDALProgressFunc pfnProgress,
1130 void *pProgressData )
override;