31 #ifndef VIRTUALDATASET_H_INCLUDED
32 #define VIRTUALDATASET_H_INCLUDED
51 CPLErr GDALRegisterDefaultPixelFunc();
54 int VRTWarpedOverviewTransform(
void *pTransformArg,
int bDstToSrc,
56 double *padfX,
double *padfY,
double *padfZ,
58 void* VRTDeserializeWarpedOverviewTransformer(
CPLXMLNode *psTree );
72 int bTriedToOpen = FALSE;
74 VRTOverviewInfo() =
default;
75 VRTOverviewInfo(VRTOverviewInfo&& oOther) noexcept:
76 osFilename(std::move(oOther.osFilename)),
78 poBand(oOther.poBand),
79 bTriedToOpen(oOther.bTriedToOpen)
81 oOther.poBand =
nullptr;
90 if( poBand ==
nullptr )
109 class CPL_DLL VRTSource
112 virtual ~VRTSource();
115 int nXOff,
int nYOff,
int nXSize,
int nYSize,
116 void *pData,
int nBufXSize,
int nBufYSize,
121 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess ) = 0;
122 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess ) = 0;
123 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
124 double* adfMinMax ) = 0;
125 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
127 double *pdfMin,
double *pdfMax,
128 double *pdfMean,
double *pdfStdDev,
129 GDALProgressFunc pfnProgress,
130 void *pProgressData ) = 0;
131 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
132 double dfMin,
double dfMax,
133 int nBuckets,
GUIntBig * panHistogram,
134 int bIncludeOutOfRange,
int bApproxOK,
135 GDALProgressFunc pfnProgress,
136 void *pProgressData ) = 0;
139 std::map<CPLString, GDALDataset*>& ) = 0;
140 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath ) = 0;
142 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
145 virtual int IsSimpleSource() {
return FALSE; }
146 virtual CPLErr FlushCache(
bool ) {
return CE_None; }
149 typedef VRTSource *(*VRTSourceParser)(
CPLXMLNode *,
const char *,
150 std::map<CPLString, GDALDataset*>& oMapSharedSources);
152 VRTSource *VRTParseCoreSources(
CPLXMLNode *psTree,
const char *,
153 std::map<CPLString, GDALDataset*>& oMapSharedSources);
154 VRTSource *VRTParseFilterSources(
CPLXMLNode *psTree,
const char *,
155 std::map<CPLString, GDALDataset*>& oMapSharedSources );
163 template<
class T>
struct VRTFlushCacheStruct
165 static void FlushCache(T& obj,
bool bAtClosing);
168 class VRTWarpedDataset;
169 class VRTPansharpenedDataset;
174 friend class VRTRasterBand;
175 friend struct VRTFlushCacheStruct<VRTDataset>;
176 friend struct VRTFlushCacheStruct<VRTWarpedDataset>;
177 friend struct VRTFlushCacheStruct<VRTPansharpenedDataset>;
178 friend class VRTSourcedRasterBand;
183 int m_bGeoTransformSet =
false;
184 double m_adfGeoTransform[6];
190 bool m_bNeedsFlush =
false;
191 bool m_bWritable =
true;
192 bool m_bCanTakeRef =
true;
194 char *m_pszVRTPath =
nullptr;
196 VRTRasterBand *m_poMaskBand =
nullptr;
198 int m_bCompatibleForDatasetIO = -1;
199 int CheckCompatibleForDatasetIO();
203 std::vector<GDALDataset*> m_apoOverviews{};
204 std::vector<GDALDataset*> m_apoOverviewsBak{};
206 std::vector<int> m_anOverviewFactors{};
208 char **m_papszXMLVRTMetadata =
nullptr;
210 std::map<CPLString, GDALDataset*> m_oMapSharedSources{};
211 std::shared_ptr<VRTGroup> m_poRootGroup{};
213 VRTRasterBand* InitBand(
const char* pszSubclass,
int nBand,
214 bool bAllowPansharpened);
215 static GDALDataset *OpenVRTProtocol(
const char* pszSpec );
216 bool AddVirtualOverview(
int nOvFactor,
217 const char* pszResampling);
222 virtual int CloseDependentDatasets()
override;
225 VRTDataset(
int nXSize,
int nYSize);
226 virtual ~VRTDataset();
228 void SetNeedsFlush() { m_bNeedsFlush =
true; }
229 virtual void FlushCache(
bool bAtClosing)
override;
231 void SetWritable(
int bWritableIn) { m_bWritable = CPL_TO_BOOL(bWritableIn); }
233 virtual CPLErr CreateMaskBand(
int nFlags )
override;
234 void SetMaskBand(VRTRasterBand* poMaskBand);
239 virtual CPLErr GetGeoTransform(
double * )
override;
240 virtual CPLErr SetGeoTransform(
double * )
override;
242 virtual CPLErr SetMetadata(
char **papszMetadata,
243 const char *pszDomain =
"" )
override;
244 virtual CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
245 const char *pszDomain =
"" )
override;
247 virtual char** GetMetadata(
const char *pszDomain =
"" )
override;
249 virtual int GetGCPCount()
override;
251 virtual const GDAL_GCP *GetGCPs()
override;
257 char **papszOptions=
nullptr )
override;
259 virtual char **GetFileList()
override;
262 int nXOff,
int nYOff,
int nXSize,
int nYSize,
263 void * pData,
int nBufXSize,
int nBufYSize,
265 int nBandCount,
int *panBandMap,
270 virtual CPLErr AdviseRead(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
271 int nBufXSize,
int nBufYSize,
273 int nBandCount,
int *panBandList,
274 char **papszOptions )
override;
276 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath);
279 virtual CPLErr IBuildOverviews(
const char *,
int,
int *,
280 int,
int *, GDALProgressFunc,
void * )
override;
282 std::shared_ptr<GDALGroup> GetRootGroup()
const override;
286 void BuildVirtualOverviews();
288 void UnsetPreservedRelativeFilenames();
292 static GDALDataset *OpenXML(
const char *,
const char * =
nullptr,
295 int nXSize,
int nYSize,
int nBands,
297 static GDALDataset *CreateMultiDimensional(
const char * pszFilename,
300 static CPLErr Delete(
const char * pszFilename );
308 class VRTWarpedRasterBand;
310 class CPL_DLL VRTWarpedDataset final:
public VRTDataset
316 int m_nOverviewCount;
317 VRTWarpedDataset **m_papoOverviews;
320 void CreateImplicitOverviews();
322 friend class VRTWarpedRasterBand;
327 virtual int CloseDependentDatasets()
override;
330 VRTWarpedDataset(
int nXSize,
int nYSize );
331 virtual ~VRTWarpedDataset();
333 virtual void FlushCache(
bool bAtClosing)
override;
335 CPLErr Initialize(
void * );
337 virtual CPLErr IBuildOverviews(
const char *,
int,
int *,
338 int,
int *, GDALProgressFunc,
void * )
override;
340 virtual CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
341 const char *pszDomain =
"" )
override;
343 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
347 char **papszOptions=
nullptr )
override;
349 virtual char **GetFileList()
override;
351 CPLErr ProcessBlock(
int iBlockX,
int iBlockY );
353 void GetBlockSize(
int *,
int * )
const;
365 GTAdjust_Intersection,
367 GTAdjust_NoneWithoutWarning
370 class VRTPansharpenedDataset final:
public VRTDataset
372 friend class VRTPansharpenedRasterBand;
377 VRTPansharpenedDataset* m_poMainDataset;
378 std::vector<VRTPansharpenedDataset*> m_apoOverviewDatasets{};
380 std::map<CPLString,CPLString> m_oMapToRelativeFilenames{};
382 int m_bLoadingOtherBands;
384 GByte *m_pabyLastBufferBandRasterIO;
385 int m_nLastBandRasterIOXOff;
386 int m_nLastBandRasterIOYOff;
387 int m_nLastBandRasterIOXSize;
388 int m_nLastBandRasterIOYSize;
391 GTAdjustment m_eGTAdjustment;
392 int m_bNoDataDisabled;
394 std::vector<GDALDataset*> m_apoDatasetsToClose{};
399 virtual int CloseDependentDatasets()
override;
402 VRTPansharpenedDataset(
int nXSize,
int nYSize );
403 virtual ~VRTPansharpenedDataset();
405 virtual void FlushCache(
bool bAtClosing)
override;
408 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
412 int nInputSpectralBandsIn,
416 char **papszOptions=
nullptr )
override;
418 virtual char **GetFileList()
override;
421 int nXOff,
int nYOff,
int nXSize,
int nYSize,
422 void * pData,
int nBufXSize,
int nBufYSize,
424 int nBandCount,
int *panBandMap,
429 void GetBlockSize(
int *,
int * )
const;
444 friend class VRTDataset;
448 int m_bNoDataValueSet;
450 int m_bHideNoDataValue;
451 double m_dfNoDataValue;
453 std::unique_ptr<GDALColorTable> m_poColorTable{};
458 char **m_papszCategoryNames;
465 void Initialize(
int nXSize,
int nYSize );
467 std::vector<VRTOverviewInfo> m_aoOverviewInfos{};
469 VRTRasterBand *m_poMaskBand;
471 std::unique_ptr<GDALRasterAttributeTable> m_poRAT{};
478 virtual ~VRTRasterBand();
481 std::map<CPLString, GDALDataset*>& );
482 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath );
484 virtual CPLErr SetNoDataValue(
double )
override;
485 virtual double GetNoDataValue(
int *pbSuccess =
nullptr )
override;
486 virtual CPLErr DeleteNoDataValue()
override;
497 virtual const char *GetUnitType()
override;
498 CPLErr SetUnitType(
const char * )
override;
500 virtual char **GetCategoryNames()
override;
501 virtual CPLErr SetCategoryNames(
char ** )
override;
503 virtual CPLErr SetMetadata(
char **papszMD,
const char *pszDomain =
"" )
override;
504 virtual CPLErr SetMetadataItem(
const char *pszName,
const char *pszValue,
505 const char *pszDomain =
"" )
override;
507 virtual double GetOffset(
int *pbSuccess =
nullptr )
override;
508 CPLErr SetOffset(
double )
override;
509 virtual double GetScale(
int *pbSuccess =
nullptr )
override;
510 CPLErr SetScale(
double )
override;
512 virtual int GetOverviewCount()
override;
515 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
516 int nBuckets,
GUIntBig * panHistogram,
517 int bIncludeOutOfRange,
int bApproxOK,
518 GDALProgressFunc,
void *pProgressData )
override;
520 virtual CPLErr GetDefaultHistogram(
double *pdfMin,
double *pdfMax,
521 int *pnBuckets,
GUIntBig ** ppanHistogram,
523 GDALProgressFunc,
void *pProgressData)
override;
525 virtual CPLErr SetDefaultHistogram(
double dfMin,
double dfMax,
526 int nBuckets,
GUIntBig *panHistogram )
override;
530 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
533 virtual void SetDescription(
const char * )
override;
536 virtual int GetMaskFlags()
override;
538 virtual CPLErr CreateMaskBand(
int nFlagsIn )
override;
540 void SetMaskBand(VRTRasterBand* poMaskBand);
542 void SetIsMaskBand();
544 CPLErr UnsetNoDataValue();
546 virtual int CloseDependentDatasets();
548 virtual int IsSourcedRasterBand() {
return FALSE; }
549 virtual int IsPansharpenRasterBand() {
return FALSE; }
556 class VRTSimpleSource;
558 class CPL_DLL VRTSourcedRasterBand
CPL_NON_FINAL:
public VRTRasterBand
562 char **m_papszSourceList =
nullptr;
563 int m_nSkipBufferInitialization = -1;
565 bool CanUseSourcesMinMaxImplementations();
570 bool SkipBufferInitialization();
574 VRTSource **papoSources =
nullptr;
576 VRTSourcedRasterBand(
GDALDataset *poDS,
int nBand );
578 int nXSize,
int nYSize );
579 VRTSourcedRasterBand(
GDALDataset *poDS,
int nBand,
581 int nXSize,
int nYSize );
582 VRTSourcedRasterBand(
GDALDataset *poDS,
int nBand,
584 int nXSize,
int nYSize,
585 int nBlockXSizeIn,
int nBlockYSizeIn );
586 virtual ~VRTSourcedRasterBand();
593 virtual int IGetDataCoverageStatus(
int nXOff,
int nYOff,
594 int nXSize,
int nYSize,
596 double* pdfDataPct)
override;
598 virtual char **GetMetadataDomainList()
override;
599 virtual const char *GetMetadataItem(
const char * pszName,
600 const char * pszDomain =
"" )
override;
601 virtual char **GetMetadata(
const char * pszDomain =
"" )
override;
602 virtual CPLErr SetMetadata(
char ** papszMetadata,
603 const char * pszDomain =
"" )
override;
604 virtual CPLErr SetMetadataItem(
const char * pszName,
605 const char * pszValue,
606 const char * pszDomain =
"" )
override;
609 std::map<CPLString, GDALDataset*>& )
override;
610 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
612 virtual double GetMinimum(
int *pbSuccess =
nullptr )
override;
613 virtual double GetMaximum(
int *pbSuccess =
nullptr )
override;
614 virtual CPLErr ComputeRasterMinMax(
int bApproxOK,
double* adfMinMax )
override;
615 virtual CPLErr ComputeStatistics(
int bApproxOK,
616 double *pdfMin,
double *pdfMax,
617 double *pdfMean,
double *pdfStdDev,
618 GDALProgressFunc pfnProgress,
619 void *pProgressData )
override;
620 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
621 int nBuckets,
GUIntBig * panHistogram,
622 int bIncludeOutOfRange,
int bApproxOK,
623 GDALProgressFunc pfnProgress,
624 void *pProgressData )
override;
626 CPLErr AddSource( VRTSource * );
628 CPLErr AddSimpleSource(
const char* pszFilename,
630 double dfSrcXOff=-1,
double dfSrcYOff=-1,
631 double dfSrcXSize=-1,
double dfSrcYSize=-1,
632 double dfDstXOff=-1,
double dfDstYOff=-1,
633 double dfDstXSize=-1,
double dfDstYSize=-1,
634 const char *pszResampling =
"near",
638 double dfSrcXOff=-1,
double dfSrcYOff=-1,
639 double dfSrcXSize=-1,
double dfSrcYSize=-1,
640 double dfDstXOff=-1,
double dfDstYOff=-1,
641 double dfDstXSize=-1,
double dfDstYSize=-1,
642 const char *pszResampling =
"near",
645 CPLErr AddComplexSource(
const char* pszFilename,
647 double dfSrcXOff=-1,
double dfSrcYOff=-1,
648 double dfSrcXSize=-1,
double dfSrcYSize=-1,
649 double dfDstXOff=-1,
double dfDstYOff=-1,
650 double dfDstXSize=-1,
double dfDstYSize=-1,
651 double dfScaleOff=0.0,
652 double dfScaleRatio=1.0,
654 int nColorTableComponent = 0);
657 double dfSrcXOff=-1,
double dfSrcYOff=-1,
658 double dfSrcXSize=-1,
double dfSrcYSize=-1,
659 double dfDstXOff=-1,
double dfDstYOff=-1,
660 double dfDstXSize=-1,
double dfDstYSize=-1,
661 double dfScaleOff=0.0,
662 double dfScaleRatio=1.0,
664 int nColorTableComponent = 0);
667 double dfSrcXOff=-1,
double dfSrcYOff=-1,
668 double dfSrcXSize=-1,
669 double dfSrcYSize=-1,
670 double dfDstXOff=-1,
double dfDstYOff=-1,
671 double dfDstXSize=-1,
672 double dfDstYSize=-1 );
677 void ConfigureSource(VRTSimpleSource *poSimpleSource,
680 double dfSrcXOff,
double dfSrcYOff,
681 double dfSrcXSize,
double dfSrcYSize,
682 double dfDstXOff,
double dfDstYOff,
683 double dfDstXSize,
double dfDstYSize );
685 void RemoveCoveredSources(
CSLConstList papszOptions =
nullptr);
687 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
689 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
690 int *pnMaxSize,
CPLHashSet* hSetFiles)
override;
692 virtual int CloseDependentDatasets()
override;
694 virtual int IsSourcedRasterBand()
override {
return TRUE; }
696 virtual CPLErr FlushCache(
bool bAtClosing)
override;
703 class CPL_DLL VRTWarpedRasterBand final:
public VRTRasterBand
708 virtual ~VRTWarpedRasterBand();
710 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
712 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
713 virtual CPLErr IWriteBlock(
int,
int,
void * )
override;
715 virtual int GetOverviewCount()
override;
722 class VRTPansharpenedRasterBand final:
public VRTRasterBand
724 int m_nIndexAsPansharpenedBand;
727 VRTPansharpenedRasterBand(
730 virtual ~VRTPansharpenedRasterBand();
732 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
734 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
737 int nXOff,
int nYOff,
int nXSize,
int nYSize,
738 void * pData,
int nBufXSize,
int nBufYSize,
743 virtual int GetOverviewCount()
override;
746 virtual int IsPansharpenRasterBand()
override {
return TRUE; }
748 void SetIndexAsPansharpenedBand(
int nIdx )
749 { m_nIndexAsPansharpenedBand = nIdx; }
750 int GetIndexAsPansharpenedBand()
const
751 {
return m_nIndexAsPansharpenedBand; }
758 class VRTDerivedRasterBandPrivateData;
760 class CPL_DLL VRTDerivedRasterBand
CPL_NON_FINAL:
public VRTSourcedRasterBand
762 VRTDerivedRasterBandPrivateData* m_poPrivate;
763 bool InitializePython();
773 VRTDerivedRasterBand(
GDALDataset *poDS,
int nBand );
774 VRTDerivedRasterBand(
GDALDataset *poDS,
int nBand,
776 virtual ~VRTDerivedRasterBand();
783 virtual int IGetDataCoverageStatus(
int nXOff,
int nYOff,
784 int nXSize,
int nYSize,
786 double* pdfDataPct)
override;
788 static CPLErr AddPixelFunction(
const char *pszFuncName,
790 static CPLErr AddPixelFunction(
const char *pszFuncName,
792 const char *pszMetadata);
794 static PixelFunc* GetPixelFunction(
const char *pszFuncName );
796 void SetPixelFunctionName(
const char *pszFuncName );
798 void SetPixelFunctionLanguage(
const char* pszLanguage );
801 std::map<CPLString, GDALDataset*>& )
override;
802 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
804 virtual double GetMinimum(
int *pbSuccess =
nullptr )
override;
805 virtual double GetMaximum(
int *pbSuccess =
nullptr )
override;
806 virtual CPLErr ComputeRasterMinMax(
int bApproxOK,
double* adfMinMax )
override;
807 virtual CPLErr ComputeStatistics(
int bApproxOK,
808 double *pdfMin,
double *pdfMax,
809 double *pdfMean,
double *pdfStdDev,
810 GDALProgressFunc pfnProgress,
811 void *pProgressData )
override;
812 virtual CPLErr GetHistogram(
double dfMin,
double dfMax,
813 int nBuckets,
GUIntBig * panHistogram,
814 int bIncludeOutOfRange,
int bApproxOK,
815 GDALProgressFunc pfnProgress,
816 void *pProgressData )
override;
818 static void Cleanup();
827 class CPL_DLL VRTRawRasterBand
CPL_NON_FINAL:
public VRTRasterBand
829 RawRasterBand *m_poRawRaster;
831 char *m_pszSourceFilename;
832 int m_bRelativeToVRT;
839 virtual ~VRTRawRasterBand();
842 std::map<CPLString, GDALDataset*>& )
override;
843 virtual CPLXMLNode * SerializeToXML(
const char *pszVRTPath )
override;
850 virtual CPLErr IReadBlock(
int,
int,
void * )
override;
851 virtual CPLErr IWriteBlock(
int,
int,
void * )
override;
853 CPLErr SetRawLink(
const char *pszFilename,
854 const char *pszVRTPath,
857 int nPixelOffset,
int nLineOffset,
858 const char *pszByteOrder );
865 char **papszOptions )
override;
867 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
868 int *pnMaxSize,
CPLHashSet* hSetFiles )
override;
881 virtual ~VRTDriver();
883 char **papszSourceParsers;
886 virtual char **
GetMetadata(
const char * pszDomain =
"" )
override;
888 const char * pszDomain =
"" )
override;
890 VRTSource *ParseSource(
CPLXMLNode *psSrc,
const char *pszVRTPath,
891 std::map<CPLString, GDALDataset*>& oMapSharedSources );
892 void AddSourceParser(
const char *pszElementName,
893 VRTSourceParser pfnParser );
900 class CPL_DLL VRTSimpleSource
CPL_NON_FINAL:
public VRTSource
906 std::map<CPLString, GDALDataset*>* m_poMapSharedSources =
nullptr;
916 void OpenSource()
const;
919 friend class VRTSourcedRasterBand;
920 friend class VRTDataset;
923 bool m_bGetMaskBand =
false;
925 double m_dfSrcXOff = 0;
926 double m_dfSrcYOff = 0;
927 double m_dfSrcXSize = 0;
928 double m_dfSrcYSize = 0;
930 double m_dfDstXOff = 0;
931 double m_dfDstYOff = 0;
932 double m_dfDstXSize = 0;
933 double m_dfDstYSize = 0;
936 int m_bNoDataSet =
false;
944 int m_bRelativeToVRTOri = -1;
946 int m_nExplicitSharedStatus = -1;
949 bool m_bDropRefOnSrcBand =
true;
951 int NeedMaxValAdjustment()
const;
953 double GetAdjustedNoDataValue()
const;
957 VRTSimpleSource(
const VRTSimpleSource* poSrcSource,
958 double dfXDstRatio,
double dfYDstRatio );
959 virtual ~VRTSimpleSource();
962 std::map<CPLString, GDALDataset*>& )
override;
963 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
965 void SetSrcBand(
const char* pszFilename,
int nBand );
968 void SetSrcWindow(
double,
double,
double,
double );
969 void SetDstWindow(
double,
double,
double,
double );
970 void SetNoDataValue(
double dfNoDataValue );
971 const CPLString& GetResampling()
const {
return m_osResampling; }
972 void SetResampling(
const char* pszResampling );
974 int GetSrcDstWindow(
double,
double,
double,
double,
976 double *pdfReqXOff,
double *pdfReqYOff,
977 double *pdfReqXSize,
double *pdfReqYSize,
978 int *,
int *,
int *,
int *,
979 int *,
int *,
int *,
int *,
983 int nXOff,
int nYOff,
int nXSize,
int nYSize,
984 void *pData,
int nBufXSize,
int nBufYSize,
989 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
990 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
991 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
992 double* adfMinMax )
override;
993 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
995 double *pdfMin,
double *pdfMax,
996 double *pdfMean,
double *pdfStdDev,
997 GDALProgressFunc pfnProgress,
998 void *pProgressData )
override;
999 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1000 double dfMin,
double dfMax,
1001 int nBuckets,
GUIntBig * panHistogram,
1002 int bIncludeOutOfRange,
int bApproxOK,
1003 GDALProgressFunc pfnProgress,
1004 void *pProgressData )
override;
1006 void DstToSrc(
double dfX,
double dfY,
1007 double &dfXOut,
double &dfYOut )
const;
1008 void SrcToDst(
double dfX,
double dfY,
1009 double &dfXOut,
double &dfYOut )
const;
1011 virtual void GetFileList(
char*** ppapszFileList,
int *pnSize,
1012 int *pnMaxSize,
CPLHashSet* hSetFiles )
override;
1014 virtual int IsSimpleSource()
override {
return TRUE; }
1015 virtual const char* GetType() {
return "SimpleSource"; }
1016 virtual CPLErr FlushCache(
bool bAtClosing)
override;
1020 int IsSameExceptBandNumber( VRTSimpleSource* poOtherSource );
1023 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1024 void * pData,
int nBufXSize,
int nBufYSize,
1026 int nBandCount,
int *panBandMap,
1031 void UnsetPreservedRelativeFilenames();
1033 void SetMaxValue(
int nVal ) { m_nMaxValue = nVal; }
1040 class VRTAveragedSource final:
public VRTSimpleSource
1045 VRTAveragedSource();
1047 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1048 void *pData,
int nBufXSize,
int nBufYSize,
1053 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1054 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1055 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
1056 double* adfMinMax )
override;
1057 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
1059 double *pdfMin,
double *pdfMax,
1060 double *pdfMean,
double *pdfStdDev,
1061 GDALProgressFunc pfnProgress,
1062 void *pProgressData )
override;
1063 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1064 double dfMin,
double dfMax,
1065 int nBuckets,
GUIntBig * panHistogram,
1066 int bIncludeOutOfRange,
int bApproxOK,
1067 GDALProgressFunc pfnProgress,
1068 void *pProgressData )
override;
1070 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1071 virtual const char* GetType()
override {
return "AveragedSource"; }
1082 VRT_SCALING_EXPONENTIAL,
1083 } VRTComplexSourceScaling;
1085 class CPL_DLL VRTComplexSource
CPL_NON_FINAL:
public VRTSimpleSource
1088 bool AreValuesUnchanged()
const;
1091 VRTComplexSourceScaling m_eScalingType;
1092 double m_dfScaleOff;
1093 double m_dfScaleRatio;
1096 int m_bSrcMinMaxDefined;
1101 double m_dfExponent;
1103 int m_nColorTableComponent;
1105 bool m_bUseMaskBand =
false;
1107 template <
class WorkingDT>
1108 CPLErr RasterIOInternal(
int nReqXOff,
int nReqYOff,
1109 int nReqXSize,
int nReqYSize,
1110 void *pData,
int nOutXSize,
int nOutYSize,
1118 VRTComplexSource(
const VRTComplexSource* poSrcSource,
1119 double dfXDstRatio,
double dfYDstRatio);
1120 virtual ~VRTComplexSource();
1123 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1124 void *pData,
int nBufXSize,
int nBufYSize,
1129 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1130 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1131 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
1132 double* adfMinMax )
override;
1133 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
1135 double *pdfMin,
double *pdfMax,
1136 double *pdfMean,
double *pdfStdDev,
1137 GDALProgressFunc pfnProgress,
1138 void *pProgressData )
override;
1139 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1140 double dfMin,
double dfMax,
1141 int nBuckets,
GUIntBig * panHistogram,
1142 int bIncludeOutOfRange,
int bApproxOK,
1143 GDALProgressFunc pfnProgress,
1144 void *pProgressData )
override;
1146 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1148 std::map<CPLString, GDALDataset*>& )
override;
1149 virtual const char* GetType()
override {
return "ComplexSource"; }
1151 double LookupValue(
double dfInput );
1153 void SetUseMaskBand(
bool bUseMaskBand) { m_bUseMaskBand = bUseMaskBand; }
1155 void SetLinearScaling(
double dfOffset,
double dfScale );
1156 void SetPowerScaling(
double dfExponent,
1161 void SetColorTableComponent(
int nComponent );
1163 double *m_padfLUTInputs;
1164 double *m_padfLUTOutputs;
1165 int m_nLUTItemCount;
1172 class VRTFilteredSource
CPL_NON_FINAL:
public VRTComplexSource
1180 int m_nSupportedTypesCount;
1183 int m_nExtraEdgePixels;
1186 VRTFilteredSource();
1187 virtual ~VRTFilteredSource();
1189 void SetExtraEdgePixels(
int );
1190 void SetFilteringDataTypesSupported(
int,
GDALDataType * );
1193 GByte *pabySrcData,
GByte *pabyDstData ) = 0;
1196 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1197 void *pData,
int nBufXSize,
int nBufYSize,
1207 class VRTKernelFilteredSource
CPL_NON_FINAL:
public VRTFilteredSource
1216 double *m_padfKernelCoefs;
1221 VRTKernelFilteredSource();
1222 virtual ~VRTKernelFilteredSource();
1225 std::map<CPLString, GDALDataset*>& )
override;
1226 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1229 GByte *pabySrcData,
GByte *pabyDstData )
override;
1231 CPLErr SetKernel(
int nKernelSize,
bool bSeparable,
double *padfCoefs );
1232 void SetNormalized(
int );
1239 class VRTAverageFilteredSource final:
public VRTKernelFilteredSource
1244 explicit VRTAverageFilteredSource(
int nKernelSize );
1245 virtual ~VRTAverageFilteredSource();
1248 std::map<CPLString, GDALDataset*>& )
override;
1249 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1255 class VRTFuncSource final:
public VRTSource
1261 virtual ~VRTFuncSource();
1264 std::map<CPLString, GDALDataset*>& )
override {
return CE_Failure; }
1265 virtual CPLXMLNode *SerializeToXML(
const char *pszVRTPath )
override;
1268 int nXOff,
int nYOff,
int nXSize,
int nYSize,
1269 void *pData,
int nBufXSize,
int nBufYSize,
1274 virtual double GetMinimum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1275 virtual double GetMaximum(
int nXSize,
int nYSize,
int *pbSuccess )
override;
1276 virtual CPLErr ComputeRasterMinMax(
int nXSize,
int nYSize,
int bApproxOK,
1277 double* adfMinMax )
override;
1278 virtual CPLErr ComputeStatistics(
int nXSize,
int nYSize,
1280 double *pdfMin,
double *pdfMax,
1281 double *pdfMean,
double *pdfStdDev,
1282 GDALProgressFunc pfnProgress,
1283 void *pProgressData )
override;
1284 virtual CPLErr GetHistogram(
int nXSize,
int nYSize,
1285 double dfMin,
double dfMax,
1286 int nBuckets,
GUIntBig * panHistogram,
1287 int bIncludeOutOfRange,
int bApproxOK,
1288 GDALProgressFunc pfnProgress,
1289 void *pProgressData )
override;
1303 #define TMP_CPL_DLL CPL_DLL
1318 explicit Ref(VRTGroup* ptr): m_ptr(ptr) {}
1319 Ref(
const Ref&) =
delete;
1320 Ref& operator=(
const Ref&) =
delete;
1324 std::shared_ptr<Ref> m_poSharedRefRootGroup{};
1325 std::weak_ptr<Ref> m_poWeakRefRootGroup{};
1326 std::shared_ptr<Ref> m_poRefSelf{};
1328 std::string m_osFilename{};
1329 mutable bool m_bDirty =
false;
1330 std::string m_osVRTPath{};
1331 std::map<std::string, std::shared_ptr<VRTGroup>> m_oMapGroups{};
1332 std::map<std::string, std::shared_ptr<VRTMDArray>> m_oMapMDArrays{};
1333 std::map<std::string, std::shared_ptr<VRTAttribute>> m_oMapAttributes{};
1334 std::map<std::string, std::shared_ptr<VRTDimension>> m_oMapDimensions{};
1336 std::shared_ptr<VRTGroup> OpenGroupInternal(
const std::string& osName)
const;
1337 void SetRootGroupRef(
const std::weak_ptr<Ref>& rgRef);
1338 std::weak_ptr<Ref> GetRootGroupRef()
const;
1342 VRTGroup(
const std::string& osParentName,
const std::string& osName);
1345 bool XMLInit(
const std::shared_ptr<VRTGroup>& poRoot,
1346 const std::shared_ptr<VRTGroup>& poThisGroup,
1348 const char* pszVRTPath);
1350 std::vector<std::string> GetMDArrayNames(
CSLConstList papszOptions)
const override;
1351 std::shared_ptr<GDALMDArray> OpenMDArray(
const std::string& osName,
1354 std::vector<std::string> GetGroupNames(
CSLConstList papszOptions)
const override;
1355 std::shared_ptr<GDALGroup> OpenGroup(
const std::string& osName,
1358 return OpenGroupInternal(osName);
1361 std::vector<std::shared_ptr<GDALDimension>> GetDimensions(
CSLConstList)
const override;
1363 std::vector<std::shared_ptr<GDALAttribute>> GetAttributes(
CSLConstList)
const override;
1365 std::shared_ptr<VRTDimension> GetDimension(
const std::string& name)
const {
1366 auto oIter = m_oMapDimensions.find(name);
1367 return oIter == m_oMapDimensions.end() ? nullptr : oIter->second;
1369 std::shared_ptr<VRTDimension> GetDimensionFromFullName(
const std::string& name,
1370 bool bEmitError)
const;
1372 std::shared_ptr<GDALGroup> CreateGroup(
const std::string& osName,
1375 std::shared_ptr<GDALDimension> CreateDimension(
const std::string& osName,
1376 const std::string& osType,
1377 const std::string& osDirection,
1381 std::shared_ptr<GDALAttribute> CreateAttribute(
1382 const std::string& osName,
1383 const std::vector<GUInt64>& anDimensions,
1387 std::shared_ptr<GDALMDArray> CreateMDArray(
const std::string& osName,
1388 const std::vector<std::shared_ptr<GDALDimension>>& aoDimensions,
1392 void SetIsRootGroup();
1394 const std::shared_ptr<Ref>& GetRef()
const {
return m_poRefSelf; }
1395 VRTGroup* GetRootGroup()
const;
1397 const std::string& GetVRTPath()
const {
return m_osVRTPath; }
1399 void SetFilename(
const std::string& osFilename) { m_osFilename = osFilename; }
1400 const std::string& GetFilename()
const {
return m_osFilename; }
1401 void Serialize()
const;
1402 CPLXMLNode* SerializeToXML(
const char *pszVRTPathIn )
const;
1403 void Serialize(
CPLXMLNode* psParent,
const char *pszVRTPathIn)
const;
1412 std::weak_ptr<VRTGroup::Ref> m_poGroupRef;
1413 std::string m_osIndexingVariableName;
1416 VRTDimension(
const std::shared_ptr<VRTGroup::Ref>& poGroupRef,
1417 const std::string& osParentName,
1418 const std::string& osName,
1419 const std::string& osType,
1420 const std::string& osDirection,
1422 const std::string& osIndexingVariableName):
1423 GDALDimension(osParentName, osName, osType, osDirection, nSize),
1424 m_poGroupRef(poGroupRef),
1425 m_osIndexingVariableName(osIndexingVariableName)
1428 VRTGroup* GetGroup()
const;
1430 static std::shared_ptr<VRTDimension> Create(
const std::shared_ptr<VRTGroup>& poThisGroup,
1431 const std::string& osParentName,
1448 std::vector<std::string> m_aosList{};
1449 std::vector<std::shared_ptr<GDALDimension>> m_dims{};
1453 bool IRead(
const GUInt64* arrayStartIdx,
1454 const size_t* count,
1458 void* pDstBuffer)
const override;
1460 bool IWrite(
const GUInt64* arrayStartIdx,
1461 const size_t* count,
1465 const void* pSrcBuffer)
override;
1469 VRTAttribute(
const std::string& osParentName,
1470 const std::string& osName,
1472 std::vector<std::string>&& aosList):
1476 m_aosList(std::move(aosList))
1478 if( m_aosList.size() > 1 )
1480 m_dims.emplace_back(std::make_shared<GDALDimension>(
1481 std::string(),
"dim",
1482 std::string(), std::string(), m_aosList.size()));
1486 VRTAttribute(
const std::string& osParentName,
1487 const std::string& osName,
1496 m_dims.emplace_back(std::make_shared<GDALDimension>(
1497 std::string(),
"dim",
1498 std::string(), std::string(), nDim));
1502 static bool CreationCommonChecks(
const std::string& osName,
1503 const std::vector<GUInt64>& anDimensions,
1504 const std::map<std::string, std::shared_ptr<VRTAttribute>>& oMapAttributes);
1506 static std::shared_ptr<VRTAttribute> Create(
const std::string& osParentName,
1509 const std::vector<std::shared_ptr<GDALDimension>>&
GetDimensions()
const override {
return m_dims; }
1520 class VRTMDArraySource
1523 virtual ~VRTMDArraySource() =
default;
1525 virtual bool Read(
const GUInt64* arrayStartIdx,
1526 const size_t* count,
1530 void* pDstBuffer)
const = 0;
1532 virtual void Serialize(
CPLXMLNode* psParent,
const char* pszVRTPath)
const = 0;
1542 friend class VRTGroup;
1544 std::weak_ptr<VRTGroup::Ref> m_poGroupRef;
1545 std::string m_osVRTPath{};
1548 std::vector<std::shared_ptr<GDALDimension>> m_dims;
1549 std::map<std::string, std::shared_ptr<VRTAttribute>> m_oMapAttributes{};
1550 std::vector<std::unique_ptr<VRTMDArraySource>> m_sources{};
1551 std::shared_ptr<OGRSpatialReference> m_poSRS{};
1552 std::vector<GByte> m_abyNoData{};
1553 std::string m_osUnit{};
1554 double m_dfScale = 1.0;
1555 double m_dfOffset = 0.0;
1556 bool m_bHasScale =
false;
1557 bool m_bHasOffset =
false;
1558 std::string m_osFilename{};
1560 bool IRead(
const GUInt64* arrayStartIdx,
1561 const size_t* count,
1565 void* pDstBuffer)
const override;
1570 VRTMDArray(
const std::shared_ptr<VRTGroup::Ref>& poGroupRef,
1571 const std::string& osParentName,
1572 const std::string& osName,
1574 std::vector<std::shared_ptr<GDALDimension>>&& dims,
1575 std::map<std::string, std::shared_ptr<VRTAttribute>>&& oMapAttributes) :
1578 m_poGroupRef(poGroupRef),
1579 m_osVRTPath(poGroupRef->m_ptr->GetVRTPath()),
1581 m_dims(std::move(dims)),
1582 m_oMapAttributes(std::move(oMapAttributes)),
1583 m_osFilename(poGroupRef->m_ptr->GetFilename())
1587 VRTMDArray(
const std::shared_ptr<VRTGroup::Ref>& poGroupRef,
1588 const std::string& osParentName,
1589 const std::string& osName,
1590 const std::vector<std::shared_ptr<GDALDimension>>& dims,
1594 m_poGroupRef(poGroupRef),
1595 m_osVRTPath(poGroupRef->m_ptr->GetVRTPath()),
1598 m_osFilename(poGroupRef->m_ptr->GetFilename())
1602 bool IsWritable()
const override {
return false; }
1604 const std::string&
GetFilename()
const override {
return m_osFilename; }
1606 static std::shared_ptr<VRTMDArray> Create(
const std::shared_ptr<VRTGroup>& poThisGroup,
1607 const std::string& osParentName,
1610 const std::vector<std::shared_ptr<GDALDimension>>&
GetDimensions()
const override {
return m_dims; }
1618 std::shared_ptr<OGRSpatialReference>
GetSpatialRef()
const override {
return m_poSRS; }
1624 const std::string&
GetUnit()
const override {
return m_osUnit; }
1626 bool SetUnit(
const std::string& osUnit)
override {
1627 m_osUnit = osUnit;
return true; }
1631 if( pbHasOffset) *pbHasOffset = m_bHasOffset;
1638 if( pbHasScale) *pbHasScale = m_bHasScale;
1644 { SetDirty(); m_bHasOffset =
true; m_dfOffset = dfOffset;
return true; }
1647 { SetDirty(); m_bHasScale =
true; m_dfScale = dfScale;
return true; }
1649 void AddSource(std::unique_ptr<VRTMDArraySource>&& poSource);
1652 const std::string& osName,
1653 const std::vector<GUInt64>& anDimensions,
1662 GDALProgressFunc pfnProgress,
1663 void * pProgressData)
override;
1665 void Serialize(
CPLXMLNode* psParent,
const char *pszVRTPathIn )
const;
1667 VRTGroup* GetGroup()
const;
1669 const std::string& GetVRTPath()
const {
return m_osVRTPath; }
1676 class VRTMDArraySourceInlinedValues final:
public VRTMDArraySource
1678 const VRTMDArray* m_poDstArray =
nullptr;
1679 bool m_bIsConstantValue;
1680 std::vector<GUInt64> m_anOffset{};
1681 std::vector<size_t> m_anCount{};
1682 std::vector<GByte> m_abyValues{};
1683 std::vector<size_t> m_anInlinedArrayStrideInBytes{};
1686 VRTMDArraySourceInlinedValues(
const VRTMDArraySourceInlinedValues&) =
delete;
1687 VRTMDArraySourceInlinedValues& operator=(
const VRTMDArraySourceInlinedValues&) =
delete;
1690 VRTMDArraySourceInlinedValues(
const VRTMDArray* poDstArray,
1691 bool bIsConstantValue,
1692 std::vector<GUInt64>&& anOffset,
1693 std::vector<size_t>&& anCount,
1694 std::vector<GByte>&& abyValues):
1695 m_poDstArray(poDstArray),
1696 m_bIsConstantValue(bIsConstantValue),
1697 m_anOffset(std::move(anOffset)),
1698 m_anCount(std::move(anCount)),
1699 m_abyValues(std::move(abyValues)),
1700 m_dt(poDstArray->GetDataType())
1702 const auto nDims(poDstArray->GetDimensionCount());
1703 m_anInlinedArrayStrideInBytes.resize(nDims);
1704 if( !bIsConstantValue && nDims > 0 )
1706 m_anInlinedArrayStrideInBytes.back() = poDstArray->GetDataType().GetSize();
1707 for(
size_t i = nDims - 1; i > 0; )
1710 m_anInlinedArrayStrideInBytes[i] =
1711 m_anInlinedArrayStrideInBytes[i+1] * m_anCount[i+1];
1716 ~VRTMDArraySourceInlinedValues();
1718 static std::unique_ptr<VRTMDArraySourceInlinedValues> Create(
1719 const VRTMDArray* poDstArray,
1722 bool Read(
const GUInt64* arrayStartIdx,
1723 const size_t* count,
1727 void* pDstBuffer)
const override;
1729 void Serialize(
CPLXMLNode* psParent,
const char* pszVRTPath)
const override;
1736 class VRTMDArraySourceRegularlySpaced final:
public VRTMDArraySource
1739 double m_dfIncrement;
1742 VRTMDArraySourceRegularlySpaced(
1743 double dfStart,
double dfIncrement):
1745 m_dfIncrement(dfIncrement)
1749 bool Read(
const GUInt64* arrayStartIdx,
1750 const size_t* count,
1754 void* pDstBuffer)
const override;
1756 void Serialize(
CPLXMLNode* psParent,
const char* pszVRTPath)
const override;
1763 class VRTMDArraySourceFromArray final:
public VRTMDArraySource
1765 const VRTMDArray* m_poDstArray =
nullptr;
1766 bool m_bRelativeToVRTSet =
false;
1767 bool m_bRelativeToVRT =
false;
1768 std::string m_osFilename{};
1769 std::string m_osArray{};
1770 std::string m_osBand{};
1771 std::vector<int> m_anTransposedAxis{};
1772 std::string m_osViewExpr{};
1773 std::vector<GUInt64> m_anSrcOffset{};
1774 mutable std::vector<GUInt64> m_anCount{};
1775 std::vector<GUInt64> m_anStep{};
1776 std::vector<GUInt64> m_anDstOffset{};
1778 VRTMDArraySourceFromArray(
const VRTMDArraySourceFromArray&) =
delete;
1779 VRTMDArraySourceFromArray& operator=(
const VRTMDArraySourceFromArray&) =
delete;
1782 VRTMDArraySourceFromArray(
const VRTMDArray* poDstArray,
1783 bool bRelativeToVRTSet,
1784 bool bRelativeToVRT,
1785 const std::string& osFilename,
1786 const std::string& osArray,
1787 const std::string& osBand,
1788 std::vector<int>&& anTransposedAxis,
1789 const std::string& osViewExpr,
1790 std::vector<GUInt64>&& anSrcOffset,
1791 std::vector<GUInt64>&& anCount,
1792 std::vector<GUInt64>&& anStep,
1793 std::vector<GUInt64>&& anDstOffset):
1794 m_poDstArray(poDstArray),
1795 m_bRelativeToVRTSet(bRelativeToVRTSet),
1796 m_bRelativeToVRT(bRelativeToVRT),
1797 m_osFilename(osFilename),
1800 m_anTransposedAxis(std::move(anTransposedAxis)),
1801 m_osViewExpr(osViewExpr),
1802 m_anSrcOffset(std::move(anSrcOffset)),
1803 m_anCount(std::move(anCount)),
1804 m_anStep(std::move(anStep)),
1805 m_anDstOffset(std::move(anDstOffset))
1809 ~VRTMDArraySourceFromArray()
override;
1811 static std::unique_ptr<VRTMDArraySourceFromArray> Create(
1812 const VRTMDArray* poDstArray,
1815 bool Read(
const GUInt64* arrayStartIdx,
1816 const size_t* count,
1820 void* pDstBuffer)
const override;
1822 void Serialize(
CPLXMLNode* psParent,
const char* pszVRTPath)
const override;
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:442
Convenient string class based on std::string.
Definition: cpl_string.h:333
Abstract class, implemented by GDALAttribute and GDALMDArray.
Definition: gdal_priv.h:2079
virtual const std::vector< std::shared_ptr< GDALDimension > > & GetDimensions() const =0
Return the dimensions of an attribute/array.
virtual const GDALExtendedDataType & GetDataType() const =0
Return the data type of an attribute/array.
Class modeling an attribute that has a name, a value and a type, and is typically used to describe a ...
Definition: gdal_priv.h:2255
A color table / palette.
Definition: gdal_priv.h:1023
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:340
int Dereference()
Subtract one from dataset reference count.
Definition: gdaldataset.cpp:1385
virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList, const OGRSpatialReference *poGCP_SRS)
Assign GCPs.
Definition: gdaldataset.cpp:1804
int GetShared() const
Returns shared flag.
Definition: gdaldataset.cpp:1457
Class modeling a a dimension / axis used to index multidimensional arrays.
Definition: gdal_priv.h:2649
virtual std::shared_ptr< GDALMDArray > GetIndexingVariable() const
Return the variable that is used to index the dimension (if there is one).
Definition: gdalmultidim.cpp:8033
virtual bool SetIndexingVariable(std::shared_ptr< GDALMDArray > poIndexingVariable)
Set the variable that is used to index the dimension.
Definition: gdalmultidim.cpp:8054
Format specific driver.
Definition: gdal_priv.h:1486
Class used to represent potentially complex data types.
Definition: gdal_priv.h:1803
Class modeling a named container of GDALAttribute, GDALMDArray, OGRLayer or other GDALGroup.
Definition: gdal_priv.h:1977
virtual std::shared_ptr< GDALAttribute > CreateAttribute(const std::string &osName, const std::vector< GUInt64 > &anDimensions, const GDALExtendedDataType &oDataType, CSLConstList papszOptions=nullptr)
Create an attribute within a GDALMDArray or GDALGroup.
Definition: gdalmultidim.cpp:254
virtual std::vector< std::shared_ptr< GDALAttribute > > GetAttributes(CSLConstList papszOptions=nullptr) const
Return the list of attributes contained in a GDALMDArray or GDALGroup.
Definition: gdalmultidim.cpp:223
Class modeling a multi-dimensional array.
Definition: gdal_priv.h:2373
virtual bool SetUnit(const std::string &osUnit)
Set the variable unit.
Definition: gdalmultidim.cpp:2064
virtual bool CopyFrom(GDALDataset *poSrcDS, const GDALMDArray *poSrcArray, bool bStrict, GUInt64 &nCurCost, const GUInt64 nTotalCost, GDALProgressFunc pfnProgress, void *pProgressData)
Copy the content of an array into a new (generally empty) array.
Definition: gdalmultidim.cpp:3180
virtual bool IsWritable() const =0
Return whether an array is writable.
virtual bool SetScale(double dfScale, GDALDataType eStorageType=GDT_Unknown)
Set the scale value to apply to raw values.
Definition: gdalmultidim.cpp:2260
virtual bool SetRawNoDataValue(const void *pRawNoData)
Set the nodata value as a "raw" value.
Definition: gdalmultidim.cpp:2205
virtual double GetOffset(bool *pbHasOffset=nullptr, GDALDataType *peStorageType=nullptr) const
Get the offset value to apply to raw values.
Definition: gdalmultidim.cpp:2348
virtual const std::string & GetFilename() const =0
Return the filename that contains that array.
virtual const void * GetRawNoDataValue() const
Return the nodata value as a "raw" value.
Definition: gdalmultidim.cpp:2140
virtual double GetScale(bool *pbHasScale=nullptr, GDALDataType *peStorageType=nullptr) const
Get the scale value to apply to raw values.
Definition: gdalmultidim.cpp:2318
virtual std::shared_ptr< OGRSpatialReference > GetSpatialRef() const
Return the spatial reference system object associated with the array.
Definition: gdalmultidim.cpp:2114
virtual bool SetSpatialRef(const OGRSpatialReference *poSRS)
Assign a spatial reference system object to the the array.
Definition: gdalmultidim.cpp:2100
virtual bool SetOffset(double dfOffset, GDALDataType eStorageType=GDT_Unknown)
Set the offset value to apply to raw values.
Definition: gdalmultidim.cpp:2289
virtual const std::string & GetUnit() const
Return the array unit.
Definition: gdalmultidim.cpp:2086
Object with metadata.
Definition: gdal_priv.h:136
virtual CPLErr SetMetadata(char **papszMetadata, const char *pszDomain="")
Set metadata.
Definition: gdalmajorobject.cpp:292
virtual char ** GetMetadataDomainList()
Fetch list of metadata domains.
Definition: gdalmajorobject.cpp:161
virtual char ** GetMetadata(const char *pszDomain="")
Fetch metadata.
Definition: gdalmajorobject.cpp:249
Class for dataset open functions.
Definition: gdal_priv.h:269
Pansharpening operation class.
Definition: gdalpansharpen.h:189
The GDALRasterAttributeTable (or RAT) class is used to encapsulate a table used to provide attribute ...
Definition: gdal_rat.h:48
A single raster band (or channel).
Definition: gdal_priv.h:1131
GDALDataset * GetDataset()
Fetch the owning dataset handle.
Definition: gdalrasterband.cpp:2847
High level image warping class.
Definition: gdalwarper.h:463
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:158
CPLErr
Error category.
Definition: cpl_error.h:53
struct _CPLHashSet CPLHashSet
Opaque type for a hash set.
Definition: cpl_hash_set.h:52
Definitions for CPL mini XML Parser/Serializer.
#define CPL_NON_FINAL
Mark that a class is explicitly recognized as non-final.
Definition: cpl_port.h:948
unsigned long long GUIntBig
Large unsigned integer type (generally 64-bit unsigned integer type).
Definition: cpl_port.h:247
GIntBig GInt64
Signed 64 bit integer type.
Definition: cpl_port.h:263
GIntBig GPtrDiff_t
Integer type large enough to hold the difference between 2 addresses.
Definition: cpl_port.h:282
#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:955
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1169
GUIntBig GUInt64
Unsigned 64 bit integer type.
Definition: cpl_port.h:265
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:215
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:244
struct CPLVirtualMem CPLVirtualMem
Opaque type that represents a virtual memory mapping.
Definition: cpl_virtualmem.h:62
GUIntBig vsi_l_offset
Type for a file offset.
Definition: cpl_vsi.h:140
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:286
GDALAccess
Definition: gdal.h:115
@ GA_ReadOnly
Definition: gdal.h:116
void GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:3727
GDALDataType
Definition: gdal.h:62
@ GDT_Unknown
Definition: gdal.h:63
CPLErr(* GDALDerivedPixelFuncWithArgs)(void **papoSources, int nSources, void *pData, int nBufXSize, int nBufYSize, GDALDataType eSrcType, GDALDataType eBufType, int nPixelSpace, int nLineSpace, CSLConstList papszFunctionArgs)
Type of functions to pass to GDALAddDerivedBandPixelFuncWithArgs.
Definition: gdal.h:941
GDALColorInterp
Definition: gdal.h:204
GDALRWFlag
Definition: gdal.h:121
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:933
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:271
Public (C callable) entry points for virtual GDAL dataset objects.
#define VRT_NODATA_UNSET
Special value to indicate that nodata is not set.
Definition: gdal_vrt.h:45
void * VRTDatasetH
Opaque type for a VRT dataset.
Definition: gdal_vrt.h:76
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
VRTDatasetH VRTCreate(int, int)
Definition: vrtdataset.cpp:79
Document node structure.
Definition: cpl_minixml.h:70
Ground Control Point.
Definition: gdal.h:711