Public Member Functions

# GDALDefaultRasterAttributeTable Class Reference

Raster Attribute Table container. More...

`#include <gdal_rat.h>`

Inheritance diagram for GDALDefaultRasterAttributeTable:

List of all members.

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

## 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:

  | pszFieldName | the name of the field to create.
  | eFieldType | the field type (integer, double or string).
  | eFieldUsage | the 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:

  | eUsage | usage 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:

  | iCol | the 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.

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:

  | dfValue | the pixel value.

Returns:
  the row index or -1 if no row is appropriate.

Reimplemented from GDALRasterAttributeTable.

GDALRATFieldType GDALDefaultRasterAttributeTable::GetTypeOfCol | ( | int |  | ) | const`[virtual]`

Fetch column type.

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

Parameters:

  | iCol | the 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:

  | iCol | the 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:

  | iRow | row to fetch (zero based).
  | iField | column 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:

  | iRow | row to fetch (zero based).
  | iField | column 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:

  | iRow | row to fetch (zero based).
  | iField | column 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:

  | dfRow0MinIn | the lower bound (pixel value) of the first category.
  | dfBinSizeIn | the 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.

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:

  | nNewCount | the new number of rows.

Reimplemented from 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:

  | iRow | row to fetch (zero based).
  | iField | column to fetch (zero based).
  | dfValue | the 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:

  | iRow | row to fetch (zero based).
  | iField | column to fetch (zero based).
  | nValue | the value to assign.

Implements 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:

  | iRow | row to fetch (zero based).
  | iField | column to fetch (zero based).
  | pszValue | the value to assign.

Implements GDALRasterAttributeTable.

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

- gdal_rat.h
- gdal_rat.cpp

Generated for GDAL by 1.7.1.