~ubuntu-branches/debian/sid/gdal/sid

« back to all changes in this revision

Viewing changes to frmts/vrt/vrtdataset.h

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-05-07 15:04:42 UTC
  • mfrom: (5.5.16 experimental)
  • Revision ID: package-import@ubuntu.com-20120507150442-2eks97loeh6rq005
Tags: 1.9.0-1
* Ready for sid, starting transition.
* All symfiles updated to latest builds.
* Added dh_numpy call in debian/rules to depend on numpy ABI.
* Policy bumped to 3.9.3, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************
2
 
 * $Id: vrtdataset.h 19819 2010-06-09 16:52:42Z warmerdam $
 
2
 * $Id: vrtdataset.h 23574 2011-12-14 19:29:48Z rouault $
3
3
 *
4
4
 * Project:  Virtual GDAL Datasets
5
5
 * Purpose:  Declaration of virtual gdal dataset classes.
38
38
int VRTApplyMetadata( CPLXMLNode *, GDALMajorObject * );
39
39
CPLXMLNode *VRTSerializeMetadata( GDALMajorObject * );
40
40
 
 
41
int VRTWarpedOverviewTransform( void *pTransformArg, int bDstToSrc,
 
42
                                int nPointCount,
 
43
                                double *padfX, double *padfY, double *padfZ,
 
44
                                int *panSuccess );
 
45
void* VRTDeserializeWarpedOverviewTransformer( CPLXMLNode *psTree );
 
46
 
 
47
/************************************************************************/
 
48
/*                          VRTOverviewInfo()                           */
 
49
/************************************************************************/
 
50
class VRTOverviewInfo
 
51
{
 
52
public:
 
53
    CPLString       osFilename;
 
54
    int             nBand;
 
55
    GDALRasterBand *poBand;
 
56
    int             bTriedToOpen;
 
57
    
 
58
    VRTOverviewInfo() : poBand(NULL), bTriedToOpen(FALSE) {}
 
59
    ~VRTOverviewInfo() {
 
60
        if( poBand == NULL ) 
 
61
            /* do nothing */;
 
62
        else if( poBand->GetDataset()->GetShared() )
 
63
            GDALClose( (GDALDatasetH) poBand->GetDataset() );
 
64
        else
 
65
            poBand->GetDataset()->Dereference();
 
66
    }
 
67
};
 
68
 
 
69
 
41
70
/************************************************************************/
42
71
/*                              VRTSource                               */
43
72
/************************************************************************/
52
81
                              GDALDataType eBufType, 
53
82
                              int nPixelSpace, int nLineSpace ) = 0;
54
83
 
 
84
    virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) = 0;
 
85
    virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) = 0;
 
86
 
55
87
    virtual CPLErr  XMLInit( CPLXMLNode *psTree, const char * ) = 0;
56
88
    virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) = 0;
57
89
    
58
90
    virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
59
91
                               int *pnMaxSize, CPLHashSet* hSetFiles);
 
92
 
 
93
    virtual int    IsSimpleSource() { return FALSE; }
60
94
};
61
95
 
62
96
typedef VRTSource *(*VRTSourceParser)(CPLXMLNode *, const char *);
68
102
/*                              VRTDataset                              */
69
103
/************************************************************************/
70
104
 
 
105
class VRTRasterBand;
 
106
 
71
107
class CPL_DLL VRTDataset : public GDALDataset
72
108
{
 
109
    friend class VRTRasterBand;
 
110
 
73
111
    char           *pszProjection;
74
112
 
75
113
    int            bGeoTransformSet;
84
122
    
85
123
    char          *pszVRTPath;
86
124
 
 
125
    VRTRasterBand *poMaskBand;
 
126
 
 
127
    int            bCompatibleForDatasetIO;
 
128
    int            CheckCompatibleForDatasetIO();
 
129
 
 
130
  protected:
 
131
    virtual int         CloseDependentDatasets();
 
132
 
87
133
  public:
88
134
                 VRTDataset(int nXSize, int nYSize);
89
135
                ~VRTDataset();
93
139
    
94
140
    void SetWritable(int bWritable) { this->bWritable = bWritable; }
95
141
 
 
142
    virtual CPLErr          CreateMaskBand( int nFlags );
 
143
    void SetMaskBand(VRTRasterBand* poMaskBand);
 
144
 
96
145
    virtual const char *GetProjectionRef(void);
97
146
    virtual CPLErr SetProjection( const char * );
98
147
    virtual CPLErr GetGeoTransform( double * );
113
162
                            
114
163
    virtual char      **GetFileList();
115
164
 
 
165
    virtual CPLErr  IRasterIO( GDALRWFlag eRWFlag,
 
166
                               int nXOff, int nYOff, int nXSize, int nYSize,
 
167
                               void * pData, int nBufXSize, int nBufYSize,
 
168
                               GDALDataType eBufType,
 
169
                               int nBandCount, int *panBandMap,
 
170
                               int nPixelSpace, int nLineSpace, int nBandSpace);
 
171
 
116
172
    virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath);
