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

Generated for GDAL by doxygen 1.8.8.