GDAL
Public Member Functions | List of all members
GNMGenericLayer Class Reference

GNM layer which represents a geography network layer of generic format. More...

#include <gnm.h>

Inheritance diagram for GNMGenericLayer:
OGRLayer GDALMajorObject

Public Member Functions

 GNMGenericLayer (OGRLayer *poLayer, GNMGenericNetwork *poNetwork)
 GNMGenericLayer.
 
virtual ~GNMGenericLayer ()
 ~GNMGenericLayer
 
virtual OGRGeometryGetSpatialFilter () override
 This method returns the current spatial filter for this layer. More...
 
virtual void SetSpatialFilter (OGRGeometry *) override
 Set a new spatial filter. More...
 
virtual void SetSpatialFilterRect (double dfMinX, double dfMinY, double dfMaxX, double dfMaxY) override
 Set a new rectangular spatial filter. More...
 
virtual void SetSpatialFilter (int iGeomField, OGRGeometry *) override
 Set a new spatial filter. More...
 
virtual void SetSpatialFilterRect (int iGeomField, double dfMinX, double dfMinY, double dfMaxX, double dfMaxY) override
 Set a new rectangular spatial filter. More...
 
virtual OGRErr SetAttributeFilter (const char *) override
 Set a new attribute query. More...
 
virtual void ResetReading () override
 Reset feature reading to start on the first feature. More...
 
virtual OGRFeatureGetNextFeature () override
 Fetch the next available feature from this layer. More...
 
virtual OGRErr SetNextByIndex (GIntBig nIndex) override
 Move read cursor to the nIndex'th feature in the current resultset. More...
 
virtual OGRErr DeleteFeature (GIntBig nFID) override
 Delete feature from layer. More...
 
virtual const char * GetName () override
 Return the layer name. More...
 
virtual OGRwkbGeometryType GetGeomType () override
 Return the layer geometry type. More...
 
virtual OGRFeatureDefnGetLayerDefn () override
 Fetch the schema information for this layer. More...
 
virtual int FindFieldIndex (const char *pszFieldName, int bExactMatch) override
 Find the index of field in the layer. More...
 
virtual OGRSpatialReferenceGetSpatialRef () override
 Fetch the spatial reference system for this layer. More...
 
virtual GIntBig GetFeatureCount (int bForce=TRUE) override
 Fetch the feature count in this layer. More...
 
virtual OGRErr GetExtent (OGREnvelope *psExtent, int bForce=TRUE) override
 Fetch the extent of this layer. More...
 
virtual OGRErr GetExtent (int iGeomField, OGREnvelope *psExtent, int bForce=TRUE) override
 Fetch the extent of this layer, on the specified geometry field. More...
 
virtual int TestCapability (const char *) override
 Test if this layer supported the named capability. More...
 
virtual OGRErr CreateField (OGRFieldDefn *poField, int bApproxOK=TRUE) override
 Create a new field on a layer. More...
 
virtual OGRErr DeleteField (int iField) override
 Delete an existing field on a layer. More...
 
virtual OGRErr ReorderFields (int *panMap) override
 Reorder all the fields of a layer. More...
 
virtual OGRErr AlterFieldDefn (int iField, OGRFieldDefn *poNewFieldDefn, int nFlagsIn) override
 Alter the definition of an existing field on a layer. More...
 
virtual OGRErr CreateGeomField (OGRGeomFieldDefn *poField, int bApproxOK=TRUE) override
 Create a new geometry field on a layer. More...
 
virtual OGRErr SyncToDisk () override
 Flush pending changes to disk. More...
 
virtual OGRStyleTableGetStyleTable () override
 Returns layer style table. More...
 
virtual void SetStyleTableDirectly (OGRStyleTable *poStyleTable) override
 Set layer style table. More...
 
virtual void SetStyleTable (OGRStyleTable *poStyleTable) override
 Set layer style table. More...
 
virtual OGRErr StartTransaction () override
 For datasources which support transactions, StartTransaction creates a transaction. More...
 
