#include <sfctable.h>
Public Member Functions | |
void | SetTableName (const char *) |
const char * | GetTableName () |
int | ReadSchemaInfo (CDataSource *, CSession *=NULL) |
void | ReleaseIUnknowns () |
int | GetSpatialRefID () |
int | HasGeometry () |
int | GetGeometryType () |
BYTE * | GetWKBGeometry (int *pnSize) |
OGRGeometry * | GetOGRGeometry () |
This class is intended to simplify access to spatial rowsets, and to centralize all the rules for selecting geometry columns, getting the spatial reference system of a rowset, and special feature access short cuts with selected providers. It is based on the ATL CTable class with a dynamic accessor.
void SFCTable::SetTableName | ( | const char * | pszTableName | ) |
Set the table name.
This is primarily needed if the SFCTable is created by means other than SFCDataSource::CreateSFCTable(). The table name is needed to collect information from the ogis columns schema rowset.
pszTableName | the name of the table from which this SFCTable is derived. |
Referenced by SFCDataSource::CreateSFCTable().
const char * SFCTable::GetTableName | ( | ) |
Get the name of this rowsets table.
Referenced by ReadSchemaInfo().
int SFCTable::ReadSchemaInfo | ( | CDataSource * | poDS, | |
CSession * | poSession = NULL | |||
) |
Read required schema rowset information.
This method is normally called by SFCDataSource::CreateSFCTable(), but if the SFCTable is created by another means, it is necessary so that the SFCTable can get information from the schema rowsets about the geometry column, SRS and so forth.
If an SFCTable is instantiated wihtout this method ever being called a number of the OpenGIS related aspects of the table will not be operational.
poDS | a CDataSource (or SFCDataSource) on which this SFCTable was created. | |
poSession | optional Session to be used internally to access various schema rowsets. |
References OGRFeatureDefn::AddFieldDefn(), OGRFeatureDefn::GetFieldCount(), GetGeometryType(), GetTableName(), HasGeometry(), OGRFeatureDefn::SetGeomType(), OGRFieldDefn::SetName(), OGRFieldDefn::SetType(), and OGRFieldDefn::SetWidth().
Referenced by SFCDataSource::CreateSFCTable().
void SFCTable::ReleaseIUnknowns | ( | ) |
Release any IUnknowns in current record.
It is very important that this be called once, and only once for each record read on an SFCTable if there may be IUnknowns (generally ISequentialStreams for the geometry column).
Unfortunately, the CRowset::ReleaseRows() doesn't take care of this itself.
int SFCTable::GetSpatialRefID | ( | ) |
Fetch the spatial reference system id of this table.
This method returns the id of the spatial reference system for this table. All geometries in this table should have this spatial reference system. The SFCDataSource::GetWKTFromSRSId() method can be used to transform this id into a useful form.
int SFCTable::HasGeometry | ( | ) |
Does this table have geometry?
Referenced by GetWKBGeometry(), and ReadSchemaInfo().
int SFCTable::GetGeometryType | ( | ) |
Fetch the geometry type of this table.
This method returns the well known binary type of the geometry in this table. This integer can be cast to the type OGRwkbGeometryType in order to use symbolic constants. The intent is that all objects in this table would be of the returned class, or a derived class. It will generally be zero (wkbUnknown) if nothing is known about the geometry types in the table.
Zero (wkbUnknown) will be returned if there is no column info schema rowset (from which this value is normally extracted).
Referenced by ReadSchemaInfo().
BYTE * SFCTable::GetWKBGeometry | ( | int * | pnSize | ) |
Fetch geometry binary column binary data.
Note that the returned pointer is to an internal buffer, and will be invalidated by the next record read operation. The data should not be freed or modified.
pnSize | pointer to an integer into which the number of bytes returned may be put. This may be NULL. |
References HasGeometry().
Referenced by GetOGRGeometry().
OGRGeometry * SFCTable::GetOGRGeometry | ( | ) |
Fetch the OGRGeometry for this record.
The reading of the BLOB column, and translation into an OGRGeometry subclass is handled automatically. The returned object becomes the responsibility of the caller and should be destroyed with delete.
References OGRGeometryFactory::createFromWkb(), and GetWKBGeometry().