Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends

VRTDataset Class Reference

Inheritance diagram for VRTDataset:
GDALDataset GDALMajorObject VRTWarpedDataset

List of all members.

Public Member Functions

 VRTDataset (int nXSize, int nYSize)
void SetNeedsFlush ()
virtual void FlushCache ()
 Flush all write cached data to disk.
void SetWritable (int bWritable)
virtual CPLErr CreateMaskBand (int nFlags)
 Adds a mask band to the dataset.
void SetMaskBand (VRTRasterBand *poMaskBand)
virtual const char * GetProjectionRef (void)
 Fetch the projection definition string for this dataset.
virtual CPLErr SetProjection (const char *)
 Set the projection reference string for this dataset.
virtual CPLErr GetGeoTransform (double *)
 Fetch the affine transformation coefficients.
virtual CPLErr SetGeoTransform (double *)
 Set the affine transformation coefficients.
virtual CPLErr SetMetadata (char **papszMD, const char *pszDomain="")
 Set metadata.
virtual CPLErr SetMetadataItem (const char *pszName, const char *pszValue, const char *pszDomain="")
 Set single metadata item.
virtual int GetGCPCount ()
 Get number of GCPs.
virtual const char * GetGCPProjection ()
 Get output projection for GCPs.
virtual const GDAL_GCPGetGCPs ()
 Fetch GCPs.
virtual CPLErr SetGCPs (int nGCPCount, const GDAL_GCP *pasGCPList, const char *pszGCPProjection)
 Assign GCPs.
virtual CPLErr AddBand (GDALDataType eType, char **papszOptions=NULL)
 Add a band to a dataset.
virtual char ** GetFileList ()
 Fetch files forming dataset.
virtual CPLErr IRasterIO (GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, void *pData, int nBufXSize, int nBufYSize, GDALDataType eBufType, int nBandCount, int *panBandMap, int nPixelSpace, int nLineSpace, int nBandSpace)
virtual CPLXMLNodeSerializeToXML (const char *pszVRTPath)
virtual CPLErr XMLInit (CPLXMLNode *, const char *)
GDALDatasetGetSingleSimpleSource ()

Static Public Member Functions

static int Identify (GDALOpenInfo *)
static GDALDatasetOpen (GDALOpenInfo *)
static GDALDatasetOpenXML (const char *, const char *=NULL, GDALAccess eAccess=GA_ReadOnly)
static GDALDatasetCreate (const char *pszName, int nXSize, int nYSize, int nBands, GDALDataType eType, char **papszOptions)
static CPLErr Delete (const char *pszFilename)

Protected Member Functions

virtual int CloseDependentDatasets ()
 Drop references to any other datasets referenced by this dataset.

Friends

class VRTRasterBand

Member Function Documentation

CPLErr VRTDataset::AddBand ( GDALDataType  eType,
char **  papszOptions = NULL 
) [virtual]

Add a band to a dataset.

This method will add a new band to the dataset if the underlying format supports this action. Most formats do not.

Note that the new GDALRasterBand is not returned. It may be fetched after successful completion of the method by calling GDALDataset::GetRasterBand(GDALDataset::GetRasterCount()) as the newest band will always be the last band.

Parameters:
eType the data type of the pixels in the new band.
papszOptions a list of NAME=VALUE option strings. The supported options are format specific. NULL may be passed by default.
Returns:
CE_None on success or CE_Failure on failure.

Reimplemented from GDALDataset.

Reimplemented in VRTWarpedDataset.

int VRTDataset::CloseDependentDatasets (  )  [protected, virtual]

Drop references to any other datasets referenced by this dataset.

This method should release any reference to other datasets (e.g. a VRT dataset to its sources), but not close the current dataset itself.

If at least, one reference to a dependent dataset has been dropped, this method should return TRUE. Otherwise it *should* return FALSE. (Failure to return the proper value might result in infinite loop)

This method can be called several times on a given dataset. After the first time, it should not do anything and return FALSE.

The driver implementation may choose to destroy its raster bands, so be careful not to call any method on the raster bands afterwards.

