|
deegree 2.5 (2011/06/29 09:44 build-8-official) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.deegree.graphics.legend.LegendElement
public class LegendElement
The implements 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.
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
| Field Summary | |
|---|---|
protected boolean |
active
A flag signaling if the legend is active initialized with false. |
protected java.awt.image.BufferedImage |
bi
The icon of the legend |
protected int |
bufferBetweenLegendAndLabel
The width in pixels between the legend and it's label initialized with 10; |
protected int |
height
The height of the legend element initialized with 0; |
protected java.lang.String |
label
The initial empty label. |
protected int |
labelPosition
The label position initialized with -1. |
protected double |
orientation
The orientation initialized with 0. |
protected java.util.ArrayList<Rule> |
ruleslist
the list of rules |
protected int |
width
The width of the legend element initialized with 0; |
| Constructor Summary | |
|---|---|
protected |
LegendElement()
empty constructor |
(package private) |
LegendElement(java.awt.image.BufferedImage legendImage)
|
(package private) |
LegendElement(Rule[] rules,
java.lang.String label,
double orientation,
int labelPosition,
boolean active,
int width,
int height)
constructor |
| Method Summary | |
|---|---|
void |
addRule(Rule rule)
adds a rule to the ArrayList ruleslist |
protected int[] |
calculateFontMetrics(java.lang.String label)
calculates the FontMetrics of the LegendLabel in pixels. |
protected void |
drawLineStringLegend(java.awt.Graphics2D g,
LineSymbolizer ls,
int width,
int height)
draws a legendsymbol, if the SLD defines a line |
protected void |
drawPointLegend(java.awt.Graphics g,
PointSymbolizer c,
int width,
int height)
draws a legendsymbol, if the SLD defines a point |
protected void |
drawPolygonLegend(java.awt.Graphics2D g,
PolygonSymbolizer ps,
int width,
int height)
draws a legendsymbol, if the SLD defines a polygon |
java.awt.image.BufferedImage |
exportAsImage(java.lang.String mime)
exports the LegendElement as BufferedImage |
int |
getBufferBetweenLegendAndLabel()
returns the buffer place between the legend symbol and the legend label in pixels |
int |
getHeight()
|
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. |
Rule[] |
getRules()
gets the Rules as an array |
int |
getWidth()
|
boolean |
isActive()
|
void |
setActive(boolean active)
activates or deactivates the label |
void |
setBufferBetweenLegendAndLabel(int i)
|
void |
setHeight(int height)
sets the height of the LegendSymbol (in pixels) |
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 labelPosition)
sets the placement of the label relative to the legend symbol. |
void |
setRules(Rule[] rules)
sets the rules |
void |
setWidth(int width)
sets the width of the LegendSymbol (in pixels) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.ArrayList<Rule> ruleslist
protected java.lang.String label
protected double orientation
protected int labelPosition
protected boolean active
protected int width
protected int height
protected int bufferBetweenLegendAndLabel
protected java.awt.image.BufferedImage bi
| Constructor Detail |
|---|
protected LegendElement()
LegendElement(java.awt.image.BufferedImage legendImage)
legendImage - the icon of the legend.
LegendElement(Rule[] rules,
java.lang.String label,
double orientation,
int labelPosition,
boolean active,
int width,
int height)
rules - the different rules from the SLDlabel - the label beneath the legend symbolorientation - the rotation of the text in the legendlabelPosition - the position of the text according to the symbolactive - whether the legendsymbol is active or notwidth - the requested width of the legend symbolheight - the requested height of the legend symbol| Method Detail |
|---|
public Rule[] getRules()
public void addRule(Rule rule)
rule - a sld rulepublic void setRules(Rule[] rules)
rules - an array of sld rulespublic void setLabel(java.lang.String label)
label - label of the LegendElementpublic java.lang.String getLabel()
public void setLabelOrientation(double orientation)
orientation - public double getLabelOrientation()
public void setLabelPlacement(int labelPosition)
+---+---+---+ | 1 | 0 | 2 | +---+---+---+ | 4 |LEG| 3 | +---+---+---+ | 7 | 5 | 6 | +---+---+---+An implementation of the interface may not supoort all positions.
labelPosition - public int getLabelPlacement()
public void setActive(boolean active)
active - public boolean isActive()
public void setWidth(int width)
width - public int getWidth()
public void setHeight(int height)
height - public int getHeight()
public int getBufferBetweenLegendAndLabel()
public void setBufferBetweenLegendAndLabel(int i)
i - the buffer as integer in pixelsgetBufferBetweenLegendAndLabel()
protected void drawPointLegend(java.awt.Graphics g,
PointSymbolizer c,
int width,
int height)
throws LegendException
g - the graphics contextc - the PointSymbolizer representing the drawable pointwidth - the requested width of the symbolheight - the requested height of the symbol
LegendException - is thrown, if the parsing of the sld failes.
protected void drawLineStringLegend(java.awt.Graphics2D g,
LineSymbolizer ls,
int width,
int height)
throws LegendException
g - the graphics contextls - the LineSymbolizer representing the drawable linewidth - the requested width of the symbolheight - the requested height of the symbol
LegendException - is thrown, if the parsing of the sld failes.
protected void drawPolygonLegend(java.awt.Graphics2D g,
PolygonSymbolizer ps,
int width,
int height)
throws LegendException
g - the graphics contextps - the PolygonSymbolizer representing the drawable polygonwidth - the requested width of the symbolheight - the requested height of the symbol
LegendException - if the parsing of the sld failes.protected int[] calculateFontMetrics(java.lang.String label)
label - the label of the LegendElement
public java.awt.image.BufferedImage exportAsImage(java.lang.String mime)
throws LegendException
mime -
LegendException
|
deegree 2.5 (2011/06/29 09:44 build-8-official) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org