| java.lang.Object org.geotools.feature.DefaultFeature
All known Subclasses: org.geotools.data.jdbc.MutableFIDFeature,
DefaultFeature | public class DefaultFeature implements SimpleFeature,Cloneable(Code) | | Provides a more efficient feature representation for the flat and complex
features. This implementation actually not only enforces feature type
synchronization, it also enforces the use of its accessor methods to change
the state of internal object representations. In this case, the
implementation is trivial, since all allowed attribute objects (from the
feature type) are immutable.
author: Chris Holmes, TOPP
author: Rob Hranac, TOPP author: Ian Schneider ARS-USDA |
Constructor Summary | |
protected | DefaultFeature(DefaultFeatureType schema, Object[] attributes, String featureID) Creates a new instance of flat feature, which must take a flat feature
type schema and all attributes as arguments. | protected | DefaultFeature(DefaultFeatureType schema, Object[] attributes) Creates a new instance of flat feature, which must take a flat feature
type schema and all attributes as arguments. |
featureId | protected String featureId(Code) | | The unique id of this feature
|
DefaultFeature | protected DefaultFeature(DefaultFeatureType schema, Object[] attributes) throws IllegalAttributeException(Code) | | Creates a new instance of flat feature, which must take a flat feature
type schema and all attributes as arguments.
Parameters: schema - Feature type schema for this flat feature. Parameters: attributes - Initial attributes for this feature. throws: IllegalAttributeException - Attribtues do not conform to featuretype schema. |
defaultID | String defaultID()(Code) | | Creates an ID from a hashcode.
an id for the feature. |
equals | public boolean equals(Object obj)(Code) | | override of equals. Returns if the passed in object is equal to this.
Parameters: obj - the Object to test for equality. true if the object is equal, false otherwise. |
getAttribute | public Object getAttribute(String xPath)(Code) | | Gets an attribute for this feature at the location specified by xPath.
Parameters: xPath - XPath representation of attribute location. Attribute. |
getAttribute | public Object getAttribute(int index)(Code) | | Gets an attribute by the given zero-based index.
Parameters: index - the position of the attribute to retrieve. The attribute at the given index. |
getAttributes | public Object[] getAttributes(Object[] array)(Code) | | Copy all the attributes of this Feature into the given array. If the
argument array is null, a new one will be created. Gets all attributes
from this feature, returned as a complex object array. This array
comes with no metadata, so to interpret this collection the caller
class should ask for the schema as well.
Parameters: array - The array to copy the attributes into. The array passed in, or a new one if null. |
getBounds | public ReferencedEnvelope getBounds()(Code) | | Get the total bounds of this feature which is calculated by doing a
union of the bounds of each geometry this feature is associated with.
An Envelope containing the total bounds of this Feature. |
getDefaultGeometry | public Geometry getDefaultGeometry()(Code) | | Gets the geometry for this feature.
Geometry for this feature. |
getFeatureType | public FeatureType getFeatureType()(Code) | | Gets a reference to the feature type schema for this feature.
A copy of this feature's metadata in the form of a feature typeschema. |
getID | public String getID()(Code) | | Gets the unique indentification string of this Feature.
The unique id. |
getNumberOfAttributes | public int getNumberOfAttributes()(Code) | | Get the number of attributes this feature has. This is simply a
convenience method for calling
getFeatureType().getNumberOfAttributes();
The total number of attributes this Feature contains. |
getParent | public FeatureCollection getParent()(Code) | | Gets the feature collection this feature is stored in.
the collection that is the parent of this feature. |
hashCode | public int hashCode()(Code) | | returns a unique code for this feature
A unique int |
setAttribute | public void setAttribute(int position, Object val) throws IllegalAttributeException(Code) | | Sets the attribute at position to val.
Parameters: position - the index of the attribute to set. Parameters: val - the new value to give the attribute at position. throws: IllegalAttributeException - if the passed in val does not validateagainst the AttributeType at that position. |
setAttribute | public void setAttribute(String xPath, Object attribute) throws IllegalAttributeException(Code) | | Sets a single attribute for this feature, passed as a complex object. If
the attribute does not exist or the object does not conform to the
internal feature type, an exception is thrown.
Parameters: xPath - XPath representation of attribute location. Parameters: attribute - Feature attribute to set. throws: IllegalAttributeException - Passed attribute does not matchfeature type |
setAttributeValue | protected void setAttributeValue(int position, Object val)(Code) | | Sets the attribute value at a given position, performing no parsing or
validation. This is so subclasses can have access to setting the array,
without opening it up completely.
Parameters: position - the index of the attribute to set. Parameters: val - the new value to give the attribute at position. |
setAttributes | public void setAttributes(Object[] attributes) throws IllegalAttributeException(Code) | | Sets all attributes for this feature, passed as an array. All
attributes are checked for validity before adding.
Parameters: attributes - All feature attributes. throws: IllegalAttributeException - Passed attributes do not match featuretype. |
setParent | public void setParent(FeatureCollection collection)(Code) | | Sets the parent collection this feature is stored in, if it is not
already set. If it is set then this method does nothing.
Parameters: collection - the collection to be set as parent. |
toString | public String toString()(Code) | | Returns a string representation of this feature.
A representation of this feature as a string. |
|
|