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 std::map<CPLString, GDALDataset*>& ) = 0;
127 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath ) = 0;
129 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
132 virtual int IsSimpleSource() {
return FALSE; }
133 virtual CPLErr FlushCache() {
return CE_None; }
136 typedef VRTSource *(*VRTSourceParser)(
CPLXMLNode *,
const char *,
void* pUniqueHandle,
137 std::map<CPLString, GDALDataset*>& oMapSharedSources);
139 VRTSource *VRTParseCoreSources( CPLXMLNode *psTree,
const char *,
void* pUniqueHandle,
140 std::map<CPLString, GDALDataset*>& oMapSharedSources);
141 VRTSource *VRTParseFilterSources( CPLXMLNode *psTree,
const char *,
void* pUniqueHandle,
142 std::map<CPLString, GDALDataset*>& oMapSharedSources );
150 template<
class T>
struct VRTFlushCacheStruct
152 static void FlushCache(T& obj);
155 class VRTWarpedDataset;
156 class VRTPansharpenedDataset;
160 friend class VRTRasterBand;
161 friend struct VRTFlushCacheStruct<VRTDataset>;
162 friend struct VRTFlushCacheStruct<VRTWarpedDataset>;
163 friend struct VRTFlushCacheStruct<VRTPansharpenedDataset>;
164 friend class VRTSourcedRasterBand;
168 int m_bGeoTransformSet;
169 double m_adfGeoTransform[6];
180 VRTRasterBand *m_poMaskBand;
182 int m_bCompatibleForDatasetIO;
183 int CheckCompatibleForDatasetIO();
184 void ExpandProxyBands();
186 std::vector<GDALDataset*> m_apoOverviews;
187 std::vector<GDALDataset*> m_apoOverviewsBak;
188 char **m_papszXMLVRTMetadata;
190 std::map<CPLString, GDALDataset*> m_oMapSharedSources;
192 VRTRasterBand* InitBand(
const char* pszSubclass,
int nBand,
193 bool bAllowPansharpened);
198 virtual
int CloseDependentDatasets() override;
201 VRTDataset(
int nXSize,
int nYSize);
202 virtual ~VRTDataset();
204 void SetNeedsFlush() { m_bNeedsFlush = TRUE; }
207 void SetWritable(
int bWritableIn) { m_bWritable = bWritableIn; }
210 void SetMaskBand(VRTRasterBand* poMaskBand);
219 const char *pszDomain =
"" )
override;
221 const char *pszDomain =
"" )
override;
223 virtual char**
GetMetadata(
const char *pszDomain =
"" )
override;
233 char **papszOptions=
nullptr )
override;
238 int nXOff,
int nYOff,
int nXSize,
int nYSize,
239 void * pData,
int nBufXSize,
int nBufYSize,
241 int nBandCount,
int *panBandMap,
247 int nBufXSize,
int nBufYSize,
249 int nBandCount,
int *panBandList,
250 char **papszOptions )
override;
252 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath);
253 virtual CPLErr XMLInit( CPLXMLNode *,
const char * );
255 virtual CPLErr IBuildOverviews(
const char *,
int,
int *,
256 int,
int *, GDALProgressFunc,
void * )
override;
260 void BuildVirtualOverviews();
262 void UnsetPreservedRelativeFilenames();
266 static GDALDataset *OpenXML(
const char *,
const char * =
nullptr,
269 int nXSize,
int nYSize,
int nBands,
271 static CPLErr Delete(
const char * pszFilename );
279 class VRTWarpedRasterBand;
281 class CPL_DLL VRTWarpedDataset :
public VRTDataset
287 int m_nOverviewCount;
288 VRTWarpedDataset **m_papoOverviews;
291 void CreateImplicitOverviews();
293 struct VerticalShiftGrid
298 double dfToMeterDest;
301 std::vector<VerticalShiftGrid> m_aoVerticalShiftGrids;
303 friend class VRTWarpedRasterBand;
308 virtual
int CloseDependentDatasets() override;
311 VRTWarpedDataset(
int nXSize,
int nYSize );
312 virtual ~VRTWarpedDataset();
314 virtual
void FlushCache() override;
316 CPLErr Initialize(
void * );
318 virtual
CPLErr IBuildOverviews( const
char *,
int,
int *,
319 int,
int *, GDALProgressFunc,
void * ) override;
321 virtual
CPLErr SetMetadataItem( const
char *pszName, const
char *pszValue,
322 const
char *pszDomain = "" ) override;
324 virtual CPLXMLNode *SerializeToXML( const
char *pszVRTPath ) override;
325 virtual
CPLErr XMLInit( CPLXMLNode *, const
char * ) override;
328 char **papszOptions=
nullptr ) override;
330 virtual
char **GetFileList() override;
332 CPLErr ProcessBlock(
int iBlockX,
int iBlockY );
334 void GetBlockSize(
int *,
int * ) const;
336 void SetApplyVerticalShiftGrid(const
char* pszVGrids,
339 double dfToMeterDest,
340 char** papszOptions );
352 GTAdjust_Intersection,
354 GTAdjust_NoneWithoutWarning
357 class VRTPansharpenedDataset :
public VRTDataset
359 friend class VRTPansharpenedRasterBand;
364 VRTPansharpenedDataset* m_poMainDataset;
365 std::vector<VRTPansharpenedDataset*> m_apoOverviewDatasets;
367 std::map<CPLString,CPLString> m_oMapToRelativeFilenames;
369 int m_bLoadingOtherBands;
371 GByte *m_pabyLastBufferBandRasterIO;
372 int m_nLastBandRasterIOXOff;
373 int m_nLastBandRasterIOYOff;
374 int m_nLastBandRasterIOXSize;
375 int m_nLastBandRasterIOYSize;
378 GTAdjustment m_eGTAdjustment;
379 int m_bNoDataDisabled;
381 std::vector<GDALDataset*> m_apoDatasetsToClose;
386 virtual
int CloseDependentDatasets() override;
389 VRTPansharpenedDataset(
int nXSize,
int nYSize );
390 virtual ~VRTPansharpenedDataset();
392 virtual
void FlushCache() override;
394 virtual
CPLErr XMLInit( CPLXMLNode *, const
char * ) override;
395 virtual CPLXMLNode * SerializeToXML( const
char *pszVRTPath ) override;
397 CPLErr XMLInit( CPLXMLNode *psTree, const
char *pszVRTPath,
399 int nInputSpectralBandsIn,
403 char **papszOptions=
nullptr ) override;
405 virtual
char **GetFileList() override;
408 int nXOff,
int nYOff,
int nXSize,
int nYSize,
409 void * pData,
int nBufXSize,
int nBufYSize,
411 int nBandCount,
int *panBandMap,
416 void GetBlockSize(
int *,
int * ) const;
433 int m_bNoDataValueSet;
435 int m_bHideNoDataValue;
436 double m_dfNoDataValue;
438 std::unique_ptr<GDALColorTable> m_poColorTable;
443 char **m_papszCategoryNames;
448 CPLXMLNode *m_psSavedHistograms;
450 void Initialize(
int nXSize,
int nYSize );
452 std::vector<VRTOverviewInfo> m_apoOverviews;
454 VRTRasterBand *m_poMaskBand;
456 std::unique_ptr<GDALRasterAttributeTable> m_poRAT;
463 virtual ~VRTRasterBand();
465 virtual
CPLErr XMLInit( CPLXMLNode *, const
char *,
void*,
467 virtual CPLXMLNode * SerializeToXML( const
char *pszVRTPath );
469 virtual
CPLErr SetNoDataValue(
double ) override;
470 virtual
double GetNoDataValue(
int *pbSuccess =
nullptr ) override;
471 virtual
CPLErr DeleteNoDataValue() override;
482 virtual const
char *GetUnitType() override;
483 CPLErr SetUnitType( const
char * ) override;
485 virtual
char **GetCategoryNames() override;
486 virtual
CPLErr SetCategoryNames(
char ** ) override;
488 virtual
CPLErr SetMetadata(
char **papszMD, const
char *pszDomain = "" ) override;
489 virtual
CPLErr SetMetadataItem( const
char *pszName, const
char *pszValue,
490 const
char *pszDomain = "" ) override;
492 virtual
double GetOffset(
int *pbSuccess =
nullptr ) override;
493 CPLErr SetOffset(
double ) override;
494 virtual
double GetScale(
int *pbSuccess =
nullptr ) override;
495 CPLErr SetScale(
double ) override;
497 virtual
int GetOverviewCount() override;
500 virtual
CPLErr GetHistogram(
double dfMin,
double dfMax,
501 int nBuckets,
GUIntBig * panHistogram,
502 int bIncludeOutOfRange,
int bApproxOK,
503 GDALProgressFunc,
void *pProgressData ) override;
505 virtual
CPLErr GetDefaultHistogram(
double *pdfMin,
double *pdfMax,
506 int *pnBuckets,
GUIntBig ** ppanHistogram,
508 GDALProgressFunc,
void *pProgressData) override;
510 virtual
CPLErr SetDefaultHistogram(
double dfMin,
double dfMax,
511 int nBuckets,
GUIntBig *panHistogram ) override;
515 virtual
void GetFileList(
char*** ppapszFileList,
int *pnSize,
518 virtual
void SetDescription( const
char * ) override;
520 virtual GDALRasterBand *GetMaskBand() override;
521 virtual
int GetMaskFlags() override;
523 virtual
CPLErr CreateMaskBand(
int nFlagsIn ) override;
525 void SetMaskBand(VRTRasterBand* poMaskBand);
527 void SetIsMaskBand();
529 CPLErr UnsetNoDataValue();
531 virtual
int CloseDependentDatasets();
533 virtual
int IsSourcedRasterBand() {
return FALSE; }
534 virtual int IsPansharpenRasterBand() {
return FALSE; }
541 class VRTSimpleSource;
543 class CPL_DLL VRTSourcedRasterBand :
public VRTRasterBand
546 int m_nRecursionCounter;
548 char **m_papszSourceList;
550 bool CanUseSourcesMinMaxImplementations();
551 void CheckSource( VRTSimpleSource *poSS );
557 VRTSource **papoSources;
558 int bSkipBufferInitialization;
560 VRTSourcedRasterBand(
GDALDataset *poDS,
int nBand );
562 int nXSize,
int nYSize );
563 VRTSourcedRasterBand(
GDALDataset *poDS,
int nBand,
565 int nXSize,
int nYSize );
566 virtual ~VRTSourcedRasterBand();
573 virtual
int IGetDataCoverageStatus(
int nXOff,
int nYOff,
574 int nXSize,
int nYSize,
576 double* pdfDataPct) override;
578 virtual
char **GetMetadataDomainList() override;
579 virtual const
char *GetMetadataItem( const
char * pszName,
580 const
char * pszDomain = "" ) override;
581 virtual
char **GetMetadata( const
char * pszDomain = "" ) override;
582 virtual
CPLErr SetMetadata(
char ** papszMetadata,
583 const
char * pszDomain = "" ) override;
584 virtual
CPLErr SetMetadataItem( const
char * pszName,
585 const
char * pszValue,
586 const
char * pszDomain = "" ) override;
588 virtual
CPLErr XMLInit( CPLXMLNode *, const
char *,
void*,
590 virtual CPLXMLNode * SerializeToXML( const
char *pszVRTPath ) override;
592 virtual
double GetMinimum(
int *pbSuccess =
nullptr ) override;
593 virtual
double GetMaximum(
int *pbSuccess =
nullptr ) override;
594 virtual
CPLErr ComputeRasterMinMax(
int bApproxOK,
double* adfMinMax ) override;
595 virtual
CPLErr ComputeStatistics(
int bApproxOK,
596 double *pdfMin,
double *pdfMax,
597 double *pdfMean,
double *pdfStdDev,
598 GDALProgressFunc pfnProgress,
599 void *pProgressData ) override;
600 virtual
CPLErr GetHistogram(
double dfMin,
double dfMax,
601 int nBuckets,
GUIntBig * panHistogram,
602 int bIncludeOutOfRange,
int bApproxOK,
603 GDALProgressFunc pfnProgress,
604 void *pProgressData ) override;
606 CPLErr AddSource( VRTSource * );
608 double dfSrcXOff=-1,
double dfSrcYOff=-1,
609 double dfSrcXSize=-1,
double dfSrcYSize=-1,
610 double dfDstXOff=-1,
double dfDstYOff=-1,
611 double dfDstXSize=-1,
double dfDstYSize=-1,
612 const
char *pszResampling = "near",
615 double dfSrcXOff=-1,
double dfSrcYOff=-1,
616 double dfSrcXSize=-1,
double dfSrcYSize=-1,
617 double dfDstXOff=-1,
double dfDstYOff=-1,
618 double dfDstXSize=-1,
double dfDstYSize=-1,
619 double dfScaleOff=0.0,
620 double dfScaleRatio=1.0,
621 double dfNoDataValue = VRT_NODATA_UNSET,
622 int nColorTableComponent = 0);
625 double dfSrcXOff=-1,
double dfSrcYOff=-1,
626 double dfSrcXSize=-1,
627 double dfSrcYSize=-1,
628 double dfDstXOff=-1,
double dfDstYOff=-1,
629 double dfDstXSize=-1,
630 double dfDstYSize=-1 );
633 double dfNoDataValue = VRT_NODATA_UNSET );
635 void ConfigureSource(VRTSimpleSource *poSimpleSource,
638 double dfSrcXOff,
double dfSrcYOff,
639 double dfSrcXSize,
double dfSrcYSize,
640 double dfDstXOff,
double dfDstYOff,
641 double dfDstXSize,
double dfDstYSize );
643 virtual
CPLErr IReadBlock(
int,
int,
void * ) override;
645 virtual
void GetFileList(
char*** ppapszFileList,
int *pnSize,
646 int *pnMaxSize,
CPLHashSet* hSetFiles) override;
648 virtual
int CloseDependentDatasets() override;
650 virtual
int IsSourcedRasterBand()
override {
return TRUE; }
652 virtual CPLErr FlushCache()
override;
659 class CPL_DLL VRTWarpedRasterBand :
public VRTRasterBand
664 virtual ~VRTWarpedRasterBand();
666 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
668 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
669 virtual CPLErr IWriteBlock(
int,
int,
void * )
override;
671 virtual int GetOverviewCount()
override;
678 class VRTPansharpenedRasterBand :
public VRTRasterBand
680 int m_nIndexAsPansharpenedBand;
683 VRTPansharpenedRasterBand(
686 virtual ~VRTPansharpenedRasterBand();
688 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
690 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
693 int nXOff,
int nYOff,
int nXSize,
int nYSize,
694 void * pData,
int nBufXSize,
int nBufYSize,
699 virtual int GetOverviewCount()
override;
702 virtual int IsPansharpenRasterBand()
override {
return TRUE; }
704 void SetIndexAsPansharpenedBand(
int nIdx )
705 { m_nIndexAsPansharpenedBand = nIdx; }
706 int GetIndexAsPansharpenedBand()
const
707 {
return m_nIndexAsPansharpenedBand; }
714 class VRTDerivedRasterBandPrivateData;
716 class CPL_DLL VRTDerivedRasterBand :
public VRTSourcedRasterBand
718 VRTDerivedRasterBandPrivateData* m_poPrivate;
719 bool InitializePython();
727 VRTDerivedRasterBand(
GDALDataset *poDS,
int nBand );
728 VRTDerivedRasterBand(
GDALDataset *poDS,
int nBand,
730 virtual ~VRTDerivedRasterBand();
737 virtual
int IGetDataCoverageStatus(
int nXOff,
int nYOff,
738 int nXSize,
int nYSize,
740 double* pdfDataPct) override;
742 static
CPLErr AddPixelFunction( const
char *pszFuncName,
746 void SetPixelFunctionName( const
char *pszFuncName );
747 void SetSourceTransferType( GDALDataType eDataType );
748 void SetPixelFunctionLanguage( const
char* pszLanguage );
750 virtual
CPLErr XMLInit( CPLXMLNode *, const
char *,
void*,
752 virtual CPLXMLNode * SerializeToXML( const
char *pszVRTPath ) override;
754 virtual
double GetMinimum(
int *pbSuccess =
nullptr ) override;
755 virtual
double GetMaximum(
int *pbSuccess =
nullptr ) override;
756 virtual
CPLErr ComputeRasterMinMax(
int bApproxOK,
double* adfMinMax ) override;
757 virtual
CPLErr ComputeStatistics(
int bApproxOK,
758 double *pdfMin,
double *pdfMax,
759 double *pdfMean,
double *pdfStdDev,
760 GDALProgressFunc pfnProgress,
761 void *pProgressData ) override;
762 virtual
CPLErr GetHistogram(
double dfMin,
double dfMax,
763 int nBuckets,
GUIntBig * panHistogram,
764 int bIncludeOutOfRange,
int bApproxOK,
765 GDALProgressFunc pfnProgress,
766 void *pProgressData ) override;
768 static
void Cleanup();
777 class CPL_DLL VRTRawRasterBand : public VRTRasterBand
779 RawRasterBand *m_poRawRaster;
781 char *m_pszSourceFilename;
782 int m_bRelativeToVRT;
789 virtual ~VRTRawRasterBand();
791 virtual
CPLErr XMLInit( CPLXMLNode *, const
char *,
void*,
793 virtual CPLXMLNode * SerializeToXML( const
char *pszVRTPath ) override;
795 virtual
CPLErr IRasterIO( GDALRWFlag,
int,
int,
int,
int,
796 void *,
int,
int, GDALDataType,
800 virtual
CPLErr IReadBlock(
int,
int,
void * ) override;
801 virtual
CPLErr IWriteBlock(
int,
int,
void * ) override;
803 CPLErr SetRawLink( const
char *pszFilename,
804 const
char *pszVRTPath,
807 int nPixelOffset,
int nLineOffset,
808 const
char *pszByteOrder );
812 virtual
void GetFileList(
char*** ppapszFileList,
int *pnSize,
813 int *pnMaxSize,
CPLHashSet* hSetFiles ) override;
826 virtual ~VRTDriver();
828 char **papszSourceParsers;
830 virtual
char **GetMetadataDomainList() override;
831 virtual
char **GetMetadata( const
char * pszDomain = "" ) override;
832 virtual
CPLErr SetMetadata(
char ** papszMetadata,
833 const
char * pszDomain = "" ) override;
835 VRTSource *ParseSource( CPLXMLNode *psSrc, const
char *pszVRTPath,
837 std::map<CPLString,
GDALDataset*>& oMapSharedSources );
838 void AddSourceParser( const
char *pszElementName,
839 VRTSourceParser pfnParser );
846 class CPL_DLL VRTSimpleSource : public VRTSource
851 friend class VRTSourcedRasterBand;
870 double m_dfNoDataValue;
871 CPLString m_osResampling;
875 int m_bRelativeToVRTOri;
876 CPLString m_osSourceFileNameOri;
877 int m_nExplicitSharedStatus;
879 int NeedMaxValAdjustment() const;
883 VRTSimpleSource( const VRTSimpleSource* poSrcSource,
884 double dfXDstRatio,
double dfYDstRatio );
885 virtual ~VRTSimpleSource();
887 virtual
CPLErr XMLInit( CPLXMLNode *psTree, const
char *,
void*,
889 virtual CPLXMLNode *SerializeToXML( const
char *pszVRTPath ) override;
892 void SetSrcMaskBand( GDALRasterBand * );
893 void SetSrcWindow(
double,
double,
double,
double );
894 void SetDstWindow(
double,
double,
double,
double );
895 void SetNoDataValue(
double dfNoDataValue );
896 const CPLString& GetResampling()
const {
return m_osResampling; }
897 void SetResampling(
const char* pszResampling );
899 int GetSrcDstWindow(
int,
int,
int,
int,
int,
int,
900 double *pdfReqXOff,
double *pdfReqYOff,
901 double *pdfReqXSize,
double *pdfReqYSize,
902 int *,
int *,
int *,
int *,
903 int *,
int *,
int *,
int * );
905 virtual CPLErr RasterIO( GDALDataType eBandDataType,
906 int nXOff,
int nYOff,
int nXSize,
int nYSize,
907 void *pData,
int nBufXSize,
int nBufYSize,
908 GDALDataType eBufType,
912 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
913 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
914 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
915 double* adfMinMax )
override;
916 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
918 double *pdfMin,
double *pdfMax,
919 double *pdfMean,
double *pdfStdDev,
920 GDALProgressFunc pfnProgress,
921 void *pProgressData )
override;
922 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
923 double dfMin,
double dfMax,
924 int nBuckets,
GUIntBig * panHistogram,
925 int bIncludeOutOfRange,
int bApproxOK,
926 GDALProgressFunc pfnProgress,
927 void *pProgressData )
override;
929 void DstToSrc(
double dfX,
double dfY,
930 double &dfXOut,
double &dfYOut )
const;
931 void SrcToDst(
double dfX,
double dfY,
932 double &dfXOut,
double &dfYOut )
const;
934 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
935 int *pnMaxSize,
CPLHashSet* hSetFiles )
override;
937 virtual int IsSimpleSource()
override {
return TRUE; }
938 virtual const char* GetType() {
return "SimpleSource"; }
939 virtual CPLErr FlushCache()
override;
942 GDALRasterBand* GetMaskBandMainBand() {
return m_poMaskBandMainBand; }
943 int IsSameExceptBandNumber( VRTSimpleSource* poOtherSource );
945 GDALDataType eBandDataType,
946 int nXOff,
int nYOff,
int nXSize,
int nYSize,
947 void * pData,
int nBufXSize,
int nBufYSize,
948 GDALDataType eBufType,
949 int nBandCount,
int *panBandMap,
954 void UnsetPreservedRelativeFilenames();
956 void SetMaxValue(
int nVal ) { m_nMaxValue = nVal; }
963 class VRTAveragedSource :
public VRTSimpleSource
969 virtual
CPLErr RasterIO( GDALDataType eBandDataType,
970 int nXOff,
int nYOff,
int nXSize,
int nYSize,
971 void *pData,
int nBufXSize,
int nBufYSize,
972 GDALDataType eBufType,
976 virtual
double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess ) override;
977 virtual
double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess ) override;
978 virtual
CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
979 double* adfMinMax ) override;
980 virtual
CPLErr ComputeStatistics(
int nXSize,
int nYSize,
982 double *pdfMin,
double *pdfMax,
983 double *pdfMean,
double *pdfStdDev,
984 GDALProgressFunc pfnProgress,
985 void *pProgressData ) override;
986 virtual
CPLErr GetHistogram(
int nXSize,
int nYSize,
987 double dfMin,
double dfMax,
988 int nBuckets,
GUIntBig * panHistogram,
989 int bIncludeOutOfRange,
int bApproxOK,
990 GDALProgressFunc pfnProgress,
991 void *pProgressData ) override;
993 virtual CPLXMLNode *SerializeToXML( const
char *pszVRTPath ) override;
994 virtual const
char* GetType()
override {
return "AveragedSource"; }
1005 VRT_SCALING_EXPONENTIAL,
1006 } VRTComplexSourceScaling;
1008 class CPL_DLL VRTComplexSource :
public VRTSimpleSource
1011 bool AreValuesUnchanged() const;
1014 VRTComplexSourceScaling m_eScalingType;
1015 double m_dfScaleOff;
1016 double m_dfScaleRatio;
1019 int m_bSrcMinMaxDefined;
1024 double m_dfExponent;
1026 int m_nColorTableComponent;
1028 template <class WorkingDT>
1029 CPLErr RasterIOInternal(
int nReqXOff,
int nReqYOff,
1030 int nReqXSize,
int nReqYSize,
1031 void *pData,
int nOutXSize,
int nOutYSize,
1032 GDALDataType eBufType,
1035 GDALDataType eWrkDataType );
1039 VRTComplexSource(const VRTComplexSource* poSrcSource,
1040 double dfXDstRatio,
double dfYDstRatio);
1041 virtual ~VRTComplexSource();
1043 virtual
CPLErr RasterIO( GDALDataType eBandDataType,
1044 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1045 void *pData,
int nBufXSize,
int nBufYSize,
1046 GDALDataType eBufType,
1050 virtual
double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess ) override;
1051 virtual
double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess ) override;
1052 virtual
CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
1053 double* adfMinMax ) override;
1054 virtual
CPLErr ComputeStatistics(
int nXSize,
int nYSize,
1056 double *pdfMin,
double *pdfMax,
1057 double *pdfMean,
double *pdfStdDev,
1058 GDALProgressFunc pfnProgress,
1059 void *pProgressData ) override;
1060 virtual
CPLErr GetHistogram(
int nXSize,
int nYSize,
1061 double dfMin,
double dfMax,
1062 int nBuckets,
GUIntBig * panHistogram,
1063 int bIncludeOutOfRange,
int bApproxOK,
1064 GDALProgressFunc pfnProgress,
1065 void *pProgressData ) override;
1067 virtual CPLXMLNode *SerializeToXML( const
char *pszVRTPath ) override;
1068 virtual
CPLErr XMLInit( CPLXMLNode *, const
char *,
void*,
1070 virtual const
char* GetType()
override {
return "ComplexSource"; }
1072 double LookupValue(
double dfInput );
1074 void SetLinearScaling(
double dfOffset,
double dfScale );
1075 void SetPowerScaling(
double dfExponent,
1080 void SetColorTableComponent(
int nComponent );
1082 double *m_padfLUTInputs;
1083 double *m_padfLUTOutputs;
1084 int m_nLUTItemCount;
1091 class VRTFilteredSource :
public VRTComplexSource
1094 int IsTypeSupported( GDALDataType eTestType )
const;
1099 int m_nSupportedTypesCount;
1100 GDALDataType m_aeSupportedTypes[20];
1102 int m_nExtraEdgePixels;
1105 VRTFilteredSource();
1106 virtual ~VRTFilteredSource();
1108 void SetExtraEdgePixels(
int );
1109 void SetFilteringDataTypesSupported(
int, GDALDataType * );
1111 virtual
CPLErr FilterData(
int nXSize,
int nYSize, GDALDataType eType,
1112 GByte *pabySrcData,
GByte *pabyDstData ) = 0;
1114 virtual
CPLErr RasterIO( GDALDataType eBandDataType,
1115 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1116 void *pData,
int nBufXSize,
int nBufYSize,
1117 GDALDataType eBufType,
1126 class VRTKernelFilteredSource : public VRTFilteredSource
1135 double *m_padfKernelCoefs;
1140 VRTKernelFilteredSource();
1141 virtual ~VRTKernelFilteredSource();
1143 virtual
CPLErr XMLInit( CPLXMLNode *psTree, const
char *,
void*,
1145 virtual CPLXMLNode *SerializeToXML( const
char *pszVRTPath ) override;
1147 virtual
CPLErr FilterData(
int nXSize,
int nYSize, GDALDataType eType,
1148 GByte *pabySrcData,
GByte *pabyDstData ) override;
1150 CPLErr SetKernel(
int nKernelSize,
bool bSeparable,
double *padfCoefs );
1151 void SetNormalized(
int );
1158 class VRTAverageFilteredSource : public VRTKernelFilteredSource
1163 explicit VRTAverageFilteredSource(
int nKernelSize );
1164 virtual ~VRTAverageFilteredSource();
1166 virtual
CPLErr XMLInit( CPLXMLNode *psTree, const
char *,
void*,
1168 virtual CPLXMLNode *SerializeToXML( const
char *pszVRTPath ) override;
1174 class VRTFuncSource : public VRTSource
1180 virtual ~VRTFuncSource();
1182 virtual
CPLErr XMLInit( CPLXMLNode *, const
char *,
void*,
1183 std::map<CPLString,
GDALDataset*>& )
override {
return CE_Failure; }
1184 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1186 virtual CPLErr RasterIO( GDALDataType eBandDataType,
1187 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1188 void *pData,
int nBufXSize,
int nBufYSize,
1189 GDALDataType eBufType,
1193 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1194 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1195 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
1196 double* adfMinMax )
override;
1197 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
1199 double *pdfMin,
double *pdfMax,
1200 double *pdfMean,
double *pdfStdDev,
1201 GDALProgressFunc pfnProgress,
1202 void *pProgressData )
override;
1203 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1204 double dfMin,
double dfMax,
1205 int nBuckets,
GUIntBig * panHistogram,
1206 int bIncludeOutOfRange,
int bApproxOK,
1207 GDALProgressFunc pfnProgress,
1208 void *pProgressData )
override;
The GDALRasterAttributeTable (or RAT) class is used to encapsulate a table used to provide attribute ...
Definition: gdal_rat.h:47
virtual CPLErr GetGeoTransform(double *padfTransform)
Fetch the affine transformation coefficients.
Definition: gdaldataset.cpp:1158
GDALDataType
Definition: gdal.h:60
Document node structure.
Definition: cpl_minixml.h:66
virtual CPLErr AddBand(GDALDataType eType, char **papszOptions=nullptr)
Add a band to a dataset.
Definition: gdaldataset.cpp:570
virtual void FlushCache(void)
Flush all write cached data to disk.
Definition: gdaldataset.cpp:418
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
virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize, GDALDataType eDT, int nBandCount, int *panBandList, char **papszOptions)
Advise driver of upcoming read requests.
Definition: gdaldataset.cpp:2756
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
virtual const OGRSpatialReference * GetGCPSpatialRef() const
Get output spatial reference system for GCPs.
Definition: gdaldataset.cpp:1595
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:774
void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition: gdaldataset.cpp:4011
#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:1366
virtual const GDAL_GCP * GetGCPs()
Fetch GCPs.
Definition: gdaldataset.cpp:1678
virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList, const OGRSpatialReference *poGCP_SRS)
Assign GCPs.
Definition: gdaldataset.cpp:1783
static GDALDataset * Open(const char *pszFilename, unsigned int nOpenFlags=0, const char *const *papszAllowedDrivers=nullptr, const char *const *papszOpenOptions=nullptr, const char *const *papszSiblingFiles=nullptr)
Definition: gdal_priv.h:613
virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS)
Set the spatial reference system for this dataset.
Definition: gdaldataset.cpp:1040
virtual CPLErr SetGeoTransform(double *padfTransform)
Set the affine transformation coefficients.
Definition: gdaldataset.cpp:1213
virtual int GetGCPCount()
Get number of GCPs.
Definition: gdaldataset.cpp:1500
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
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:2941
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:251
virtual char ** GetFileList(void)
Fetch files forming dataset.
Definition: gdaldataset.cpp:2841
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:156
void GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:3588
Object with metadata.
Definition: gdal_priv.h:132
GDALDataset * GetDataset()
Fetch the owning dataset handle.
Definition: gdalrasterband.cpp:2837
CPLErr SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain) override
Set single metadata item.
GUIntBig vsi_l_offset
Type for a file offset.
Definition: cpl_vsi.h:140
A single raster band (or channel).
Definition: gdal_priv.h:1068
GDALAccess
Definition: gdal.h:113
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:335
virtual const OGRSpatialReference * GetSpatialRef() const
Fetch the spatial reference for this dataset.
Definition: gdaldataset.cpp:909
CPLErr SetMetadata(char **papszMetadata, const char *pszDomain) override
Set metadata.
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
int GetShared() const
Returns shared flag.
Definition: gdaldataset.cpp:1438
Format specific driver.
Definition: gdal_priv.h:1423
A color table / palette.
Definition: gdal_priv.h:964
Ground Control Point.
Definition: gdal.h:563
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:997