Package org.gdal.ogr

## Class FeatureDefn

- java.lang.Object
- - org.gdal.ogr.FeatureDefn

-     public class FeatureDefn
      extends java.lang.Object

  Definition of a feature class or feature layer.

  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 Summary

    Constructors
    Constructor | Description
    --- | ---
    `FeatureDefn()` | Constructor.
    `FeatureDefn​(java.lang.String name)` | Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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.
    `byte[]` | `GetNameAsByteArray()` |
    `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.

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FeatureDefn

          public FeatureDefn​(java.lang.String name)

      Constructor.

      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.

      Parameters:
        `name` - the name to be assigned to this layer/class. It does not need to be unique. and may be null.

    - #### FeatureDefn

          public FeatureDefn()

      Constructor.

      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.

  - ### Method Detail

    - #### delete

          public void delete()

    - #### equals

          public boolean equals​(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### GetName

          public java.lang.String GetName()

      Get name of this FeatureDefn.
      Returns:
        the name.

    - #### GetNameAsByteArray

          public byte[] GetNameAsByteArray()

    - #### GetFieldCount

          public int GetFieldCount()

      Fetch number of fields on this feature.
      Returns:
        count of fields.

    - #### GetFieldDefn

          public FieldDefn GetFieldDefn​(int ifield)

      /** Fetch field definition.
      Parameters:
        `ifield` - the field to fetch, between 0 and GetFieldCount()-1.
      Returns:
        a pointer to an internal field definition object. This object should not be modified or freed by the application.

    - #### GetFieldIndex

          public int GetFieldIndex​(java.lang.String name)

      Find field by name.

      The field index of the first field matching the passed field name (case insensitively) is returned.

      Parameters:
        `name` - the field name to search for.
      Returns:
        the field index, or -1 if no match found.

    - #### AddFieldDefn

          public void AddFieldDefn​(FieldDefn defn)

      Add a new field definition.

      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.

      Parameters:
        `defn` - the definition of the new field.

    - #### GetGeomFieldCount

          public int GetGeomFieldCount()

    - #### GetGeomFieldDefn

          public GeomFieldDefn GetGeomFieldDefn​(int i)

    - #### GetGeomFieldIndex

          public int GetGeomFieldIndex​(java.lang.String field_name)

    - #### AddGeomFieldDefn

          public void AddGeomFieldDefn​(GeomFieldDefn defn)

    - #### DeleteGeomFieldDefn

          public int DeleteGeomFieldDefn​(int idx)

    - #### GetGeomType

          public int GetGeomType()

      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.

      Returns:
        the base type for all geometry related to this definition.

    - #### SetGeomType

          public void SetGeomType​(int geom_type)

      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 Features have been created against this definition.

      Parameters:
        `geom_type` - the new type to assign.

    - #### GetReferenceCount

          public int GetReferenceCount()

      Fetch current reference count.
      Returns:
        the current reference count.

    - #### IsGeometryIgnored

          public int IsGeometryIgnored()

      Determine whether the geometry can be omitted when fetching features.
      Returns:
        ignore state (1 if ignored, 0 otherwise)

    - #### SetGeometryIgnored

          public void SetGeometryIgnored​(int bIgnore)

      Set whether the geometry can be omitted when fetching features.
      Parameters:
        `bIgnore` - ignore state (1 to ignore, 0 otherwise)

    - #### IsStyleIgnored

          public int IsStyleIgnored()

      Determine whether the style can be omitted when fetching features.
      Returns:
        ignore state (1 if ignored, 0 otherwise)

    - #### SetStyleIgnored

          public void SetStyleIgnored​(int bIgnore)

      Set whether the style can be omitted when fetching features.
      Parameters:
        `bIgnore` - ignore state (1 to ignore, 0 otherwise)

    - #### IsSame

          public int IsSame​(FeatureDefn other_defn)