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  char *m_pszProjection;
162 
163  int m_bGeoTransformSet;
164  double m_adfGeoTransform[6];
165 
166  int m_nGCPCount;
167  GDAL_GCP *m_pasGCPList;
168  char *m_pszGCPProjection;
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  std::vector<GDALDataset*> m_apoOverviews;
180  std::vector<GDALDataset*> m_apoOverviewsBak;
181  char **m_papszXMLVRTMetadata;
182 
183  VRTRasterBand* InitBand(const char* pszSubclass, int nBand,
184  bool bAllowPansharpened);
185 
186  CPL_DISALLOW_COPY_ASSIGN(VRTDataset)
187 
188  protected:
189  virtual int CloseDependentDatasets() override;
190 
191  public:
192  VRTDataset(int nXSize, int nYSize);
193  virtual ~VRTDataset();
194 
195  void SetNeedsFlush() { m_bNeedsFlush = TRUE; }
196  virtual void FlushCache() override;
197 
198  void SetWritable(int bWritableIn) { m_bWritable = bWritableIn; }
199 
200  virtual CPLErr CreateMaskBand( int nFlags ) override;
201  void SetMaskBand(VRTRasterBand* poMaskBand);
202 
203  virtual const char *GetProjectionRef() override;
204  virtual CPLErr SetProjection( const char * ) override;
205  virtual CPLErr GetGeoTransform( double * ) override;
206  virtual CPLErr SetGeoTransform( double * ) override;
207 
208  virtual CPLErr SetMetadata( char **papszMetadata,
209  const char *pszDomain = "" ) override;
210  virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
211  const char *pszDomain = "" ) override;
212 
213  virtual char** GetMetadata( const char *pszDomain = "" ) override;
214 
215  virtual int GetGCPCount() override;
216  virtual const char *GetGCPProjection() override;
217  virtual const GDAL_GCP *GetGCPs() override;
218  virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
219  const char *pszGCPProjection ) override;
220 
221  virtual CPLErr AddBand( GDALDataType eType,
222  char **papszOptions=nullptr ) override;
223 
224  virtual char **GetFileList() override;
225 
226  virtual CPLErr IRasterIO( GDALRWFlag eRWFlag,
227  int nXOff, int nYOff, int nXSize, int nYSize,
228  void * pData, int nBufXSize, int nBufYSize,
229  GDALDataType eBufType,
230  int nBandCount, int *panBandMap,
231  GSpacing nPixelSpace, GSpacing nLineSpace,
232  GSpacing nBandSpace,
233  GDALRasterIOExtraArg* psExtraArg) override;
234 
235  virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
236  int nBufXSize, int nBufYSize,
237  GDALDataType eDT,
238  int nBandCount, int *panBandList,
239  char **papszOptions ) override;
240 
241  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath);
242  virtual CPLErr XMLInit( CPLXMLNode *, const char * );
243 
244  virtual CPLErr IBuildOverviews( const char *, int, int *,
245  int, int *, GDALProgressFunc, void * ) override;
246 
247  /* Used by PDF driver for example */
248  GDALDataset* GetSingleSimpleSource();
249  void BuildVirtualOverviews();
250 
251  void UnsetPreservedRelativeFilenames();
252 
253  static int Identify( GDALOpenInfo * );
254  static GDALDataset *Open( GDALOpenInfo * );
255  static GDALDataset *OpenXML( const char *, const char * = nullptr,
256  GDALAccess eAccess = GA_ReadOnly );
257  static GDALDataset *Create( const char * pszName,
258  int nXSize, int nYSize, int nBands,
259  GDALDataType eType, char ** papszOptions );
260  static CPLErr Delete( const char * pszFilename );
261 };
262 
263 /************************************************************************/
264 /* VRTWarpedDataset */
265 /************************************************************************/
266 
267 class GDALWarpOperation;
268 class VRTWarpedRasterBand;
269 
270 class CPL_DLL VRTWarpedDataset : public VRTDataset
271 {
272  int m_nBlockXSize;
273  int m_nBlockYSize;
274  GDALWarpOperation *m_poWarper;
275 
276  int m_nOverviewCount;
277  VRTWarpedDataset **m_papoOverviews;
278  int m_nSrcOvrLevel;
279 
280  void CreateImplicitOverviews();
281 
282  struct VerticalShiftGrid
283  {
284  CPLString osVGrids;
285  int bInverse;
286  double dfToMeterSrc;
287  double dfToMeterDest;
288  CPLStringList aosOptions;
289  };
290  std::vector<VerticalShiftGrid> m_aoVerticalShiftGrids;
291 
292  friend class VRTWarpedRasterBand;
293 
294  CPL_DISALLOW_COPY_ASSIGN(VRTWarpedDataset)
295 
296  protected:
297  virtual int CloseDependentDatasets() override;
298 
299 public:
300  VRTWarpedDataset( int nXSize, int nYSize );
301  virtual ~VRTWarpedDataset();
302 
303  virtual void FlushCache() override;
304 
305  CPLErr Initialize( /* GDALWarpOptions */ void * );
306 
307  virtual CPLErr IBuildOverviews( const char *, int, int *,
308  int, int *, GDALProgressFunc, void * ) override;
309 
310  virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
311  const char *pszDomain = "" ) override;
312 
313  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) override;
314  virtual CPLErr XMLInit( CPLXMLNode *, const char * ) override;
315 
316  virtual CPLErr AddBand( GDALDataType eType,
317  char **papszOptions=nullptr ) override;
318 
319  virtual char **GetFileList() override;
320 
321  CPLErr ProcessBlock( int iBlockX, int iBlockY );
322 
323  void GetBlockSize( int *, int * ) const;
324 
325  void SetApplyVerticalShiftGrid(const char* pszVGrids,
326  int bInverse,
327  double dfToMeterSrc,
328  double dfToMeterDest,
329  char** papszOptions );
330 };
331 
332 /************************************************************************/
333 /* VRTPansharpenedDataset */
334 /************************************************************************/
335 
337 
338 typedef enum
339 {
340  GTAdjust_Union,
341  GTAdjust_Intersection,
342  GTAdjust_None,
343  GTAdjust_NoneWithoutWarning
344 } GTAdjustment;
345 
346 class VRTPansharpenedDataset : public VRTDataset
347 {
348  friend class VRTPansharpenedRasterBand;
349 
350  int m_nBlockXSize;
351  int m_nBlockYSize;
352  GDALPansharpenOperation* m_poPansharpener;
353  VRTPansharpenedDataset* m_poMainDataset;
354  std::vector<VRTPansharpenedDataset*> m_apoOverviewDatasets;
355  // Map from absolute to relative.
356  std::map<CPLString,CPLString> m_oMapToRelativeFilenames;
357 
358  int m_bLoadingOtherBands;
359 
360  GByte *m_pabyLastBufferBandRasterIO;
361  int m_nLastBandRasterIOXOff;
362  int m_nLastBandRasterIOYOff;
363  int m_nLastBandRasterIOXSize;
364  int m_nLastBandRasterIOYSize;
365  GDALDataType m_eLastBandRasterIODataType;
366 
367  GTAdjustment m_eGTAdjustment;
368  int m_bNoDataDisabled;
369 
370  std::vector<GDALDataset*> m_apoDatasetsToClose;
371 
372  CPL_DISALLOW_COPY_ASSIGN(VRTPansharpenedDataset)
373 
374  protected:
375  virtual int CloseDependentDatasets() override;
376 
377 public:
378  VRTPansharpenedDataset( int nXSize, int nYSize );
379  virtual ~VRTPansharpenedDataset();
380 
381  virtual void FlushCache() override;
382 
383  virtual CPLErr XMLInit( CPLXMLNode *, const char * ) override;
384  virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath ) override;
385 
386  CPLErr XMLInit( CPLXMLNode *psTree, const char *pszVRTPath,
387  GDALRasterBandH hPanchroBandIn,
388  int nInputSpectralBandsIn,
389  GDALRasterBandH* pahInputSpectralBandsIn );
390 
391  virtual CPLErr AddBand( GDALDataType eType,
392  char **papszOptions=nullptr ) override;
393 
394  virtual char **GetFileList() override;
395 
396  virtual CPLErr IRasterIO( GDALRWFlag eRWFlag,
397  int nXOff, int nYOff, int nXSize, int nYSize,
398  void * pData, int nBufXSize, int nBufYSize,
399  GDALDataType eBufType,
400  int nBandCount, int *panBandMap,
401  GSpacing nPixelSpace, GSpacing nLineSpace,
402  GSpacing nBandSpace,
403  GDALRasterIOExtraArg* psExtraArg) override;
404 
405  void GetBlockSize( int *, int * ) const;
406 
407  GDALPansharpenOperation* GetPansharpener() { return m_poPansharpener; }
408 };
409 
410 /************************************************************************/
411 /* VRTRasterBand */
412 /* */
413 /* Provides support for all the various kinds of metadata but */
414 /* no raster access. That is handled by derived classes. */
415 /************************************************************************/
416 
417 class CPL_DLL VRTRasterBand : public GDALRasterBand
418 {
419  protected:
420  int m_bIsMaskBand;
421 
422  int m_bNoDataValueSet;
423  // If set to true, will not report the existence of nodata.
424  int m_bHideNoDataValue;
425  double m_dfNoDataValue;
426 
427  std::unique_ptr<GDALColorTable> m_poColorTable;
428 
429  GDALColorInterp m_eColorInterp;
430 
431  char *m_pszUnitType;
432  char **m_papszCategoryNames;
433 
434  double m_dfOffset;
435  double m_dfScale;
436 
437  CPLXMLNode *m_psSavedHistograms;
438 
439  void Initialize( int nXSize, int nYSize );
440 
441  std::vector<VRTOverviewInfo> m_apoOverviews;
442 
443  VRTRasterBand *m_poMaskBand;
444 
445  std::unique_ptr<GDALRasterAttributeTable> m_poRAT;
446 
447  CPL_DISALLOW_COPY_ASSIGN(VRTRasterBand)
448 
449  public:
450 
451  VRTRasterBand();
452  virtual ~VRTRasterBand();
453 
454  virtual CPLErr XMLInit( CPLXMLNode *, const char *, void* );
455  virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath );
456 
457  virtual CPLErr SetNoDataValue( double ) override;
458  virtual double GetNoDataValue( int *pbSuccess = nullptr ) override;
459  virtual CPLErr DeleteNoDataValue() override;
460 
461  virtual CPLErr SetColorTable( GDALColorTable * ) override;
462  virtual GDALColorTable *GetColorTable() override;
463 
464  virtual GDALRasterAttributeTable *GetDefaultRAT() override;
465  virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * poRAT ) override;
466 
467  virtual CPLErr SetColorInterpretation( GDALColorInterp ) override;
468  virtual GDALColorInterp GetColorInterpretation() override;
469 
470  virtual const char *GetUnitType() override;
471  CPLErr SetUnitType( const char * ) override;
472 
473  virtual char **GetCategoryNames() override;
474  virtual CPLErr SetCategoryNames( char ** ) override;
475 
476  virtual CPLErr SetMetadata( char **papszMD, const char *pszDomain = "" ) override;
477  virtual CPLErr SetMetadataItem( const char *pszName, const char *pszValue,
478  const char *pszDomain = "" ) override;
479 
480  virtual double GetOffset( int *pbSuccess = nullptr ) override;
481  CPLErr SetOffset( double ) override;
482  virtual double GetScale( int *pbSuccess = nullptr ) override;
483  CPLErr SetScale( double ) override;
484 
485  virtual int GetOverviewCount() override;
486  virtual GDALRasterBand *GetOverview(int) override;
487 
488  virtual CPLErr GetHistogram( double dfMin, double dfMax,
489  int nBuckets, GUIntBig * panHistogram,
490  int bIncludeOutOfRange, int bApproxOK,
491  GDALProgressFunc, void *pProgressData ) override;
492 
493  virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
494  int *pnBuckets, GUIntBig ** ppanHistogram,
495  int bForce,
496  GDALProgressFunc, void *pProgressData) override;
497 
498  virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
499  int nBuckets, GUIntBig *panHistogram ) override;
500 
501  CPLErr CopyCommonInfoFrom( GDALRasterBand * );
502 
503  virtual void GetFileList(char*** ppapszFileList, int *pnSize,
504  int *pnMaxSize, CPLHashSet* hSetFiles);
505 
506  virtual void SetDescription( const char * ) override;
507 
508  virtual GDALRasterBand *GetMaskBand() override;
509  virtual int GetMaskFlags() override;
510 
511  virtual CPLErr CreateMaskBand( int nFlagsIn ) override;
512 
513  void SetMaskBand(VRTRasterBand* poMaskBand);
514 
515  void SetIsMaskBand();
516 
517  CPLErr UnsetNoDataValue();
518 
519  virtual int CloseDependentDatasets();
520 
521  virtual int IsSourcedRasterBand() { return FALSE; }
522  virtual int IsPansharpenRasterBand() { return FALSE; }
523 };
524 
525 /************************************************************************/
526 /* VRTSourcedRasterBand */
527 /************************************************************************/
528 
529 class VRTSimpleSource;
530 
531 class CPL_DLL VRTSourcedRasterBand : public VRTRasterBand
532 {
533  private:
534  int m_nRecursionCounter;
535  CPLString m_osLastLocationInfo;
536  char **m_papszSourceList;
537 
538  bool CanUseSourcesMinMaxImplementations();
539  void CheckSource( VRTSimpleSource *poSS );
540 
541  CPL_DISALLOW_COPY_ASSIGN(VRTSourcedRasterBand)
542 
543  public:
544  int nSources;
545  VRTSource **papoSources;
546  int bSkipBufferInitialization;
547 
548  VRTSourcedRasterBand( GDALDataset *poDS, int nBand );
549  VRTSourcedRasterBand( GDALDataType eType,
550  int nXSize, int nYSize );
551  VRTSourcedRasterBand( GDALDataset *poDS, int nBand,
552  GDALDataType eType,
553  int nXSize, int nYSize );
554  virtual ~VRTSourcedRasterBand();
555 
556  virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
557  void *, int, int, GDALDataType,
558  GSpacing nPixelSpace, GSpacing nLineSpace,
559  GDALRasterIOExtraArg* psExtraArg) override;
560 
561  virtual int IGetDataCoverageStatus( int nXOff, int nYOff,
562  int nXSize, int nYSize,
563  int nMaskFlagStop,
564  double* pdfDataPct) override;
565 
566  virtual char **GetMetadataDomainList() override;
567  virtual const char *GetMetadataItem( const char * pszName,
568  const char * pszDomain = "" ) override;
569  virtual char **GetMetadata( const char * pszDomain = "" ) override;
570  virtual CPLErr SetMetadata( char ** papszMetadata,
571  const char * pszDomain = "" ) override;
572  virtual CPLErr SetMetadataItem( const char * pszName,
573  const char * pszValue,
574  const char * pszDomain = "" ) override;
575 
576  virtual CPLErr XMLInit( CPLXMLNode *, const char *, void* ) override;
577  virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath ) override;
578 
579  virtual double GetMinimum( int *pbSuccess = nullptr ) override;
580  virtual double GetMaximum(int *pbSuccess = nullptr ) override;
581  virtual CPLErr ComputeRasterMinMax( int bApproxOK, double* adfMinMax ) override;
582  virtual CPLErr ComputeStatistics( int bApproxOK,
583  double *pdfMin, double *pdfMax,
584  double *pdfMean, double *pdfStdDev,
585  GDALProgressFunc pfnProgress,
586  void *pProgressData ) override;
587  virtual CPLErr GetHistogram( double dfMin, double dfMax,
588  int nBuckets, GUIntBig * panHistogram,
589  int bIncludeOutOfRange, int bApproxOK,
590  GDALProgressFunc pfnProgress,
591  void *pProgressData ) override;
592 
593  CPLErr AddSource( VRTSource * );
594  CPLErr AddSimpleSource( GDALRasterBand *poSrcBand,
595  double dfSrcXOff=-1, double dfSrcYOff=-1,
596  double dfSrcXSize=-1, double dfSrcYSize=-1,
597  double dfDstXOff=-1, double dfDstYOff=-1,
598  double dfDstXSize=-1, double dfDstYSize=-1,
599  const char *pszResampling = "near",
600  double dfNoDataValue = VRT_NODATA_UNSET);
601  CPLErr AddComplexSource( GDALRasterBand *poSrcBand,
602  double dfSrcXOff=-1, double dfSrcYOff=-1,
603  double dfSrcXSize=-1, double dfSrcYSize=-1,
604  double dfDstXOff=-1, double dfDstYOff=-1,
605  double dfDstXSize=-1, double dfDstYSize=-1,
606  double dfScaleOff=0.0,
607  double dfScaleRatio=1.0,
608  double dfNoDataValue = VRT_NODATA_UNSET,
609  int nColorTableComponent = 0);
610 
611  CPLErr AddMaskBandSource( GDALRasterBand *poSrcBand,
612  double dfSrcXOff=-1, double dfSrcYOff=-1,
613  double dfSrcXSize=-1,
614  double dfSrcYSize=-1,
615  double dfDstXOff=-1, double dfDstYOff=-1,
616  double dfDstXSize=-1,
617  double dfDstYSize=-1 );
618 
619  CPLErr AddFuncSource( VRTImageReadFunc pfnReadFunc, void *hCBData,
620  double dfNoDataValue = VRT_NODATA_UNSET );
621 
622  void ConfigureSource(VRTSimpleSource *poSimpleSource,
623  GDALRasterBand *poSrcBand,
624  int bAddAsMaskBand,
625  double dfSrcXOff, double dfSrcYOff,
626  double dfSrcXSize, double dfSrcYSize,
627  double dfDstXOff, double dfDstYOff,
628  double dfDstXSize, double dfDstYSize );
629 
630  virtual CPLErr IReadBlock( int, int, void * ) override;
631 
632  virtual void GetFileList(char*** ppapszFileList, int *pnSize,
633  int *pnMaxSize, CPLHashSet* hSetFiles) override;
634 
635  virtual int CloseDependentDatasets() override;
636 
637  virtual int IsSourcedRasterBand() override { return TRUE; }
638 
639  virtual CPLErr FlushCache() override;
640 };
641 
642 /************************************************************************/
643 /* VRTWarpedRasterBand */
644 /************************************************************************/
645 
646 class CPL_DLL VRTWarpedRasterBand : public VRTRasterBand
647 {
648  public:
649  VRTWarpedRasterBand( GDALDataset *poDS, int nBand,
650  GDALDataType eType = GDT_Unknown );
651  virtual ~VRTWarpedRasterBand();
652 
653  virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath ) override;
654 
655  virtual CPLErr IReadBlock( int, int, void * ) override;
656  virtual CPLErr IWriteBlock( int, int, void * ) override;
657 
658  virtual int GetOverviewCount() override;
659  virtual GDALRasterBand *GetOverview(int) override;
660 };
661 /************************************************************************/
662 /* VRTPansharpenedRasterBand */
663 /************************************************************************/
664 
665 class VRTPansharpenedRasterBand : public VRTRasterBand
666 {
667  int m_nIndexAsPansharpenedBand;
668 
669  public:
670  VRTPansharpenedRasterBand(
671  GDALDataset *poDS, int nBand,
672  GDALDataType eDataType = GDT_Unknown );
673  virtual ~VRTPansharpenedRasterBand();
674 
675  virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath ) override;
676 
677  virtual CPLErr IReadBlock( int, int, void * ) override;
678 
679  virtual CPLErr IRasterIO( GDALRWFlag eRWFlag,
680  int nXOff, int nYOff, int nXSize, int nYSize,
681  void * pData, int nBufXSize, int nBufYSize,
682  GDALDataType eBufType,
683  GSpacing nPixelSpace, GSpacing nLineSpace,
684  GDALRasterIOExtraArg* psExtraArg) override;
685 
686  virtual int GetOverviewCount() override;
687  virtual GDALRasterBand *GetOverview(int) override;
688 
689  virtual int IsPansharpenRasterBand() override { return TRUE; }
690 
691  void SetIndexAsPansharpenedBand( int nIdx )
692  { m_nIndexAsPansharpenedBand = nIdx; }
693  int GetIndexAsPansharpenedBand() const
694  { return m_nIndexAsPansharpenedBand; }
695 };
696 
697 /************************************************************************/
698 /* VRTDerivedRasterBand */
699 /************************************************************************/
700 
701 class VRTDerivedRasterBandPrivateData;
702 
703 class CPL_DLL VRTDerivedRasterBand : public VRTSourcedRasterBand
704 {
705  VRTDerivedRasterBandPrivateData* m_poPrivate;
706  bool InitializePython();
707 
708  CPL_DISALLOW_COPY_ASSIGN(VRTDerivedRasterBand)
709 
710  public:
711  char *pszFuncName;
712  GDALDataType eSourceTransferType;
713 
714  VRTDerivedRasterBand( GDALDataset *poDS, int nBand );
715  VRTDerivedRasterBand( GDALDataset *poDS, int nBand,
716  GDALDataType eType, int nXSize, int nYSize );
717  virtual ~VRTDerivedRasterBand();
718 
719  virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
720  void *, int, int, GDALDataType,
721  GSpacing nPixelSpace, GSpacing nLineSpace,
722  GDALRasterIOExtraArg* psExtraArg ) override;
723 
724  virtual int IGetDataCoverageStatus( int nXOff, int nYOff,
725  int nXSize, int nYSize,
726  int nMaskFlagStop,
727  double* pdfDataPct) override;
728 
729  static CPLErr AddPixelFunction( const char *pszFuncName,
730  GDALDerivedPixelFunc pfnPixelFunc );
731  static GDALDerivedPixelFunc GetPixelFunction( const char *pszFuncName );
732 
733  void SetPixelFunctionName( const char *pszFuncName );
734  void SetSourceTransferType( GDALDataType eDataType );
735  void SetPixelFunctionLanguage( const char* pszLanguage );
736 
737  virtual CPLErr XMLInit( CPLXMLNode *, const char *, void* ) override;
738  virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath ) override;
739 
740  virtual double GetMinimum( int *pbSuccess = nullptr ) override;
741  virtual double GetMaximum(int *pbSuccess = nullptr ) override;
742  virtual CPLErr ComputeRasterMinMax( int bApproxOK, double* adfMinMax ) override;
743  virtual CPLErr ComputeStatistics( int bApproxOK,
744  double *pdfMin, double *pdfMax,
745  double *pdfMean, double *pdfStdDev,
746  GDALProgressFunc pfnProgress,
747  void *pProgressData ) override;
748  virtual CPLErr GetHistogram( double dfMin, double dfMax,
749  int nBuckets, GUIntBig * panHistogram,
750  int bIncludeOutOfRange, int bApproxOK,
751  GDALProgressFunc pfnProgress,
752  void *pProgressData ) override;
753 
754  static void Cleanup();
755 };
756 
757 /************************************************************************/
758 /* VRTRawRasterBand */
759 /************************************************************************/
760 
761 class RawRasterBand;
762 
763 class CPL_DLL VRTRawRasterBand : public VRTRasterBand
764 {
765  RawRasterBand *m_poRawRaster;
766 
767  char *m_pszSourceFilename;
768  int m_bRelativeToVRT;
769 
770  CPL_DISALLOW_COPY_ASSIGN(VRTRawRasterBand)
771 
772  public:
773  VRTRawRasterBand( GDALDataset *poDS, int nBand,
774  GDALDataType eType = GDT_Unknown );
775  virtual ~VRTRawRasterBand();
776 
777  virtual CPLErr XMLInit( CPLXMLNode *, const char *, void* ) override;
778  virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath ) override;
779 
780  virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
781  void *, int, int, GDALDataType,
782  GSpacing nPixelSpace, GSpacing nLineSpace,
783  GDALRasterIOExtraArg* psExtraArg ) override;
784 
785  virtual CPLErr IReadBlock( int, int, void * ) override;
786  virtual CPLErr IWriteBlock( int, int, void * ) override;
787 
788  CPLErr SetRawLink( const char *pszFilename,
789  const char *pszVRTPath,
790  int bRelativeToVRT,
791  vsi_l_offset nImageOffset,
792  int nPixelOffset, int nLineOffset,
793  const char *pszByteOrder );
794 
795  void ClearRawLink();
796 
797  virtual void GetFileList( char*** ppapszFileList, int *pnSize,
798  int *pnMaxSize, CPLHashSet* hSetFiles ) override;
799 };
800 
801 /************************************************************************/
802 /* VRTDriver */
803 /************************************************************************/
804 
805 class VRTDriver : public GDALDriver
806 {
807  CPL_DISALLOW_COPY_ASSIGN(VRTDriver)
808 
809  public:
810  VRTDriver();
811  virtual ~VRTDriver();
812 
813  char **papszSourceParsers;
814 
815  virtual char **GetMetadataDomainList() override;
816  virtual char **GetMetadata( const char * pszDomain = "" ) override;
817  virtual CPLErr SetMetadata( char ** papszMetadata,
818  const char * pszDomain = "" ) override;
819 
820  VRTSource *ParseSource( CPLXMLNode *psSrc, const char *pszVRTPath,
821  void* pUniqueHandle );
822  void AddSourceParser( const char *pszElementName,
823  VRTSourceParser pfnParser );
824 };
825 
826 /************************************************************************/
827 /* VRTSimpleSource */
828 /************************************************************************/
829 
830 class CPL_DLL VRTSimpleSource : public VRTSource
831 {
832  CPL_DISALLOW_COPY_ASSIGN(VRTSimpleSource)
833 
834 protected:
835  friend class VRTSourcedRasterBand;
836 
837  GDALRasterBand *m_poRasterBand;
838 
839  // When poRasterBand is a mask band, poMaskBandMainBand is the band
840  // from which the mask band is taken.
841  GDALRasterBand *m_poMaskBandMainBand;
842 
843  double m_dfSrcXOff;
844  double m_dfSrcYOff;
845  double m_dfSrcXSize;
846  double m_dfSrcYSize;
847 
848  double m_dfDstXOff;
849  double m_dfDstYOff;
850  double m_dfDstXSize;
851  double m_dfDstYSize;
852 
853  int m_bNoDataSet;
854  double m_dfNoDataValue;
855  CPLString m_osResampling;
856 
857  int m_nMaxValue;
858 
859  int m_bRelativeToVRTOri;
860  CPLString m_osSourceFileNameOri;
861  int m_nExplicitSharedStatus; // -1 unknown, 0 = unshared, 1 = shared
862 
863  int NeedMaxValAdjustment() const;
864 
865 public:
866  VRTSimpleSource();
867  VRTSimpleSource( const VRTSimpleSource* poSrcSource,
868  double dfXDstRatio, double dfYDstRatio );
869  virtual ~VRTSimpleSource();
870 
871  virtual CPLErr XMLInit( CPLXMLNode *psTree, const char *, void* ) override;
872  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) override;
873 
874  void SetSrcBand( GDALRasterBand * );
875  void SetSrcMaskBand( GDALRasterBand * );
876  void SetSrcWindow( double, double, double, double );
877  void SetDstWindow( double, double, double, double );
878  void SetNoDataValue( double dfNoDataValue );
879  const CPLString& GetResampling() const { return m_osResampling; }
880  void SetResampling( const char* pszResampling );
881 
882  int GetSrcDstWindow( int, int, int, int, int, int,
883  double *pdfReqXOff, double *pdfReqYOff,
884  double *pdfReqXSize, double *pdfReqYSize,
885  int *, int *, int *, int *,
886  int *, int *, int *, int * );
887 
888  virtual CPLErr RasterIO( GDALDataType eBandDataType,
889  int nXOff, int nYOff, int nXSize, int nYSize,
890  void *pData, int nBufXSize, int nBufYSize,
891  GDALDataType eBufType,
892  GSpacing nPixelSpace, GSpacing nLineSpace,
893  GDALRasterIOExtraArg* psExtraArgIn ) override;
894 
895  virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) override;
896  virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) override;
897  virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
898  double* adfMinMax ) override;
899  virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
900  int bApproxOK,
901  double *pdfMin, double *pdfMax,
902  double *pdfMean, double *pdfStdDev,
903  GDALProgressFunc pfnProgress,
904  void *pProgressData ) override;
905  virtual CPLErr GetHistogram( int nXSize, int nYSize,
906  double dfMin, double dfMax,
907  int nBuckets, GUIntBig * panHistogram,
908  int bIncludeOutOfRange, int bApproxOK,
909  GDALProgressFunc pfnProgress,
910  void *pProgressData ) override;
911 
912  void DstToSrc( double dfX, double dfY,
913  double &dfXOut, double &dfYOut ) const;
914  void SrcToDst( double dfX, double dfY,
915  double &dfXOut, double &dfYOut ) const;
916 
917  virtual void GetFileList( char*** ppapszFileList, int *pnSize,
918  int *pnMaxSize, CPLHashSet* hSetFiles ) override;
919 
920  virtual int IsSimpleSource() override { return TRUE; }
921  virtual const char* GetType() { return "SimpleSource"; }
922  virtual CPLErr FlushCache() override;
923 
924  GDALRasterBand* GetBand();
925  int IsSameExceptBandNumber( VRTSimpleSource* poOtherSource );
926  CPLErr DatasetRasterIO(
927  GDALDataType eBandDataType,
928  int nXOff, int nYOff, int nXSize, int nYSize,
929  void * pData, int nBufXSize, int nBufYSize,
930  GDALDataType eBufType,
931  int nBandCount, int *panBandMap,
932  GSpacing nPixelSpace, GSpacing nLineSpace,
933  GSpacing nBandSpace,
934  GDALRasterIOExtraArg* psExtraArg );
935 
936  void UnsetPreservedRelativeFilenames();
937 
938  void SetMaxValue( int nVal ) { m_nMaxValue = nVal; }
939 };
940 
941 /************************************************************************/
942 /* VRTAveragedSource */
943 /************************************************************************/
944 
945 class VRTAveragedSource : public VRTSimpleSource
946 {
947  CPL_DISALLOW_COPY_ASSIGN(VRTAveragedSource)
948 
949 public:
950  VRTAveragedSource();
951  virtual CPLErr RasterIO( GDALDataType eBandDataType,
952  int nXOff, int nYOff, int nXSize, int nYSize,
953  void *pData, int nBufXSize, int nBufYSize,
954  GDALDataType eBufType,
955  GSpacing nPixelSpace, GSpacing nLineSpace,
956  GDALRasterIOExtraArg* psExtraArgIn ) override;
957 
958  virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) override;
959  virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) override;
960  virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
961  double* adfMinMax ) override;
962  virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
963  int bApproxOK,
964  double *pdfMin, double *pdfMax,
965  double *pdfMean, double *pdfStdDev,
966  GDALProgressFunc pfnProgress,
967  void *pProgressData ) override;
968  virtual CPLErr GetHistogram( int nXSize, int nYSize,
969  double dfMin, double dfMax,
970  int nBuckets, GUIntBig * panHistogram,
971  int bIncludeOutOfRange, int bApproxOK,
972  GDALProgressFunc pfnProgress,
973  void *pProgressData ) override;
974 
975  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) override;
976  virtual const char* GetType() override { return "AveragedSource"; }
977 };
978 
979 /************************************************************************/
980 /* VRTComplexSource */
981 /************************************************************************/
982 
983 typedef enum
984 {
985  VRT_SCALING_NONE,
986  VRT_SCALING_LINEAR,
987  VRT_SCALING_EXPONENTIAL,
988 } VRTComplexSourceScaling;
989 
990 class CPL_DLL VRTComplexSource : public VRTSimpleSource
991 {
992  CPL_DISALLOW_COPY_ASSIGN(VRTComplexSource)
993  bool AreValuesUnchanged() const;
994 
995 protected:
996  VRTComplexSourceScaling m_eScalingType;
997  double m_dfScaleOff; // For linear scaling.
998  double m_dfScaleRatio; // For linear scaling.
999 
1000  // For non-linear scaling with a power function.
1001  int m_bSrcMinMaxDefined;
1002  double m_dfSrcMin;
1003  double m_dfSrcMax;
1004  double m_dfDstMin;
1005  double m_dfDstMax;
1006  double m_dfExponent;
1007 
1008  int m_nColorTableComponent;
1009 
1010  template <class WorkingDT>
1011  CPLErr RasterIOInternal( int nReqXOff, int nReqYOff,
1012  int nReqXSize, int nReqYSize,
1013  void *pData, int nOutXSize, int nOutYSize,
1014  GDALDataType eBufType,
1015  GSpacing nPixelSpace, GSpacing nLineSpace,
1016  GDALRasterIOExtraArg* psExtraArg,
1017  GDALDataType eWrkDataType );
1018 
1019 public:
1020  VRTComplexSource();
1021  VRTComplexSource(const VRTComplexSource* poSrcSource,
1022  double dfXDstRatio, double dfYDstRatio);
1023  virtual ~VRTComplexSource();
1024 
1025  virtual CPLErr RasterIO( GDALDataType eBandDataType,
1026  int nXOff, int nYOff, int nXSize, int nYSize,
1027  void *pData, int nBufXSize, int nBufYSize,
1028  GDALDataType eBufType,
1029  GSpacing nPixelSpace, GSpacing nLineSpace,
1030  GDALRasterIOExtraArg* psExtraArgIn ) override;
1031 
1032  virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) override;
1033  virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) override;
1034  virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
1035  double* adfMinMax ) override;
1036  virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
1037  int bApproxOK,
1038  double *pdfMin, double *pdfMax,
1039  double *pdfMean, double *pdfStdDev,
1040  GDALProgressFunc pfnProgress,
1041  void *pProgressData ) override;
1042  virtual CPLErr GetHistogram( int nXSize, int nYSize,
1043  double dfMin, double dfMax,
1044  int nBuckets, GUIntBig * panHistogram,
1045  int bIncludeOutOfRange, int bApproxOK,
1046  GDALProgressFunc pfnProgress,
1047  void *pProgressData ) override;
1048 
1049  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) override;
1050  virtual CPLErr XMLInit( CPLXMLNode *, const char *, void* ) override;
1051  virtual const char* GetType() override { return "ComplexSource"; }
1052 
1053  double LookupValue( double dfInput );
1054 
1055  void SetLinearScaling( double dfOffset, double dfScale );
1056  void SetPowerScaling( double dfExponent,
1057  double dfSrcMin,
1058  double dfSrcMax,
1059  double dfDstMin,
1060  double dfDstMax );
1061  void SetColorTableComponent( int nComponent );
1062 
1063  double *m_padfLUTInputs;
1064  double *m_padfLUTOutputs;
1065  int m_nLUTItemCount;
1066 };
1067 
1068 /************************************************************************/
1069 /* VRTFilteredSource */
1070 /************************************************************************/
1071 
1072 class VRTFilteredSource : public VRTComplexSource
1073 {
1074 private:
1075  int IsTypeSupported( GDALDataType eTestType ) const;
1076 
1077  CPL_DISALLOW_COPY_ASSIGN(VRTFilteredSource)
1078 
1079 protected:
1080  int m_nSupportedTypesCount;
1081  GDALDataType m_aeSupportedTypes[20];
1082 
1083  int m_nExtraEdgePixels;
1084 
1085 public:
1086  VRTFilteredSource();
1087  virtual ~VRTFilteredSource();
1088 
1089  void SetExtraEdgePixels( int );
1090  void SetFilteringDataTypesSupported( int, GDALDataType * );
1091 
1092  virtual CPLErr FilterData( int nXSize, int nYSize, GDALDataType eType,
1093  GByte *pabySrcData, GByte *pabyDstData ) = 0;
1094 
1095  virtual CPLErr RasterIO( GDALDataType eBandDataType,
1096  int nXOff, int nYOff, int nXSize, int nYSize,
1097  void *pData, int nBufXSize, int nBufYSize,
1098  GDALDataType eBufType,
1099  GSpacing nPixelSpace, GSpacing nLineSpace,
1100  GDALRasterIOExtraArg* psExtraArg ) override;
1101 };
1102 
1103 /************************************************************************/
1104 /* VRTKernelFilteredSource */
1105 /************************************************************************/
1106 
1107 class VRTKernelFilteredSource : public VRTFilteredSource
1108 {
1109  CPL_DISALLOW_COPY_ASSIGN(VRTKernelFilteredSource)
1110 
1111 protected:
1112  int m_nKernelSize;
1113 
1114  bool m_bSeparable;
1115 
1116  double *m_padfKernelCoefs;
1117 
1118  int m_bNormalized;
1119 
1120 public:
1121  VRTKernelFilteredSource();
1122  virtual ~VRTKernelFilteredSource();
1123 
1124  virtual CPLErr XMLInit( CPLXMLNode *psTree, const char *, void* ) override;
1125  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) override;
1126 
1127  virtual CPLErr FilterData( int nXSize, int nYSize, GDALDataType eType,
1128  GByte *pabySrcData, GByte *pabyDstData ) override;
1129 
1130  CPLErr SetKernel( int nKernelSize, bool bSeparable, double *padfCoefs );
1131  void SetNormalized( int );
1132 };
1133 
1134 /************************************************************************/
1135 /* VRTAverageFilteredSource */
1136 /************************************************************************/
1137 
1138 class VRTAverageFilteredSource : public VRTKernelFilteredSource
1139 {
1140  CPL_DISALLOW_COPY_ASSIGN(VRTAverageFilteredSource)
1141 
1142 public:
1143  explicit VRTAverageFilteredSource( int nKernelSize );
1144  virtual ~VRTAverageFilteredSource();
1145 
1146  virtual CPLErr XMLInit( CPLXMLNode *psTree, const char *, void* ) override;
1147  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) override;
1148 };
1149 
1150 /************************************************************************/
1151 /* VRTFuncSource */
1152 /************************************************************************/
1153 class VRTFuncSource : public VRTSource
1154 {
1155  CPL_DISALLOW_COPY_ASSIGN(VRTFuncSource)
1156 
1157 public:
1158  VRTFuncSource();
1159  virtual ~VRTFuncSource();
1160 
1161  virtual CPLErr XMLInit( CPLXMLNode *, const char *, void* ) override { return CE_Failure; }
1162  virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) override;
1163 
1164  virtual CPLErr RasterIO( GDALDataType eBandDataType,
1165  int nXOff, int nYOff, int nXSize, int nYSize,
1166  void *pData, int nBufXSize, int nBufYSize,
1167  GDALDataType eBufType,
1168  GSpacing nPixelSpace, GSpacing nLineSpace,
1169  GDALRasterIOExtraArg* psExtraArg ) override;
1170 
1171  virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) override;
1172  virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) override;
1173  virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
1174  double* adfMinMax ) override;
1175  virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
1176  int bApproxOK,
1177  double *pdfMin, double *pdfMax,
1178  double *pdfMean, double *pdfStdDev,
1179  GDALProgressFunc pfnProgress,
1180  void *pProgressData ) override;
1181  virtual CPLErr GetHistogram( int nXSize, int nYSize,
1182  double dfMin, double dfMax,
1183  int nBuckets, GUIntBig * panHistogram,
1184  int bIncludeOutOfRange, int bApproxOK,
1185  GDALProgressFunc pfnProgress,
1186  void *pProgressData ) override;
1187 
1188  VRTImageReadFunc pfnReadFunc;
1189  void *pCBData;
1190  GDALDataType eType;
1191 
1192  float fNoDataValue;
1193 };
1194 
1195 #endif /* #ifndef DOXYGEN_SKIP */
1196 
1197 #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:922
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:548
virtual void FlushCache(void)
Flush all write cached data to disk.
Definition: gdaldataset.cpp:396
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:2263
virtual const char * GetProjectionRef(void)
Fetch the projection definition string for this dataset.
Definition: gdaldataset.cpp:824
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:766
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:215
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:258
Pansharpening operation class.
Definition: gdalpansharpen.h:188
Convenient string class based on std::string.
Definition: cpl_string.h:329
Hash set implementation.
Definition: gdal.h:61
virtual CPLErr SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList, const char *pszGCPProjection)
Assign GCPs.
Definition: gdaldataset.cpp:1382
void char ** GetMetadata(const char *pszDomain="") override
Fetch metadata.
Definition: gdaldataset.cpp:3469
#define VRT_NODATA_UNSET
Special value to indicate that nodata is not set.
Definition: gdal_vrt.h:45
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:273
int Dereference()
Subtract one from dataset reference count.
Definition: gdaldataset.cpp:1130
virtual const GDAL_GCP * GetGCPs()
Fetch GCPs.
Definition: gdaldataset.cpp:1332
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:602
virtual CPLErr SetGeoTransform(double *padfTransform)
Set the affine transformation coefficients.
Definition: gdaldataset.cpp:977
virtual int GetGCPCount()
Get number of GCPs.
Definition: gdaldataset.cpp:1264
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:440
virtual CPLErr CreateMaskBand(int nFlagsIn)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:2445
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:2345
virtual CPLErr SetProjection(const char *pszProjection)
Set the projection reference string for this dataset.
Definition: gdaldataset.cpp:864
virtual const char * GetGCPProjection()
Get output projection for GCPs.
Definition: gdaldataset.cpp:1299
void GDALClose(GDALDatasetH)
Close GDAL dataset.
Definition: gdaldataset.cpp:3046
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:139
A single raster band (or channel).
Definition: gdal_priv.h:1032
GDALAccess
Definition: gdal.h:113
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:335
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:1202
Definition: gdal.h:114
Format specific driver.
Definition: gdal_priv.h:1386
A color table / palette.
Definition: gdal_priv.h:937
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.