GDAL
vrtdataset.h
1 /******************************************************************************
2  * $Id$
3  *
4  * Project: Virtual GDAL Datasets
5  * Purpose: Declaration of virtual gdal dataset classes.
6  * Author: Frank Warmerdam, warmerdam@pobox.com
7  *
8  ******************************************************************************
9  * Copyright (c) 2001, Frank Warmerdam <warmerdam@pobox.com>
10  * Copyright (c) 2007-2013, Even Rouault <even dot rouault at mines-paris dot org>
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be included
20  * in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28  * DEALINGS IN THE SOFTWARE.
29  ****************************************************************************/
30 
31 #ifndef VIRTUALDATASET_H_INCLUDED
32 #define VIRTUALDATASET_H_INCLUDED
33 
34 #ifndef DOXYGEN_SKIP
35 
36 #include "cpl_hash_set.h"
37 #include "gdal_pam.h"
38 #include "gdal_priv.h"
39 #include "gdal_rat.h"
40 #include "gdal_vrt.h"
41 #include "gdal_rat.h"
42 
43 #include <map>
44 #include <memory>
45 #include <vector>
46 
47 int VRTApplyMetadata( CPLXMLNode *, GDALMajorObject * );
48 CPLXMLNode *VRTSerializeMetadata( GDALMajorObject * );
49 CPLErr GDALRegisterDefaultPixelFunc();
50 
51 #if 0
52 int VRTWarpedOverviewTransform( void *pTransformArg, int bDstToSrc,
53  int nPointCount,
54  double *padfX, double *padfY, double *padfZ,
55  int *panSuccess );
56 void* VRTDeserializeWarpedOverviewTransformer( CPLXMLNode *psTree );
57 #endif
58 
59 /************************************************************************/
60 /* VRTOverviewInfo() */
61 /************************************************************************/
62 class VRTOverviewInfo
63 {
64  CPL_DISALLOW_COPY_ASSIGN(VRTOverviewInfo)
65 
66 public:
67  CPLString osFilename{};
68  int nBand = 0;
69  GDALRasterBand *poBand = nullptr;
70  int bTriedToOpen = FALSE;
71 
72  VRTOverviewInfo() = default;
73  VRTOverviewInfo(VRTOverviewInfo&& oOther) noexcept:
74  osFilename(std::move(oOther.osFilename)),
75  nBand(oOther.nBand),
76  poBand(oOther.poBand),
77  bTriedToOpen(oOther.bTriedToOpen)
78  {
79  oOther.poBand = nullptr;
80  }
81 
82  ~VRTOverviewInfo() {
83  if( poBand == nullptr )
84  /* do nothing */;
85  else if( poBand->GetDataset()->GetShared() )
86  GDALClose( /* (GDALDatasetH) */ poBand->GetDataset() );
87  else
88  poBand->GetDataset()->Dereference();
89  }
90 };
91 
92 /************************************************************************/
93 /* VRTSource */
94 /************************************************************************/
95 
96 class CPL_DLL VRTSource
97 {
98 public:
99  virtual ~VRTSource();
100 
101  virtual CPLErr RasterIO( GDALDataType eBandDataType,
102  int nXOff, int nYOff, int nXSize, int nYSize,
103  void *pData, int nBufXSize, int nBufYSize,
104  GDALDataType eBufType,
105  GSpacing nPixelSpace, GSpacing nLineSpace,
106  GDALRasterIOExtraArg* psExtraArg ) = 0;
107 
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,
113  int bApproxOK,
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;
124 
125  virtual CPLErr XMLInit( CPLXMLNode *psTree, const char *, void* ) = 0;
126  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) = 0;
127 
128  virtual void GetFileList(char*** ppapszFileList, int *pnSize,
129  int *pnMaxSize, CPLHashSet* hSetFiles);
130 
131  virtual int IsSimpleSource() { return FALSE; }
132  virtual CPLErr FlushCache() { return CE_None; }
133 };
134 
135 typedef VRTSource *(*VRTSourceParser)(CPLXMLNode *, const char *, void* pUniqueHandle);
136 
137 VRTSource *VRTParseCoreSources( CPLXMLNode *psTree, const char *, void* pUniqueHandle );
138 VRTSource *VRTParseFilterSources( CPLXMLNode *psTree, const char *, void* pUniqueHandle );
139 
140 /************************************************************************/
141 /* VRTDataset */
142 /************************************************************************/
143 
144 class VRTRasterBand;
145 
146 template<class T> struct VRTFlushCacheStruct
147 {
148  static void FlushCache(T& obj);
149 };
150 
151 class VRTWarpedDataset;
152 class VRTPansharpenedDataset;
153 
154 class CPL_DLL VRTDataset : public GDALDataset
155 {
156  friend class VRTRasterBand;
157  friend struct VRTFlushCacheStruct<VRTDataset>;
158  friend struct VRTFlushCacheStruct<VRTWarpedDataset>;
159  friend struct VRTFlushCacheStruct<VRTPansharpenedDataset>;
160 
161  OGRSpatialReference* m_poSRS = nullptr;
162 
163  int m_bGeoTransformSet;
164  double m_adfGeoTransform[6];
165 
166  int m_nGCPCount;
167  GDAL_GCP *m_pasGCPList;
168  OGRSpatialReference *m_poGCP_SRS = nullptr;
169 
170  int m_bNeedsFlush;
171  int m_bWritable;
172 
173  char *m_pszVRTPath;
174 
175  VRTRasterBand *m_poMaskBand;
176 
177  int m_bCompatibleForDatasetIO;
178  int CheckCompatibleForDatasetIO();
179  void ExpandProxyBands();
180 
181  std::vector<GDALDataset*> m_apoOverviews;
182  std::vector<GDALDataset*> m_apoOverviewsBak;
183  char **m_papszXMLVRTMetadata;
184 
185  VRTRasterBand* InitBand(const char* pszSubclass, int nBand,
186  bool bAllowPansharpened);
187 
188  CPL_DISALLOW_COPY_ASSIGN(VRTDataset)
189 
190  protected:
191  virtual int CloseDependentDatasets() override;
192 
193  public:
194  VRTDataset(int nXSize, int nYSize);
195  virtual ~VRTDataset();
196 
197  void SetNeedsFlush() { m_bNeedsFlush = TRUE; }
198  virtual void FlushCache() override;
199 
200  void SetWritable(int bWritableIn) { m_bWritable = bWritableIn; }
201 
202  virtual CPLErr CreateMaskBand( int nFlags ) override;
203  void SetMaskBand(VRTRasterBand* poMaskBand);
204 
205  const OGRSpatialReference* GetSpatialRef() const override { return m_poSRS; }
206  CPLErr SetSpatialRef(const OGRSpatialReference* poSRS) override;
207 
208  virtual CPLErr GetGeoTransform( double * ) override;
209  virtual CPLErr SetGeoTransform( double * ) override;
210 
211  virtual CPLErr SetMetadata( char **papszMetadata,
212  const char *pszDomain = "" ) override;
213  virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
214  const char *pszDomain = "" ) override;
215 
216  virtual char** GetMetadata( const char *pszDomain = "" ) override;
217 
218  virtual int GetGCPCount() override;
219  const OGRSpatialReference* GetGCPSpatialRef() const override { return m_poGCP_SRS; }
220  virtual const GDAL_GCP *GetGCPs() override;
221  using GDALDataset::SetGCPs;
222  CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
223  const OGRSpatialReference* poSRS ) override;
224 
225  virtual CPLErr AddBand( GDALDataType eType,
226  char **papszOptions=nullptr ) override;
227 
228  virtual char **GetFileList() override;
229 
230  virtual CPLErr IRasterIO( GDALRWFlag eRWFlag,
231  int nXOff, int nYOff, int nXSize, int nYSize,
232  void * pData, int nBufXSize, int nBufYSize,
233  GDALDataType eBufType,
234  int nBandCount, int *panBandMap,
235  GSpacing nPixelSpace, GSpacing nLineSpace,
236  GSpacing nBandSpace,
237  GDALRasterIOExtraArg* psExtraArg) override;
238 
239  virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
240  int nBufXSize, int nBufYSize,
241  GDALDataType eDT,
242  int nBandCount, int *panBandList,
243  char **papszOptions ) override;
244 
245  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath);
246  virtual CPLErr XMLInit( CPLXMLNode *, const char * );
247 
248  virtual CPLErr IBuildOverviews( const char *, int, int *,
249  int, int *, GDALProgressFunc, void * ) override;
250 
251  /* Used by PDF driver for example */
252  GDALDataset* GetSingleSimpleSource();
253  void BuildVirtualOverviews();
254 
255  void UnsetPreservedRelativeFilenames();
256 
257  static int Identify( GDALOpenInfo * );
258  static GDALDataset *Open( GDALOpenInfo * );
259  static GDALDataset *OpenXML( const char *, const char * = nullptr,
260  GDALAccess eAccess = GA_ReadOnly );
261  static GDALDataset *Create( const char * pszName,
262  int nXSize, int nYSize, int nBands,
263  GDALDataType eType, char ** papszOptions );
264  static CPLErr Delete( const char * pszFilename );
265 };
266 
267 /************************************************************************/
268 /* VRTWarpedDataset */
269 /************************************************************************/
270 
271 class GDALWarpOperation;
272 class VRTWarpedRasterBand;
273 
274 class CPL_DLL VRTWarpedDataset : public VRTDataset
275 {
276  int m_nBlockXSize;
277  int m_nBlockYSize;
278  GDALWarpOperation *m_poWarper;
279 
280  int m_nOverviewCount;
281  VRTWarpedDataset **m_papoOverviews;
282  int m_nSrcOvrLevel;
283 
284  void CreateImplicitOverviews();
285 
286  struct VerticalShiftGrid
287  {
288  CPLString osVGrids;
289  int bInverse;
290  double dfToMeterSrc;
291  double dfToMeterDest;
292  CPLStringList aosOptions;
293  };
294  std::vector<VerticalShiftGrid> m_aoVerticalShiftGrids;
295 
296  friend class VRTWarpedRasterBand;
297 
298  CPL_DISALLOW_COPY_ASSIGN(VRTWarpedDataset)
299 
300  protected:
301  virtual int CloseDependentDatasets() override;
302 
303 public:
304  VRTWarpedDataset( int nXSize, int nYSize );
305  virtual ~VRTWarpedDataset();
306 
307  virtual void FlushCache() override;
308 
309  CPLErr Initialize( /* GDALWarpOptions */ void * );
310 
311  virtual CPLErr IBuildOverviews( const char *, int, int *,
312  int, int *, GDALProgressFunc, void * ) override;
313 
314  virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
315  const char *pszDomain = "" ) override;
316 
317  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) override;
318  virtual CPLErr XMLInit( CPLXMLNode *, const char * ) override;
319 
320  virtual CPLErr AddBand( GDALDataType eType,
321  char **papszOptions=nullptr ) override;
322 
323  virtual char **GetFileList() override;
324 
325  CPLErr ProcessBlock( int iBlockX, int iBlockY );
326 
327  void GetBlockSize( int *, int * ) const;
328 
329  void SetApplyVerticalShiftGrid(const char* pszVGrids,
330  int bInverse,
331  double dfToMeterSrc,
332  double dfToMeterDest,
333  char** papszOptions );
334 };
335 
336 /************************************************************************/
337 /* VRTPansharpenedDataset */
338 /************************************************************************/
339 
341 
342 typedef enum
343 {
344  GTAdjust_Union,
345  GTAdjust_Intersection,
346  GTAdjust_None,
347  GTAdjust_NoneWithoutWarning
348 } GTAdjustment;
349 
350 class VRTPansharpenedDataset : public VRTDataset
351 {
352  friend class VRTPansharpenedRasterBand;
353 
354  int m_nBlockXSize;
355  int m_nBlockYSize;
356  GDALPansharpenOperation* m_poPansharpener;
357  VRTPansharpenedDataset* m_poMainDataset;
358  std::vector<VRTPansharpenedDataset*> m_apoOverviewDatasets;
359  // Map from absolute to relative.
360  std::map<CPLString,CPLString> m_oMapToRelativeFilenames;
361 
362  int m_bLoadingOtherBands;
363 
364  GByte *m_pabyLastBufferBandRasterIO;
365  int m_nLastBandRasterIOXOff;
366  int m_nLastBandRasterIOYOff;
367  int m_nLastBandRasterIOXSize;
368  int m_nLastBandRasterIOYSize;
369  GDALDataType m_eLastBandRasterIODataType;
370 
371  GTAdjustment m_eGTAdjustment;
372  int m_bNoDataDisabled;
373 
374  std::vector<GDALDataset*> m_apoDatasetsToClose;
375 
376  CPL_DISALLOW_COPY_ASSIGN(VRTPansharpenedDataset)
377 
378  protected:
379  virtual int CloseDependentDatasets() override;
380 
381 public:
382  VRTPansharpenedDataset( int nXSize, int nYSize );
383  virtual ~VRTPansharpenedDataset();
384 
385  virtual void FlushCache() override;
386 
387  virtual CPLErr XMLInit( CPLXMLNode *, const char * ) override;
388  virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath ) override;
389 
390  CPLErr XMLInit( CPLXMLNode *psTree, const char *pszVRTPath,
391  GDALRasterBandH hPanchroBandIn,
392  int nInputSpectralBandsIn,
393  GDALRasterBandH* pahInputSpectralBandsIn );
394 
395  virtual CPLErr AddBand( GDALDataType eType,
396  char **papszOptions=nullptr ) override;
397 
398  virtual char **GetFileList() override;
399 
400  virtual CPLErr IRasterIO( GDALRWFlag eRWFlag,
401  int nXOff, int nYOff, int nXSize, int nYSize,
402  void * pData, int nBufXSize, int nBufYSize,
403  GDALDataType eBufType,
404  int nBandCount, int *panBandMap,
405  GSpacing nPixelSpace, GSpacing nLineSpace,
406  GSpacing nBandSpace,
407  GDALRasterIOExtraArg* psExtraArg) override;
408 
409  void GetBlockSize( int *, int * ) const;
410 
411  GDALPansharpenOperation* GetPansharpener() { return m_poPansharpener; }
412 };
413 
414 /************************************************************************/
415 /* VRTRasterBand */
416 /* */
417 /* Provides support for all the various kinds of metadata but */
418 /* no raster access. That is handled by derived classes. */
419 /************************************************************************/
420 
421 class CPL_DLL VRTRasterBand : public GDALRasterBand
422 {
423  protected:
424  int m_bIsMaskBand;
425 
426  int m_bNoDataValueSet;
427  // If set to true, will not report the existence of nodata.
428  int m_bHideNoDataValue;
429  double m_dfNoDataValue;
430 
431  std::unique_ptr<GDALColorTable> m_poColorTable;
432 
433  GDALColorInterp m_eColorInterp;
434 
435  char *m_pszUnitType;
436  char **m_papszCategoryNames;
437 
438  double m_dfOffset;
439  double m_dfScale;
440 
441  CPLXMLNode *m_psSavedHistograms;
442 
443  void Initialize( int nXSize, int nYSize );
444 
445  std::vector<VRTOverviewInfo> m_apoOverviews;
446 
447  VRTRasterBand *m_poMaskBand;
448 
449  std::unique_ptr<GDALRasterAttributeTable> m_poRAT;
450 
451  CPL_DISALLOW_COPY_ASSIGN(VRTRasterBand)
452 
453  public:
454 
455  VRTRasterBand();
456  virtual ~VRTRasterBand();
457 
458  virtual CPLErr XMLInit( CPLXMLNode *, const char *, void* );
459  virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath );
460 
461  virtual CPLErr SetNoDataValue( double ) override;
462  virtual double GetNoDataValue( int *pbSuccess = nullptr ) override;
463  virtual CPLErr DeleteNoDataValue() override;
464 
465  virtual CPLErr SetColorTable( GDALColorTable * ) override;
466  virtual GDALColorTable *GetColorTable() override;
467 
468  virtual GDALRasterAttributeTable *GetDefaultRAT() override;
469  virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * poRAT ) override;
470 
471  virtual CPLErr SetColorInterpretation( GDALColorInterp ) override;
472  virtual GDALColorInterp GetColorInterpretation() override;
473 
474  virtual const char *GetUnitType() override;
475  CPLErr SetUnitType( const char * ) override;
476 
477  virtual char **GetCategoryNames() override;
478  virtual CPLErr SetCategoryNames( char ** ) override;
479 
480  virtual CPLErr SetMetadata( char **papszMD, const char *pszDomain = "" ) override;
481  virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
482  const char *pszDomain = "" ) override;
483 
484  virtual double GetOffset( int *pbSuccess = nullptr ) override;
485  CPLErr SetOffset( double ) override;
486  virtual double GetScale( int *pbSuccess = nullptr ) override;
487  CPLErr SetScale( double ) override;
488 
489  virtual int GetOverviewCount() override;
490  virtual GDALRasterBand *GetOverview(int) override;
491 
492  virtual CPLErr GetHistogram( double dfMin, double dfMax,
493  int nBuckets, GUIntBig * panHistogram,
494  int bIncludeOutOfRange, int bApproxOK,
495  GDALProgressFunc, void *pProgressData ) override;
496 
497  virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
498  int *pnBuckets, GUIntBig ** ppanHistogram,
499  int bForce,
500  GDALProgressFunc, void *pProgressData) override;
501 
502  virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
503  int nBuckets, GUIntBig *panHistogram ) override;
504 
505  CPLErr CopyCommonInfoFrom( GDALRasterBand * );
506 
507  virtual void GetFileList(char*** ppapszFileList, int *pnSize,
508  int *pnMaxSize, CPLHashSet* hSetFiles);
509 
510  virtual void SetDescription( const char * ) override;
511 
512  virtual GDALRasterBand *GetMaskBand() override;
513  virtual int GetMaskFlags() override;
514 
515  virtual CPLErr CreateMaskBand( int nFlagsIn ) override;
516 
517  void SetMaskBand(VRTRasterBand* poMaskBand);
518 
519  void SetIsMaskBand();
520 
521  CPLErr UnsetNoDataValue();
522 
523  virtual int CloseDependentDatasets();
524 
525  virtual int IsSourcedRasterBand() { return FALSE; }
526  virtual int IsPansharpenRasterBand() { return FALSE; }
527 };
528 
529 /************************************************************************/
530 /* VRTSourcedRasterBand */
531 /************************************************************************/
532 
533 class VRTSimpleSource;
534 
535 class CPL_DLL VRTSourcedRasterBand : public VRTRasterBand
536 {
537  private:
538  int m_nRecursionCounter;
539  CPLString m_osLastLocationInfo;
540  char **m_papszSourceList;
541 
542  bool CanUseSourcesMinMaxImplementations();
543  void CheckSource( VRTSimpleSource *poSS );
544 
545  CPL_DISALLOW_COPY_ASSIGN(VRTSourcedRasterBand)
546 
547  public:
548  int nSources;
549  VRTSource **papoSources;
550  int bSkipBufferInitialization;
551 
552  VRTSourcedRasterBand( GDALDataset *poDS, int nBand );
553  VRTSourcedRasterBand( GDALDataType eType,
554  int nXSize, int nYSize );
555  VRTSourcedRasterBand( GDALDataset *poDS, int nBand,
556  GDALDataType eType,
557  int nXSize, int nYSize );
558  virtual ~VRTSourcedRasterBand();
559 
560  virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
561  void *, int, int, GDALDataType,
562  GSpacing nPixelSpace, GSpacing nLineSpace,
563  GDALRasterIOExtraArg* psExtraArg) override;
564 
565  virtual int IGetDataCoverageStatus( int nXOff, int nYOff,
566  int nXSize, int nYSize,
567  int nMaskFlagStop,
568  double* pdfDataPct) override;
569 
570  virtual char **GetMetadataDomainList() override;
571  virtual const char *GetMetadataItem( const char * pszName,
572  const char * pszDomain = "" ) override;
573  virtual char **GetMetadata( const char * pszDomain = "" ) override;
574  virtual CPLErr SetMetadata( char ** papszMetadata,
575  const char * pszDomain = "" ) override;
576  virtual CPLErr SetMetadataItem( const char * pszName,
577  const char * pszValue,
578  const char * pszDomain = "" ) override;
579 
580  virtual CPLErr XMLInit( CPLXMLNode *, const char *, void* ) override;
581  virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath ) override;
582 
583  virtual double GetMinimum( int *pbSuccess = nullptr ) override;
584  virtual double GetMaximum(int *pbSuccess = nullptr ) override;
585  virtual CPLErr ComputeRasterMinMax( int bApproxOK, double* adfMinMax ) override;
586  virtual CPLErr ComputeStatistics( int bApproxOK,
587  double *pdfMin, double *pdfMax,
588  double *pdfMean, double *pdfStdDev,
589  GDALProgressFunc pfnProgress,
590  void *pProgressData ) override;
591  virtual CPLErr GetHistogram( double dfMin, double dfMax,
592  int nBuckets, GUIntBig * panHistogram,
593  int bIncludeOutOfRange, int bApproxOK,
594  GDALProgressFunc pfnProgress,
595  void *pProgressData ) override;
596 
597  CPLErr AddSource( VRTSource * );
598  CPLErr AddSimpleSource( GDALRasterBand *poSrcBand,
599  double dfSrcXOff=-1, double dfSrcYOff=-1,
600  double dfSrcXSize=-1, double dfSrcYSize=-1,
601  double dfDstXOff=-1, double dfDstYOff=-1,
602  double dfDstXSize=-1, double dfDstYSize=-1,
603  const char *pszResampling = "near",
604  double dfNoDataValue = VRT_NODATA_UNSET);
605  CPLErr AddComplexSource( GDALRasterBand *poSrcBand,
606  double dfSrcXOff=-1, double dfSrcYOff=-1,
607  double dfSrcXSize=-1, double dfSrcYSize=-1,
608  double dfDstXOff=-1, double dfDstYOff=-1,
609  double dfDstXSize=-1, double dfDstYSize=-1,
610  double dfScaleOff=0.0,
611  double dfScaleRatio=1.0,
612  double dfNoDataValue = VRT_NODATA_UNSET,
613  int nColorTableComponent = 0);
614 
615  CPLErr AddMaskBandSource( GDALRasterBand *poSrcBand,
616  double dfSrcXOff=-1, double dfSrcYOff=-1,
617  double dfSrcXSize=-1,
618  double dfSrcYSize=-1,
619  double dfDstXOff=-1, double dfDstYOff=-1,
620  double dfDstXSize=-1,
621  double dfDstYSize=-1 );
622 
623  CPLErr AddFuncSource( VRTImageReadFunc pfnReadFunc, void *hCBData,
624  double dfNoDataValue = VRT_NODATA_UNSET );
625 
626  void ConfigureSource(VRTSimpleSource *poSimpleSource,
627  GDALRasterBand *poSrcBand,
628  int bAddAsMaskBand,
629  double dfSrcXOff, double dfSrcYOff,
630  double dfSrcXSize, double dfSrcYSize,
631  double dfDstXOff, double dfDstYOff,
632  double dfDstXSize, double dfDstYSize );
633 
634  virtual CPLErr IReadBlock( int, int, void * ) override;
635 
636  virtual void GetFileList(char*** ppapszFileList, int *pnSize,
637  int *pnMaxSize, CPLHashSet* hSetFiles) override;
638 
639  virtual int CloseDependentDatasets() override;
640 
641  virtual int IsSourcedRasterBand() override { return TRUE; }
642 
643  virtual CPLErr FlushCache() override;
644 };
645 
646 /************************************************************************/
647 /* VRTWarpedRasterBand */
648 /************************************************************************/
649 
650 class CPL_DLL VRTWarpedRasterBand : public VRTRasterBand
651 {
652  public:
653  VRTWarpedRasterBand( GDALDataset *poDS, int nBand,
654  GDALDataType eType = GDT_Unknown );
655  virtual ~VRTWarpedRasterBand();
656 
657  virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath ) override;
658 
659  virtual CPLErr IReadBlock( int, int, void * ) override;
660  virtual CPLErr IWriteBlock( int, int, void * ) override;
661 
662  virtual int GetOverviewCount() override;
663  virtual GDALRasterBand *GetOverview(int) override;
664 };
665 /************************************************************************/
666 /* VRTPansharpenedRasterBand */
667 /************************************************************************/
668 
669 class VRTPansharpenedRasterBand : public VRTRasterBand
670 {
671  int m_nIndexAsPansharpenedBand;
672 
673  public:
674  VRTPansharpenedRasterBand(
675  GDALDataset *poDS, int nBand,
676  GDALDataType eDataType = GDT_Unknown );
677  virtual ~VRTPansharpenedRasterBand();
678 
679  virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath ) override;
680 
681  virtual CPLErr IReadBlock( int, int, void * ) override;
682 
683  virtual CPLErr IRasterIO( GDALRWFlag eRWFlag,
684  int nXOff, int nYOff, int nXSize, int nYSize,
685  void * pData, int nBufXSize, int nBufYSize,
686  GDALDataType eBufType,
687  GSpacing nPixelSpace, GSpacing nLineSpace,
688  GDALRasterIOExtraArg* psExtraArg) override;
689 
690  virtual int GetOverviewCount() override;
691  virtual GDALRasterBand *GetOverview(int) override;
692 
693  virtual int IsPansharpenRasterBand() override { return TRUE; }
694 
695  void SetIndexAsPansharpenedBand( int nIdx )
696  { m_nIndexAsPansharpenedBand = nIdx; }
697  int GetIndexAsPansharpenedBand() const
698  { return m_nIndexAsPansharpenedBand; }
699 };
700 
701 /************************************************************************/
702 /* VRTDerivedRasterBand */
703 /************************************************************************/
704 
705 class VRTDerivedRasterBandPrivateData;
706 
707 class CPL_DLL VRTDerivedRasterBand : public VRTSourcedRasterBand
708 {
709  VRTDerivedRasterBandPrivateData* m_poPrivate;
710  bool InitializePython();
711 
712  CPL_DISALLOW_COPY_ASSIGN(VRTDerivedRasterBand)
713 
714  public:
715  char *pszFuncName;
716  GDALDataType eSourceTransferType;
717 
718  VRTDerivedRasterBand( GDALDataset *poDS, int nBand );
719  VRTDerivedRasterBand( GDALDataset *poDS, int nBand,
720  GDALDataType eType, int nXSize, int nYSize );
721  virtual ~VRTDerivedRasterBand();
722 
723  virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
724  void *, int, int, GDALDataType,
725  GSpacing nPixelSpace, GSpacing nLineSpace,
726  GDALRasterIOExtraArg* psExtraArg ) override;
727 
728  virtual int IGetDataCoverageStatus( int nXOff, int nYOff,
729  int nXSize, int nYSize,
730  int nMaskFlagStop,
731  double* pdfDataPct) override;
732 
733  static CPLErr AddPixelFunction( const char *pszFuncName,
734  GDALDerivedPixelFunc pfnPixelFunc );
735  static GDALDerivedPixelFunc GetPixelFunction( const char *pszFuncName );
736 
737  void SetPixelFunctionName( const char *pszFuncName );
738  void SetSourceTransferType( GDALDataType eDataType );
739  void SetPixelFunctionLanguage( const char* pszLanguage );
740 
741  virtual CPLErr XMLInit( CPLXMLNode *, const char *, void* ) override;
742  virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath ) override;
743 
744  virtual double GetMinimum( int *pbSuccess = nullptr ) override;
745  virtual double GetMaximum(int *pbSuccess = nullptr ) override;
746  virtual CPLErr ComputeRasterMinMax( int bApproxOK, double* adfMinMax ) override;
747  virtual CPLErr ComputeStatistics( int bApproxOK,
748  double *pdfMin, double *pdfMax,
749  double *pdfMean, double *pdfStdDev,
750  GDALProgressFunc pfnProgress,
751  void *pProgressData ) override;
752  virtual CPLErr GetHistogram( double dfMin, double dfMax,
753  int nBuckets, GUIntBig * panHistogram,
754  int bIncludeOutOfRange, int bApproxOK,
755  GDALProgressFunc pfnProgress,
756  void *pProgressData ) override;
757 
758  static void Cleanup();
759 };
760 
761 /************************************************************************/
762 /* VRTRawRasterBand */
763 /************************************************************************/
764 
765 class RawRasterBand;
766 
767 class CPL_DLL VRTRawRasterBand : public VRTRasterBand
768 {
769  RawRasterBand *m_poRawRaster;
770 
771  char *m_pszSourceFilename;
772  int m_bRelativeToVRT;
773 
774  CPL_DISALLOW_COPY_ASSIGN(VRTRawRasterBand)
775 
776  public:
777  VRTRawRasterBand( GDALDataset *poDS, int nBand,
778  GDALDataType eType = GDT_Unknown );
779  virtual ~VRTRawRasterBand();
780 
781  virtual CPLErr XMLInit( CPLXMLNode *, const char *, void* ) override;
782  virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath ) override;
783 
784  virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
785  void *, int, int, GDALDataType,
786  GSpacing nPixelSpace, GSpacing nLineSpace,
787  GDALRasterIOExtraArg* psExtraArg ) override;
788 
789  virtual CPLErr IReadBlock( int, int, void * ) override;
790  virtual CPLErr IWriteBlock( int, int, void * ) override;
791 
792  CPLErr SetRawLink( const char *pszFilename,
793  const char *pszVRTPath,
794  int bRelativeToVRT,
795  vsi_l_offset nImageOffset,
796  int nPixelOffset, int nLineOffset,
797  const char *pszByteOrder );
798 
799  void ClearRawLink();
800 
801  virtual void GetFileList( char*** ppapszFileList, int *pnSize,
802  int *pnMaxSize, CPLHashSet* hSetFiles ) override;
803 };
804 
805 /************************************************************************/
806 /* VRTDriver */
807 /************************************************************************/
808 
809 class VRTDriver : public GDALDriver
810 {
811  CPL_DISALLOW_COPY_ASSIGN(VRTDriver)
812 
813  public:
814  VRTDriver();
815  virtual ~VRTDriver();
816 
817  char **papszSourceParsers;
818 
819  virtual char **GetMetadataDomainList() override;
820  virtual char **GetMetadata( const char * pszDomain = "" ) override;
821  virtual CPLErr SetMetadata( char ** papszMetadata,
822  const char * pszDomain = "" ) override;
823 
824  VRTSource *ParseSource( CPLXMLNode *psSrc, const char *pszVRTPath,
825  void* pUniqueHandle );
826  void AddSourceParser( const char *pszElementName,
827  VRTSourceParser pfnParser );
828 };
829 
830 /************************************************************************/
831 /* VRTSimpleSource */
832 /************************************************************************/
833 
834 class CPL_DLL VRTSimpleSource : public VRTSource
835 {
836  CPL_DISALLOW_COPY_ASSIGN(VRTSimpleSource)
837 
838 protected:
839  friend class VRTSourcedRasterBand;
840 
841  GDALRasterBand *m_poRasterBand;
842 
843  // When poRasterBand is a mask band, poMaskBandMainBand is the band
844  // from which the mask band is taken.
845  GDALRasterBand *m_poMaskBandMainBand;
846 
847  double m_dfSrcXOff;
848  double m_dfSrcYOff;
849  double m_dfSrcXSize;
850  double m_dfSrcYSize;
851 
852  double m_dfDstXOff;
853  double m_dfDstYOff;
854  double m_dfDstXSize;
855  double m_dfDstYSize;
856 
857  int m_bNoDataSet;
858  double m_dfNoDataValue;
859  CPLString m_osResampling;
860 
861  int m_nMaxValue;
862 
863  int m_bRelativeToVRTOri;
864  CPLString m_osSourceFileNameOri;
865  int m_nExplicitSharedStatus; // -1 unknown, 0 = unshared, 1 = shared
866 
867  int NeedMaxValAdjustment() const;
868 
869 public:
870  VRTSimpleSource();
871  VRTSimpleSource( const VRTSimpleSource* poSrcSource,
872  double dfXDstRatio, double dfYDstRatio );
873  virtual ~VRTSimpleSource();
874 
875  virtual CPLErr XMLInit( CPLXMLNode *psTree, const char *, void* ) override;
876  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) override;
877 
878  void SetSrcBand( GDALRasterBand * );
879  void SetSrcMaskBand( GDALRasterBand * );
880  void SetSrcWindow( double, double, double, double );
881  void SetDstWindow( double, double, double, double );
882  void SetNoDataValue( double dfNoDataValue );
883  const CPLString& GetResampling() const { return m_osResampling; }
884  void SetResampling( const char* pszResampling );
885 
886  int GetSrcDstWindow( int, int, int, int, int, int,
887  double *pdfReqXOff, double *pdfReqYOff,
888  double *pdfReqXSize, double *pdfReqYSize,
889  int *, int *, int *, int *,
890  int *, int *, int *, int * );
891 
892  virtual CPLErr RasterIO( GDALDataType eBandDataType,
893  int nXOff, int nYOff, int nXSize, int nYSize,
894  void *pData, int nBufXSize, int nBufYSize,
895  GDALDataType eBufType,
896  GSpacing nPixelSpace, GSpacing nLineSpace,
897  GDALRasterIOExtraArg* psExtraArgIn ) override;
898 
899  virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) override;
900  virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) override;
901  virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
902  double* adfMinMax ) override;
903  virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
904  int bApproxOK,
905  double *pdfMin, double *pdfMax,
906  double *pdfMean, double *pdfStdDev,
907  GDALProgressFunc pfnProgress,
908  void *pProgressData ) override;
909  virtual CPLErr GetHistogram( int nXSize, int nYSize,
910  double dfMin, double dfMax,
911  int nBuckets, GUIntBig * panHistogram,
912  int bIncludeOutOfRange, int bApproxOK,
913  GDALProgressFunc pfnProgress,
914  void *pProgressData ) override;
915 
916  void DstToSrc( double dfX, double dfY,
917  double &dfXOut, double &dfYOut ) const;
918  void SrcToDst( double dfX, double dfY,
919  double &dfXOut, double &dfYOut ) const;
920 
921  virtual void GetFileList( char*** ppapszFileList, int *pnSize,
922  int *pnMaxSize, CPLHashSet* hSetFiles ) override;
923 
924  virtual int IsSimpleSource() override { return TRUE; }
925  virtual const char* GetType() { return "SimpleSource"; }
926  virtual CPLErr FlushCache() override;
927 
928  GDALRasterBand* GetBand();
929  int IsSameExceptBandNumber( VRTSimpleSource* poOtherSource );
930  CPLErr DatasetRasterIO(
931  GDALDataType eBandDataType,
932  int nXOff, int nYOff, int nXSize, int nYSize,
933  void * pData, int nBufXSize, int nBufYSize,
934  GDALDataType eBufType,
935  int nBandCount, int *panBandMap,
936  GSpacing nPixelSpace, GSpacing nLineSpace,
937  GSpacing nBandSpace,
938  GDALRasterIOExtraArg* psExtraArg );
939 
940  void UnsetPreservedRelativeFilenames();
941 
942  void SetMaxValue( int nVal ) { m_nMaxValue = nVal; }
943 };
944 
945 /************************************************************************/
946 /* VRTAveragedSource */
947 /************************************************************************/
948 
949 class VRTAveragedSource : public VRTSimpleSource
950 {
951  CPL_DISALLOW_COPY_ASSIGN(VRTAveragedSource)
952 
953 public:
954  VRTAveragedSource();
955  virtual CPLErr RasterIO( GDALDataType eBandDataType,
956  int nXOff, int nYOff, int nXSize, int nYSize,
957  void *pData, int nBufXSize, int nBufYSize,
958  GDALDataType eBufType,
959  GSpacing nPixelSpace, GSpacing nLineSpace,
960  GDALRasterIOExtraArg* psExtraArgIn ) override;
961 
962  virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) override;
963  virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) override;
964  virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
965  double* adfMinMax ) override;
966  virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
967  int bApproxOK,
968  double *pdfMin, double *pdfMax,
969  double *pdfMean, double *pdfStdDev,
970  GDALProgressFunc pfnProgress,
971  void *pProgressData ) override;
972  virtual CPLErr GetHistogram( int nXSize, int nYSize,
973  double dfMin, double dfMax,
974  int nBuckets, GUIntBig * panHistogram,
975  int bIncludeOutOfRange, int bApproxOK,
976  GDALProgressFunc pfnProgress,
977  void *pProgressData ) override;
978 
979  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) override;
980  virtual const char* GetType() override { return "AveragedSource"; }
981 };
982 
983 /************************************************************************/
984 /* VRTComplexSource */
985 /************************************************************************/
986 
987 typedef enum
988 {
989  VRT_SCALING_NONE,
990  VRT_SCALING_LINEAR,
991  VRT_SCALING_EXPONENTIAL,
992 } VRTComplexSourceScaling;
993 
994 class CPL_DLL VRTComplexSource : public VRTSimpleSource
995 {
996  CPL_DISALLOW_COPY_ASSIGN(VRTComplexSource)
997  bool AreValuesUnchanged() const;
998 
999 protected:
1000  VRTComplexSourceScaling m_eScalingType;
1001  double m_dfScaleOff; // For linear scaling.
1002  double m_dfScaleRatio; // For linear scaling.
1003 
1004  // For non-linear scaling with a power function.
1005  int m_bSrcMinMaxDefined;
1006  double m_dfSrcMin;
1007  double m_dfSrcMax;
1008  double m_dfDstMin;
1009  double m_dfDstMax;
1010  double m_dfExponent;
1011 
1012  int m_nColorTableComponent;
1013 
1014  template <class WorkingDT>
1015  CPLErr RasterIOInternal( int nReqXOff, int nReqYOff,
1016  int nReqXSize, int nReqYSize,
1017  void *pData, int nOutXSize, int nOutYSize,
1018  GDALDataType eBufType,
1019  GSpacing nPixelSpace, GSpacing nLineSpace,
1020  GDALRasterIOExtraArg* psExtraArg,
1021  GDALDataType eWrkDataType );
1022 
1023 public:
1024  VRTComplexSource();
1025  VRTComplexSource(const VRTComplexSource* poSrcSource,
1026  double dfXDstRatio, double dfYDstRatio);
1027  virtual ~VRTComplexSource();
1028 
1029  virtual CPLErr RasterIO( GDALDataType eBandDataType,
1030  int nXOff, int nYOff, int nXSize, int nYSize,
1031  void *pData, int nBufXSize, int nBufYSize,
1032  GDALDataType eBufType,
1033  GSpacing nPixelSpace, GSpacing nLineSpace,
1034  GDALRasterIOExtraArg* psExtraArgIn ) override;
1035 
1036  virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) override;
1037  virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) override;
1038  virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
1039  double* adfMinMax ) override;
1040  virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
1041  int bApproxOK,
1042  double *pdfMin, double *pdfMax,
1043  double *pdfMean, double *pdfStdDev,
1044  GDALProgressFunc pfnProgress,
1045  void *pProgressData ) override;
1046  virtual CPLErr GetHistogram( int nXSize, int nYSize,
1047  double dfMin, double dfMax,
1048  int nBuckets, GUIntBig * panHistogram,
1049  int bIncludeOutOfRange, int bApproxOK,
1050  GDALProgressFunc pfnProgress,
1051  void *pProgressData ) override;
1052 
1053  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) override;
1054  virtual CPLErr XMLInit( CPLXMLNode *, const char *, void* ) override;
1055  virtual const char* GetType() override { return "ComplexSource"; }
1056 
1057  double LookupValue( double dfInput );
1058 
1059  void SetLinearScaling( double dfOffset, double dfScale );
1060  void SetPowerScaling( double dfExponent,
1061  double dfSrcMin,
1062  double dfSrcMax,
1063  double dfDstMin,
1064  double dfDstMax );
1065  void SetColorTableComponent( int nComponent );
1066 
1067  double *m_padfLUTInputs;
1068  double *m_padfLUTOutputs;
1069  int m_nLUTItemCount;
1070 };
1071 
1072 /************************************************************************/
1073 /* VRTFilteredSource */
1074 /************************************************************************/
1075 
1076 class VRTFilteredSource : public VRTComplexSource
1077 {
1078 private:
1079  int IsTypeSupported( GDALDataType eTestType ) const;
1080 
1081  CPL_DISALLOW_COPY_ASSIGN(VRTFilteredSource)
1082 
1083 protected:
1084  int m_nSupportedTypesCount;
1085  GDALDataType m_aeSupportedTypes[20];
1086 
1087  int m_nExtraEdgePixels;
1088 
1089 public:
1090  VRTFilteredSource();
1091  virtual ~VRTFilteredSource();
1092 
1093  void SetExtraEdgePixels( int );
1094  void SetFilteringDataTypesSupported( int, GDALDataType * );
1095 
1096  virtual CPLErr FilterData( int nXSize, int nYSize, GDALDataType eType,
1097  GByte *pabySrcData, GByte *pabyDstData ) = 0;
1098 
1099  virtual CPLErr RasterIO( GDALDataType eBandDataType,
1100  int nXOff, int nYOff, int nXSize, int nYSize,
1101  void *pData, int nBufXSize, int nBufYSize,
1102  GDALDataType eBufType,
1103  GSpacing nPixelSpace, GSpacing nLineSpace,
1104  GDALRasterIOExtraArg* psExtraArg ) override;
1105 };
1106 
1107 /************************************************************************/
1108 /* VRTKernelFilteredSource */
1109 /************************************************************************/
1110 
1111 class VRTKernelFilteredSource : public VRTFilteredSource
1112 {
1113  CPL_DISALLOW_COPY_ASSIGN(VRTKernelFilteredSource)
1114 
1115 protected:
1116  int m_nKernelSize;
1117 
1118  bool m_bSeparable;
1119 
1120  double *m_padfKernelCoefs;
1121 
1122  int m_bNormalized;
1123 
1124 public:
1125  VRTKernelFilteredSource();
1126  virtual ~VRTKernelFilteredSource();
1127 
1128  virtual CPLErr XMLInit( CPLXMLNode *psTree, const char *, void* ) override;
1129  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) override;
1130 
1131  virtual CPLErr FilterData( int nXSize, int nYSize, GDALDataType eType,
1132  GByte *pabySrcData, GByte *pabyDstData ) override;
1133 
1134  CPLErr SetKernel( int nKernelSize, bool bSeparable, double *padfCoefs );
1135  void SetNormalized( int );
1136 };
1137 
1138 /************************************************************************/
1139 /* VRTAverageFilteredSource */
1140 /************************************************************************/
1141 
1142 class VRTAverageFilteredSource : public VRTKernelFilteredSource
1143 {
1144  CPL_DISALLOW_COPY_ASSIGN(VRTAverageFilteredSource)
1145 
1146 public:
1147  explicit VRTAverageFilteredSource( int nKernelSize );
1148  virtual ~VRTAverageFilteredSource();
1149 
1150  virtual CPLErr XMLInit( CPLXMLNode *psTree, const char *, void* ) override;
1151  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) override;
1152 };
1153 
1154 /************************************************************************/
1155 /* VRTFuncSource */
1156 /************************************************************************/
1157 class VRTFuncSource : public VRTSource
1158 {
1159  CPL_DISALLOW_COPY_ASSIGN(VRTFuncSource)
1160 
1161 public:
1162  VRTFuncSource();
1163  virtual ~VRTFuncSource();
1164 
1165  virtual CPLErr XMLInit( CPLXMLNode *, const char *, void* ) override { return CE_Failure; }
1166  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) override;
1167 
1168  virtual CPLErr RasterIO( GDALDataType eBandDataType,
1169  int nXOff, int nYOff, int nXSize, int nYSize,
1170  void *pData, int nBufXSize, int nBufYSize,
1171  GDALDataType eBufType,
1172  GSpacing nPixelSpace, GSpacing nLineSpace,
1173  GDALRasterIOExtraArg* psExtraArg ) override;
1174 
1175  virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) override;
1176  virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) override;
1177  virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
1178  double* adfMinMax ) override;
1179  virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
1180  int bApproxOK,
1181  double *pdfMin, double *pdfMax,
1182  double *pdfMean, double *pdfStdDev,
1183  GDALProgressFunc pfnProgress,
1184  void *pProgressData ) override;
1185  virtual CPLErr GetHistogram( int nXSize, int nYSize,
1186  double dfMin, double dfMax,
1187  int nBuckets, GUIntBig * panHistogram,
1188  int bIncludeOutOfRange, int bApproxOK,
1189  GDALProgressFunc pfnProgress,
1190  void *pProgressData ) override;
1191 
1192  VRTImageReadFunc pfnReadFunc;
1193  void *pCBData;
1194  GDALDataType eType;
1195 
1196  float fNoDataValue;
1197 };
1198 
1199 #endif /* #ifndef DOXYGEN_SKIP */
1200 
1201 #endif /* ndef VIRTUALDATASET_H_INCLUDED */
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
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:1156
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:568
virtual void FlushCache(void)
Flush all write cached data to disk.
Definition: gdaldataset.cpp:416
C++ GDAL entry points.
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:2743
GDALRWFlag
Definition: gdal.h:119
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:771
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:1593
Convenient string class based on std::string.
Definition: cpl_string.h:329
Hash set implementation.
Definition: gdal.h:61
void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition: gdaldataset.cpp:3949
#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:1364
virtual const GDAL_GCP * GetGCPs()
Fetch GCPs.
Definition: gdaldataset.cpp:1676
virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList, const OGRSpatialReference *poGCP_SRS)
Assign GCPs.
Definition: gdaldataset.cpp:1781
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:611
virtual CPLErr SetSpatialRef(const OGRSpatialReference *poSRS)
Set the spatial reference system for this dataset.
Definition: gdaldataset.cpp:1038
virtual CPLErr SetGeoTransform(double *padfTransform)
Set the affine transformation coefficients.
Definition: gdaldataset.cpp:1211
virtual int GetGCPCount()
Get number of GCPs.
Definition: gdaldataset.cpp:1498
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
Structure to pass extra arguments to RasterIO() method.
Definition: gdal.h:147
High level image warping class.
Definition: gdalwarper.h:442
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:2925
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:2825
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:3526
Object with metadata.
Definition: gdal_priv.h:132
GDALDataset * GetDataset()
Fetch the owning dataset handle.
Definition: gdalrasterband.cpp:2826
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:1057
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:907
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:1436
Definition: gdal.h:114
Format specific driver.
Definition: gdal_priv.h:1411
A color table / palette.
Definition: gdal_priv.h:962
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

Generated for GDAL by doxygen 1.8.8.