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