org.geotools.renderer.j2d
Class RenderedLegend

java.lang.Object
  extended byorg.geotools.renderer.j2d.RenderedLayer
      extended byorg.geotools.renderer.j2d.RenderedLegend
Direct Known Subclasses:
RenderedMapScale

public class RenderedLegend
extends RenderedLayer

Base class for legends painted at fixed location in the widget area. Contrary to others kinds of layers, legends location are not zoom-dependent. The legend location is specified by two quantities: a compass-direction relative to widget's bounds (for example North-East) and a margin in dots (or pixels) to keep between the legend and widget's borders.

Version:
$Id: RenderedLegend.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux

Field Summary
 
Fields inherited from class org.geotools.renderer.j2d.RenderedLayer
listeners
 
Constructor Summary
RenderedLegend()
          Construct a new legend located in the upper left corner (LegendPosition.NORTH_WEST).
RenderedLegend(java.lang.String text)
          Construct a new legend with the specified text.
 
Method Summary
 java.awt.Insets getInsets()
          Returns the space in pixels between the legend and the painting area's bounds.
 java.awt.Insets getMargin()
          Deprecated. Use getInsets() instead.
 LegendPosition getPosition()
          Returns the legend position.
 java.lang.String getText()
          Returns the legend text, or null if none.
protected  void paint(RenderingContext context)
          Paint the text in the legend area.
 void setInsets(java.awt.Insets insets)
          Set the space in pixels between the legend and the painting area's bounds.
 void setMargin(java.awt.Insets insets)
          Deprecated. Use setInsets(java.awt.Insets) instead.
 void setPosition(LegendPosition position)
          Set the legend position.
 void setText(java.lang.String text)
          Set the legend text.
 
Methods inherited from class org.geotools.renderer.j2d.RenderedLayer
addPropertyChangeListener, addPropertyChangeListener, dispose, getAction, getCoordinateSystem, getLocale, getName, getPreferredArea, getPreferredPixelSize, getRenderer, getToolTipText, getTreeLock, getZOrder, isVisible, prefetch, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, setCoordinateSystem, setPreferredArea, setPreferredPixelSize, setVisible, setZOrder, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RenderedLegend

public RenderedLegend()
Construct a new legend located in the upper left corner (LegendPosition.NORTH_WEST). The space between legend and widget's bounds default to 15 pixels.


RenderedLegend

public RenderedLegend(java.lang.String text)
Construct a new legend with the specified text. By default, the legend is located in the upper left corner (LegendPosition.NORTH_WEST). The space between legend and widget's bounds default to 15 pixels.

Parameters:
text - The legend text, or null if none.
Method Detail

getText

public java.lang.String getText()
Returns the legend text, or null if none.


setText

public void setText(java.lang.String text)
Set the legend text.

Parameters:
text - The new legend text, or null if none.

getPosition

public LegendPosition getPosition()
Returns the legend position.


setPosition

public void setPosition(LegendPosition position)
Set the legend position. This position is relative to the painting area's bounds.


getMargin

public java.awt.Insets getMargin()
Deprecated. Use getInsets() instead.


setMargin

public void setMargin(java.awt.Insets insets)
Deprecated. Use setInsets(java.awt.Insets) instead.


getInsets

public java.awt.Insets getInsets()
Returns the space in pixels between the legend and the painting area's bounds.


setInsets

public void setInsets(java.awt.Insets insets)
Set the space in pixels between the legend and the painting area's bounds.


paint

protected void paint(RenderingContext context)
              throws org.opengis.referencing.operation.TransformException
Paint the text in the legend area.

Specified by:
paint in class RenderedLayer
Parameters:
context - Information relatives to the rendering context.
Throws:
org.opengis.referencing.operation.TransformException - If a coordinate transformation failed during the rendering process.


Copyright © GeoTools. All Rights Reserved.