OGR
Public Member Functions | Friends | List of all members
OGRLayerWithTransaction Class Reference
Inheritance diagram for OGRLayerWithTransaction:
OGRLayerDecorator OGRLayer

Public Member Functions

virtual const char * GetName ()
 Return the layer name. More...
 
virtual OGRFeatureDefnGetLayerDefn ()
 Fetch the schema information for this layer. More...
 
virtual OGRErr CreateField (OGRFieldDefn *poField, int bApproxOK=TRUE)
 Create a new field on a layer. More...
 
virtual OGRErr DeleteField (int iField)
 Delete an existing field on a layer. More...
 
virtual OGRErr ReorderFields (int *panMap)
 Reorder all the fields of a layer. More...
 
virtual OGRErr AlterFieldDefn (int iField, OGRFieldDefn *poNewFieldDefn, int nFlags)
 Alter the definition of an existing field on a layer. More...
 
virtual OGRErr CreateGeomField (OGRGeomFieldDefn *poField, int bApproxOK=TRUE)
 Create a new geometry field on a layer. More...
 
virtual OGRFeatureGetNextFeature ()
 Fetch the next available feature from this layer. More...
 
virtual OGRFeatureGetFeature (GIntBig nFID)
 Fetch a feature by its identifier. More...
 
virtual OGRErr ISetFeature (OGRFeature *poFeature)
 Rewrite an existing feature. More...
 
virtual OGRErr ICreateFeature (OGRFeature *poFeature)
 Create and write a new feature within a layer. More...
 
- Public Member Functions inherited from OGRLayerDecorator
virtual OGRGeometryGetSpatialFilter ()
 This method returns the current spatial filter for this layer. More...
 
virtual void SetSpatialFilter (OGRGeometry *)
 Set a new spatial filter. More...
 
virtual void SetSpatialFilterRect (double dfMinX, double dfMinY, double dfMaxX, double dfMaxY)
 Set a new rectangular spatial filter. More...
 
virtual void SetSpatialFilter (int iGeomField, OGRGeometry *)
 Set a new spatial filter. More...
 
virtual void SetSpatialFilterRect (int iGeomField, double dfMinX, double dfMinY, double dfMaxX, double dfMaxY)
 Set a new rectangular spatial filter. More...
 
virtual OGRErr SetAttributeFilter (const char *)
 Set a new attribute query. More...
 
virtual void ResetReading ()
 Reset feature reading to start on the first feature. More...
 
virtual OGRErr SetNextByIndex (GIntBig nIndex)
 Move read cursor to the nIndex'th feature in the current resultset. More...
 
virtual OGRErr DeleteFeature (GIntBig nFID)
 Delete feature from layer. More...
 
virtual OGRwkbGeometryType GetGeomType ()
 Return the layer geometry type. More...
 
virtual OGRSpatialReferenceGetSpatialRef ()
 Fetch the spatial reference system for this layer. More...
 
virtual GIntBig GetFeatureCount (int bForce=TRUE)
 Fetch the feature count in this layer. More...
 
virtual OGRErr GetExtent (int iGeomField, OGREnvelope *psExtent, int bForce=TRUE)
 Fetch the extent of this layer, on the specified geometry field. More...
 
virtual OGRErr GetExtent (OGREnvelope *psExtent, int bForce=TRUE)
 Fetch the extent of this layer. More...
 
virtual int TestCapability (const char *)
 Test if this layer supported the named capability. More...
 
virtual OGRErr SyncToDisk ()
 Flush pending changes to disk. More...
 
virtual OGRStyleTableGetStyleTable ()
 Returns layer style table. More...
 
virtual void SetStyleTableDirectly (OGRStyleTable *poStyleTable)
 Set layer style table. More...
 
virtual void SetStyleTable (OGRStyleTable *poStyleTable)
 Set layer style table. More...
 
virtual const char * GetFIDColumn ()
 This method returns the name of the underlying database column being used as the FID column, or "" if not supported. More...
 
virtual const char * GetGeometryColumn ()
 This method returns the name of the underlying database column being used as the geometry column, or "" if not supported. More...
 
virtual OGRErr SetIgnoredFields (const char **papszFields)
 Set which fields can be omitted when retrieving features from the layer. More...
 
- Public Member Functions inherited from OGRLayer
OGRErr SetFeature (OGRFeature *poFeature)
 Rewrite an existing feature. More...
 
OGRErr CreateFeature (OGRFeature *poFeature)
 Create and write a new feature within a layer. More...
 
virtual int FindFieldIndex (const char *pszFieldName, int bExactMatch)
 Find the index of field in the layer. More...
 
