GDAL
Public Member Functions
GDALDefaultRasterAttributeTable Class Reference

#include <gdal_rat.h>

Inheritance diagram for GDALDefaultRasterAttributeTable:
GDALRasterAttributeTable

List of all members.

Public Member Functions

 GDALDefaultRasterAttributeTable ()
 Construct empty table.
 GDALDefaultRasterAttributeTable (const GDALDefaultRasterAttributeTable &)
 Copy constructor.
GDALDefaultRasterAttributeTableClone () const CPL_OVERRIDE
 Copy Raster Attribute Table.
virtual int GetColumnCount () const CPL_OVERRIDE
 Fetch table column count.
virtual const char * GetNameOfCol (int) const CPL_OVERRIDE
 Fetch name of indicated column.
virtual GDALRATFieldUsage GetUsageOfCol (int) const CPL_OVERRIDE
 Fetch column usage value.
virtual GDALRATFieldType GetTypeOfCol (int) const CPL_OVERRIDE
 Fetch column type.
virtual int GetColOfUsage (GDALRATFieldUsage) const CPL_OVERRIDE
 Return the index of the column that corresponds to the passed usage.
virtual int GetRowCount () const CPL_OVERRIDE
 Fetch row count.
virtual const char * GetValueAsString (int iRow, int iField) const CPL_OVERRIDE
 Fetch field value as a string.
virtual int GetValueAsInt (int iRow, int iField) const CPL_OVERRIDE
 Fetch field value as a integer.
virtual double GetValueAsDouble (int iRow, int iField) const CPL_OVERRIDE
 Fetch field value as a double.
virtual void SetValue (int iRow, int iField, const char *pszValue) CPL_OVERRIDE
 Set value.
virtual void SetValue (int iRow, int iField, double dfValue) CPL_OVERRIDE
 Set field value from double.
virtual void SetValue (int iRow, int iField, int nValue) CPL_OVERRIDE
 Set field value from integer.
virtual int ChangesAreWrittenToFile () CPL_OVERRIDE
 Determine whether changes made to this RAT are reflected directly in the dataset.
virtual void SetRowCount (int iCount) CPL_OVERRIDE
 Set row count.
virtual int GetRowOfValue (double dfValue) const CPL_OVERRIDE
 Get row for pixel value.
virtual int GetRowOfValue (int nValue) const CPL_OVERRIDE
 Get row for pixel value.
virtual CPLErr CreateColumn (const char *pszFieldName, GDALRATFieldType eFieldType, GDALRATFieldUsage eFieldUsage) CPL_OVERRIDE
 Create new column.
virtual CPLErr SetLinearBinning (double dfRow0Min, double dfBinSize) CPL_OVERRIDE
 Set linear binning information.
virtual int GetLinearBinning (double *pdfRow0Min, double *pdfBinSize) const CPL_OVERRIDE
 Get linear binning information.

Detailed Description

Raster Attribute Table container.


Member Function Documentation

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.

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.

Return the index of the column that corresponds to the passed usage.

Parameters:
eUsageusage.
Returns:
column index, or -1 in case of error.

Implements GDALRasterAttributeTable.

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  iCol) const [virtual]

Fetch name of indicated column.

Parameters:
iColcolumn index.
Returns:
name.

Implements GDALRasterAttributeTable.

Fetch row count.

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

Returns:
the number of rows.

Implements GDALRasterAttributeTable.

int GDALDefaultRasterAttributeTable::GetRowOfValue ( double  dfValue) const [virtual]

Get row for pixel value.

Given a raw pixel value, the raster attribute table is scanned to determine which row in the table applies to the pixel value. The row index is returned.

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

Parameters:
dfValuethe pixel value.
Returns:
the row index or -1 if no row is appropriate.

Reimplemented from GDALRasterAttributeTable.

int GDALDefaultRasterAttributeTable::GetRowOfValue ( int  nValue) const [virtual]

Get row for pixel value.

Given a raw pixel value, the raster attribute table is scanned to determine which row in the table applies to the pixel value. The row index is returned.

Int arg for now just converted to double. Perhaps we will handle this in a special way some day?

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

Parameters:
nValuethe pixel value.
Returns:
the row index or -1 if no row is appropriate.

Reimplemented from GDALRasterAttributeTable.

Fetch column type.

Parameters:
iColcolumn index.
Returns:
type.

Implements GDALRasterAttributeTable.

Fetch column usage value.

Parameters:
iColcolumn index.
Returns:
usage.

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  dfRow0MinIn,
double  dfBinSizeIn 
) [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  nNewCount) [virtual]

Set row count.

Parameters:
nNewCountnew count.

Reimplemented from GDALRasterAttributeTable.

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

Set value.

Parameters:
iRowrow index.
iFieldfield index.
pszValuevalue.

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.7.6.1.