deegree 2.5 (2011/06/29 09:44 build-8-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:
java.io.Serializable, Feature

public class DefaultFeature
extends AbstractFeature
implements java.io.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: 29072 $ $Date: 2011-01-06 10:35:49 +0100 (Do, 06 Jan 2011) $
Author:
Andreas Poth, Markus Schneider, last edited by: $Author: apoth $
See Also:
Serialized Form

Field Summary
protected  Geometry[] geometryPropertyValues
           
protected  FeatureProperty[] properties
           
protected  java.util.Map<QualifiedName,java.lang.Object> propertyMap
           
protected  java.lang.Object[] propertyValues
           
 
Fields inherited from class org.deegree.model.feature.AbstractFeature
description, envelope, envelopeCalculated, featureType, owner
 
Constructor Summary
protected DefaultFeature(java.lang.String id, FeatureType featureType, FeatureProperty[] properties)
          Creates a new instance of DefaultFeature from the given parameters.
protected DefaultFeature(java.lang.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.
 java.lang.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.
 java.lang.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 java.util.Map<QualifiedName,java.lang.Object> propertyMap

properties

protected FeatureProperty[] properties

propertyValues

protected java.lang.Object[] propertyValues

geometryPropertyValues

protected Geometry[] geometryPropertyValues
Constructor Detail

DefaultFeature

protected DefaultFeature(java.lang.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(java.lang.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 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. Property values 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

toString

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

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