OGRErr Intersection (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=NULL, GDALProgressFunc pfnProgress=NULL, void *pProgressArg=NULL)
 Intersection of two layers. More...
 
OGRErr Union (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=NULL, GDALProgressFunc pfnProgress=NULL, void *pProgressArg=NULL)
 Union of two layers. More...
 
OGRErr SymDifference (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg)
 Symmetrical difference of two layers. More...
 
OGRErr Identity (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=NULL, GDALProgressFunc pfnProgress=NULL, void *pProgressArg=NULL)
 Identify the features of this layer with the ones from the identity layer. More...
 
OGRErr Update (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=NULL, GDALProgressFunc pfnProgress=NULL, void *pProgressArg=NULL)
 Update this layer with features from the update layer. More...
 
OGRErr Clip (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=NULL, GDALProgressFunc pfnProgress=NULL, void *pProgressArg=NULL)
 Clip off areas that are not covered by the method layer. More...
 
OGRErr Erase (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=NULL, GDALProgressFunc pfnProgress=NULL, void *pProgressArg=NULL)
 Remove areas that are covered by the method layer. More...
 
int Reference ()
 Increment layer reference count. More...
 
int Dereference ()
 Decrement layer reference count. More...
 
int GetRefCount () const
 Fetch reference count. More...
 
OGRErr ReorderField (int iOldFieldPos, int iNewFieldPos)
 Reorder an existing field on a layer. More...
 

Friends

class OGRDataSourceWithTransaction
 

Additional Inherited Members

Member Function Documentation

OGRErr OGRLayerWithTransaction::AlterFieldDefn ( int  iField,
OGRFieldDefn poNewFieldDefn,
int  nFlags 
)
virtual

Alter the definition of an existing field on a layer.

You must use this to alter the definition of an existing field of a real layer. Internally the OGRFeatureDefn for the layer will be updated to reflect the altered field. Applications should never modify the OGRFeatureDefn used by a layer directly.

This method should not be called while there are feature objects in existance that were obtained or created with the previous layer definition.

Not all drivers support this method. You can query a layer to check if it supports it with the OLCAlterFieldDefn capability. Some drivers may only support this method while there are still no features in the layer. When it is supported, the existings features of the backing file/database should be updated accordingly. Some drivers might also not support all update flags.

This function is the same as the C function OGR_L_AlterFieldDefn().

Parameters
iFieldindex of the field whose definition must be altered.
poNewFieldDefnnew field definition
nFlagscombination of ALTER_NAME_FLAG, ALTER_TYPE_FLAG, ALTER_WIDTH_PRECISION_FLAG, ALTER_NULLABLE_FLAG and ALTER_DEFAULT_FLAG to indicate which of the name and/or type and/or width and precision fields and/or nullability from the new field definition must be taken into account.
Returns
OGRERR_NONE on success.
Since
OGR 1.9.0

Reimplemented from OGRLayerDecorator.

References OGRLayer::AlterFieldDefn(), OGRFieldDefn::GetDefault(), OGRFeatureDefn::GetFieldDefn(), OGRLayer::GetLayerDefn(), OGRFieldDefn::GetNameRef(), OGRFieldDefn::GetPrecision(), OGRFieldDefn::GetSubType(), OGRFieldDefn::GetType(), OGRFieldDefn::GetWidth(), OGRFieldDefn::IsNullable(), OGRFieldDefn::SetDefault(), OGRFieldDefn::SetName(), OGRFieldDefn::SetNullable(), OGRFieldDefn::SetPrecision(), OGRFieldDefn::SetSubType(), OGRFieldDefn::SetType(), and OGRFieldDefn::SetWidth().

OGRErr OGRLayerWithTransaction::CreateField ( OGRFieldDefn poField,
int  bApproxOK = TRUE 
)
virtual

Create a new field on a layer.

You must use this to create new fields on a real layer. Internally the OGRFeatureDefn for the layer will be updated to reflect the new field. Applications should never modify the OGRFeatureDefn used by a layer directly.

This method should not be called while there are feature objects in existance that were obtained or created with the previous layer definition.

Not all drivers support this method. You can query a layer to check if it supports it with the OLCCreateField capability. Some drivers may only support this method while there are still no features in the layer. When it is supported, the existings features of the backing file/database should be updated accordingly.

Drivers may or may not support not-null constraints. If they support creating fields with not-null constraints, this is generally before creating any feature to the layer.

This function is the same as the C function OGR_L_CreateField().

Parameters
poFieldfield definition to write to disk.
bApproxOKIf TRUE, the field may be created in a slightly different form depending on the limitations of the format driver.
Returns
OGRERR_NONE on success.

