org.deegree.graphics.legend
Interface LegendElement

All Known Subinterfaces:
LegendElementCollection
All Known Implementing Classes:
LegendElement_Impl, LegendElementCollection_Impl

public interface LegendElement

The interface describes the basic legend element. a legend element may has a label that can be set to eight positions relative to the legend graphic. A LegendElement can be activated or deactivated. It depends on the using application what effect this behavior will have. It depends on implementing classes how a LegendElement is realized. E.g. as 'simple' image or maybe as composition of Components.

LegendElements can be collected in a LegendElementCollection which also is a LegendElement to group elements or to create more complex elements.

Each LegendElement is able to paint itself as BufferedImage

Version:
$Revision: 1.5 $ $Date: 2004/04/27 15:40:15 $
Author:
Andreas Poth

Field Summary
static int LP_BOTTOMCENTER
           
static int LP_BOTTOMLEFT
           
static int LP_BOTTOMRIGHT
           
static int LP_LEFT
           
static int LP_NOLABEL
           
static int LP_RIGHT
           
static int LP_TOPCENTER
           
static int LP_TOPLEFT
           
static int LP_TOPRIGHT
           
 
Method Summary
 java.awt.image.BufferedImage exportAsImage()
          exports the LegendElement as BufferedImage
 java.lang.String getLabel()
          returns the label set to LegendElement.
 double getLabelOrientation()
          returns the current orientation of the label of the LegendElement in radians.
 int getLabelPlacement()
          returns the placement of the label relative to the legend symbol.
 void setActive(boolean active)
          activates or deactivates the label
 void setLabel(java.lang.String label)
          sets the label of the LegendElement
 void setLabelOrientation(double orientation)
          sets the orientation of the label of the LegendElement.
 void setLabelPlacement(int lablePosition)
          sets the placement of the label relative to the legend symbol.
 

Field Detail

LP_NOLABEL

public static final int LP_NOLABEL
See Also:
Constant Field Values

LP_TOPCENTER

public static final int LP_TOPCENTER
See Also:
Constant Field Values

LP_TOPLEFT

public static final int LP_TOPLEFT
See Also:
Constant Field Values

LP_TOPRIGHT

public static final int LP_TOPRIGHT
See Also:
Constant Field Values

LP_RIGHT

public static final int LP_RIGHT
See Also:
Constant Field Values

LP_LEFT

public static final int LP_LEFT
See Also:
Constant Field Values

LP_BOTTOMCENTER

public static final int LP_BOTTOMCENTER
See Also:
Constant Field Values

LP_BOTTOMRIGHT

public static final int LP_BOTTOMRIGHT
See Also:
Constant Field Values

LP_BOTTOMLEFT

public static final int LP_BOTTOMLEFT
See Also:
Constant Field Values
Method Detail

setLabel

public void setLabel(java.lang.String label)
sets the label of the LegendElement

Parameters:
label - label of the LegendElement

getLabel

public java.lang.String getLabel()
returns the label set to LegendElement. If no label is set, the method returns null

Returns:
label of the LegendElement or null

setLabelOrientation

public void setLabelOrientation(double orientation)
sets the orientation of the label of the LegendElement. A label can have an orientation from -90° to 90° expressed in radians, where 0° is horizontal

Parameters:
orientation -

getLabelOrientation

public double getLabelOrientation()
returns the current orientation of the label of the LegendElement in radians. If the element hasn't a label Double.NEGATIVE_INFINITY will be returned.

Returns:
orientation of the label of the LegendElement in radians

setLabelPlacement

public void setLabelPlacement(int lablePosition)
sets the placement of the label relative to the legend symbol. Possible values are:
       +---+---+---+
       | 1 | 0 | 2 |
       +---+---+---+
       | 4 |LEG| 3 |
       +---+---+---+
       | 7 | 5 | 6 |
       +---+---+---+
     
An implementation of the interface may not supoort all positions.

Parameters:
lablePosition -

getLabelPlacement

public int getLabelPlacement()
returns the placement of the label relative to the legend symbol. If the element hasn't a label LegendElement.LP_NOLABEL will be returned. Otherwise possible values are:

Returns:
coded placement of the label relative to the legend symbol

setActive

public void setActive(boolean active)
activates or deactivates the label

Parameters:
active -

exportAsImage

public java.awt.image.BufferedImage exportAsImage()
                                           throws LegendException
exports the LegendElement as BufferedImage

Returns:
Throws:
LegendException