org.deegree_impl.graphics.displayelements
Class LabelDisplayElement_Impl

java.lang.Object
  extended byorg.deegree_impl.graphics.displayelements.DisplayElement_Impl
      extended byorg.deegree_impl.graphics.displayelements.GeometryDisplayElement_Impl
          extended byorg.deegree_impl.graphics.displayelements.LabelDisplayElement_Impl
All Implemented Interfaces:
DisplayElement, GeometryDisplayElement, LabelDisplayElement, java.io.Serializable

public class LabelDisplayElement_Impl
extends GeometryDisplayElement_Impl
implements LabelDisplayElement, java.io.Serializable

DisplayElement that encapsulates a GM_Object (geometry), a ParameterValueType (caption) and a TextSymbolizer (style).

The graphical (say: screen) representations of this DisplayElement are Label-instances. These are generated either when the paint-method is called or assigned externally using the setLabels- or addLabels-methods.

Version:
$Revision: 1.21 $ $Date: 2004/02/09 07:59:41 $
Author:
Andreas Poth, Markus Schneider
See Also:
Serialized Form

Field Summary
protected  Feature feature
           
protected  GM_Object geometry
           
protected  Symbolizer highlightSymbolizer
           
private  ParameterValueType label
           
private  java.util.ArrayList labels
           
protected  java.lang.Object placement
           
protected  Symbolizer selectedSymbolizer
           
private static long serialVersionUID
          Use serialVersionUID for interoperability.
protected  Symbolizer symbolizer
           
 
Constructor Summary
(package private) LabelDisplayElement_Impl(Feature feature, GM_Object geometry, TextSymbolizer symbolizer)
          Creates a new LabelDisplayElement_Impl object.
 
Method Summary
 void addLabel(Label label)
          Adds a Label representation that is to be considered when the LabelDisplayElement is painted to the view.
 void addLabels(Label[] labels)
          Adds Label representations that are to be considered when the LabelDisplayElement is painted to the view.
 void clearLabels()
          Removes all Label representations for this LabelDisplayElement.
 boolean doesScaleConstraintApply(double scale)
          Returns whether the DisplayElement should be painted at the current scale or not.
 java.lang.String getAssociateFeatureId()
          returns the id of the feature that's associated with the DisplayElement
 Feature getFeature()
          Returns the associated Feature.
 GM_Object getGeometry()
          returns the geometry that determines the position the DisplayElement will be rendered to
 Symbolizer getHighlightSymbolizer()
          returns the symbolizer that determines how the geometry will be rendered if it's highlighted
 ParameterValueType getLabel()
          Returns the caption of the label as ParameterValueType.
 Symbolizer getSelectedSymbolizer()
          returns the symbolizer that determines how the geometry will be rendered if it's selected
 Symbolizer getSymbolizer()
          Returns the symbolizer that determines how the geometry will be rendered.
 boolean isHighlighted()
          returns if the DisplayElement is highlighted or not.
 boolean isSelected()
          returns if the DisplayElement is selected or not
 void paint(java.awt.Graphics g, GeoTransform projection)
          Renders the DisplayElement to the submitted graphic context.
 void setGeometry(GM_Object geometry)
          sets the geometry that determines the position the DisplayElement will be rendered to
 void setHighlighted(boolean highlighted)
          marks the DisplayElement as highlighted or not
 void setHighlightSymbolizer(Symbolizer rule)
          sets the rule that determines how the geometry will be rendered when it's highlighted
 void setLabel(ParameterValueType label)
          Sets the caption of the label.
 void setLabels(Label[] labels)
          Sets the Label representations that are to be considered when the LabelDisplayElement is painted to the view.
 void setPlacement(java.lang.Object o)
          Overwrites the default placement of the DisplayElement.
 void setSelected(boolean selected)
          marks a DisplayElement as selected or not
 void setSelectedSymbolizer(Symbolizer rule)
          sets the rule that determines how the geometry will be rendered when it's selected
 void setSymbolizer(Symbolizer symbolizer)
          sets the rules that determines how the geometry will be rendered
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.deegree.graphics.displayelements.GeometryDisplayElement
getGeometry, getHighlightSymbolizer, getSelectedSymbolizer, getSymbolizer, setGeometry, setHighlightSymbolizer, setPlacement, setSelectedSymbolizer, setSymbolizer
 
Methods inherited from interface org.deegree.graphics.displayelements.DisplayElement
getAssociateFeatureId, getFeature, isHighlighted, isSelected, setHighlighted, setSelected
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Use serialVersionUID for interoperability.

See Also:
Constant Field Values

label

private ParameterValueType label

labels

private java.util.ArrayList labels

geometry

protected GM_Object geometry

symbolizer

protected Symbolizer symbolizer

highlightSymbolizer

protected Symbolizer highlightSymbolizer

selectedSymbolizer

protected Symbolizer selectedSymbolizer

placement

protected java.lang.Object placement

feature

protected Feature feature
Constructor Detail

LabelDisplayElement_Impl

