GDAL
Public Member Functions | List of all members
GDALDefaultRasterAttributeTable Class Reference

Raster Attribute Table container. More...

#include <gdal_rat.h>

Inheritance diagram for GDALDefaultRasterAttributeTable:
GDALRasterAttributeTable

Public Member Functions

 GDALDefaultRasterAttributeTable ()
 Construct empty table.
 
 GDALDefaultRasterAttributeTable (const GDALDefaultRasterAttributeTable &)
 Copy constructor.
 
GDALDefaultRasterAttributeTableClone () const
 Copy Raster Attribute Table. More...
 
virtual int GetColumnCount () const
 Fetch table column count. More...
 
virtual const char * GetNameOfCol (int) const
 Fetch name of indicated column. More...
 
virtual GDALRATFieldUsage GetUsageOfCol (int) const
 Fetch column usage value. More...
 
virtual GDALRATFieldType GetTypeOfCol (int) const
 Fetch column type. More...
 
virtual int GetColOfUsage (GDALRATFieldUsage) const
 Fetch column index for given usage. More...
 
virtual int GetRowCount () const
 Fetch row count. More...
 
virtual const char * GetValueAsString (int iRow, int iField) const
 Fetch field value as a string. More...
 
virtual int GetValueAsInt (int iRow, int iField) const
 Fetch field value as a integer. More...
 
virtual double GetValueAsDouble (int iRow, int iField) const
 Fetch field value as a double. More...
 
virtual void SetValue (int iRow, int iField, const char *pszValue)
 Set field value from string. More...
 
virtual void SetValue (int iRow, int iField, double dfValue)
 Set field value from double. More...
 
virtual void SetValue (int iRow, int iField, int nValue)
 Set field value from integer. More...
 
virtual int ChangesAreWrittenToFile ()
 Determine whether changes made to this RAT are reflected directly in the dataset. More...
 
virtual void SetRowCount (int iCount)
 Set row count. More...
 
virtual int GetRowOfValue (double dfValue) const
 
virtual int GetRowOfValue (int nValue) const
 
virtual CPLErr CreateColumn (const char *pszFieldName, GDALRATFieldType eFieldType, GDALRATFieldUsage eFieldUsage)
 Create new column. More...
 
virtual CPLErr SetLinearBinning (double dfRow0Min, double dfBinSize)
 Set linear binning information. More...
 
virtual int GetLinearBinning (double *pdfRow0Min, double *pdfBinSize) const
 Get linear binning information. More...
 
- Public Member Functions inherited from GDALRasterAttributeTable
virtual CPLErr ValuesIO (GDALRWFlag eRWFlag, int iField, int iStartRow, int iLength, double *pdfData)
 Read or Write a block of doubles to/from the Attribute Table. More...
 
virtual CPLErr ValuesIO (GDALRWFlag eRWFlag, int iField, int iStartRow, int iLength, int *pnData)
 Read or Write a block of integers to/from the Attribute Table. More...
 
virtual CPLErr ValuesIO (GDALRWFlag eRWFlag, int iField, int iStartRow, int iLength, char **papszStrList)
 Read or Write a block of strings to/from the Attribute Table. More...
 
virtual CPLXMLNodeSerialize () const
 Serialize. More...
 
virtual CPLErr XMLInit (CPLXMLNode *, const char *)
 
virtual CPLErr InitializeFromColorTable (const GDALColorTable *)
 Initialize from color table. More...
 
virtual GDALColorTableTranslateToColorTable (int nEntryCount=-1)
 Translate to a color table. More...
 
virtual void DumpReadable (FILE *=NULL)
 Dump RAT in readable form. More...
 

Detailed Description

Raster Attribute Table container.

Member Function Documentation

int GDALDefaultRasterAttributeTable::ChangesAreWrittenToFile ( )
virtual

Determine whether changes made to this RAT are reflected directly in the dataset.

If this returns FALSE then GDALRasterBand.SetDefaultRAT() should be called. Otherwise this is unnecessary since changes to this object are reflected in the dataset.

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

Implements GDALRasterAttributeTable.

GDALDefaultRasterAttributeTable * GDALDefaultRasterAttributeTable::Clone ( ) const
virtual

Copy Raster Attribute Table.

Creates a new copy of an existing raster attribute table. The new copy becomes the responsibility of the caller to destroy. May fail (return NULL) if the attribute table is too large to clone (GetRowCount() * GetColCount() > RAT_MAX_ELEM_FOR_CLONE)

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

Returns
new copy of the RAT as an in-memory implementation.

Implements GDALRasterAttributeTable.

CPLErr GDALDefaultRasterAttributeTable::CreateColumn ( const char *  pszFieldName,
GDALRATFieldType  eFieldType,
GDALRATFieldUsage  eFieldUsage 
)
virtual

Create new column.

If the table already has rows, all row values for the new column will be initialized to the default value ("", or zero). The new column is always created as the last column, can will be column (field) "GetColumnCount()-1" after CreateColumn() has completed successfully.

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

Parameters
pszFieldNamethe name of the field to create.
eFieldTypethe field type (integer, double or string).
eFieldUsagethe field usage, GFU_Generic if not known.
Returns
CE_None on success or CE_Failure if something goes wrong.

Reimplemented from GDALRasterAttributeTable.

int GDALDefaultRasterAttributeTable::GetColOfUsage ( GDALRATFieldUsage  ) const
virtual

Fetch column index for given usage.

Returns the index of the first column of the requested usage type, or -1 if no match is found.

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