Basically the only safe action you can do after calling CloseDependantDatasets() is to call the destructor.

Note: the only legitimate caller of CloseDependantDatasets() is GDALDriverManager::~GDALDriverManager()

Returns:
TRUE if at least one reference to another dataset has been dropped.

Reimplemented from GDALDataset.

Reimplemented in VRTWarpedDataset.

CPLErr VRTDataset::CreateMaskBand ( int  nFlags  )  [virtual]

Adds a mask band to the dataset.

The default implementation of the CreateMaskBand() method is implemented based on similar rules to the .ovr handling implemented using the GDALDefaultOverviews object. A TIFF file with the extension .msk will be created with the same basename as the original file, and it will have one band. The mask images will be deflate compressed tiled images with the same block size as the original image if possible.

Note that if you got a mask band with a previous call to GetMaskBand(), it might be invalidated by CreateMaskBand(). So you have to call GetMaskBand() again.

Since:
GDAL 1.5.0
Parameters:
nFlags ignored. GMF_PER_DATASET will be assumed.
Returns:
CE_None on success or CE_Failure on an error.
See also:
http://trac.osgeo.org/gdal/wiki/rfc15_nodatabitmask

Reimplemented from GDALDataset.

void VRTDataset::FlushCache ( void   )  [virtual]

Flush all write cached data to disk.

Any raster (or other GDAL) data written via GDAL calls, but buffered internally will be written to disk.

The default implementation of this method just calls the FlushCache() method on each of the raster bands and the SyncToDisk() method on each of the layers. Conceptionally, calling FlushCache() on a dataset should include any work that might be accomplished by calling SyncToDisk() on layers in that dataset.

Using this method does not prevent use from calling GDALClose() to properly close a dataset and ensure that important data not addressed by FlushCache() is written in the file.

This method is the same as the C function GDALFlushCache().

Reimplemented from GDALDataset.

char ** VRTDataset::GetFileList ( void   )  [virtual]

Fetch files forming dataset.

Returns a list of files believed to be part of this dataset. If it returns an empty list of files it means there is believed to be no local file system files associated with the dataset (for instance a virtual dataset). The returned file list is owned by the caller and should be deallocated with CSLDestroy().

The returned filenames will normally be relative or absolute paths depending on the path used to originally open the dataset. The strings will be UTF-8 encoded.

This method is the same as the C GDALGetFileList() function.

Returns:
NULL or a NULL terminated array of file names.

Reimplemented from GDALDataset.

Reimplemented in VRTWarpedDataset.

int VRTDataset::GetGCPCount (  )  [virtual]

Get number of GCPs.

This method is the same as the C function GDALGetGCPCount().

Returns:
number of GCPs for this dataset. Zero if there are none.

Reimplemented from GDALDataset.

const char * VRTDataset::GetGCPProjection (  )  [virtual]

Get output projection for GCPs.

This method is the same as the C function GDALGetGCPProjection().

The projection string follows the normal rules from GetProjectionRef().

Returns:
internal projection string or "" if there are no GCPs. It should not be altered, freed or expected to last for long.

Reimplemented from GDALDataset.

const GDAL_GCP * VRTDataset::GetGCPs (  )  [virtual]

Fetch GCPs.

This method is the same as the C function GDALGetGCPs().

Returns:
pointer to internal GCP structure list. It should not be modified, and may change on the next GDAL call.

Reimplemented from GDALDataset.

CPLErr VRTDataset::GetGeoTransform ( double *  padfTransform  )  [virtual]

Fetch the affine transformation coefficients.

Fetches the coefficients for transforming between pixel/line (P,L) raster space, and projection coordinates (Xp,Yp) space.

   Xp = padfTransform[0] + P*padfTransform[1] + L*padfTransform[2];
   Yp = padfTransform[3] + P*padfTransform[4] + L*padfTransform[5];

In a north up image, padfTransform[1] is the pixel width, and padfTransform[5] is the pixel height. The upper left corner of the upper left pixel is at position (padfTransform[0],padfTransform[3]).

