deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.model.feature
Class DefaultFeature

java.lang.Object
  extended by org.deegree.model.feature.AbstractFeature
      extended by org.deegree.model.feature.DefaultFeature
All Implemented Interfaces:
Serializable, Feature

public class DefaultFeature
extends AbstractFeature
implements Serializable

Features are, according to the Abstract Specification, digital representations of real world entities. Feature Identity thus refers to mechanisms to identify such representations: not to identify the real world entities that are the subject of a representation. Thus two different representations of a real world entity (say the Mississippi River) will be two different features with distinct identities. Real world identification systems, such as title numbers, while possibly forming a sound basis for an implementation of a feature identity mechanism, are not of themselves such a mechanism.

Version:
$Revision: 20990 $ $Date: 2009-11-24 10:35:54 +0100 (Di, 24. Nov 2009) $
Author:
Andreas Poth, Markus Schneider, last edited by: $Author: mschneider $
See Also:
Serialized Form

Field Summary
protected  Geometry[] geometryPropertyValues
           
protected  FeatureProperty[] properties
           
protected  Map<QualifiedName,Object> propertyMap
           
protected  Object[] propertyValues
           
 
Fields inherited from class org.deegree.model.feature.AbstractFeature
description, envelope, envelopeCalculated, featureType, owner
 
Constructor Summary
protected DefaultFeature(String id, FeatureType featureType, FeatureProperty[] properties)
          Creates a new instance of DefaultFeature from the given parameters.
protected DefaultFeature(String id, FeatureType featureType, FeatureProperty[] properties, FeatureProperty owner)
          Creates a new instance of DefaultFeature from the given parameters.
 
Method Summary
 void addProperty(FeatureProperty property)
          Adds the given property to the feature's properties.
 Object clone()
           
 Feature cloneDeep()
           
 Geometry getDefaultGeometryPropertyValue()
          Returns the value of the default geometry property of the feature.
 FeatureProperty getDefaultProperty(PropertyPath path)
          Returns the property of the feature identified by the given PropertyPath in their original order.
 FeatureProperty getDefaultProperty(QualifiedName name)
          Returns the first property of the feature with the given name.
 Geometry[] getGeometryPropertyValues()
          Returns the values of all geometry properties of the feature.
 FeatureProperty[] getProperties()
          Returns all properties of the feature in their original order.
 FeatureProperty[] getProperties(int index)
          Deprecated.  
 FeatureProperty[] getProperties(QualifiedName name)
          Returns the properties of the feature with the given name in their original order.
 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 setProperty(FeatureProperty property, int index)
          Sets the value for the given property.
 String toString()
           
 void validate()
          TODO type checks!
 
Methods inherited from class org.deegree.model.feature.AbstractFeature
getAttribute, getAttributes, getBoundedBy, getDescription, getFeatureType, getId, getName, getOwner, resetBounds, setAttribute, setEnvelopesUpdated, setFeatureType, setId
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

propertyMap

protected Map<QualifiedName,Object> propertyMap

properties

protected FeatureProperty[] properties

propertyValues

protected Object[] propertyValues

geometryPropertyValues

protected Geometry[] geometryPropertyValues
Constructor Detail

DefaultFeature

protected DefaultFeature(String id,
                         FeatureType featureType,
                         FeatureProperty[] properties)
Creates a new instance of DefaultFeature from the given parameters.

Parameters:
id -
featureType -
properties - properties of the new feature, given in their intended order

DefaultFeature

protected DefaultFeature(String id,
                         FeatureType featureType,
                         FeatureProperty[] properties,
                         FeatureProperty owner)
Creates a new instance of DefaultFeature from the given parameters.

Parameters:
id -
featureType -
properties - properties of the new feature, given in their intended order
owner -
Method Detail

validate

public void validate()
              throws FeatureException
TODO type checks!

Throws:
FeatureException

getProperties

public FeatureProperty[] getProperties()
Returns all properties of the feature in their original order.

Specified by:
getProperties in interface Feature
Returns:
all properties of the feature

getProperties

public FeatureProperty[] getProperties(QualifiedName name)
Returns the properties of the feature with the given name in their original order.

Specified by:
getProperties in interface Feature
Parameters:
name - name of the properties to look up
Returns:
the properties of the feature with the given name or null if the feature has no property with that name

getDefaultProperty

public FeatureProperty getDefaultProperty(PropertyPath path)
                                   throws PropertyPathResolvingException
Returns the property of the feature identified by the given PropertyPath in their original order. 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 properties of the feature identified by the given PropertyPath or null if the feature has no such properties
Throws:
PropertyPathResolvingException
See Also:
PropertyPath

getDefaultProperty

public FeatureProperty getDefaultProperty(QualifiedName name)
Returns the first property of the feature with the given name.

Specified by:
getDefaultProperty in interface Feature
Parameters:
name - name of the property to look up
Returns:
the first property of the feature with the given name or null if the feature has no such property

getProperties

@Deprecated
public FeatureProperty[] getProperties(int index)
Deprecated. 

Returns the properties of the feature at the submitted index of the feature type definition.

Specified by:
getProperties in interface Feature
Parameters:
index - index of the properties to look up
Returns:
the properties of the feature at the submitted index

getGeometryPropertyValues

public Geometry[] getGeometryPropertyValues()
Returns the values of all geometry properties of the feature.

Specified by:
getGeometryPropertyValues in interface Feature
Returns:
the values of all geometry properties of the feature, or a zero-length array if the feature has no geometry properties

getDefaultGeometryPropertyValue

public Geometry getDefaultGeometryPropertyValue()
Returns the value of the default geometry property of the feature. If the feature has no geometry property, this is a Point at the coordinates (0,0).

Specified by:
getDefaultGeometryPropertyValue in interface Feature
Returns:
default geometry or Point at (0,0) if feature has no geometry

setProperty

public void setProperty(FeatureProperty property,
                        int index)
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)
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 properties with this name, the new one is inserted directly behind them.

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

removeProperty

public void removeProperty(QualifiedName propertyName)
Removes the properties with the given name.

Specified by:
removeProperty in interface Feature
Parameters:
propertyName - name of the (possibly multiple) property to remove

replaceProperty

public void replaceProperty(FeatureProperty oldProperty,
                            FeatureProperty newProperty)
Replaces the given property with a new one.

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

clone

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

cloneDeep

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

toString

public String toString()
Overrides:
toString in class Object

deegree 2.3 (2010/04/09 10:10 build-4-official)

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