Interface Feature

All Superinterfaces:
Cloneable, Comparable
All Known Implementing Classes:
AbstractBasicFeature, BasicFeature, FlexibleFeature, ReferencedImageFeature

public interface Feature extends Cloneable, Comparable
A representation of an object in the world, including its location, geometry, and other attributes. A Feature has spatial attributes (polygons, points, etc.) and non-spatial attributes (strings, dates, and numbers).

In the current Workbench model, each feature has one spatial attribute (Geometry) and zero or more non-spatial attributes.

  • Method Summary

    Modifier and Type
    Method
    Description
    Clones this Feature.
    clone(boolean deep)
    Clones this Feature.
    clone(boolean deep, boolean copyPK)
    Clones this Feature.
    getAttribute(int i)
    Returns the specified attribute.
    Returns the specified attribute.
    A low-level accessor that is not normally used.
    double
    getDouble(int attributeIndex)
    Returns a double attribute.
    org.locationtech.jts.geom.Geometry
    Convenience method for returning the spatial attribute.
    int
    Returns a number that uniquely identifies this feature.
    int
    getInteger(int attributeIndex)
    Returns a integer attribute.
    Returns the feature's metadata
    getString(int attributeIndex)
    Returns the result of calling #toString on the attribute at the given (zero-based) index, or "" if it is null.
    getString(String attributeName)
    Returns the result of calling #toString on the attribute with the given (case-sensitive) name, or "" if it is null.
    void
    setAttribute(int attributeIndex, Object newAttribute)
    Sets the specified attribute.
    void
    setAttribute(String attributeName, Object newAttribute)
    Sets the specified attribute.
    void
    setAttributes(Object[] attributes)
    A low-level accessor that is not normally used.
    void
    setGeometry(org.locationtech.jts.geom.Geometry geometry)
    Convenience method for setting the spatial attribute.
    void
    A low-level accessor that is not normally used.

    Methods inherited from interface Comparable

    compareTo
  • Method Details

    • setAttributes

      void setAttributes(Object[] attributes)
      A low-level accessor that is not normally used.
      Parameters:
      attributes - may have a different length than the current attributes.
    • setSchema

      void setSchema(FeatureSchema schema)
      A low-level accessor that is not normally used.
    • getID

      int getID()
      Returns a number that uniquely identifies this feature. This number is not persistent. (Implementors can obtain an ID from FeatureUtil#nextID).
      Returns:
      n, where this feature is the nth Feature created by this application
    • setAttribute

      void setAttribute(int attributeIndex, Object newAttribute)
      Sets the specified attribute.
      Parameters:
      attributeIndex - the array index at which to put the new attribute
      newAttribute - the new attribute
    • setAttribute

      void setAttribute(String attributeName, Object newAttribute)
      Sets the specified attribute.
      Parameters:
      attributeName - the name of the attribute to set
      newAttribute - the new attribute
    • setGeometry

      void setGeometry(org.locationtech.jts.geom.Geometry geometry)
      Convenience method for setting the spatial attribute. JUMP Workbench PlugIns and CursorTools should not use this method directly, but should use an EditTransaction, so that the proper events are fired.
      Parameters:
      geometry - the new spatial attribute
    • getAttribute

      Object getAttribute(int i)
      Returns the specified attribute.
      Parameters:
      i - the index of the attribute to get
      Returns:
      the attribute
    • getAttribute

      Object getAttribute(String name)
      Returns the specified attribute.
      Parameters:
      name - the name of the attribute to get
      Returns:
      the attribute
    • getString

      String getString(int attributeIndex)
      Returns the result of calling #toString on the attribute at the given (zero-based) index, or "" if it is null. Note that this method may be called even if the attribute is not of type AttributeType.STRING.
    • getInteger

      int getInteger(int attributeIndex)
      Returns a integer attribute.
      Parameters:
      attributeIndex - the index of the attribute to retrieve
      Returns:
      the integer attribute with the given name
    • getDouble

      double getDouble(int attributeIndex)
      Returns a double attribute.
      Parameters:
      attributeIndex - the index of the attribute to retrieve
      Returns:
      the double attribute with the given name
    • getString

      String getString(String attributeName)
      Returns the result of calling #toString on the attribute with the given (case-sensitive) name, or "" if it is null. Note that this method may be called even if the attribute is not of type AttributeType.STRING.
    • getGeometry

      org.locationtech.jts.geom.Geometry getGeometry()
      Convenience method for returning the spatial attribute.
      Returns:
      the feature's spatial attribute
    • getSchema

      FeatureSchema getSchema()
      Returns the feature's metadata
      Returns:
      the metadata describing the names and types of the attributes
    • clone

      Feature clone()
      Clones this Feature. Geometry and Primary Key will also be cloned. Warning : Feature.clone() imlpementation does not follow general contract of clone (which recommends using super.clone) but makes a deep copy of the Object using BasicFeature constructor.
      Returns:
      a new Feature with the same attributes as this Feature
    • clone

      Feature clone(boolean deep)
      Clones this Feature.
      Parameters:
      deep - whether or not to clone the geometry
      Returns:
      a new Feature with the same attributes as this Feature
    • clone

      Feature clone(boolean deep, boolean copyPK)
      Clones this Feature.
      Parameters:
      deep - whether or not to clone the geometry
      copyPK - whether or not to copy external PK attribute if exists
      Returns:
      a new Feature with the same attributes as this Feature
    • getAttributes

      Object[] getAttributes()
      A low-level accessor that is not normally used.