GDAL

- Main Page
- Related Pages
- Classes
- Files
- Download
- Issue Tracker

- File List
- File Members

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

Generated for GDAL by 1.8.8.