LabelDisplayElement_Impl(Feature feature,
                         GM_Object geometry,
                         TextSymbolizer symbolizer)
Creates a new LabelDisplayElement_Impl object.

Parameters:
feature - associated Feature
geometry - associated GM_Object
symbolizer - associated TextSymbolizer
Method Detail

setLabel

public void setLabel(ParameterValueType label)
Sets the caption of the label.

Specified by:
setLabel in interface LabelDisplayElement

getLabel

public ParameterValueType getLabel()
Returns the caption of the label as ParameterValueType.

Specified by:
getLabel in interface LabelDisplayElement

paint

public void paint(java.awt.Graphics g,
                  GeoTransform projection)
Renders the DisplayElement to the submitted graphic context. If the Label-represenations have been assigned externally, these labels are used, else Label-instances are created automatically using the LabelFactory.

Specified by:
paint in interface DisplayElement
Specified by:
paint in class DisplayElement_Impl
Parameters:
g - Graphics context to be used
projection - GeoTransform to be used

doesScaleConstraintApply

public boolean doesScaleConstraintApply(double scale)
Returns whether the DisplayElement should be painted at the current scale or not.

Specified by:
doesScaleConstraintApply in interface DisplayElement
Overrides:
doesScaleConstraintApply in class GeometryDisplayElement_Impl

clearLabels

public void clearLabels()
Removes all Label representations for this LabelDisplayElement.

Specified by:
clearLabels in interface LabelDisplayElement

addLabel

public void addLabel(Label label)
Adds a Label representation that is to be considered when the LabelDisplayElement is painted to the view.

Specified by:
addLabel in interface LabelDisplayElement

addLabels

public void addLabels(Label[] labels)
Adds Label representations that are to be considered when the LabelDisplayElement is painted to the view.

Specified by:
addLabels in interface LabelDisplayElement

setLabels

public void setLabels(Label[] labels)
Sets the Label representations that are to be considered when the LabelDisplayElement is painted to the view.

Specified by:
setLabels in interface LabelDisplayElement

setPlacement

public void setPlacement(java.lang.Object o)
Overwrites the default placement of the DisplayElement. This method is used by the PlacementOptimizer to minimize the overlapping of labels, for example.

Specified by:
setPlacement in interface GeometryDisplayElement
Parameters:
o - the placement to be used

setGeometry

public void setGeometry(GM_Object geometry)
sets the geometry that determines the position the DisplayElement will be rendered to

Specified by:
setGeometry in interface GeometryDisplayElement

getGeometry

public GM_Object getGeometry()
returns the geometry that determines the position the DisplayElement will be rendered to

Specified by:
getGeometry in interface GeometryDisplayElement

setSymbolizer

public void setSymbolizer(Symbolizer symbolizer)
sets the rules that determines how the geometry will be rendered

Specified by:
setSymbolizer in interface GeometryDisplayElement
Parameters:
symbolizer - symbolizer defining rendering style

getSymbolizer

public Symbolizer getSymbolizer()
Returns the symbolizer that determines how the geometry will be rendered.

Specified by:
getSymbolizer in interface GeometryDisplayElement

setHighlightSymbolizer

public void setHighlightSymbolizer(Symbolizer rule)
sets the rule that determines how the geometry will be rendered when it's highlighted

Specified by:
setHighlightSymbolizer in interface GeometryDisplayElement
Parameters:
rule - symbolizer defining rendering style

getHighlightSymbolizer

public Symbolizer getHighlightSymbolizer()
returns the symbolizer that determines how the geometry will be rendered if it's highlighted

Specified by:
getHighlightSymbolizer in interface GeometryDisplayElement

setSelectedSymbolizer

public void setSelectedSymbolizer(Symbolizer rule)
sets the rule that determines how the geometry will be rendered when it's selected

Specified by:
setSelectedSymbolizer in interface GeometryDisplayElement
Parameters:
rule - symbolizer defining rendering style

getSelectedSymbolizer

public Symbolizer getSelectedSymbolizer()
returns the symbolizer that determines how the geometry will be rendered if it's selected

Specified by:
getSelectedSymbolizer in interface GeometryDisplayElement

getFeature

public Feature getFeature()
Returns the associated Feature.

Specified by:
getFeature in interface DisplayElement

getAssociateFeatureId

public java.lang.String getAssociateFeatureId()
returns the id of the feature that's associated with the DisplayElement

Specified by:
getAssociateFeatureId in interface DisplayElement

setSelected

public void setSelected(boolean selected)
marks a DisplayElement as selected or not

Specified by:
setSelected in interface DisplayElement

isSelected

public boolean isSelected()
returns if the DisplayElement is selected or not

Specified by:
isSelected in interface DisplayElement

setHighlighted

public void setHighlighted(boolean highlighted)
marks the DisplayElement as highlighted or not

Specified by:
setHighlighted in interface DisplayElement

isHighlighted

public boolean isHighlighted()
returns if the DisplayElement is highlighted or not.

Specified by:
isHighlighted in interface DisplayElement