The default transform is (0,1,0,0,0,1) and should be returned even when a CE_Failure error is returned, such as for formats that don't support transformation to projection coordinates.

This method does the same thing as the C GDALGetGeoTransform() function.

Parameters:
padfTransform an existing six double buffer into which the transformation will be placed.
Returns:
CE_None on success, or CE_Failure if no transform can be fetched.

Reimplemented from GDALDataset.

const char * VRTDataset::GetProjectionRef ( void   )  [virtual]

Fetch the projection definition string for this dataset.

Same as the C function GDALGetProjectionRef().

The returned string defines the projection coordinate system of the image in OpenGIS WKT format. It should be suitable for use with the OGRSpatialReference class.

When a projection definition is not available an empty (but not NULL) string is returned.

Returns:
a pointer to an internal projection reference string. It should not be altered, freed or expected to last for long.
See also:
http://www.gdal.org/ogr/osr_tutorial.html

Reimplemented from GDALDataset.

CPLErr VRTDataset::SetGCPs ( int  nGCPCount,
const GDAL_GCP pasGCPList,
const char *  pszGCPProjection 
) [virtual]

Assign GCPs.

This method is the same as the C function GDALSetGCPs().

This method assigns the passed set of GCPs to this dataset, as well as setting their coordinate system. Internally copies are made of the coordinate system and list of points, so the caller remains responsible for deallocating these arguments if appropriate.

Most formats do not support setting of GCPs, even formats that can handle GCPs. These formats will return CE_Failure.

Parameters:
nGCPCount number of GCPs being assigned.
pasGCPList array of GCP structures being assign (nGCPCount in array).
pszGCPProjection the new OGC WKT coordinate system to assign for the GCP output coordinates. This parameter should be "" if no output coordinate system is known.
Returns:
CE_None on success, CE_Failure on failure (including if action is not supported for this format).

Reimplemented from GDALDataset.

CPLErr VRTDataset::SetGeoTransform ( double *  padfTransform  )  [virtual]

Set the affine transformation coefficients.

See GetGeoTransform() for details on the meaning of the padfTransform coefficients.

This method does the same thing as the C GDALSetGeoTransform() function.

Parameters:
padfTransform a six double buffer containing the transformation coefficients to be written with the dataset.
Returns:
CE_None on success, or CE_Failure if this transform cannot be written.

Reimplemented from GDALDataset.

CPLErr VRTDataset::SetMetadata ( char **  papszMetadataIn,
const char *  pszDomain = "" 
) [virtual]

Set metadata.

The C function GDALSetMetadata() does the same thing as this method.

Parameters:
papszMetadataIn the metadata in name=value string list format to apply.
pszDomain the domain of interest. Use "" or NULL for the default domain.
Returns:
CE_None on success, CE_Failure on failure and CE_Warning if the metadata has been accepted, but is likely not maintained persistently by the underlying object between sessions.

Reimplemented from GDALMajorObject.

CPLErr VRTDataset::SetMetadataItem ( const char *  pszName,
const char *  pszValue,
const char *  pszDomain = "" 
) [virtual]

Set single metadata item.

The C function GDALSetMetadataItem() does the same thing as this method.

Parameters:
pszName the key for the metadata item to fetch.
pszValue the value to assign to the key.
pszDomain the domain to set within, use NULL for the default domain.
Returns:
CE_None on success, or an error code on failure.

Reimplemented from GDALMajorObject.

CPLErr VRTDataset::SetProjection ( const char *  pszProjection  )  [virtual]

Set the projection reference string for this dataset.

The string should be in OGC WKT or PROJ.4 format. An error may occur because of incorrectly specified projection strings, because the dataset is not writable, or because the dataset does not support the indicated projection. Many formats do not support writing projections.

This method is the same as the C GDALSetProjection() function.

Parameters:
pszProjection projection reference string.
Returns:
CE_Failure if an error occurs, otherwise CE_None.

Reimplemented from GDALDataset.


The documentation for this class was generated from the following files:

Generated for GDAL by doxygen 1.7.1.