Parameters
eUsageusage type to search for.
Returns
column index, or -1 on failure.

Implements GDALRasterAttributeTable.

int GDALDefaultRasterAttributeTable::GetColumnCount ( ) const
virtual

Fetch table column count.

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

Returns
the number of columns.

Implements GDALRasterAttributeTable.

int GDALDefaultRasterAttributeTable::GetLinearBinning ( double *  pdfRow0Min,
double *  pdfBinSize 
) const
virtual

Get linear binning information.

Returns linear binning information if any is associated with the RAT.

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

Parameters
pdfRow0Min(out) the lower bound (pixel value) of the first category.
pdfBinSize(out) the width of each category (in pixel value units).
Returns
TRUE if linear binning information exists or FALSE if there is none.

Reimplemented from GDALRasterAttributeTable.

const char * GDALDefaultRasterAttributeTable::GetNameOfCol ( int  ) const
virtual

Fetch name of indicated column.

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

Parameters
iColthe column index (zero based).
Returns
the column name or an empty string for invalid column numbers.

Implements GDALRasterAttributeTable.

int GDALDefaultRasterAttributeTable::GetRowCount ( ) const
virtual

Fetch row count.

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

Returns
the number of rows.

Implements GDALRasterAttributeTable.

GDALRATFieldType GDALDefaultRasterAttributeTable::GetTypeOfCol ( int  ) const
virtual

Fetch column type.

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

Parameters
iColthe column index (zero based).
Returns
column type or GFT_Integer if the column index is illegal.

Implements GDALRasterAttributeTable.

GDALRATFieldUsage GDALDefaultRasterAttributeTable::GetUsageOfCol ( int  ) const
virtual

Fetch column usage value.

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

Parameters
iColthe column index (zero based).
Returns
the column usage, or GFU_Generic for improper column numbers.

Implements GDALRasterAttributeTable.

double GDALDefaultRasterAttributeTable::GetValueAsDouble ( int  iRow,
int  iField 
) const
virtual

Fetch field value as a double.

The value of the requested column in the requested row is returned as a double. Non double fields will be converted to double with the possibility of data loss.

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

Parameters
iRowrow to fetch (zero based).
iFieldcolumn to fetch (zero based).
Returns
field value

Implements GDALRasterAttributeTable.

int GDALDefaultRasterAttributeTable::GetValueAsInt ( int  iRow,
int  iField 
) const
virtual

Fetch field value as a integer.

The value of the requested column in the requested row is returned as an integer. Non-integer fields will be converted to integer with the possibility of data loss.

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

Parameters
iRowrow to fetch (zero based).
iFieldcolumn to fetch (zero based).
Returns
field value

Implements GDALRasterAttributeTable.

const char * GDALDefaultRasterAttributeTable::GetValueAsString ( int  iRow,
int  iField 
) const
virtual

Fetch field value as a string.

The value of the requested column in the requested row is returned as a string. If the field is numeric, it is formatted as a string using default rules, so some precision may be lost.

The returned string is temporary and cannot be expected to be available after the next GDAL call.

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

Parameters
iRowrow to fetch (zero based).
iFieldcolumn to fetch (zero based).
Returns
field value.

Implements GDALRasterAttributeTable.

CPLErr GDALDefaultRasterAttributeTable::SetLinearBinning ( double  dfRow0Min,
double  dfBinSize 
)
virtual

Set linear binning information.

For RATs with equal sized categories (in pixel value space) that are evenly spaced, this method may be used to associate the linear binning information with the table.

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

Parameters
dfRow0MinInthe lower bound (pixel value) of the first category.
dfBinSizeInthe width of each category (in pixel value units).
Returns
CE_None on success or CE_Failure on failure.

Reimplemented from GDALRasterAttributeTable.

void GDALDefaultRasterAttributeTable::SetRowCount ( int  iCount)
virtual

Set row count.

Resizes the table to include the indicated number of rows. Newly created rows will be initialized to their default values - "" for strings, and zero for numeric fields.

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

Parameters
nNewCountthe new number of rows.

Reimplemented from GDALRasterAttributeTable.

void GDALDefaultRasterAttributeTable::SetValue ( int  iRow,
int  iField,
const char *  pszValue 
)
virtual

Set field value from string.

The indicated field (column) on the indicated row is set from the passed value. The value will be automatically converted for other field types, with a possible loss of precision.

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

Parameters
iRowrow to fetch (zero based).
iFieldcolumn to fetch (zero based).
pszValuethe value to assign.

Implements GDALRasterAttributeTable.

void GDALDefaultRasterAttributeTable::SetValue ( int  iRow,
int  iField,
double  dfValue 
)
virtual

Set field value from double.

The indicated field (column) on the indicated row is set from the passed value. The value will be automatically converted for other field types, with a possible loss of precision.

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

Parameters
iRowrow to fetch (zero based).
iFieldcolumn to fetch (zero based).
dfValuethe value to assign.

Implements GDALRasterAttributeTable.

void GDALDefaultRasterAttributeTable::SetValue ( int  iRow,
int  iField,
int  nValue 
)
virtual

Set field value from integer.

The indicated field (column) on the indicated row is set from the passed value. The value will be automatically converted for other field types, with a possible loss of precision.

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

Parameters
iRowrow to fetch (zero based).
iFieldcolumn to fetch (zero based).
nValuethe value to assign.

Implements GDALRasterAttributeTable.


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

Generated for GDAL by doxygen 1.8.11.