deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.model.feature
Class DefaultFeatureCollection

java.lang.Object
  extended by org.deegree.model.feature.AbstractFeature
      extended by org.deegree.model.feature.AbstractFeatureCollection
          extended by org.deegree.model.feature.DefaultFeatureCollection
All Implemented Interfaces:
java.io.Serializable, Feature, FeatureCollection

 class DefaultFeatureCollection
extends AbstractFeatureCollection
implements java.io.Serializable

This interface provides services for the management of groups of features. These groups can come into being for a number of reasons: e.g. a project as a whole, for the scope of a query, as the result of a query or arbitrarily selected by a user for some common manipulation. A feature's membership of a particular FeatureCollection does not necessarily imply any relationship with other member features. Composite or compound features which own constituent member Features (e.g. an Airport composed of Terminals, Runways, Aprons, Hangars, etc) may also support the FeatureCollection interface to provide a generic means for clients to access constituent members without needing to be aware of the internal implementation details of the compound feature.

-----------------------------------------------------------------------

Version:
$Revision: 18195 $ $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $
Author:
Andreas Poth

Field Summary
 
Fields inherited from class org.deegree.model.feature.AbstractFeature
description, envelopeCalculated, featureType, owner
 
Constructor Summary
DefaultFeatureCollection(java.lang.String id, Feature[] features)
          constructor for initializing a feature collection with an id and an array of features.
DefaultFeatureCollection(java.lang.String id, Feature[] features, QualifiedName qName)
          Constructor for initializing a feature collection with an id and an array of features.
DefaultFeatureCollection(java.lang.String id, int initialCapacity)
           
 
Method Summary
 void add(Feature feature)
          Appends a feature to the collection.
 void addProperty(FeatureProperty property)
          Adds the given property to the feature's properties.
 void clear()
          removes all features from a collection
 java.lang.Object clone()
           
 Feature cloneDeep()
           
 Envelope getBoundedBy()
          Returns the envelope / boundingbox of the feature.
 FeatureProperty getDefaultProperty(PropertyPath path)
          Returns the property of the feature identified by the given PropertyPath.
 Feature getFeature(int index)
          returns the feature that is assigned to the submitted index.
 Feature getFeature(java.lang.String id)
           
 FeatureType getFeatureType()
          returns the FeatureType of this Feature
 java.util.Iterator<Feature> iterator()
          returns an Iterator on the feature contained in a collection
 Feature remove(Feature feature)
          removes the submitted feature from the collection
 Feature remove(int index)
          removes a feature identified by its index from the feature collection.
 void removeProperty(QualifiedName propertyName)
          Removes the properties with the given name.
 void replaceProperty(FeatureProperty oldProperty, FeatureProperty newProperty)
          Replaces the given property with a new one.
 void setEnvelopesUpdated()
          Signals that the envelopes of the geometry properties have been updated.
 void setProperty(FeatureProperty property, int index)
          Sets the value for the given property.
 int size()
          returns the number of features within the collection
 Feature[] toArray()
          returns an array of all features
 java.lang.String toString()
           
 
Methods inherited from class org.deegree.model.feature.AbstractFeatureCollection
addAll, addAll, addAllUncontained, addAllUncontained, getDefaultGeometryPropertyValue, getDefaultProperty, getGeometryPropertyValues, getProperties, getProperties, getProperties, remove, setProperty
 
Methods inherited from class org.deegree.model.feature.AbstractFeature
getAttribute, getAttributes, getDescription, getId, getName, getOwner, resetBounds, setAttribute, setFeatureType, setId
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.deegree.model.feature.Feature
getAttribute, getAttributes, getDescription, getId, getName, getOwner, setAttribute, setFeatureType, setId
 

Constructor Detail

DefaultFeatureCollection

DefaultFeatureCollection(java.lang.String id,
                         int initialCapacity)

DefaultFeatureCollection

DefaultFeatureCollection(java.lang.String id,
                         Feature[] features)
constructor for initializing a feature collection with an id and an array of features.


DefaultFeatureCollection

DefaultFeatureCollection(java.lang.String id,
                         Feature[] features,
                         QualifiedName qName)
Constructor for initializing a feature collection with an id and an array of features. It's name will be taken from the given name.

Parameters:
id - of the feature collection
features - to be added
qName - of the feature collection, if null the default name of wfs:FeatureCollection will be given.
Method Detail

clear

public void clear()
Description copied from interface: FeatureCollection
removes all features from a collection

Specified by:
clear in interface FeatureCollection

getFeatureType

public FeatureType getFeatureType()
Description copied from class: AbstractFeature
returns the FeatureType of this Feature

Specified by:
getFeatureType in interface Feature
Overrides:
getFeatureType in class AbstractFeature
Returns:
the FeatureType of this Feature(Collection)

toArray

public Feature[] toArray()
returns an array of all features

Specified by:
toArray in interface FeatureCollection
Returns:
an array of all features

iterator

public java.util.Iterator<Feature> iterator()
returns an Iterator on the feature contained in a collection

Specified by:
iterator in interface FeatureCollection
Returns:
an Iterator on the feature contained in a collection

getFeature

public Feature getFeature(int index)
returns the feature that is assigned to the submitted index. If the submitted value for index is smaller 0 and larger then the number features within the featurecollection-1 an exeption will be thrown.

Specified by:
getFeature in interface FeatureCollection
Parameters:
index - of the feature.
Returns:
the feature at the submitted index

getFeature

public Feature getFeature(java.lang.String id)
Specified by:
getFeature in interface FeatureCollection
Parameters:
id - of the feature
Returns:
the feature that is assigned to the submitted id. If no valid feature could be found null will be returned.

remove

public Feature remove(Feature feature)
removes the submitted feature from the collection

Specified by:
remove in interface FeatureCollection
Parameters:
feature - to remove
Returns:
removed feature

remove

public Feature remove(int index)
removes a feature identified by its index from the feature collection. The removed feature will be returned. If the submitted value for index is smaller 0 and larger then the number features within the featurecollection-1 an ArrayIndexOutOfBoundsExcpetion will raise

Specified by:
remove in interface FeatureCollection
Parameters:
index - of the feature to remove.
Returns:
removed feature

add

public void add(Feature feature)
Appends a feature to the collection. If the submitted feature doesn't matches the feature type defined for all features within the collection an exception will be thrown.

Specified by:
add in interface FeatureCollection
Parameters:
feature - to add.

size

public int size()
returns the number of features within the collection

Specified by:
size in interface FeatureCollection
Returns:
the number of features within the collection

setProperty

public void setProperty(FeatureProperty property,
                        int index)
Description copied from interface: Feature
Sets the value for the given property. The index is needed to specify the occurences of the property that is to be replaced. Set to 0 for properties that may only occur once.

Specified by:
setProperty in interface Feature
Parameters:
property - property name and the property's new value
index - position of the property that is to be replaced

addProperty

public void addProperty(FeatureProperty property)
Description copied from interface: Feature
Adds the given property to the feature's properties. The position of the property is determined by the feature type. If the feature already has a property with this name, it is inserted behind it.

Specified by:
addProperty in interface Feature
Parameters:
property - property to insert

removeProperty

public void removeProperty(QualifiedName propertyName)
Description copied from interface: Feature
Removes the properties with the given name.

Specified by:
removeProperty in interface Feature
Parameters:
propertyName - name of the properties to remove

replaceProperty

public void replaceProperty(FeatureProperty oldProperty,
                            FeatureProperty newProperty)
Description copied from interface: Feature
Replaces the given property with a new one.

Specified by:
replaceProperty in interface Feature
Parameters:
oldProperty - property to be replaced
newProperty - new property

getBoundedBy

public Envelope getBoundedBy()
                      throws GeometryException
Description copied from class: AbstractFeature
Returns the envelope / boundingbox of the feature. The bounding box will be created in a recursion. That means if a property of the feature (a) contains another feature (b) the bounding box of b will be merged with the bounding box calculated from the geometry properties of a. A feature has no geometry properties and no properties that are features (and having a bounding box theirself) null will be returned.

Specified by:
getBoundedBy in interface Feature
Overrides:
getBoundedBy in class AbstractFeature
Returns:
the envelope / bounding box of the feature
Throws:
GeometryException

setEnvelopesUpdated

public void setEnvelopesUpdated()
Description copied from class: AbstractFeature
Signals that the envelopes of the geometry properties have been updated.

Specified by:
setEnvelopesUpdated in interface Feature
Overrides:
setEnvelopesUpdated in class AbstractFeature

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDefaultProperty

public FeatureProperty getDefaultProperty(PropertyPath path)
                                   throws PropertyPathResolvingException
Description copied from interface: Feature
Returns the property of the feature identified by the given PropertyPath. NOTE: Current implementation does not handle multiple properties (on the path) or index addressing in the path.

Specified by:
getDefaultProperty in interface Feature
Parameters:
path - the path of the property to look up
Returns:
the property of the feature identified by the given PropertyPath
Throws:
PropertyPathResolvingException
See Also:
PropertyPath

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Feature
Overrides:
clone in class AbstractFeature
Returns:
a shallow clone of a feature collection. Property values of contained features will not be cloned except for properties that are features (DefaultFeature) or feature collections (DefaultFeatureCollection).
Throws:
java.lang.CloneNotSupportedException

cloneDeep

public Feature cloneDeep()
                  throws java.lang.CloneNotSupportedException
Specified by:
cloneDeep in interface Feature
Returns:
a deep clone of a feature. All not simple properties (incl. geometries) will be cloned
Throws:
java.lang.CloneNotSupportedException

deegree 2.5 (2011/06/29 09:44 build-8-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org