virtual OGRErr CommitTransaction () override
 For datasources which support transactions, CommitTransaction commits a transaction. More...
 
virtual OGRErr RollbackTransaction () override
 For datasources which support transactions, RollbackTransaction will roll back a datasource to its state before the start of the current transaction. More...
 
virtual const char * GetFIDColumn () override
 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 () override
 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) override
 Set which fields can be omitted when retrieving features from the layer. More...
 
OGRErr Intersection (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
 Intersection.
 
OGRErr Union (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
 Union.
 
OGRErr SymDifference (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg)
 SymDifference.
 
OGRErr Identity (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
 Identity.
 
OGRErr Update (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
 Update.
 
OGRErr Clip (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
 Clip.
 
OGRErr Erase (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
 Erase.
 
GIntBig GetFeaturesRead ()
 GetFeaturesRead.
 
int AttributeFilterEvaluationNeedsGeometry ()
 AttributeFilterEvaluationNeedsGeometry.
 
- Public Member Functions inherited from OGRLayer
FeatureIterator begin ()
 Return begin of feature iterator. More...
 
FeatureIterator end ()
 Return end of feature iterator. More...
 
virtual OGRFeatureGetFeature (GIntBig nFID) CPL_WARN_UNUSED_RESULT
 Fetch a feature by its identifier. More...
 
OGRErr SetFeature (OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT
 Rewrite an existing feature. More...
 
OGRErr CreateFeature (OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT
 Create and write a new feature within a layer. More...
 
OGRErr Intersection (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
 Intersection of two layers. More...
 
OGRErr Union (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
 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=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
 Identify the features of this layer with the ones from the identity layer. More...
 
OGRErr Update (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
 Update this layer with features from the update layer. More...
 
OGRErr Clip (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
 Clip off areas that are not covered by the method layer. More...
 
OGRErr Erase (OGRLayer *pLayerMethod, OGRLayer *pLayerResult, char **papszOptions=nullptr, GDALProgressFunc pfnProgress=nullptr, void *pProgressArg=nullptr)
 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...
 
- Public Member Functions inherited from GDALMajorObject
int GetMOFlags () const
 Returns the GMO_ flags. More...
 
void SetMOFlags (int nFlagsIn)
 Assign GMO_flags. More...
 
virtual const char * GetDescription () const
 Fetch object description. More...
 
virtual void SetDescription (const char *)
 Set object description. More...
 
virtual char ** GetMetadataDomainList ()
 Fetch list of metadata domains. More...
 
virtual char ** GetMetadata (const char *pszDomain="")
 Fetch metadata. More...
 
virtual CPLErr SetMetadata (char **papszMetadata, const char *pszDomain="")
 Set metadata. More...
 
virtual const char * GetMetadataItem (const char *pszName, const char *pszDomain="")
 Fetch single metadata item. More...
 
virtual CPLErr SetMetadataItem (const char *pszName, const char *pszValue, const char *pszDomain="")
 Set single metadata item. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from OGRLayer
static OGRLayerH ToHandle (OGRLayer *poLayer)
 Convert a OGRLayer* to a OGRLayerH. More...
 
static OGRLayerFromHandle (OGRLayerH hLayer)
 Convert a OGRLayerH to a OGRLayer*. More...
 
- Static Public Member Functions inherited from GDALMajorObject
static GDALMajorObjectH ToHandle (GDALMajorObject *poMajorObject)
 Convert a GDALMajorObject* to a GDALMajorObjectH. More...
 
static GDALMajorObjectFromHandle (GDALMajorObjectH hMajorObject)
 Convert a GDALMajorObjectH to a GDALMajorObject*. More...
 
- Protected Member Functions inherited from OGRLayer
virtual OGRErr ISetFeature (OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT
 Rewrite an existing feature. More...
 
virtual OGRErr ICreateFeature (OGRFeature *poFeature) CPL_WARN_UNUSED_RESULT
 Create and write a new feature within a layer. More...
 
- Protected Member Functions inherited from GDALMajorObject
char ** BuildMetadataDomainList (char **papszList, int bCheckNonEmpty,...) CPL_NULL_TERMINATED
 Helper function for custom implementations of GetMetadataDomainList() More...
 

Detailed Description

GNM layer which represents a geography network layer of generic format.

The class override some OGRLayer methods to fulfill the network requirements.

Since
GDAL 2.1

Member Function Documentation

◆ AlterFieldDefn()

OGRErr GNMGenericLayer::AlterFieldDefn ( int  iField,
OGRFieldDefn poNewFieldDefn,
int  nFlags 
)
overridevirtual

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 existence 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 existing 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 OGRLayer.

◆ CommitTransaction()

OGRErr GNMGenericLayer::CommitTransaction ( )
overridevirtual

For datasources which support transactions, CommitTransaction commits a transaction.

If no transaction is active, or the commit fails, will return OGRERR_FAILURE. Datasources which do not support transactions will always return OGRERR_NONE.

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

Returns
OGRERR_NONE on success.

Reimplemented from OGRLayer.

◆ CreateField()

OGRErr GNMGenericLayer::CreateField ( OGRFieldDefn poField,
int  bApproxOK = TRUE 
)
overridevirtual

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 existence 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 existing 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 OGRLayer.

◆ CreateGeomField()

OGRErr GNMGenericLayer::CreateGeomField ( OGRGeomFieldDefn poField,
int  bApproxOK = TRUE 
)
overridevirtual

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 existence 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 existing 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.

◆ DeleteFeature()

OGRErr GNMGenericLayer::DeleteFeature ( GIntBig  nFID)
overridevirtual

Delete feature from layer.

The feature with the indicated feature id is deleted from the layer if supported by the driver. Most drivers do not support feature deletion, and will return OGRERR_UNSUPPORTED_OPERATION. The TestCapability() layer method may be called with OLCDeleteFeature to check if the driver supports feature deletion.

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

Parameters
nFIDthe feature id to be deleted from the layer
Returns
OGRERR_NONE if the operation works, otherwise an appropriate error code (e.g OGRERR_NON_EXISTING_FEATURE if the feature does not exist).

Reimplemented from OGRLayer.

◆ DeleteField()

OGRErr GNMGenericLayer::DeleteField ( int  iField)
overridevirtual

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 existence 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 existing 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 OGRLayer.

◆ FindFieldIndex()

int GNMGenericLayer::FindFieldIndex ( const char *  pszFieldName,
int  bExactMatch 
)
overridevirtual

Find the index of field in the layer.

The returned number is the index of the field in the layers, or -1 if the field doesn't exist.

If bExactMatch is set to FALSE and the field doesn't exists in the given form the driver might apply some changes to make it match, like those it might do if the layer was created (eg. like LAUNDER in the OCI driver).

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

Returns
field index, or -1 if the field doesn't exist

Reimplemented from OGRLayer.

◆ GetExtent() [1/2]

OGRErr GNMGenericLayer::GetExtent ( OGREnvelope *  psExtent,
int  bForce = TRUE 
)
overridevirtual

Fetch the extent of this layer.

Returns the extent (MBR) of the data in the layer. If bForce is FALSE, and it would be expensive to establish the extent then OGRERR_FAILURE will be returned indicating that the extent isn't know. If bForce is TRUE then some implementations will actually scan the entire layer once to compute the MBR of all the features in the layer.

Depending on the drivers, the returned extent may or may not take the spatial filter into account. So it is safer to call GetExtent() without setting a spatial filter.

Layers without any geometry may return OGRERR_FAILURE just indicating that no meaningful extents could be collected.

Note that some implementations of this method may alter the read cursor of the layer.

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

Parameters
psExtentthe structure in which the extent value will be returned.
bForceFlag indicating whether the extent should be computed even if it is expensive.
Returns
OGRERR_NONE on success, OGRERR_FAILURE if extent not known.

Reimplemented from OGRLayer.

◆ GetExtent() [2/2]

OGRErr GNMGenericLayer::GetExtent ( int  iGeomField,
OGREnvelope *  psExtent,
int  bForce = TRUE 
)
overridevirtual

Fetch the extent of this layer, on the specified geometry field.

Returns the extent (MBR) of the data in the layer. If bForce is FALSE, and it would be expensive to establish the extent then OGRERR_FAILURE will be returned indicating that the extent isn't know. If bForce is TRUE then some implementations will actually scan the entire layer once to compute the MBR of all the features in the layer.

Depending on the drivers, the returned extent may or may not take the spatial filter into account. So it is safer to call GetExtent() without setting a spatial filter.

Layers without any geometry may return OGRERR_FAILURE just indicating that no meaningful extents could be collected.

Note that some implementations of this method may alter the read cursor of the layer.

Note to driver implementer: if you implement GetExtent(int,OGREnvelope*,int), you must also implement GetExtent(OGREnvelope*, int) to make it call GetExtent(0,OGREnvelope*,int).

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

Parameters
iGeomFieldthe index of the geometry field on which to compute the extent.
psExtentthe structure in which the extent value will be returned.
bForceFlag indicating whether the extent should be computed even if it is expensive.
Returns
OGRERR_NONE on success, OGRERR_FAILURE if extent not known.

Reimplemented from OGRLayer.

◆ GetFeatureCount()

GIntBig GNMGenericLayer::GetFeatureCount ( int  bForce = TRUE)
overridevirtual

Fetch the feature count in this layer.

Returns the number of features in the layer. For dynamic databases the count may not be exact. If bForce is FALSE, and it would be expensive to establish the feature count a value of -1 may be returned indicating that the count isn't know. If bForce is TRUE some implementations will actually scan the entire layer once to count objects.

The returned count takes the spatial filter into account.

Note that some implementations of this method may alter the read cursor of the layer.

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

Note: since GDAL 2.0, this method returns a GIntBig (previously a int)

Parameters
bForceFlag indicating whether the count should be computed even if it is expensive.
Returns
feature count, -1 if count not known.

Reimplemented from OGRLayer.

◆ GetFIDColumn()

const char * GNMGenericLayer::GetFIDColumn ( )
overridevirtual

This method returns the name of the underlying database column being used as the FID column, or "" if not supported.

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

Returns
fid column name.

Reimplemented from OGRLayer.

◆ GetGeometryColumn()

const char * GNMGenericLayer::GetGeometryColumn ( )
overridevirtual

This method returns the name of the underlying database column being used as the geometry column, or "" if not supported.

For layers with multiple geometry fields, this method only returns the name of the first geometry column. For other columns, use GetLayerDefn()->OGRFeatureDefn::GetGeomFieldDefn(i)->GetNameRef().

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

Returns
geometry column name.

Reimplemented from OGRLayer.

◆ GetGeomType()

OGRwkbGeometryType GNMGenericLayer::GetGeomType ( )
overridevirtual

Return the layer geometry type.

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

For layers with multiple geometry fields, this method only returns the geometry type of the first geometry column. For other columns, use GetLayerDefn()->OGRFeatureDefn::GetGeomFieldDefn(i)->GetType(). For layers without any geometry field, this method returns wkbNone.

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

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

Returns
the geometry type
Since
OGR 1.8.0

Reimplemented from OGRLayer.

◆ GetLayerDefn()

OGRFeatureDefn * GNMGenericLayer::GetLayerDefn ( )
overridevirtual

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.

Implements OGRLayer.

◆ GetName()

const char * GNMGenericLayer::GetName ( )
overridevirtual

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

◆ GetNextFeature()

OGRFeature * GNMGenericLayer::GetNextFeature ( )
overridevirtual

Fetch the next available feature from this layer.

The returned feature becomes the responsibility 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 seeing 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.

Implements OGRLayer.

◆ GetSpatialFilter()

OGRGeometry * GNMGenericLayer::GetSpatialFilter ( )
overridevirtual

This method returns the current spatial filter for this layer.

The returned pointer is to an internally owned object, and should not be altered or deleted by the caller.

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

Returns
spatial filter geometry.

Reimplemented from OGRLayer.

◆ GetSpatialRef()

OGRSpatialReference * GNMGenericLayer::GetSpatialRef ( )
overridevirtual

Fetch the spatial reference system for this layer.

The returned object is owned by the OGRLayer and should not be modified or freed by the application.

Starting with OGR 1.11, several geometry fields can be associated to a feature definition. Each geometry field can have its own spatial reference system, which is returned by OGRGeomFieldDefn::GetSpatialRef(). OGRLayer::GetSpatialRef() is equivalent to GetLayerDefn()->OGRFeatureDefn::GetGeomFieldDefn(0)->GetSpatialRef()

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

Returns
spatial reference, or NULL if there isn't one.

Reimplemented from OGRLayer.

◆ GetStyleTable()

OGRStyleTable * GNMGenericLayer::GetStyleTable ( )
overridevirtual

Returns layer style table.

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

Returns
pointer to a style table which should not be modified or freed by the caller.

Reimplemented from OGRLayer.

◆ ReorderFields()

OGRErr GNMGenericLayer::ReorderFields ( int *  panMap)
overridevirtual

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 existence 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 existing 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 OGRLayer.

◆ ResetReading()

void GNMGenericLayer::ResetReading ( )
overridevirtual

Reset feature reading to start on the first feature.

This affects GetNextFeature().

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

Implements OGRLayer.

◆ RollbackTransaction()

OGRErr GNMGenericLayer::RollbackTransaction ( )
overridevirtual

For datasources which support transactions, RollbackTransaction will roll back a datasource to its state before the start of the current transaction.

If no transaction is active, or the rollback fails, will return OGRERR_FAILURE. Datasources which do not support transactions will always return OGRERR_NONE.

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

Returns
OGRERR_NONE on success.

Reimplemented from OGRLayer.

◆ SetAttributeFilter()

OGRErr GNMGenericLayer::SetAttributeFilter ( const char *  pszQuery)
overridevirtual

Set a new attribute query.

This method sets the attribute query string to be used when fetching features via the GetNextFeature() method. Only features for which the query evaluates as true will be returned.

The query string should be in the format of an SQL WHERE clause. For instance "population > 1000000 and population < 5000000" where population is an attribute in the layer. The query format is normally a restricted form of SQL WHERE clause as described in the "WHERE" section of the OGR SQL tutorial. In some cases (RDBMS backed drivers) the native capabilities of the database may be used to interpret the WHERE clause in which case the capabilities will be broader than those of OGR SQL.

Note that installing a query string will generally result in resetting the current reading position (ala ResetReading()).

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

Parameters
pszQueryquery in restricted SQL WHERE format, or NULL to clear the current query.
Returns
OGRERR_NONE if successfully installed, or an error code if the query expression is in error, or some other failure occurs.

Reimplemented from OGRLayer.

◆ SetIgnoredFields()

OGRErr GNMGenericLayer::SetIgnoredFields ( const char **  papszFields)
overridevirtual

Set which fields can be omitted when retrieving features from the layer.

If the driver supports this functionality (testable using OLCIgnoreFields capability), it will not fetch the specified fields in subsequent calls to GetFeature() / GetNextFeature() and thus save some processing time and/or bandwidth.

Besides field names of the layers, the following special fields can be passed: "OGR_GEOMETRY" to ignore geometry and "OGR_STYLE" to ignore layer style.

By default, no fields are ignored.

This method is the same as the C function OGR_L_SetIgnoredFields()

Parameters
papszFieldsan array of field names terminated by NULL item. If NULL is passed, the ignored list is cleared.
Returns
OGRERR_NONE if all field names have been resolved (even if the driver does not support this method)

Reimplemented from OGRLayer.

◆ SetNextByIndex()

OGRErr GNMGenericLayer::SetNextByIndex ( GIntBig  nIndex)
overridevirtual

Move read cursor to the nIndex'th feature in the current resultset.

This method allows positioning of a layer such that the GetNextFeature() call will read the requested feature, where nIndex is an absolute index into the current result set. So, setting it to 3 would mean the next feature read with GetNextFeature() would have been the 4th feature to have been read if sequential reading took place from the beginning of the layer, including accounting for spatial and attribute filters.

Only in rare circumstances is SetNextByIndex() efficiently implemented. In all other cases the default implementation which calls ResetReading() and then calls GetNextFeature() nIndex times is used. To determine if fast seeking is available on the current layer use the TestCapability() method with a value of OLCFastSetNextByIndex.

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

Parameters
nIndexthe index indicating how many steps into the result set to seek.
Returns
OGRERR_NONE on success or an error code.

Reimplemented from OGRLayer.

◆ SetSpatialFilter() [1/2]

void GNMGenericLayer::SetSpatialFilter ( OGRGeometry poFilter)
overridevirtual

Set a new spatial filter.

This method set the geometry to be used as a spatial filter when fetching features via the GetNextFeature() method. Only features that geometrically intersect the filter geometry will be returned.

Currently this test is may be inaccurately implemented, but it is guaranteed that all features whose envelope (as returned by OGRGeometry::getEnvelope()) overlaps the envelope of the spatial filter will be returned. This can result in more shapes being returned that should strictly be the case.

Starting with GDAL 2.3, features with null or empty geometries will never be considered as matching a spatial filter.

This method makes an internal copy of the passed geometry. The passed geometry remains the responsibility of the caller, and may be safely destroyed.

For the time being the passed filter geometry should be in the same SRS as the layer (as returned by OGRLayer::GetSpatialRef()). In the future this may be generalized.

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

Parameters
poFilterthe geometry to use as a filtering region. NULL may be passed indicating that the current spatial filter should be cleared, but no new one instituted.

Reimplemented from OGRLayer.

◆ SetSpatialFilter() [2/2]

void GNMGenericLayer::SetSpatialFilter ( int  iGeomField,
OGRGeometry poFilter 
)
overridevirtual

Set a new spatial filter.

This method set the geometry to be used as a spatial filter when fetching features via the GetNextFeature() method. Only features that geometrically intersect the filter geometry will be returned.

Currently this test is may be inaccurately implemented, but it is guaranteed that all features who's envelope (as returned by OGRGeometry::getEnvelope()) overlaps the envelope of the spatial filter will be returned. This can result in more shapes being returned that should strictly be the case.

This method makes an internal copy of the passed geometry. The passed geometry remains the responsibility of the caller, and may be safely destroyed.

For the time being the passed filter geometry should be in the same SRS as the geometry field definition it corresponds to (as returned by GetLayerDefn()->OGRFeatureDefn::GetGeomFieldDefn(iGeomField)->GetSpatialRef()). In the future this may be generalized.

Note that only the last spatial filter set is applied, even if several successive calls are done with different iGeomField values.

Note to driver implementer: if you implement SetSpatialFilter(int,OGRGeometry*), you must also implement SetSpatialFilter(OGRGeometry*) to make it call SetSpatialFilter(0,OGRGeometry*).

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

Parameters
iGeomFieldindex of the geometry field on which the spatial filter operates.
poFilterthe geometry to use as a filtering region. NULL may be passed indicating that the current spatial filter should be cleared, but no new one instituted.
Since
GDAL 1.11

Reimplemented from OGRLayer.

◆ SetSpatialFilterRect() [1/2]

void GNMGenericLayer::SetSpatialFilterRect ( double  dfMinX,
double  dfMinY,
double  dfMaxX,
double  dfMaxY 
)
overridevirtual

Set a new rectangular spatial filter.

This method set rectangle to be used as a spatial filter when fetching features via the GetNextFeature() method. Only features that geometrically intersect the given rectangle will be returned.

The x/y values should be in the same coordinate system as the layer as a whole (as returned by OGRLayer::GetSpatialRef()). Internally this method is normally implemented as creating a 5 vertex closed rectangular polygon and passing it to OGRLayer::SetSpatialFilter(). It exists as a convenience.

The only way to clear a spatial filter set with this method is to call OGRLayer::SetSpatialFilter(NULL).

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

Parameters
dfMinXthe minimum X coordinate for the rectangular region.
dfMinYthe minimum Y coordinate for the rectangular region.
dfMaxXthe maximum X coordinate for the rectangular region.
dfMaxYthe maximum Y coordinate for the rectangular region.

Reimplemented from OGRLayer.

◆ SetSpatialFilterRect() [2/2]

void GNMGenericLayer::SetSpatialFilterRect ( int  iGeomField,
double  dfMinX,
double  dfMinY,
double  dfMaxX,
double  dfMaxY 
)
overridevirtual

Set a new rectangular spatial filter.

This method set rectangle to be used as a spatial filter when fetching features via the GetNextFeature() method. Only features that geometrically intersect the given rectangle will be returned.

The x/y values should be in the same coordinate system as as the geometry field definition it corresponds to (as returned by GetLayerDefn()->OGRFeatureDefn::GetGeomFieldDefn(iGeomField)->GetSpatialRef()). Internally this method is normally implemented as creating a 5 vertex closed rectangular polygon and passing it to OGRLayer::SetSpatialFilter(). It exists as a convenience.

The only way to clear a spatial filter set with this method is to call OGRLayer::SetSpatialFilter(NULL).

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

Parameters
iGeomFieldindex of the geometry field on which the spatial filter operates.
dfMinXthe minimum X coordinate for the rectangular region.
dfMinYthe minimum Y coordinate for the rectangular region.
dfMaxXthe maximum X coordinate for the rectangular region.
dfMaxYthe maximum Y coordinate for the rectangular region.
Since
GDAL 1.11

Reimplemented from OGRLayer.

◆ SetStyleTable()

void GNMGenericLayer::SetStyleTable ( OGRStyleTable poStyleTable)
overridevirtual

Set layer style table.

This method operate exactly as OGRLayer::SetStyleTableDirectly() except that it does not assume ownership of the passed table.

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

Parameters
poStyleTablepointer to style table to set

Reimplemented from OGRLayer.

◆ SetStyleTableDirectly()

void GNMGenericLayer::SetStyleTableDirectly ( OGRStyleTable poStyleTable)
overridevirtual

Set layer style table.

This method operate exactly as OGRLayer::SetStyleTable() except that it assumes ownership of the passed table.

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

Parameters
poStyleTablepointer to style table to set

Reimplemented from OGRLayer.

◆ StartTransaction()

OGRErr GNMGenericLayer::StartTransaction ( )
overridevirtual

For datasources which support transactions, StartTransaction creates a transaction.

If starting the transaction fails, will return OGRERR_FAILURE. Datasources which do not support transactions will always return OGRERR_NONE.

Note: as of GDAL 2.0, use of this API is discouraged when the dataset offers dataset level transaction with GDALDataset::StartTransaction(). The reason is that most drivers can only offer transactions at dataset level, and not layer level. Very few drivers really support transactions at layer scope.

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

Returns
OGRERR_NONE on success.

Reimplemented from OGRLayer.

◆ SyncToDisk()

OGRErr GNMGenericLayer::SyncToDisk ( )
overridevirtual

Flush pending changes to disk.

This call is intended to force the layer to flush any pending writes to disk, and leave the disk file in a consistent state. It would not normally have any effect on read-only datasources.

Some layers do not implement this method, and will still return OGRERR_NONE. The default implementation just returns OGRERR_NONE. An error is only returned if an error occurs while attempting to flush to disk.

In any event, you should always close any opened datasource with OGRDataSource::DestroyDataSource() that will ensure all data is correctly flushed.

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

Returns
OGRERR_NONE if no error occurs (even if nothing is done) or an error code.

Reimplemented from OGRLayer.

◆ TestCapability()

int GNMGenericLayer::TestCapability ( const char *  pszCap)
overridevirtual

Test if this layer supported the named capability.

The capability codes that can be tested are represented as strings, but #defined constants exists to ensure correct spelling. Specific layer types may implement class specific capabilities, but this can't generally be discovered by the caller.

  • OLCRandomRead / "RandomRead": TRUE if the GetFeature() method is implemented in an optimized way for this layer, as opposed to the default implementation using ResetReading() and GetNextFeature() to find the requested feature id.

  • OLCSequentialWrite / "SequentialWrite": TRUE if the CreateFeature() method works for this layer. Note this means that this particular layer is writable. The same OGRLayer class may returned FALSE for other layer instances that are effectively read-only.

  • OLCRandomWrite / "RandomWrite": TRUE if the SetFeature() method is operational on this layer. Note this means that this particular layer is writable. The same OGRLayer class may returned FALSE for other layer instances that are effectively read-only.

  • OLCFastSpatialFilter / "FastSpatialFilter": TRUE if this layer implements spatial filtering efficiently. Layers that effectively read all features, and test them with the OGRFeature intersection methods should return FALSE. This can be used as a clue by the application whether it should build and maintain its own spatial index for features in this layer.

  • OLCFastFeatureCount / "FastFeatureCount": TRUE if this layer can return a feature count (via GetFeatureCount()) efficiently. i.e. without counting the features. In some cases this will return TRUE until a spatial filter is installed after which it will return FALSE.

  • OLCFastGetExtent / "FastGetExtent": TRUE if this layer can return its data extent (via GetExtent()) efficiently, i.e. without scanning all the features. In some cases this will return TRUE until a spatial filter is installed after which it will return FALSE.

  • OLCFastSetNextByIndex / "FastSetNextByIndex": TRUE if this layer can perform the SetNextByIndex() call efficiently, otherwise FALSE.

  • OLCCreateField / "CreateField": TRUE if this layer can create new fields on the current layer using CreateField(), otherwise FALSE.

  • OLCCreateGeomField / "CreateGeomField": (GDAL >= 1.11) TRUE if this layer can create new geometry fields on the current layer using CreateGeomField(), otherwise FALSE.

  • OLCDeleteField / "DeleteField": TRUE if this layer can delete existing fields on the current layer using DeleteField(), otherwise FALSE.

  • OLCReorderFields / "ReorderFields": TRUE if this layer can reorder existing fields on the current layer using ReorderField() or ReorderFields(), otherwise FALSE.

  • OLCAlterFieldDefn / "AlterFieldDefn": TRUE if this layer can alter the definition of an existing field on the current layer using AlterFieldDefn(), otherwise FALSE.

  • OLCDeleteFeature / "DeleteFeature": TRUE if the DeleteFeature() method is supported on this layer, otherwise FALSE.

  • OLCStringsAsUTF8 / "StringsAsUTF8": TRUE if values of OFTString fields are assured to be in UTF-8 format. If FALSE the encoding of fields is uncertain, though it might still be UTF-8.

  • OLCTransactions / "Transactions": TRUE if the StartTransaction(), CommitTransaction() and RollbackTransaction() methods work in a meaningful way, otherwise FALSE.

  • OLCIgnoreFields / "IgnoreFields": TRUE if fields, geometry and style will be omitted when fetching features as set by SetIgnoredFields() method.

  • OLCCurveGeometries / "CurveGeometries": TRUE if this layer supports writing curve geometries or may return such geometries. (GDAL 2.0).

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

Parameters
pszCapthe name of the capability to test.
Returns
TRUE if the layer has the requested capability, or FALSE otherwise. OGRLayers will return FALSE for any unrecognized capabilities.

Implements OGRLayer.


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

Generated for GDAL by doxygen 1.8.13.