OGR
|
#include <ogr_feature.h>
Public Member Functions | |
OGRFeatureDefn (const char *pszName=NULL) | |
Constructor. More... | |
virtual const char * | GetName () |
Get name of this OGRFeatureDefn. More... | |
virtual int | GetFieldCount () |
Fetch number of fields on this feature. More... | |
virtual OGRFieldDefn * | GetFieldDefn (int i) |
Fetch field definition. More... | |
virtual int | GetFieldIndex (const char *) |
Find field by name. More... | |
virtual void | AddFieldDefn (OGRFieldDefn *) |
Add a new field definition. More... | |
virtual OGRErr | DeleteFieldDefn (int iField) |
Delete an existing field definition. More... | |
virtual OGRErr | ReorderFieldDefns (int *panMap) |
Reorder the field definitions in the array of the feature definition. More... | |
virtual int | GetGeomFieldCount () |
Fetch number of geometry fields on this feature. More... | |
virtual OGRGeomFieldDefn * | GetGeomFieldDefn (int i) |
Fetch geometry field definition. More... | |
virtual int | GetGeomFieldIndex (const char *) |
Find geometry field by name. More... | |
virtual void | AddGeomFieldDefn (OGRGeomFieldDefn *, int bCopy=TRUE) |
Add a new geometry field definition. More... | |
virtual OGRErr | DeleteGeomFieldDefn (int iGeomField) |
Delete an existing geometry field definition. More... | |
virtual OGRwkbGeometryType | GetGeomType () |
Fetch the geometry base type. More... | |
virtual void | SetGeomType (OGRwkbGeometryType) |
Assign the base geometry type for this layer. More... | |
virtual OGRFeatureDefn * | Clone () |
Create a copy of this feature definition. More... | |
int | Reference () |
Increments the reference count by one. More... | |
int | Dereference () |
Decrements the reference count by one. More... | |
int | GetReferenceCount () |
Fetch current reference count. More... | |
void | Release () |
Drop a reference to this object, and destroy if no longer referenced. | |
virtual int | IsGeometryIgnored () |
Determine whether the geometry can be omitted when fetching features. More... | |
virtual void | SetGeometryIgnored (int bIgnore) |
Set whether the geometry can be omitted when fetching features. More... | |
virtual int | IsStyleIgnored () |
Determine whether the style can be omitted when fetching features. More... | |
virtual void | SetStyleIgnored (int bIgnore) |
Set whether the style can be omitted when fetching features. More... | |
virtual int | IsSame (OGRFeatureDefn *poOtherFeatureDefn) |
Test if the feature definition is identical to the other one. More... | |
Definition of a feature class or feature layer.
This object contains schema information for a set of OGRFeatures. In table based systems, an OGRFeatureDefn is essentially a layer. In more object oriented approaches (such as SF CORBA) this can represent a class of features but doesn't necessarily relate to all of a layer, or just one layer.
This object also can contain some other information such as a name, the base geometry type and potentially other metadata.
Starting with GDAL 1.11, in addition to attribute fields, it can also contain multiple geometry fields.
It is reasonable for different translators to derive classes from OGRFeatureDefn with additional translator specific information.
OGRFeatureDefn::OGRFeatureDefn | ( | const char * | pszName = NULL | ) |
Constructor.
The OGRFeatureDefn maintains a reference count, but this starts at zero. It is mainly intended to represent a count of OGRFeature's based on this definition.
This method is the same as the C function OGR_FD_Create().
pszName | the name to be assigned to this layer/class. It does not need to be unique. |
References CPLMalloc(), CPLStrdup(), and wkbUnknown.
Referenced by Clone(), OGR_FD_Create(), and OGR_FD_SetStyleIgnored().
|
virtual |
Add a new field definition.
To add a new field definition to a layer definition, do not use this function directly, but use OGRLayer::CreateField() instead.
This method should only be called while there are no OGRFeature objects in existence based on this OGRFeatureDefn. The OGRFieldDefn passed in is copied, and remains the responsibility of the caller.
This method is the same as the C function OGR_FD_AddFieldDefn().
poNewDefn | the definition of the new field. |
References CPLRealloc(), and GetFieldCount().
Referenced by Clone(), and OGRUnionLayer::GetLayerDefn().
|
virtual |
Add a new geometry field definition.
To add a new geometry field definition to a layer definition, do not use this function directly, but use OGRLayer::CreateGeomField() instead.
This method does an internal copy of the passed geometry field definition, unless bCopy is set to FALSE (in which case it takes ownership of the field definition.
This method should only be called while there are no OGRFeature objects in existence based on this OGRFeatureDefn. The OGRGeomFieldDefn passed in is copied, and remains the responsibility of the caller.
This method is the same as the C function OGR_FD_AddGeomFieldDefn().
poNewDefn | the definition of the new geometry field. |
bCopy | whether poNewDefn should be copied. |
References CPLRealloc(), and GetGeomFieldCount().
Referenced by Clone(), and SetGeomType().
|
virtual |
Create a copy of this feature definition.
Creates a deep copy of the feature definition.
References AddFieldDefn(), AddGeomFieldDefn(), DeleteGeomFieldDefn(), GetFieldCount(), GetFieldDefn(), GetGeomFieldCount(), GetGeomFieldDefn(), GetName(), and OGRFeatureDefn().
Referenced by OGRWarpedLayer::GetLayerDefn().
|
virtual |
Delete an existing field definition.
To delete an existing field definition from a layer definition, do not use this function directly, but use OGRLayer::DeleteField() instead.
This method should only be called while there are no OGRFeature objects in existence based on this OGRFeatureDefn.
This method is the same as the C function OGR_FD_DeleteFieldDefn().
iField | the index of the field defintion. |
References GetFieldCount().
|
virtual |
Delete an existing geometry field definition.
To delete an existing field definition from a layer definition, do not use this function directly, but use OGRLayer::DeleteGeomField() instead.
This method should only be called while there are no OGRFeature objects in existence based on this OGRFeatureDefn.
This method is the same as the C function OGR_FD_DeleteGeomFieldDefn().
iGeomField | the index of the geometry field defintion. |
References GetGeomFieldCount().
Referenced by Clone(), and SetGeomType().
|
inline |
Decrements the reference count by one.
This method is the same as the C function OGR_FD_Dereference().
Referenced by Release().
|
virtual |
Fetch number of fields on this feature.
This method is the same as the C function OGR_FD_GetFieldCount().
Referenced by AddFieldDefn(), Clone(), OGRFeature::Clone(), OGRDataSource::CopyLayer(), DeleteFieldDefn(), OGRFeature::Equal(), OGRDataSource::ExecuteSQL(), OGRFeature::GetFieldAsDouble(), OGRFeature::GetFieldAsInteger(), OGRFeature::GetFieldAsString(), OGRFeature::GetFieldCount(), GetFieldDefn(), GetFieldIndex(), OGRUnionLayer::GetGeomType(), OGRGenSQLResultsLayer::GetLayerDefn(), OGRUnionLayer::GetLayerDefn(), OGRFeature::IsFieldSet(), IsSame(), OGR_DS_GetLayerByName(), OGR_F_Create(), OGR_F_SetStyleStringDirectly(), OGR_L_SetIgnoredFields(), OGRFeature::OGRFeature(), OGRLayer::ReorderField(), ReorderFieldDefns(), OGRLayer::SetAttributeFilter(), OGRLayer::SetIgnoredFields(), and OGRGenSQLResultsLayer::TestCapability().
|
virtual |
Fetch field definition.
This method is the same as the C function OGR_FD_GetFieldDefn().
Starting with GDAL 1.7.0, this method will also issue an error if the index is not valid.
iField | the field to fetch, between 0 and GetFieldCount()-1. |
References CPLError(), and GetFieldCount().
Referenced by Clone(), OGRDataSource::CopyLayer(), OGRFeature::DumpReadable(), OGRFeature::Equal(), OGRDataSource::ExecuteSQL(), OGRFeature::GetFieldAsBinary(), OGRFeature::GetFieldAsDateTime(), OGRFeature::GetFieldAsDouble(), OGRFeature::GetFieldAsDoubleList(), OGRFeature::GetFieldAsInteger(), OGRFeature::GetFieldAsIntegerList(), OGRFeature::GetFieldAsString(), OGRFeature::GetFieldAsStringList(), OGRFeature::GetFieldDefnRef(), GetFieldIndex(), OGRUnionLayer::GetGeomType(), OGRGenSQLResultsLayer::GetLayerDefn(), OGRUnionLayer::GetLayerDefn(), IsSame(), OGR_DS_GetLayerByName(), OGR_F_Create(), OGR_L_SetIgnoredFields(), OGRFeature::SetField(), OGRLayer::SetIgnoredFields(), OGRGenSQLResultsLayer::TestCapability(), and OGRFeature::UnsetField().
|
virtual |
Find field by name.
The field index of the first field matching the passed field name (case insensitively) is returned.
This method is the same as the C function OGR_FD_GetFieldIndex().
pszFieldName | the field name to search for. |
References GetFieldCount(), and GetFieldDefn().
Referenced by OGRDataSource::CopyLayer(), OGRLayer::FindFieldIndex(), OGRFeature::GetFieldIndex(), OGRUnionLayer::GetGeomType(), OGRUnionLayer::GetLayerDefn(), OGRUnionLayer::GetSpatialRef(), OGR_DS_GetLayerByName(), OGR_L_SetIgnoredFields(), OGRGeocodeDestroySession(), and OGRLayer::SetIgnoredFields().
|
virtual |
Fetch number of geometry fields on this feature.
This method is the same as the C function OGR_FD_GetGeomFieldCount().
Referenced by AddGeomFieldDefn(), Clone(), OGRFeature::Clone(), OGRDataSource::CopyLayer(), DeleteGeomFieldDefn(), OGRDataSource::ExecuteSQL(), OGRFeature::GetGeomFieldCount(), GetGeomFieldDefn(), GetGeomFieldIndex(), OGRUnionLayer::GetGeomType(), GetGeomType(), OGRUnionLayer::GetLayerDefn(), IsGeometryIgnored(), IsSame(), OGR_F_Create(), OGR_F_SetStyleStringDirectly(), OGRFeature::OGRFeature(), SetGeometryIgnored(), and SetGeomType().
|
virtual |
Fetch geometry field definition.
This method is the same as the C function OGR_FD_GetGeomFieldDefn().
iGeomField | the geometry field to fetch, between 0 and GetGeomFieldCount()-1. |
References CPLError(), and GetGeomFieldCount().
Referenced by Clone(), OGRDataSource::CopyLayer(), OGRFeature::DumpReadable(), OGRDataSource::ExecuteSQL(), OGRLayer::GetGeometryColumn(), OGRFeature::GetGeomFieldDefnRef(), GetGeomFieldIndex(), OGRUnionLayer::GetGeomType(), GetGeomType(), OGRUnionLayer::GetLayerDefn(), OGRLayer::GetSpatialRef(), IsGeometryIgnored(), IsSame(), OGRUnionLayer::ResetReading(), SetGeometryIgnored(), SetGeomType(), and OGRLayer::SetIgnoredFields().
|
virtual |
Find geometry field by name.
The geometry field index of the first geometry field matching the passed field name (case insensitively) is returned.
This method is the same as the C function OGR_FD_GetGeomFieldIndex().
pszGeomFieldName | the geometry field name to search for. |
References GetGeomFieldCount(), and GetGeomFieldDefn().
Referenced by OGRFeature::GetGeomFieldIndex(), OGRUnionLayer::GetGeomType(), OGRUnionLayer::GetLayerDefn(), OGRUnionLayer::ResetReading(), and OGRLayer::SetIgnoredFields().
|
virtual |
Fetch the geometry base type.
Note that some drivers are unable to determine a specific geometry type for a layer, in which case wkbUnknown is returned. A value of wkbNone indicates no geometry is available for the layer at all. Many drivers do not properly mark the geometry type as 25D even if some or all geometries are in fact 25D. A few (broken) drivers return wkbPolygon for layers that also include wkbMultiPolygon.
Starting with GDAL 1.11, this method returns GetGeomFieldDefn(0)->GetType().
This method is the same as the C function OGR_FD_GetGeomType().
References GetGeomFieldCount(), GetGeomFieldDefn(), OGRGeomFieldDefn::GetType(), and wkbNone.
Referenced by OGRDataSource::CopyLayer(), and OGRLayer::GetGeomType().
|
virtual |
Get name of this OGRFeatureDefn.
This method is the same as the C function OGR_FD_GetName().
Referenced by Clone(), OGRSFDriver::CopyDataSource(), OGRDataSource::CopyLayer(), OGRFeature::DumpReadable(), OGRLayer::GetName(), IsSame(), and OGRFeature::SetField().
|
inline |
Fetch current reference count.
This method is the same as the C function OGR_FD_GetReferenceCount().
|
virtual |
Determine whether the geometry can be omitted when fetching features.
This method is the same as the C function OGR_FD_IsGeometryIgnored().
Starting with GDAL 1.11, this method returns GetGeomFieldDefn(0)->IsIgnored().
References GetGeomFieldCount(), GetGeomFieldDefn(), and OGRGeomFieldDefn::IsIgnored().
|
virtual |
Test if the feature definition is identical to the other one.
poOtherFeatureDefn | the other feature definition to compare to. |
References GetFieldCount(), GetFieldDefn(), GetGeomFieldCount(), GetGeomFieldDefn(), GetName(), OGRFieldDefn::IsSame(), and OGRGeomFieldDefn::IsSame().
|
inlinevirtual |
Determine whether the style can be omitted when fetching features.
This method is the same as the C function OGR_FD_IsStyleIgnored().
|
inline |
Increments the reference count by one.
The reference count is used keep track of the number of OGRFeature objects referencing this definition.
This method is the same as the C function OGR_FD_Reference().
Referenced by OGRWarpedLayer::GetLayerDefn(), and OGRFeature::OGRFeature().
|
virtual |
Reorder the field definitions in the array of the feature definition.
To reorder the field definitions in a layer definition, do not use this function directly, but use OGR_L_ReorderFields() instead.
This method should only be called while there are no OGRFeature objects in existence based on this OGRFeatureDefn.
This method is the same as the C function OGR_FD_ReorderFieldDefns().
panMap | an array of GetFieldCount() elements which is a permutation of [0, GetFieldCount()-1]. panMap is such that, for each field definition at position i after reordering, its position before reordering was panMap[i]. |
References CPLMalloc(), and GetFieldCount().
|
virtual |
Set whether the geometry can be omitted when fetching features.
This method is the same as the C function OGR_FD_SetGeometryIgnored().
Starting with GDAL 1.11, this method calls GetGeomFieldDefn(0)->SetIgnored().
bIgnore | ignore state |
References GetGeomFieldCount(), GetGeomFieldDefn(), and OGRGeomFieldDefn::SetIgnored().
Referenced by OGRLayer::SetIgnoredFields().
|
virtual |
Assign the base geometry type for this layer.
All geometry objects using this type must be of the defined type or a derived type. The default upon creation is wkbUnknown which allows for any geometry type. The geometry type should generally not be changed after any OGRFeatures have been created against this definition.
This method is the same as the C function OGR_FD_SetGeomType().
Starting with GDAL 1.11, this method calls GetGeomFieldDefn(0)->SetType().
eNewType | the new type to assign. |
References AddGeomFieldDefn(), DeleteGeomFieldDefn(), GetGeomFieldCount(), GetGeomFieldDefn(), OGRGeomFieldDefn::SetType(), and wkbNone.
|
inlinevirtual |
Set whether the style can be omitted when fetching features.
This method is the same as the C function OGR_FD_SetStyleIgnored().
bIgnore | ignore state |
Referenced by OGRLayer::SetIgnoredFields().