public class FeatureDefn
extends java.lang.Object
The FeatureDefn class is a binding for the C++ OGRFeatureDefn class.
This object contains schema information for a set of Feature. In table based systems, a FeatureDefn 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.
It is reasonable for different translators to derive classes from FeatureDefn with additional translator specific information.
Constructor | Description |
---|---|
FeatureDefn() |
Constructor.
|
FeatureDefn(java.lang.String name) |
Constructor.
|
Modifier and Type | Method | Description |
---|---|---|
void |
AddFieldDefn(FieldDefn defn) |
Add a new field definition.
|
void |
AddGeomFieldDefn(GeomFieldDefn defn) |
|
void |
delete() |
|
int |
DeleteGeomFieldDefn(int idx) |
|
boolean |
equals(java.lang.Object obj) |
|
int |
GetFieldCount() |
Fetch number of fields on this feature.
|
FieldDefn |
GetFieldDefn(int ifield) |
Fetch field definition.
|
int |
GetFieldIndex(java.lang.String name) |
Find field by name.
|
int |
GetGeomFieldCount() |
|
GeomFieldDefn |
GetGeomFieldDefn(int i) |
|
int |
GetGeomFieldIndex(java.lang.String field_name) |
|
int |
GetGeomType() |
Fetch the geometry base type.
|
java.lang.String |
GetName() |
Get name of this FeatureDefn.
|
int |
GetReferenceCount() |
Fetch current reference count.
|
int |
hashCode() |
|
int |
IsGeometryIgnored() |
Determine whether the geometry can be omitted when fetching features.
|
int |
IsSame(FeatureDefn other_defn) |
|
int |
IsStyleIgnored() |
Determine whether the style can be omitted when fetching features.
|
void |
SetGeometryIgnored(int bIgnore) |
Set whether the geometry can be omitted when fetching features.
|
void |
SetGeomType(int geom_type) |
Assign the base geometry type for this layer.
|
void |
SetStyleIgnored(int bIgnore) |
Set whether the style can be omitted when fetching features.
|
public FeatureDefn(java.lang.String name)
The FeatureDefn maintains a reference count, but this starts at zero. It is mainly intended to represent a count of Feature's based on this definition.
name
- the name to be assigned to this layer/class. It does not
need to be unique. and may be null.public FeatureDefn()
The FeatureDefn maintains a reference count, but this starts at zero. It is mainly intended to represent a count of Feature's based on this definition. The FeatureDefn will be unnamed.
public void delete()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String GetName()
public int GetFieldCount()
public FieldDefn GetFieldDefn(int ifield)
ifield
- the field to fetch, between 0 and GetFieldCount()-1.public int GetFieldIndex(java.lang.String name)
The field index of the first field matching the passed field name (case insensitively) is returned.
name
- the field name to search for.public void AddFieldDefn(FieldDefn defn)
To add a new field definition to a layer definition, do not use this function directly, but use Layer.CreateField() instead.
This method should only be called while there are no Feature objects in existence based on this FeatureDefn. The FieldDefn passed in is copied, and remains the responsibility of the caller.
defn
- the definition of the new field.public int GetGeomFieldCount()
public GeomFieldDefn GetGeomFieldDefn(int i)
public int GetGeomFieldIndex(java.lang.String field_name)
public void AddGeomFieldDefn(GeomFieldDefn defn)
public int DeleteGeomFieldDefn(int idx)
public int GetGeomType()
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.
public void SetGeomType(int geom_type)
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 Features have been created against this definition.
geom_type
- the new type to assign.public int GetReferenceCount()
public int IsGeometryIgnored()
public void SetGeometryIgnored(int bIgnore)
bIgnore
- ignore state (1 to ignore, 0 otherwise)public int IsStyleIgnored()
public void SetStyleIgnored(int bIgnore)
bIgnore
- ignore state (1 to ignore, 0 otherwise)public int IsSame(FeatureDefn other_defn)