org.deegree.feature
Class AbstractFeature

java.lang.Object
  extended by org.deegree.feature.AbstractFeature
All Implemented Interfaces:
GMLObject, Object, TypedObjectNode, Feature
Direct Known Subclasses:
AbstractFeatureCollection, GenericFeature

public abstract class AbstractFeature
extends Object
implements Feature

Abstract base class for common Feature implementations.

Version:
$Revision:$, $Date:$
Author:
Markus Schneider , last edited by: $Author:$

Field Summary
protected  String fid
          Feature id
protected  FeatureType ft
          Feature type
protected  StandardGMLFeatureProps standardProps
          Default GML properties that every GML feature allows for (gml:name, gml:description, ...).
 
Constructor Summary
protected AbstractFeature(String fid, FeatureType ft, ExtraProps extraProps)
          Creates a new AbstractFeature instance.
 
Method Summary
protected  Envelope calcEnvelope()
          Helper method for calculating the envelope of a feature.
 Envelope getEnvelope()
          Returns the envelope of the feature.
 ExtraProps getExtraProperties()
          Returns the extra properties associated with the feature.
 StandardGMLFeatureProps getGMLProperties()
          Returns the standard GML properties (e.g.
 String getId()
          Returns the id of the feature.
 QName getName()
          Returns the name of the feature.
 Property[] getProperties(GMLVersion version)
          Returns all properties in order, including standard GML properties.
 Property[] getProperties(QName propName, GMLVersion version)
          Returns the properties with the given name, in order.
 Property getProperty(QName propName, GMLVersion version)
          Returns the property with the given name.
 FeatureType getType()
          Returns the type information for this feature.
 void setExtraProperties(ExtraProps extraProps)
           
 void setId(String fid)
          Sets the id of the feature.
 void setProperties(List<Property> props, GMLVersion version)
          Called during construction to initialize the properties of the feature.
 void setPropertyValue(QName propName, int occurence, TypedObjectNode value, GMLVersion version)
          Sets the value of a specific occurrence of a property with a given name (or removes the property from the feature).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.deegree.feature.Feature
getGeometryProperties, getProperties, getProperties, getProperty, setProperties, setPropertyValue
 

Field Detail

fid

protected String fid
Feature id


ft

protected final FeatureType ft
Feature type


standardProps

protected StandardGMLFeatureProps standardProps
Default GML properties that every GML feature allows for (gml:name, gml:description, ...).

Constructor Detail

AbstractFeature

protected AbstractFeature(String fid,
                          FeatureType ft,
                          ExtraProps extraProps)
Creates a new AbstractFeature instance.

Parameters:
fid - feature id or null if the feature is anonymous (discouraged for most use cases)
ft - feature type, must not be null
extraProps - extra properties, may be null
Method Detail

getId

public String getId()
Description copied from interface: Feature
Returns the id of the feature.

In a GML representation of the feature, this corresponds to the gml:id (GML 3 and later) or fid (GML 2) attribute of the feature element.

Specified by:
getId in interface Object
Specified by:
getId in interface Feature
Returns:
the id of the feature, may be null

setId

public void setId(String fid)
Description copied from interface: Feature
Sets the id of the feature.

In a GML representation of the feature, this corresponds to the gml:id (GML 3 and later) or fid (GML 2) attribute of the feature element.

Specified by:
setId in interface Feature
Parameters:
fid - the id of the feature instance, may be null

getName

public QName getName()
Description copied from interface: Feature
Returns the name of the feature.

In a GML representation of the feature, this corresponds to the feature element's name.

Specified by:
getName in interface Feature
Returns:
the name of the feature instance, never null

getType

public FeatureType getType()
Description copied from interface: Feature
Returns the type information for this feature.

Specified by:
getType in interface Feature
Returns:
the type information, never null

getGMLProperties

public StandardGMLFeatureProps getGMLProperties()
Description copied from interface: GMLObject
Returns the standard GML properties (e.g. gml:name).

Specified by:
getGMLProperties in interface GMLObject
Specified by:
getGMLProperties in interface Feature
Returns:
the standard GML properties, may be

getEnvelope

public Envelope getEnvelope()
Description copied from interface: Feature
Returns the envelope of the feature.

Specified by:
getEnvelope in interface Feature
Returns:
the envelope of the feature, or null if the feature has no envelope information / geometry properties

calcEnvelope

protected Envelope calcEnvelope()
Helper method for calculating the envelope of a feature.

Returns:
envelope of all geometry properties of the feature

getProperties

public Property[] getProperties(GMLVersion version)
Description copied from interface: Feature
Returns all properties in order, including standard GML properties.

Specified by:
getProperties in interface Feature
Parameters:
version - determines the names and types of the standard GML properties, must not be null
Returns:
all properties, including standard GML properties, may be empty, but never null

getProperties

public Property[] getProperties(QName propName,
                                GMLVersion version)
Description copied from interface: Feature
Returns the properties with the given name, in order.

Specified by:
getProperties in interface Feature
Parameters:
propName - name of the requested properties
version - determines the names and types of the standard GML properties, must not be null
Returns:
the properties with the given name, in order, may be empty, but never null

getProperty

public Property getProperty(QName propName,
                            GMLVersion version)
Description copied from interface: Feature
Returns the property with the given name.

Specified by:
getProperty in interface Feature
Parameters:
propName - name of the requested property
version - determines the names and types of the standard GML properties, must not be null
Returns:
the property with the given name

setProperties

public void setProperties(List<Property> props,
                          GMLVersion version)
                   throws IllegalArgumentException
Description copied from interface: Feature
Called during construction to initialize the properties of the feature.

Specified by:
setProperties in interface Feature
version - determines the names and types of the standard GML properties, must not be null
Throws:
IllegalArgumentException - if the property names or values are not compatible with the feature type

setPropertyValue

public void setPropertyValue(QName propName,
                             int occurence,
                             TypedObjectNode value,
                             GMLVersion version)
Description copied from interface: Feature
Sets the value of a specific occurrence of a property with a given name (or removes the property from the feature).

Specified by:
setPropertyValue in interface Feature
Parameters:
propName - property name
occurence - index of the property, starting with zero. If the property is not a multi-property (i.e. maxOccurs=1), this is always zero.
value - new value of the property or null (removes the property)
version - determines the names and types of the standard GML properties, must not be null

getExtraProperties

public ExtraProps getExtraProperties()
Description copied from interface: Feature
Returns the extra properties associated with the feature.

These properties are not defined by the FeatureType, but provide a generic way to attach information to the Feature (e.g. rendering hints).

Specified by:
getExtraProperties in interface Feature
Returns:
extra properties, may be null

setExtraProperties

public void setExtraProperties(ExtraProps extraProps)
Specified by:
setExtraProperties in interface Feature


Copyright © 2011. All Rights Reserved.