|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.feature.FeatureImpl
This is a sample implementation of the FeatureType API.
The suffix implementation is used to indicat this is a direct, straight forward implementation of the associated interface.
This serves as, my reference implementation, if you have any questions please contact me (jgarnett@refractions.net) or jump on the geotools-devel email list. There is a good chance my understanding is wrong, I expect and want feedback on this implementation.
I especially am interested in:
Nested Class Summary |
Nested classes inherited from class org.geotools.feature.Feature |
Feature.NULL |
Constructor Summary | |
FeatureImpl()
|
Method Summary | |
java.lang.Object |
getAttribute(int index)
Gets an attribute by the given zero-based index. |
java.lang.Object |
getAttribute(java.lang.String xPath)
Gets an attribute for this feature at the location specified by xPath. |
java.lang.Object[] |
getAttributes(java.lang.Object[] attributes)
Copy all the attributes of this Feature into the given array. |
com.vividsolutions.jts.geom.Envelope |
getBounds()
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. |
com.vividsolutions.jts.geom.Geometry |
getDefaultGeometry()
Gets the default geometry for this feature. |
FeatureType |
getFeatureType()
Gets a reference to the schema for this feature. |
java.lang.String |
getID()
Gets the unique feature ID for this feature. |
int |
getNumberOfAttributes()
Get the number of attributes this feature has. |
FeatureCollection |
getParent()
Gets the feature collection this feature is stored in. |
void |
setAttribute(int position,
java.lang.Object val)
Sets an attribute by the given zero-based index. |
void |
setAttribute(java.lang.String xPath,
java.lang.Object attribute)
Sets a single attribute for this feature, passed as a complex object. |
void |
setDefaultGeometry(com.vividsolutions.jts.geom.Geometry geometry)
Sets the default geometry for this feature. |
void |
setParent(FeatureCollection collection)
Sets the parent collection this feature is stored in, if it is not already set. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FeatureImpl()
Method Detail |
public FeatureCollection getParent()
Feature
public void setParent(FeatureCollection collection)
Feature
collection
- the collection to be set as parent.public FeatureType getFeatureType()
Feature
getFeatureType
in interface Feature
public java.lang.String getID()
Feature
public java.lang.Object[] getAttributes(java.lang.Object[] attributes)
Feature
getAttributes
in interface Feature
attributes
- An array to copy attributes into. May be null.
public java.lang.Object getAttribute(java.lang.String xPath)
Feature
getAttribute
in interface Feature
xPath
- XPath representation of attribute location.
public java.lang.Object getAttribute(int index)
Feature
getAttribute
in interface Feature
index
- The requested index. Must be 0 <= idx <
getNumberOfAttributes().
Feature.getAttribute(String)
public void setAttribute(int position, java.lang.Object val) throws IllegalAttributeException, java.lang.ArrayIndexOutOfBoundsException
Feature
setAttribute
in interface Feature
position
- The requested index. Must be 0 <= idx <
getNumberOfAttributes()val
- An object representing the attribute being set
java.lang.ArrayIndexOutOfBoundsException
- if an invalid position is given
IllegalAttributeException
- if the passed in val does not validate
against the AttributeType at that position.Feature.setAttribute(String, Object)
public int getNumberOfAttributes()
Feature
getNumberOfAttributes
in interface Feature
public void setAttribute(java.lang.String xPath, java.lang.Object attribute) throws IllegalAttributeException
Feature
setAttribute
in interface Feature
xPath
- XPath representation of attribute location.attribute
- Feature attribute to set.
IllegalAttributeException
- If the attribute is illegal for the
path specified.public com.vividsolutions.jts.geom.Geometry getDefaultGeometry()
Feature
This method will return null
if no DefaultGeometry has been
defined by the schema.
getDefaultGeometry
in interface Feature
null
public void setDefaultGeometry(com.vividsolutions.jts.geom.Geometry geometry) throws IllegalAttributeException
Feature
setDefaultGeometry
in interface Feature
geometry
- The geometry to set.
IllegalAttributeException
- If the AttributeType is not a
geometry, or is invalid for some other reason.public com.vividsolutions.jts.geom.Envelope getBounds()
Feature
This method will return an empty Envelope if the feature contains no geometry information.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |