org.n52.oxf.feature
Class OXFFeature

java.lang.Object
  extended by org.n52.oxf.feature.OXFFeature
All Implemented Interfaces:
org.opengis.feature.Feature
Direct Known Subclasses:
OXFFeatureCollection

public class OXFFeature
extends Object
implements org.opengis.feature.Feature

Author:
Arne Broering

Constructor Summary
OXFFeature(String id, OXFFeatureType featureType)
           
OXFFeature(String id, OXFFeatureType featureType, org.opengis.feature.FeatureCollection parent)
           
 
Method Summary
 boolean equals(Object feature)
           
 Object getAttribute(int index)
          not supported
 Object getAttribute(String name)
          Returns the value of the named attribute of this Feature.
 com.vividsolutions.jts.geom.Geometry getBoundingBox()
           
 org.opengis.spatialschema.geometry.Envelope getBounds()
          not supported
 OXFFeatureType getFeatureType()
          Returns the description of this feature's type.
 com.vividsolutions.jts.geom.Geometry getGeometry()
           
 String getID()
          Returns a String that uniquely identifies this Feature instance with this Java virtual machine (and perhaps uniquely in a broader scope as well).
 org.opengis.feature.FeatureCollection getParent()
          Returns the collection in which this Feature is contained.
 String[] getSpecifiedAttributes()
           
 String produceDescription()
           
 void setAttribute(int index, Object value)
          not supported
 void setAttribute(String name, Object value)
          Sets the value of the named attribute.
 void setGeometry(com.vividsolutions.jts.geom.Geometry g)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OXFFeature

public OXFFeature(String id,
                  OXFFeatureType featureType)

OXFFeature

public OXFFeature(String id,
                  OXFFeatureType featureType,
                  org.opengis.feature.FeatureCollection parent)
Method Detail

equals

public boolean equals(Object feature)
Overrides:
equals in class Object
Parameters:
feature -
Returns:
true if the specified feature is an OXFFeature and not null and the IDs of both features are equal.

getSpecifiedAttributes

public String[] getSpecifiedAttributes()
Returns:
the names of the attributes contained by the attributeMap of this OXFFeature.

getFeatureType

public OXFFeatureType getFeatureType()
Returns the description of this feature's type.

Specified by:
getFeatureType in interface org.opengis.feature.Feature

getAttribute

public Object getAttribute(String name)
                    throws IllegalArgumentException
Returns the value of the named attribute of this Feature. If the maximum cardinality of this attribute is one, then this method returns the value of the attribute. Otherwise, if the maximum cardinality of this attribute is greater than one, then this method will return an instance of Collection.

Specified by:
getAttribute in interface org.opengis.feature.Feature
Parameters:
name - The name of the feature attribute to retrieve.
Throws:
IllegalArgumentException - If an attribute of the given name does not exist in this feature's type.

setAttribute

public void setAttribute(String name,
                         Object value)
                  throws IllegalArgumentException,
                         ClassCastException
Sets the value of the named attribute. The value can either be a single object, if the maximum cardinality of the given attribute is one, or the value can be an instance of Collection if the attribute's maximum cardinality is greater than one.

If the attributeMap previously contained a mapping for the specified name, the old value is replaced.

Specified by:
setAttribute in interface org.opengis.feature.Feature
Parameters:
name - The name of the attribute whose value to set.
value - The new value of the given attribute.
Throws:
IllegalArgumentException - If value is a collection (other than a singleton) and it's a single-valued attribute, or if the given name does not match any of the attributes of this feature.
ClassCastException - If the attribute type is a type other than Object in the FeatureType and an incorrect type is passed in.

getID

public String getID()
Returns a String that uniquely identifies this Feature instance with this Java virtual machine (and perhaps uniquely in a broader scope as well). This value is not necessarily one of the attributes of this feature. Some features may implement this method by concatenating this feature's type name with the String values of all of the primary key attributes. (This is only a suggestion, however, and a given Feature implementation may choose to compute the ID in whatever way makes sense.)

Specified by:
getID in interface org.opengis.feature.Feature

getParent

public org.opengis.feature.FeatureCollection getParent()
Returns the collection in which this Feature is contained.

Specified by:
getParent in interface org.opengis.feature.Feature

getBoundingBox

public com.vividsolutions.jts.geom.Geometry getBoundingBox()
Returns:
the envelope of the geometry of this feature. or null if this object does not contain a geometry.

getGeometry

public com.vividsolutions.jts.geom.Geometry getGeometry()
Returns:

setGeometry

public void setGeometry(com.vividsolutions.jts.geom.Geometry g)
Parameters:
g -

toString

public String toString()
Overrides:
toString in class Object

produceDescription

public String produceDescription()

setAttribute

public void setAttribute(int index,
                         Object value)
                  throws UnsupportedOperationException
not supported

Specified by:
setAttribute in interface org.opengis.feature.Feature
Throws:
UnsupportedOperationException

getAttribute

public Object getAttribute(int index)
                    throws UnsupportedOperationException
not supported

Specified by:
getAttribute in interface org.opengis.feature.Feature
Throws:
UnsupportedOperationException

getBounds

public org.opengis.spatialschema.geometry.Envelope getBounds()
                                                      throws UnsupportedOperationException
not supported

Specified by:
getBounds in interface org.opengis.feature.Feature
Throws:
UnsupportedOperationException


Copyright © 2005 - 2010 52°North Initiative for Geospatial Open Source Software GmbH. All rights reserved.