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

Generated for GDAL by doxygen 1.8.8.