Reimplemented from OGRLayerDecorator.

References OGRFeatureDefn::AddFieldDefn(), OGRLayer::CreateField(), OGRFeatureDefn::GetFieldCount(), OGRFeatureDefn::GetFieldDefn(), and OGRLayer::GetLayerDefn().

OGRErr OGRLayerWithTransaction::CreateGeomField ( OGRGeomFieldDefn poField,
int  bApproxOK = TRUE 
)
virtual

Create a new geometry field on a layer.

You must use this to create new geometry fields on a real layer. Internally the OGRFeatureDefn for the layer will be updated to reflect the new field. Applications should never modify the OGRFeatureDefn used by a layer directly.

This method should not be called while there are feature objects in existance that were obtained or created with the previous layer definition.

Not all drivers support this method. You can query a layer to check if it supports it with the OLCCreateGeomField capability. Some drivers may only support this method while there are still no features in the layer. When it is supported, the existings features of the backing file/database should be updated accordingly.

Drivers may or may not support not-null constraints. If they support creating fields with not-null constraints, this is generally before creating any feature to the layer.

This function is the same as the C function OGR_L_CreateGeomField().

Parameters
poFieldgeometry field definition to write to disk.
bApproxOKIf TRUE, the field may be created in a slightly different form depending on the limitations of the format driver.
Returns
OGRERR_NONE on success.
Since
OGR 1.11

Reimplemented from OGRLayer.

References OGRFeatureDefn::AddGeomFieldDefn(), OGRLayer::CreateGeomField(), OGRFeatureDefn::GetGeomFieldCount(), OGRFeatureDefn::GetGeomFieldDefn(), and OGRLayer::GetLayerDefn().

OGRErr OGRLayerWithTransaction::DeleteField ( int  iField)
virtual

Delete an existing field on a layer.

You must use this to delete existing fields on a real layer. Internally the OGRFeatureDefn for the layer will be updated to reflect the deleted field. Applications should never modify the OGRFeatureDefn used by a layer directly.

This method should not be called while there are feature objects in existance that were obtained or created with the previous layer definition.

Not all drivers support this method. You can query a layer to check if it supports it with the OLCDeleteField capability. Some drivers may only support this method while there are still no features in the layer. When it is supported, the existings features of the backing file/database should be updated accordingly.

This function is the same as the C function OGR_L_DeleteField().

Parameters
iFieldindex of the field to delete.
Returns
OGRERR_NONE on success.
Since
OGR 1.9.0

Reimplemented from OGRLayerDecorator.

References OGRLayer::DeleteField(), and OGRFeatureDefn::DeleteFieldDefn().

OGRFeature * OGRLayerWithTransaction::GetFeature ( GIntBig  nFID)
virtual

Fetch a feature by its identifier.

This function will attempt to read the identified feature. The nFID value cannot be OGRNullFID. Success or failure of this operation is unaffected by the spatial or attribute filters (and specialized implementations in drivers should make sure that they do not take into account spatial or attribute filters).

If this method returns a non-NULL feature, it is guaranteed that its feature id (OGRFeature::GetFID()) will be the same as nFID.

Use OGRLayer::TestCapability(OLCRandomRead) to establish if this layer supports efficient random access reading via GetFeature(); however, the call should always work if the feature exists as a fallback implementation just scans all the features in the layer looking for the desired feature.

Sequential reads (with GetNextFeature()) are generally considered interrupted by a GetFeature() call.

The returned feature should be free with OGRFeature::DestroyFeature().

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

Parameters
nFIDthe feature id of the feature to read.
Returns
a feature now owned by the caller, or NULL on failure.

Reimplemented from OGRLayerDecorator.

References OGRLayer::GetFeature(), OGRFeature::GetFID(), GetLayerDefn(), OGRFeature::SetFID(), and OGRFeature::SetFrom().

OGRFeatureDefn * OGRLayerWithTransaction::GetLayerDefn ( )
virtual

Fetch the schema information for this layer.

The returned OGRFeatureDefn is owned by the OGRLayer, and should not be modified or freed by the application. It encapsulates the attribute schema of the features of the layer.

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

Returns
feature definition.

Reimplemented from OGRLayerDecorator.

References OGRFeatureDefn::Clone(), OGRLayer::GetLayerDefn(), and OGRFeatureDefn::Reference().

Referenced by GetFeature(), and GetNextFeature().

virtual const char* OGRLayerWithTransaction::GetName ( )
inlinevirtual

Return the layer name.

