Interface Feature

  • All Superinterfaces:
    Cloneable, Comparable
    All Known Implementing Classes:
    AbstractBasicFeature, BasicFeature

    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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Object clone()
      Clones this Feature.
      Feature clone​(boolean deep)
      Clones this Feature.
      Object getAttribute​(int i)
      Returns the specified attribute.
      Object getAttribute​(String name)
      Returns the specified attribute.
      Object[] getAttributes()
      A low-level accessor that is not normally used.
      double getDouble​(int attributeIndex)
      Returns a double attribute.
      org.locationtech.jts.geom.Geometry getGeometry()
      Convenience method for returning the spatial attribute.
      int getID()
      Returns a number that uniquely identifies this feature.
      int getInteger​(int attributeIndex)
      Returns a integer attribute.
      FeatureSchema getSchema()
      Returns the feature's metadata
      String getString​(int attributeIndex)
      Returns the result of calling #toString on the attribute at the given (zero-based) index, or "" if it is null.
      String 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 setSchema​(FeatureSchema schema)
      A low-level accessor that is not normally used.
    • Method Detail

      • 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

        Object clone()
        Clones this Feature. The geometry will also be cloned.
        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
      • getAttributes

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