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

org.deegree.graphics.displayelements
Class ScaledFeature

java.lang.Object
  extended by org.deegree.graphics.displayelements.ScaledFeature
All Implemented Interfaces:
Feature

public class ScaledFeature
extends java.lang.Object
implements Feature

This class is a wrapper for a Feature and a Feature itself.

It adds a special behavior/property to a feature that is required by deegree DisplayElements. This special behavior is an additional property named "$SCALE". In opposite to conventional properties this one can change its value during lifetime of a feature without changing the underlying feature itself.
The class is use to offer users the opportunity to use the scale of a map within expressions embedded in SLD rules/symbolizers, i.e. this enables a user to define that a symbol shall appear in 10m size independ of a map's scale.

Version:
$Revision: 27102 $, $Date: 2010-09-30 14:16:00 +0200 (Do, 30 Sep 2010) $
Author:
Andreas Poth, last edited by: $Author: apoth $

Constructor Summary
ScaledFeature(Feature feature, double scale)
           
 
Method Summary
 void addProperty(FeatureProperty property)
          Adds the given property to the feature's properties.
 java.lang.Object clone()
           
 Feature cloneDeep()
           
 java.lang.String getAttribute(java.lang.String name)
          Returns the attribute value of the attribute with the specified name.
 java.util.Map<java.lang.String,java.lang.String> getAttributes()
          Returns all attributes of the feature.
 Envelope getBoundedBy()
          Returns the envelope / bounding box of the feature.
 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.
 FeatureProperty getDefaultProperty(QualifiedName name)
          use '$SCALE' to access the scale property value
 java.lang.String getDescription()
          Returns the description of the feature.
 FeatureType getFeatureType()
          Returns the feature type of this feature.
 Geometry[] getGeometryPropertyValues()
          Returns the values of all geometry properties of the feature.
 java.lang.String getId()
          Returns the id of the feature.
 QualifiedName getName()
          Returns the qualified name of the feature.
 FeatureProperty getOwner()
          Returns the owner of the feature.
 FeatureProperty[] getProperties()
          Returns all properties of the feature in their original order.
 FeatureProperty[] getProperties(int index)
          The property '$SCALE' has the highest valid index
 FeatureProperty[] getProperties(QualifiedName name)
          Returns the properties of the feature with the given name in their original order.
 double getScale()
          returns the features scale
 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 setAttribute(java.lang.String name, java.lang.String value)
          Sets the value of the attribute with the given name.
 void setEnvelopesUpdated()
          Signals that the envelopes of the geometry properties have been updated.
 void setFeatureType(FeatureType ft)
          Sets the feature type of this feature.
 void setId(java.lang.String fid)
          Sets the id of the feature.
 void setProperty(FeatureProperty property, int index)
          Sets the value for the given property.
 void setScale(double scale)
          sets the features scale.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScaledFeature

public ScaledFeature(Feature feature,
                     double scale)
Parameters:
feature - feature wrap
scale - maps scale (should be -1 if not known)
Method Detail

getOwner

public FeatureProperty getOwner()
Description copied from interface: Feature
Returns the owner of the feature. This is the feature property that has this feature as value or null if this feature is a root feature.

Specified by:
getOwner in interface Feature
Returns:
features owner

getDescription

public java.lang.String getDescription()
Description copied from interface: Feature
Returns the description of the feature.

Specified by:
getDescription in interface Feature
Returns:
feature description

getName

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

Specified by:
getName in interface Feature
Returns:
features name

getDefaultGeometryPropertyValue

public Geometry getDefaultGeometryPropertyValue()
Description copied from interface: Feature
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
See Also:
Feature.getDefaultGeometryPropertyValue()

getBoundedBy

public Envelope getBoundedBy()
                      throws GeometryException
Description copied from interface: Feature
Returns the envelope / bounding box of the feature.

Specified by:
getBoundedBy in interface Feature
Returns:
features envelope
Throws:
GeometryException

getFeatureType

public FeatureType getFeatureType()
Description copied from interface: Feature
Returns the feature type of this feature.

Specified by:
getFeatureType in interface Feature
Returns:
the feature type of this feature
See Also:
the returned feature type contains all properties of the wrapped feature plus a property named '$SCALE'

getGeometryPropertyValues

public Geometry[] getGeometryPropertyValues()
Description copied from interface: Feature
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
See Also:
Feature.getGeometryPropertyValues()

getId

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

Specified by:
getId in interface Feature
Returns:
the id of the feature
See Also:
Feature.getId()

getProperties

public FeatureProperty[] getProperties()
Description copied from interface: Feature
Returns all properties of the feature in their original order.

Specified by:
getProperties in interface Feature
Returns:
all properties of the feature
See Also:
the returned array contains all properties of the wrapped feature plus a property named '$SCALE'

getProperties

public FeatureProperty[] getProperties(int index)
The property '$SCALE' has the highest valid index

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

getDefaultProperty

public FeatureProperty getDefaultProperty(QualifiedName name)
use '$SCALE' to access the scale property value

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

public FeatureProperty[] getProperties(QualifiedName name)
Description copied from interface: Feature
Returns the properties of the feature with the given name in their original order.

Specified by:
getProperties in interface Feature
Parameters:
name -
Returns:
property array

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 -
Returns:
property
Throws:
PropertyPathResolvingException
See Also:
PropertyPath

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

setScale

public void setScale(double scale)
sets the features scale. Expected is the scale denominator as defined by OGC SLD specification

Parameters:
scale -

getScale

public double getScale()
returns the features scale

Returns:
the features scale

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 -

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 -

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 -
newProperty -

setId

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

Specified by:
setId in interface Feature
Parameters:
fid -

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Returns the attribute value of the attribute with the specified name.

Specified by:
getAttribute in interface Feature
Parameters:
name - name of the attribute
Returns:
the attribute value

getAttributes

public java.util.Map<java.lang.String,java.lang.String> getAttributes()
Returns all attributes of the feature.

Specified by:
getAttributes in interface Feature
Returns:
all attributes, keys are names, values are attribute values

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
Sets the value of the attribute with the given name.

Specified by:
setAttribute in interface Feature
Parameters:
name - name of the attribute
value - value to set

setFeatureType

public void setFeatureType(FeatureType ft)
Sets the feature type of this feature.

Specified by:
setFeatureType in interface Feature
Parameters:
ft - feature type to set

setEnvelopesUpdated

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

Specified by:
setEnvelopesUpdated in interface Feature

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

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Feature
Overrides:
clone in class java.lang.Object
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

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