This returns the same content as GetLayerDefn()->OGRFeatureDefn::GetName(), but for a few drivers, calling GetName() directly can avoid lengthy layer definition initialization.

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

If this method is derived in a driver, it must be done such that it returns the same content as GetLayerDefn()->OGRFeatureDefn::GetName().

Returns
the layer name (must not been freed)
Since
OGR 1.8.0

Reimplemented from OGRLayerDecorator.

OGRFeature * OGRLayerWithTransaction::GetNextFeature ( )
virtual

Fetch the next available feature from this layer.

The returned feature becomes the responsiblity of the caller to delete with OGRFeature::DestroyFeature(). It is critical that all features associated with an OGRLayer (more specifically an OGRFeatureDefn) be deleted before that layer/datasource is deleted.

Only features matching the current spatial filter (set with SetSpatialFilter()) will be returned.

This method implements sequential access to the features of a layer. The ResetReading() method can be used to start at the beginning again.

Features returned by GetNextFeature() may or may not be affected by concurrent modifications depending on drivers. A guaranteed way of seing modifications in effect is to call ResetReading() on layers where GetNextFeature() has been called, before reading again. Structural changes in layers (field addition, deletion, ...) when a read is in progress may or may not be possible depending on drivers. If a transaction is committed/aborted, the current sequential reading may or may not be valid after that operation and a call to ResetReading() might be needed.

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

Returns
a feature, or NULL if no more features are available.

Reimplemented from OGRLayerDecorator.

References OGRFeature::GetFID(), GetLayerDefn(), OGRLayer::GetNextFeature(), OGRFeature::SetFID(), and OGRFeature::SetFrom().

OGRErr OGRLayerWithTransaction::ICreateFeature ( OGRFeature poFeature)
virtual

Create and write a new feature within a layer.

This method is implemented by drivers and not called directly. User code should use CreateFeature() instead.

The passed feature is written to the layer as a new feature, rather than overwriting an existing one. If the feature has a feature id other than OGRNullFID, then the native implementation may use that as the feature id of the new feature, but not necessarily. Upon successful return the passed feature will have been updated with the new feature id.

Parameters
poFeaturethe feature to write to disk.
Returns
OGRERR_NONE on success.
Since
GDAL 2.0

Reimplemented from OGRLayerDecorator.

References OGRLayer::CreateFeature(), OGRFeature::GetFID(), OGRLayer::GetLayerDefn(), OGRFeature::SetFID(), and OGRFeature::SetFrom().

OGRErr OGRLayerWithTransaction::ISetFeature ( OGRFeature poFeature)
virtual

Rewrite an existing feature.

This method is implemented by drivers and not called directly. User code should use SetFeature() instead.

This method will write a feature to the layer, based on the feature id within the OGRFeature.

Parameters
poFeaturethe feature to write.
Returns
OGRERR_NONE if the operation works, otherwise an appropriate error code (e.g OGRERR_NON_EXISTING_FEATURE if the feature does not exist).
Since
GDAL 2.0

Reimplemented from OGRLayerDecorator.

References OGRFeature::GetFID(), OGRLayer::GetLayerDefn(), OGRLayer::SetFeature(), OGRFeature::SetFID(), and OGRFeature::SetFrom().

OGRErr OGRLayerWithTransaction::ReorderFields ( int *  panMap)
virtual

Reorder all the fields of a layer.

You must use this to reorder existing fields on a real layer. Internally the OGRFeatureDefn for the layer will be updated to reflect the reordering of the fields. Applications should never modify the OGRFeatureDefn used by a layer directly.

This method should not be called while there are feature objects in existance that were obtained or created with the previous layer definition.

panMap is such that,for each field definition at position i after reordering, its position before reordering was panMap[i].

For example, let suppose the fields were "0","1","2","3","4" initially. ReorderFields([0,2,3,1,4]) will reorder them as "0","2","3","1","4".

Not all drivers support this method. You can query a layer to check if it supports it with the OLCReorderFields capability. Some drivers may only support this method while there are still no features in the layer. When it is supported, the existings features of the backing file/database should be updated accordingly.

This function is the same as the C function OGR_L_ReorderFields().

Parameters
panMapan array of GetLayerDefn()->OGRFeatureDefn::GetFieldCount() elements which is a permutation of [0, GetLayerDefn()->OGRFeatureDefn::GetFieldCount()-1].
Returns
OGRERR_NONE on success.
Since
OGR 1.9.0

Reimplemented from OGRLayerDecorator.

References OGRFeatureDefn::ReorderFieldDefns(), and OGRLayer::ReorderFields().


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

Generated for GDAL by doxygen 1.8.9.1.