org.geotools.axis
Interface Graduation

All Known Implementing Classes:
AbstractGraduation

public interface Graduation

An axis's graduation. A object encompass minimal and maximal values for an axis in arbitrary units, and allow access to tick locations and labels through a TickIterator object. Different implementations may compute tick locations in different ways. For example a graduation for dates is handled in a different way than a graduation for numbers.

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

Field Summary
static java.awt.RenderingHints.Key AXIS_TITLE_FONT
          The font to use for rendering the title.
static java.awt.RenderingHints.Key TICK_LABEL_FONT
          The font to use for rendering tick labels.
static java.awt.RenderingHints.Key VISUAL_AXIS_LENGTH
          Rendering hint for the axis length, in pixels or points (1/72 of inch).
static java.awt.RenderingHints.Key VISUAL_TICK_SPACING
          Rendering hint for the preferred spacing between ticks, in pixels or points (1/72 of inch).
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 java.text.Format getFormat()
          Returns the format to use for formatting labels.
 java.util.Locale getLocale()
          Returns the locale to use for formatting title and labels.
 double getMaximum()
          Returns the maximal value for this graduation.
 double getMinimum()
          Returns the minimal value for this graduation.
 double getRange()
          Returns the graduation's range.
 TickIterator getTickIterator(java.awt.RenderingHints hints, TickIterator reuse)
          Returns an iterator object that iterates along the graduation ticks and provides access to the graduation values.
 java.lang.String getTitle(boolean includeSymbol)
          Returns the axis title.
 javax.units.Unit getUnit()
          Returns the graduation's units, or if unknow.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 

Field Detail

VISUAL_AXIS_LENGTH

public static final java.awt.RenderingHints.Key VISUAL_AXIS_LENGTH
Rendering hint for the axis length, in pixels or points (1/72 of inch). Values for this key must be Number objects. This hint is used together with VISUAL_TICK_SPACING during TickIterator creation in order to compute a tick increment value.

See Also:
getTickIterator(java.awt.RenderingHints, org.geotools.axis.TickIterator)

VISUAL_TICK_SPACING

public static final java.awt.RenderingHints.Key VISUAL_TICK_SPACING
Rendering hint for the preferred spacing between ticks, in pixels or points (1/72 of inch). Values for this key must be Number objects. This hint is used together with VISUAL_AXIS_LENGTH during TickIterator creation in order to compute a tick increment value. The tick spacing really used may be slightly different, since TickIterator may choose a rounded value.

See Also:
getTickIterator(java.awt.RenderingHints, org.geotools.axis.TickIterator)

TICK_LABEL_FONT

public static final java.awt.RenderingHints.Key TICK_LABEL_FONT
The font to use for rendering tick labels. Value for this key must be a Font object. If this hint is not provided, a default font will be used.

See Also:
Axis2D.paint(java.awt.Graphics2D)

AXIS_TITLE_FONT

public static final java.awt.RenderingHints.Key AXIS_TITLE_FONT
The font to use for rendering the title. Value for this key must be a Font object. If this hint is not provided, a default font will be used.

See Also:
Axis2D.paint(java.awt.Graphics2D)
Method Detail

getMinimum

public double getMinimum()
Returns the minimal value for this graduation.

Returns:
The minimal value in getUnit() units.
See Also:
getMaximum(), getRange()

getMaximum

public double getMaximum()
Returns the maximal value for this graduation.

Returns:
The maximal value in getUnit() units.
See Also:
getMinimum(), getRange()

getRange

public double getRange()
Returns the graduation's range. This is equivalents to computing getMaximum()-getMinimum(). However, some implementation may optimize this computation in order to avoid rounding errors.


getTitle

public java.lang.String getTitle(boolean includeSymbol)
Returns the axis title. If is , then the returned string will includes units as in "Temperature (?C)", or time zone as in "Start time (UTC)". The exact formatting is local-dependent.

Parameters:
includeSymbol - to format the unit or timezone symbol after the name.
Returns:
The graduation name (also to be use as axis title).

getUnit

public javax.units.Unit getUnit()
Returns the graduation's units, or if unknow.


getLocale

public java.util.Locale getLocale()
Returns the locale to use for formatting title and labels.


getFormat

public java.text.Format getFormat()
Returns the format to use for formatting labels. The format really used by TickIterator.currentLabel() may not be the same. For example, some iterators may adjust automatically the number of fraction digits.


getTickIterator

public TickIterator getTickIterator(java.awt.RenderingHints hints,
                                    TickIterator reuse)
Returns an iterator object that iterates along the graduation ticks and provides access to the graduation values. If an optional RenderingHints is specified, tick locations are adjusted according values for VISUAL_AXIS_LENGTH and VISUAL_TICK_SPACING keys.

Parameters:
hints - Rendering hints for the axis, or for the default hints.
reuse - An iterator to reuse if possible, or to create a new one. A non-null object may help to reduce the number of object garbage-collected when rendering the axis.
Returns:
A iterator to use for iterating through the graduation. This iterator may or may not be the object.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. The listener is registered for all properties, such as "label" and "locale".


removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list.



Copyright © GeoTools. All Rights Reserved.