117
173
    virtual CPLErr      XMLInit( CPLXMLNode *, const char * );
118
174
 
140
196
 
141
197
    friend class VRTWarpedRasterBand;
142
198
 
 
199
  protected:
 
200
    virtual int         CloseDependentDatasets();
 
201
 
143
202
public:
144
203
    int               nOverviewCount;
145
204
    VRTWarpedDataset  **papoOverviews;
176
235
class CPL_DLL VRTRasterBand : public GDALRasterBand
177
236
{
178
237
  protected:
 
238
    int            bIsMaskBand;
 
239
 
179
240
    int            bNoDataValueSet;
180
241
    int            bHideNoDataValue; // If set to true, will not report the existance of nodata
181
242
    double         dfNoDataValue;
194
255
 
195
256
    void           Initialize( int nXSize, int nYSize );
196
257
 
 
258
    std::vector<VRTOverviewInfo> apoOverviews;
 
259
 
 
260
    VRTRasterBand *poMaskBand;
 
261
 
197
262
  public:
198
263
 
199
264
                    VRTRasterBand();
225
290
    CPLErr SetOffset( double );
226
291
    virtual double GetScale( int *pbSuccess = NULL );
227
292
    CPLErr SetScale( double );
 
293
 
 
294
    virtual int GetOverviewCount();
 
295
    virtual GDALRasterBand *GetOverview(int);
228
296
    
229
297
    virtual CPLErr  GetHistogram( double dfMin, double dfMax,
230
298
                          int nBuckets, int * panHistogram,
245
313
                               int *pnMaxSize, CPLHashSet* hSetFiles);
246
314
    
247
315
    virtual void   SetDescription( const char * );
 
316
 
 
317
    virtual GDALRasterBand *GetMaskBand();
 
318
    virtual int             GetMaskFlags();
 
319
 
 
320
    virtual CPLErr          CreateMaskBand( int nFlags );
 
321
    
 
322
    void SetMaskBand(VRTRasterBand* poMaskBand);
 
323
 
 
324
    void SetIsMaskBand();
 
325
 
 
326
    CPLErr UnsetNoDataValue();
 
327
 
 
328
    virtual int         CloseDependentDatasets();
 
329
 
 
330
    virtual int         IsSourcedRasterBand() { return FALSE; }
248
331
};
249
332
 
250
333
/************************************************************************/
253
336
 
254
337
class CPL_DLL VRTSourcedRasterBand : public VRTRasterBand
255
338
{
256
 
    int            bAlreadyInIRasterIO;
257
 
    
 
339
  private:
 
340
    int            bAntiRecursionFlag;
 
341
    CPLString      osLastLocationInfo;
 
342
 
258
343
    void           Initialize( int nXSize, int nYSize );
259
344
 
260
345
  public:
274
359
                              void *, int, int, GDALDataType,
275
360
                              int, int );
276
361
 
 
362
    virtual const char *GetMetadataItem( const char * pszName,
 
363
                                         const char * pszDomain = "" );
277
364
    virtual char      **GetMetadata( const char * pszDomain = "" );
278
365
    virtual CPLErr      SetMetadata( char ** papszMetadata,
279
366
                                     const char * pszDomain = "" );
284
371
    virtual CPLErr         XMLInit( CPLXMLNode *, const char * );
285
372
    virtual CPLXMLNode *   SerializeToXML( const char *pszVRTPath );
286
373
 
 
374
    virtual double GetMinimum( int *pbSuccess = NULL );
 
375
    virtual double GetMaximum(int *pbSuccess = NULL );
 
376
 
287
377
    CPLErr         AddSource( VRTSource * );
288
378
    CPLErr         AddSimpleSource( GDALRasterBand *poSrcBand, 
289
379
                                    int nSrcXOff=-1, int nSrcYOff=-1, 
302
392
                                     double dfNoDataValue = VRT_NODATA_UNSET,
303
393
                                     int nColorTableComponent = 0);
