- Main Page
- Classes
- Files
- Directories
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# SFCDataSource Class Reference

`#include <sfcdatasource.h>`

List of all members.

## Public Member Functions
void | Reinitialize ()
int | GetSFTableCount ()
const char * | GetSFTableName (int)
SFCTable * | CreateSFCTable (const char *pszTablename, OGRGeometry *poFilterGeometry=NULL, DBPROPOGISENUM eOperator=DBPROP_OGIS_ENVELOPE_INTERSECTS)
char * | GetWKTFromSRSId (int nSRS_ID)

## Detailed Description

Simplified SFCOM DataSource interface.

This class is based on the ATL CDataSource, and adds a convenient way to instantiate an SFCTable for a particular table in the data source. This class is intended to include methods for getting a list of spatial tables for the data source, but this hasn't been implemented yet.

Questions:

- Do we want to use CPL error handling mechanisms? This would help capture meaningful text messages for errors within the client side API, and make access to IErrorInfo (is that the right name) information easier. Perhaps the client side code should throw exceptions instead?

- Should our methods use BSTR or unicode strings instead of regular char?

## Member Function Documentation

void SFCDataSource::Reinitialize | ( |  | ) |

Reinitialize SFTable list.

This method can be called to trigger rebuilding of the list of spatial tables returned by GetSFTableName(). Otherwise it is built on the first request for SFTables, and cached - not reflecting additions or deletions.

The list of spatial tables is intended to be a list of all tables in this data source that have spatial information in them. That is those for which an SFCTable would be able to get geometry information from the table. Some data sources may not support any means of returning the list of tables in which case none will be identified. In this case the user would have to enter a table name directly to use with CreateSFCTable().

This method will try to build the list of simple features tables by traversing the DBSCHEMA_OGIS_FEATURE_TABLES schema rowset. If that doesn't exist, it will traverse the DBSCHEMA_TABLES schema rowset, selecting only those tables with OGIS style geometry columns apparent present.

int SFCDataSource::GetSFTableCount | ( |  | ) |

Get the number of spatial tables.

See Reinitialize() method for details on the spatial table list.

Returns:
  number of spatial tables.

const char * SFCDataSource::GetSFTableName | ( | int | i | ) |

Get the name of a spatial table.

Fetches the name of the requested spatial table. This name is suitable for use with CreateSFCTable(). See Reinitialize() method for details on the list of spatial tables.

Parameters:

  | i | value between 0 and GetSFTableCount()-1.

Returns:
  pointer to internal table name. Should not be modified, or freed by the application.

SFCTable * SFCDataSource::CreateSFCTable | ( | const char * | pszTableName,
|  | OGRGeometry * | poFilterGeometry = `NULL`,
|  | DBPROPOGISENUM | eOperator = `DBPROP_OGIS_ENVELOPE_INTERSECTS` |
| ) |  |  |

Open a spatial table.

This method creates an instance of an SFCTable to access a spatial table. On failure NULL is returned; however, there is currently no way to interogate the error that caused the failure.

Parameters:

  | pszTableName | the name of the spatial table. Generally selected from the list of tables exposed by GetSFTableName().
  | poFilterGeometry | the geometry to use as a spatial filter, or more often NULL to get all features from the spatial table. (NOT IMPLEMENTED)
  | eOperator | One of the geometry operators (DBPROP_OGIS_*) from oledbgis.h. Defaults to DBPROP_ENVELOPE_INTERSECTS.

Returns:
  a pointer to the new spatial table object, or NULL on failure.

char * SFCDataSource::GetWKTFromSRSId | ( | int | nSRS_ID | ) |

Get WKT format from spatial ref system id.

Read the spatial reference system system schema rowset to translate a data source specific SRS ID into it's well known text format equivelent. The returned string should be freed with CoTaskMemFree() when no longer needed.

A return value of "Unknown" will indicate that the SRS ID was not successfully translated.

Parameters:

  | nSRS_ID | the id for the SRS to fetch, as returned from the SFCTable::GetSpatialRefID() for instance.

Returns:
  string representation of SRS.

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

- sfcdatasource.h
- sfcdatasource.cpp

Generated for GDAL by 1.5.1.