31 #ifndef VIRTUALDATASET_H_INCLUDED 32 #define VIRTUALDATASET_H_INCLUDED 49 CPLErr GDALRegisterDefaultPixelFunc();
52 int VRTWarpedOverviewTransform(
void *pTransformArg,
int bDstToSrc,
54 double *padfX,
double *padfY,
double *padfZ,
56 void* VRTDeserializeWarpedOverviewTransformer(
CPLXMLNode *psTree );
70 int bTriedToOpen = FALSE;
72 VRTOverviewInfo() =
default;
73 VRTOverviewInfo(VRTOverviewInfo&& oOther) noexcept:
74 osFilename(std::move(oOther.osFilename)),
76 poBand(oOther.poBand),
77 bTriedToOpen(oOther.bTriedToOpen)
79 oOther.poBand =
nullptr;
83 if( poBand ==
nullptr )
96 class CPL_DLL VRTSource
102 int nXOff,
int nYOff,
int nXSize,
int nYSize,
103 void *pData,
int nBufXSize,
int nBufYSize,
108 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess ) = 0;
109 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess ) = 0;
110 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
111 double* adfMinMax ) = 0;
112 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
114 double *pdfMin,
double *pdfMax,
115 double *pdfMean,
double *pdfStdDev,
116 GDALProgressFunc pfnProgress,
117 void *pProgressData ) = 0;
118 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
119 double dfMin,
double dfMax,
120 int nBuckets,
GUIntBig * panHistogram,
121 int bIncludeOutOfRange,
int bApproxOK,
122 GDALProgressFunc pfnProgress,
123 void *pProgressData ) = 0;
126 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath ) = 0;
128 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
131 virtual int IsSimpleSource() {
return FALSE; }
132 virtual CPLErr FlushCache() {
return CE_None; }
135 typedef VRTSource *(*VRTSourceParser)(
CPLXMLNode *,
const char *,
void* pUniqueHandle);
137 VRTSource *VRTParseCoreSources( CPLXMLNode *psTree,
const char *,
void* pUniqueHandle );
138 VRTSource *VRTParseFilterSources( CPLXMLNode *psTree,
const char *,
void* pUniqueHandle );
146 template<
class T>
struct VRTFlushCacheStruct
148 static void FlushCache(T& obj);
151 class VRTWarpedDataset;
152 class VRTPansharpenedDataset;
156 friend class VRTRasterBand;
157 friend struct VRTFlushCacheStruct<VRTDataset>;
158 friend struct VRTFlushCacheStruct<VRTWarpedDataset>;
159 friend struct VRTFlushCacheStruct<VRTPansharpenedDataset>;
161 char *m_pszProjection;
163 int m_bGeoTransformSet;
164 double m_adfGeoTransform[6];
168 char *m_pszGCPProjection;
175 VRTRasterBand *m_poMaskBand;
177 int m_bCompatibleForDatasetIO;
178 int CheckCompatibleForDatasetIO();
179 void ExpandProxyBands();
181 std::vector<GDALDataset*> m_apoOverviews;
182 std::vector<GDALDataset*> m_apoOverviewsBak;
183 char **m_papszXMLVRTMetadata;
185 VRTRasterBand* InitBand(
const char* pszSubclass,
int nBand,
186 bool bAllowPansharpened);
191 virtual int CloseDependentDatasets()
override;
194 VRTDataset(
int nXSize,
int nYSize);
195 virtual ~VRTDataset();
197 void SetNeedsFlush() { m_bNeedsFlush = TRUE; }
198 virtual void FlushCache()
override;
200 void SetWritable(
int bWritableIn) { m_bWritable = bWritableIn; }
202 virtual CPLErr CreateMaskBand(
int nFlags )
override;
203 void SetMaskBand(VRTRasterBand* poMaskBand);
205 virtual const char *GetProjectionRef()
override;
206 virtual CPLErr SetProjection(
const char * )
override;
207 virtual CPLErr GetGeoTransform(
double * )
override;
208 virtual CPLErr SetGeoTransform(
double * )
override;
210 virtual CPLErr SetMetadata(
char **papszMetadata,
211 const char *pszDomain =
"" )
override;
212 virtual CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
213 const char *pszDomain =
"" )
override;
215 virtual char** GetMetadata(
const char *pszDomain =
"" )
override;
217 virtual int GetGCPCount()
override;
218 virtual const char *GetGCPProjection()
override;
219 virtual const GDAL_GCP *GetGCPs()
override;
220 virtual CPLErr SetGCPs(
int nGCPCount,
const GDAL_GCP *pasGCPList,
221 const char *pszGCPProjection )
override;
224 char **papszOptions=
nullptr )
override;
226 virtual char **GetFileList()
override;
229 int nXOff,
int nYOff,
int nXSize,
int nYSize,
230 void * pData,
int nBufXSize,
int nBufYSize,
232 int nBandCount,
int *panBandMap,
237 virtual CPLErr AdviseRead(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
238 int nBufXSize,
int nBufYSize,
240 int nBandCount,
int *panBandList,
241 char **papszOptions )
override;
243 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath);
244 virtual CPLErr XMLInit( CPLXMLNode *,
const char * );
246 virtual CPLErr IBuildOverviews(
const char *,
int,
int *,
247 int,
int *, GDALProgressFunc,
void * )
override;
251 void BuildVirtualOverviews();
253 void UnsetPreservedRelativeFilenames();
257 static GDALDataset *OpenXML(
const char *,
const char * =
nullptr,
260 int nXSize,
int nYSize,
int nBands,
262 static CPLErr Delete(
const char * pszFilename );
270 class VRTWarpedRasterBand;
272 class CPL_DLL VRTWarpedDataset :
public VRTDataset
278 int m_nOverviewCount;
279 VRTWarpedDataset **m_papoOverviews;
282 void CreateImplicitOverviews();
284 struct VerticalShiftGrid
289 double dfToMeterDest;
292 std::vector<VerticalShiftGrid> m_aoVerticalShiftGrids;
294 friend class VRTWarpedRasterBand;
299 virtual int CloseDependentDatasets()
override;
302 VRTWarpedDataset(
int nXSize,
int nYSize );
303 virtual ~VRTWarpedDataset();
305 virtual void FlushCache()
override;
307 CPLErr Initialize(
void * );
309 virtual CPLErr IBuildOverviews(
const char *,
int,
int *,
310 int,
int *, GDALProgressFunc,
void * )
override;
312 virtual CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
313 const char *pszDomain =
"" )
override;
315 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
316 virtual CPLErr XMLInit( CPLXMLNode *,
const char * )
override;
319 char **papszOptions=
nullptr )
override;
321 virtual char **GetFileList()
override;
323 CPLErr ProcessBlock(
int iBlockX,
int iBlockY );
325 void GetBlockSize(
int *,
int * )
const;
327 void SetApplyVerticalShiftGrid(
const char* pszVGrids,
330 double dfToMeterDest,
331 char** papszOptions );
343 GTAdjust_Intersection,
345 GTAdjust_NoneWithoutWarning
348 class VRTPansharpenedDataset :
public VRTDataset
350 friend class VRTPansharpenedRasterBand;
355 VRTPansharpenedDataset* m_poMainDataset;
356 std::vector<VRTPansharpenedDataset*> m_apoOverviewDatasets;
358 std::map<CPLString,CPLString> m_oMapToRelativeFilenames;
360 int m_bLoadingOtherBands;
362 GByte *m_pabyLastBufferBandRasterIO;
363 int m_nLastBandRasterIOXOff;
364 int m_nLastBandRasterIOYOff;
365 int m_nLastBandRasterIOXSize;
366 int m_nLastBandRasterIOYSize;
369 GTAdjustment m_eGTAdjustment;
370 int m_bNoDataDisabled;
372 std::vector<GDALDataset*> m_apoDatasetsToClose;
377 virtual int CloseDependentDatasets()
override;
380 VRTPansharpenedDataset(
int nXSize,
int nYSize );
381 virtual ~VRTPansharpenedDataset();
383 virtual void FlushCache()
override;
385 virtual CPLErr XMLInit( CPLXMLNode *,
const char * )
override;
386 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
388 CPLErr XMLInit( CPLXMLNode *psTree,
const char *pszVRTPath,
390 int nInputSpectralBandsIn,
394 char **papszOptions=
nullptr )
override;
396 virtual char **GetFileList()
override;
399 int nXOff,
int nYOff,
int nXSize,
int nYSize,
400 void * pData,
int nBufXSize,
int nBufYSize,
402 int nBandCount,
int *panBandMap,
407 void GetBlockSize(
int *,
int * )
const;
424 int m_bNoDataValueSet;
426 int m_bHideNoDataValue;
427 double m_dfNoDataValue;
429 std::unique_ptr<GDALColorTable> m_poColorTable;
434 char **m_papszCategoryNames;
439 CPLXMLNode *m_psSavedHistograms;
441 void Initialize(
int nXSize,
int nYSize );
443 std::vector<VRTOverviewInfo> m_apoOverviews;
445 VRTRasterBand *m_poMaskBand;
447 std::unique_ptr<GDALRasterAttributeTable> m_poRAT;
454 virtual ~VRTRasterBand();
456 virtual CPLErr XMLInit( CPLXMLNode *,
const char *,
void* );
457 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath );
459 virtual CPLErr SetNoDataValue(
double )
override;
460 virtual double GetNoDataValue(
int *pbSuccess =
nullptr )
override;
461 virtual CPLErr DeleteNoDataValue()
override;
472 virtual const char *GetUnitType()
override;
473 CPLErr SetUnitType(
const char * )
override;
475 virtual char **GetCategoryNames()
override;
476 virtual CPLErr SetCategoryNames(
char ** )
override;
478 virtual CPLErr SetMetadata(
char **papszMD,
const char *pszDomain =
"" )
override;
479 virtual CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
480 const char *pszDomain =
"" )
override;
482 virtual double GetOffset(
int *pbSuccess =
nullptr )
override;
483 CPLErr SetOffset(
double )
override;
484 virtual double GetScale(
int *pbSuccess =
nullptr )
override;
485 CPLErr SetScale(
double )
override;
487 virtual int GetOverviewCount()
override;
490 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
491 int nBuckets,
GUIntBig * panHistogram,
492 int bIncludeOutOfRange,
int bApproxOK,
493 GDALProgressFunc,
void *pProgressData )
override;
495 virtual CPLErr GetDefaultHistogram(
double *pdfMin,
double *pdfMax,
496 int *pnBuckets,
GUIntBig ** ppanHistogram,
498 GDALProgressFunc,
void *pProgressData)
override;
500 virtual CPLErr SetDefaultHistogram(
double dfMin,
double dfMax,
501 int nBuckets,
GUIntBig *panHistogram )
override;
505 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
508 virtual void SetDescription(
const char * )
override;
511 virtual int GetMaskFlags()
override;
513 virtual CPLErr CreateMaskBand(
int nFlagsIn )
override;
515 void SetMaskBand(VRTRasterBand* poMaskBand);
517 void SetIsMaskBand();
519 CPLErr UnsetNoDataValue();
521 virtual int CloseDependentDatasets();
523 virtual int IsSourcedRasterBand() {
return FALSE; }
524 virtual int IsPansharpenRasterBand() {
return FALSE; }
531 class VRTSimpleSource;
533 class CPL_DLL VRTSourcedRasterBand :
public VRTRasterBand
536 int m_nRecursionCounter;
538 char **m_papszSourceList;
540 bool CanUseSourcesMinMaxImplementations();
541 void CheckSource( VRTSimpleSource *poSS );
547 VRTSource **papoSources;
548 int bSkipBufferInitialization;
550 VRTSourcedRasterBand(
GDALDataset *poDS,
int nBand );
552 int nXSize,
int nYSize );
553 VRTSourcedRasterBand(
GDALDataset *poDS,
int nBand,
555 int nXSize,
int nYSize );
556 virtual ~VRTSourcedRasterBand();
563 virtual int IGetDataCoverageStatus(
int nXOff,
int nYOff,
564 int nXSize,
int nYSize,
566 double* pdfDataPct)
override;
568 virtual char **GetMetadataDomainList()
override;
569 virtual const char *GetMetadataItem(
const char * pszName,
570 const char * pszDomain =
"" )
override;
571 virtual char **GetMetadata(
const char * pszDomain =
"" )
override;
572 virtual CPLErr SetMetadata(
char ** papszMetadata,
573 const char * pszDomain =
"" )
override;
574 virtual CPLErr SetMetadataItem(
const char * pszName,
575 const char * pszValue,
576 const char * pszDomain =
"" )
override;
578 virtual CPLErr XMLInit( CPLXMLNode *,
const char *,
void* )
override;
579 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
581 virtual double GetMinimum(
int *pbSuccess =
nullptr )
override;
582 virtual double GetMaximum(
int *pbSuccess =
nullptr )
override;
583 virtual CPLErr ComputeRasterMinMax(
int bApproxOK,
double* adfMinMax )
override;
584 virtual CPLErr ComputeStatistics(
int bApproxOK,
585 double *pdfMin,
double *pdfMax,
586 double *pdfMean,
double *pdfStdDev,
587 GDALProgressFunc pfnProgress,
588 void *pProgressData )
override;
589 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
590 int nBuckets,
GUIntBig * panHistogram,
591 int bIncludeOutOfRange,
int bApproxOK,
592 GDALProgressFunc pfnProgress,
593 void *pProgressData )
override;
595 CPLErr AddSource( VRTSource * );
597 double dfSrcXOff=-1,
double dfSrcYOff=-1,
598 double dfSrcXSize=-1,
double dfSrcYSize=-1,
599 double dfDstXOff=-1,
double dfDstYOff=-1,
600 double dfDstXSize=-1,
double dfDstYSize=-1,
601 const char *pszResampling =
"near",
604 double dfSrcXOff=-1,
double dfSrcYOff=-1,
605 double dfSrcXSize=-1,
double dfSrcYSize=-1,
606 double dfDstXOff=-1,
double dfDstYOff=-1,
607 double dfDstXSize=-1,
double dfDstYSize=-1,
608 double dfScaleOff=0.0,
609 double dfScaleRatio=1.0,
611 int nColorTableComponent = 0);
614 double dfSrcXOff=-1,
double dfSrcYOff=-1,
615 double dfSrcXSize=-1,
616 double dfSrcYSize=-1,
617 double dfDstXOff=-1,
double dfDstYOff=-1,
618 double dfDstXSize=-1,
619 double dfDstYSize=-1 );
624 void ConfigureSource(VRTSimpleSource *poSimpleSource,
627 double dfSrcXOff,
double dfSrcYOff,
628 double dfSrcXSize,
double dfSrcYSize,
629 double dfDstXOff,
double dfDstYOff,
630 double dfDstXSize,
double dfDstYSize );
632 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
634 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
635 int *pnMaxSize,
CPLHashSet* hSetFiles)
override;
637 virtual int CloseDependentDatasets()
override;
639 virtual int IsSourcedRasterBand()
override {
return TRUE; }
641 virtual CPLErr FlushCache()
override;
648 class CPL_DLL VRTWarpedRasterBand :
public VRTRasterBand
653 virtual ~VRTWarpedRasterBand();
655 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
657 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
658 virtual CPLErr IWriteBlock(
int,
int,
void * )
override;
660 virtual int GetOverviewCount()
override;
667 class VRTPansharpenedRasterBand :
public VRTRasterBand
669 int m_nIndexAsPansharpenedBand;
672 VRTPansharpenedRasterBand(
675 virtual ~VRTPansharpenedRasterBand();
677 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
679 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
682 int nXOff,
int nYOff,
int nXSize,
int nYSize,
683 void * pData,
int nBufXSize,
int nBufYSize,
688 virtual int GetOverviewCount()
override;
691 virtual int IsPansharpenRasterBand()
override {
return TRUE; }
693 void SetIndexAsPansharpenedBand(
int nIdx )
694 { m_nIndexAsPansharpenedBand = nIdx; }
695 int GetIndexAsPansharpenedBand()
const 696 {
return m_nIndexAsPansharpenedBand; }
703 class VRTDerivedRasterBandPrivateData;
705 class CPL_DLL VRTDerivedRasterBand :
public VRTSourcedRasterBand
707 VRTDerivedRasterBandPrivateData* m_poPrivate;
708 bool InitializePython();
716 VRTDerivedRasterBand(
GDALDataset *poDS,
int nBand );
717 VRTDerivedRasterBand(
GDALDataset *poDS,
int nBand,
719 virtual ~VRTDerivedRasterBand();
726 virtual int IGetDataCoverageStatus(
int nXOff,
int nYOff,
727 int nXSize,
int nYSize,
729 double* pdfDataPct)
override;
731 static CPLErr AddPixelFunction(
const char *pszFuncName,
735 void SetPixelFunctionName(
const char *pszFuncName );
737 void SetPixelFunctionLanguage(
const char* pszLanguage );
739 virtual CPLErr XMLInit( CPLXMLNode *,
const char *,
void* )
override;
740 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
742 virtual double GetMinimum(
int *pbSuccess =
nullptr )
override;
743 virtual double GetMaximum(
int *pbSuccess =
nullptr )
override;
744 virtual CPLErr ComputeRasterMinMax(
int bApproxOK,
double* adfMinMax )
override;
745 virtual CPLErr ComputeStatistics(
int bApproxOK,
746 double *pdfMin,
double *pdfMax,
747 double *pdfMean,
double *pdfStdDev,
748 GDALProgressFunc pfnProgress,
749 void *pProgressData )
override;
750 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
751 int nBuckets,
GUIntBig * panHistogram,
752 int bIncludeOutOfRange,
int bApproxOK,
753 GDALProgressFunc pfnProgress,
754 void *pProgressData )
override;
756 static void Cleanup();
765 class CPL_DLL VRTRawRasterBand :
public VRTRasterBand
767 RawRasterBand *m_poRawRaster;
769 char *m_pszSourceFilename;
770 int m_bRelativeToVRT;
777 virtual ~VRTRawRasterBand();
779 virtual CPLErr XMLInit( CPLXMLNode *,
const char *,
void* )
override;
780 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
787 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
788 virtual CPLErr IWriteBlock(
int,
int,
void * )
override;
790 CPLErr SetRawLink(
const char *pszFilename,
791 const char *pszVRTPath,
794 int nPixelOffset,
int nLineOffset,
795 const char *pszByteOrder );
799 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
800 int *pnMaxSize,
CPLHashSet* hSetFiles )
override;
813 virtual ~VRTDriver();
815 char **papszSourceParsers;
817 virtual char **GetMetadataDomainList()
override;
818 virtual char **GetMetadata(
const char * pszDomain =
"" )
override;
819 virtual CPLErr SetMetadata(
char ** papszMetadata,
820 const char * pszDomain =
"" )
override;
822 VRTSource *ParseSource( CPLXMLNode *psSrc,
const char *pszVRTPath,
823 void* pUniqueHandle );
824 void AddSourceParser(
const char *pszElementName,
825 VRTSourceParser pfnParser );
832 class CPL_DLL VRTSimpleSource :
public VRTSource
837 friend class VRTSourcedRasterBand;
856 double m_dfNoDataValue;
861 int m_bRelativeToVRTOri;
863 int m_nExplicitSharedStatus;
865 int NeedMaxValAdjustment()
const;
869 VRTSimpleSource(
const VRTSimpleSource* poSrcSource,
870 double dfXDstRatio,
double dfYDstRatio );
871 virtual ~VRTSimpleSource();
873 virtual CPLErr XMLInit( CPLXMLNode *psTree,
const char *,
void* )
override;
874 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
878 void SetSrcWindow(
double,
double,
double,
double );
879 void SetDstWindow(
double,
double,
double,
double );
880 void SetNoDataValue(
double dfNoDataValue );
881 const CPLString& GetResampling()
const {
return m_osResampling; }
882 void SetResampling(
const char* pszResampling );
884 int GetSrcDstWindow(
int,
int,
int,
int,
int,
int,
885 double *pdfReqXOff,
double *pdfReqYOff,
886 double *pdfReqXSize,
double *pdfReqYSize,
887 int *,
int *,
int *,
int *,
888 int *,
int *,
int *,
int * );
891 int nXOff,
int nYOff,
int nXSize,
int nYSize,
892 void *pData,
int nBufXSize,
int nBufYSize,
897 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
898 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
899 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
900 double* adfMinMax )
override;
901 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
903 double *pdfMin,
double *pdfMax,
904 double *pdfMean,
double *pdfStdDev,
905 GDALProgressFunc pfnProgress,
906 void *pProgressData )
override;
907 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
908 double dfMin,
double dfMax,
909 int nBuckets,
GUIntBig * panHistogram,
910 int bIncludeOutOfRange,
int bApproxOK,
911 GDALProgressFunc pfnProgress,
912 void *pProgressData )
override;
914 void DstToSrc(
double dfX,
double dfY,
915 double &dfXOut,
double &dfYOut )
const;
916 void SrcToDst(
double dfX,
double dfY,
917 double &dfXOut,
double &dfYOut )
const;
919 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
920 int *pnMaxSize,
CPLHashSet* hSetFiles )
override;
922 virtual int IsSimpleSource()
override {
return TRUE; }
923 virtual const char* GetType() {
return "SimpleSource"; }
924 virtual CPLErr FlushCache()
override;
927 int IsSameExceptBandNumber( VRTSimpleSource* poOtherSource );
930 int nXOff,
int nYOff,
int nXSize,
int nYSize,
931 void * pData,
int nBufXSize,
int nBufYSize,
933 int nBandCount,
int *panBandMap,
938 void UnsetPreservedRelativeFilenames();
940 void SetMaxValue(
int nVal ) { m_nMaxValue = nVal; }
947 class VRTAveragedSource :
public VRTSimpleSource
954 int nXOff,
int nYOff,
int nXSize,
int nYSize,
955 void *pData,
int nBufXSize,
int nBufYSize,
960 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
961 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
962 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
963 double* adfMinMax )
override;
964 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
966 double *pdfMin,
double *pdfMax,
967 double *pdfMean,
double *pdfStdDev,
968 GDALProgressFunc pfnProgress,
969 void *pProgressData )
override;
970 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
971 double dfMin,
double dfMax,
972 int nBuckets,
GUIntBig * panHistogram,
973 int bIncludeOutOfRange,
int bApproxOK,
974 GDALProgressFunc pfnProgress,
975 void *pProgressData )
override;
977 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
978 virtual const char* GetType()
override {
return "AveragedSource"; }
989 VRT_SCALING_EXPONENTIAL,
990 } VRTComplexSourceScaling;
992 class CPL_DLL VRTComplexSource :
public VRTSimpleSource
995 bool AreValuesUnchanged()
const;
998 VRTComplexSourceScaling m_eScalingType;
1000 double m_dfScaleRatio;
1003 int m_bSrcMinMaxDefined;
1008 double m_dfExponent;
1010 int m_nColorTableComponent;
1012 template <
class WorkingDT>
1013 CPLErr RasterIOInternal(
int nReqXOff,
int nReqYOff,
1014 int nReqXSize,
int nReqYSize,
1015 void *pData,
int nOutXSize,
int nOutYSize,
1023 VRTComplexSource(
const VRTComplexSource* poSrcSource,
1024 double dfXDstRatio,
double dfYDstRatio);
1025 virtual ~VRTComplexSource();
1028 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1029 void *pData,
int nBufXSize,
int nBufYSize,
1034 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1035 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1036 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
1037 double* adfMinMax )
override;
1038 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
1040 double *pdfMin,
double *pdfMax,
1041 double *pdfMean,
double *pdfStdDev,
1042 GDALProgressFunc pfnProgress,
1043 void *pProgressData )
override;
1044 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1045 double dfMin,
double dfMax,
1046 int nBuckets,
GUIntBig * panHistogram,
1047 int bIncludeOutOfRange,
int bApproxOK,
1048 GDALProgressFunc pfnProgress,
1049 void *pProgressData )
override;
1051 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1052 virtual CPLErr XMLInit( CPLXMLNode *,
const char *,
void* )
override;
1053 virtual const char* GetType()
override {
return "ComplexSource"; }
1055 double LookupValue(
double dfInput );
1057 void SetLinearScaling(
double dfOffset,
double dfScale );
1058 void SetPowerScaling(
double dfExponent,
1063 void SetColorTableComponent(
int nComponent );
1065 double *m_padfLUTInputs;
1066 double *m_padfLUTOutputs;
1067 int m_nLUTItemCount;
1074 class VRTFilteredSource :
public VRTComplexSource
1082 int m_nSupportedTypesCount;
1085 int m_nExtraEdgePixels;
1088 VRTFilteredSource();
1089 virtual ~VRTFilteredSource();
1091 void SetExtraEdgePixels(
int );
1092 void SetFilteringDataTypesSupported(
int,
GDALDataType * );
1095 GByte *pabySrcData,
GByte *pabyDstData ) = 0;
1098 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1099 void *pData,
int nBufXSize,
int nBufYSize,
1109 class VRTKernelFilteredSource :
public VRTFilteredSource
1118 double *m_padfKernelCoefs;
1123 VRTKernelFilteredSource();
1124 virtual ~VRTKernelFilteredSource();
1126 virtual CPLErr XMLInit( CPLXMLNode *psTree,
const char *,
void* )
override;
1127 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1130 GByte *pabySrcData,
GByte *pabyDstData )
override;
1132 CPLErr SetKernel(
int nKernelSize,
bool bSeparable,
double *padfCoefs );
1133 void SetNormalized(
int );
1140 class VRTAverageFilteredSource :
public VRTKernelFilteredSource
1145 explicit VRTAverageFilteredSource(
int nKernelSize );
1146 virtual ~VRTAverageFilteredSource();
1148 virtual CPLErr XMLInit( CPLXMLNode *psTree,
const char *,
void* )
override;
1149 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1155 class VRTFuncSource :
public VRTSource
1161 virtual ~VRTFuncSource();
1163 virtual CPLErr XMLInit( CPLXMLNode *,
const char *,
void* )
override {
return CE_Failure; }
1164 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1167 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1168 void *pData,
int nBufXSize,
int nBufYSize,
1173 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1174 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1175 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
1176 double* adfMinMax )
override;
1177 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
1179 double *pdfMin,
double *pdfMax,
1180 double *pdfMean,
double *pdfStdDev,
1181 GDALProgressFunc pfnProgress,
1182 void *pProgressData )
override;
1183 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1184 double dfMin,
double dfMax,
1185 int nBuckets,
GUIntBig * panHistogram,
1186 int bIncludeOutOfRange,
int bApproxOK,
1187 GDALProgressFunc pfnProgress,
1188 void *pProgressData )
override;
The GDALRasterAttributeTable (or RAT) class is used to encapsulate a table used to provide attribute ...
Definition: gdal_rat.h:47
GDALDataType
Definition: gdal.h:60
Document node structure.
Definition: cpl_minixml.h:66
CPLErr(* VRTImageReadFunc)(void *hCBData, int nXOff, int nYOff, int nXSize, int nYSize, void *pData)
Type for a function that returns the pixel data in a provided window.
Definition: gdal_vrt.h:51
GDALRWFlag
Definition: gdal.h:119
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:215
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:258
Pansharpening operation class.
Definition: gdalpansharpen.h:188
Convenient string class based on std::string.
Definition: cpl_string.h:329
CPLErr(* GDALDerivedPixelFunc)(void **papoSources, int nSources, void *pData, int nBufXSize, int nBufYSize, GDALDataType eSrcType, GDALDataType eBufType, int nPixelSpace, int nLineSpace)
Type of functions to pass to GDALAddDerivedBandPixelFunc.
Definition: gdal.h:766
#define VRT_NODATA_UNSET
Special value to indicate that nodata is not set.
Definition: gdal_vrt.h:45
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:273
int Dereference()
Subtract one from dataset reference count.
Definition: gdaldataset.cpp:1130
Class for dataset open functions.
Definition: gdal_priv.h:265
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:438
High level image warping class.
Definition: gdalwarper.h:442
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:251
void GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:3061
Object with metadata.
Definition: gdal_priv.h:132
GDALDataset * GetDataset()
Fetch the owning dataset handle.
Definition: gdalrasterband.cpp:2826
GUIntBig vsi_l_offset
Type for a file offset.
Definition: cpl_vsi.h:140
A single raster band (or channel).
Definition: gdal_priv.h:1032
GDALAccess
Definition: gdal.h:113
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:335
GDALColorInterp
Definition: gdal.h:190
Public (C callable) entry points for virtual GDAL dataset objects.
struct _CPLHashSet CPLHashSet
Opaque type for a hash set.
Definition: cpl_hash_set.h:52
Format specific driver.
Definition: gdal_priv.h:1386
A color table / palette.
Definition: gdal_priv.h:937
int GetShared() const
Returns shared flag.
Definition: gdaldataset.cpp:1202
Ground Control Point.
Definition: gdal.h:560
CPLErr
Error category.
Definition: cpl_error.h:52
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:989