304
394
 
 
395
    CPLErr         AddMaskBandSource( GDALRasterBand *poSrcBand,
 
396
                                      int nSrcXOff=-1, int nSrcYOff=-1,
 
397
                                      int nSrcXSize=-1, int nSrcYSize=-1,
 
398
                                      int nDstXOff=-1, int nDstYOff=-1,
 
399
                                      int nDstXSize=-1, int nDstYSize=-1 );
 
400
 
305
401
    CPLErr         AddFuncSource( VRTImageReadFunc pfnReadFunc, void *hCBData,
306
402
                                  double dfNoDataValue = VRT_NODATA_UNSET );
307
403
 
310
406
    
311
407
    virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
312
408
                               int *pnMaxSize, CPLHashSet* hSetFiles);
 
409
 
 
410
    virtual int         CloseDependentDatasets();
 
411
 
 
412
    virtual int         IsSourcedRasterBand() { return TRUE; }
313
413
};
314
414
 
315
415
/************************************************************************/
412
512
 
413
513
class VRTDriver : public GDALDriver
414
514
{
 
515
    void        *pDeserializerData;
 
516
 
415
517
  public:
416
518
                 VRTDriver();
417
519
                 ~VRTDriver();
436
538
protected:
437
539
    GDALRasterBand      *poRasterBand;
438
540
 
 
541
    /* when poRasterBand is a mask band, poMaskBandMainBand is the band */
 
542
    /* from which the mask band is taken */
 
543
    GDALRasterBand      *poMaskBandMainBand; 
 
544
 
439
545
    int                 nSrcXOff;
440
546
    int                 nSrcYOff;
441
547
    int                 nSrcXSize;
457
563
    virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
458
564
 
459
565
    void           SetSrcBand( GDALRasterBand * );
 
566
    void           SetSrcMaskBand( GDALRasterBand * );
460
567
    void           SetSrcWindow( int, int, int, int );
461
568
    void           SetDstWindow( int, int, int, int );
462
569
    void           SetNoDataValue( double dfNoDataValue );
470
577
                              GDALDataType eBufType, 
471
578
                              int nPixelSpace, int nLineSpace );
472
579
 
 
580
    virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess );
 
581
    virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess );
 
582
 
473
583
    void            DstToSrc( double dfX, double dfY,
474
584
                              double &dfXOut, double &dfYOut );
475
585
    void            SrcToDst( double dfX, double dfY,
477
587
    
478
588
    virtual void   GetFileList(char*** ppapszFileList, int *pnSize,
479
589
                               int *pnMaxSize, CPLHashSet* hSetFiles);
 
590
 
 
591
    virtual int    IsSimpleSource() { return TRUE; }
 
592
    virtual const char* GetType() { return "SimpleSource"; }
 
593
 
 
594
    GDALRasterBand* GetBand();
 
595
    int             IsSameExceptBandNumber(VRTSimpleSource* poOtherSource);
 
596
    CPLErr          DatasetRasterIO(
 
597
                               int nXOff, int nYOff, int nXSize, int nYSize,
 
598
                               void * pData, int nBufXSize, int nBufYSize,
 
599
                               GDALDataType eBufType,
 
600
                               int nBandCount, int *panBandMap,
 
601
                               int nPixelSpace, int nLineSpace, int nBandSpace);
480
602
};
481
603
 
482
604
/************************************************************************/
491
613
                              void *pData, int nBufXSize, int nBufYSize, 
492
614
                              GDALDataType eBufType, 
493
615
                              int nPixelSpace, int nLineSpace );
 
616
 
 
617
    virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess );
 
618
    virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess );
 
619
 
494
620
    virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
 
621
    virtual const char* GetType() { return "AveragedSource"; }
495
622
};
496
623
 
497
624
/************************************************************************/
508
635
                             void *pData, int nBufXSize, int nBufYSize, 
509
636
                             GDALDataType eBufType, 
510
637
                             int nPixelSpace, int nLineSpace );
 
638
 
 
639
    virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess );
 
640
    virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess );
 
641
 
511
642
    virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
512
643
    virtual CPLErr XMLInit( CPLXMLNode *, const char * );
 
644
    virtual const char* GetType() { return "ComplexSource"; }
 
645
 
513
646
    double  LookupValue( double dfInput );
514
647
 
515
648
    int            bDoScaling;
610
743
                              GDALDataType eBufType, 
611
744
                              int nPixelSpace, int nLineSpace );
612
745
 
 
746
    virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess );
 
747
    virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess );
 
748
 
613
749
    VRTImageReadFunc    pfnReadFunc;
614
750
    void               *pCBData;
615
751
    GDALDataType        eType;