org.geotools.axis
Interface Graduation

All Known Implementing Classes:
AbstractGraduation, DateGraduation, LogarithmicNumberGraduation, NumberGraduation

public interface Graduation

An axis's graduation. A Graduation 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
Author:
Martin Desruisseaux (PMO, IRD)
Module:

Field Summary
static RenderingHints.Key AXIS_TITLE_FONT
          The font to use for rendering the title.
static RenderingHints.Key TICK_LABEL_FONT
          The font to use for rendering tick labels.
static RenderingHints.Key VISUAL_AXIS_LENGTH
          Rendering hint for the axis length, in pixels or points (1/72 of inch).
static 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(PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 Format getFormat()
          Returns the format to use for formatting labels.
 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(RenderingHints hints, TickIterator reuse)
          Returns an iterator object that iterates along the graduation ticks and provides access to the graduation values.
 String getTitle(boolean includeSymbol)
          Returns the axis title.
 Unit<?> getUnit()
          Returns the graduation's units, or null if unknow.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 

Field Detail

VISUAL_AXIS_LENGTH

static final 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

static final 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

static final 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

static final 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

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

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

getMaximum

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

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

getRange

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.

Returns:
The graduation range.

getTitle

String getTitle(boolean includeSymbol)
Returns the axis title. If includeUnits is true, 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 - true to format the unit or timezone symbol after the name.
Returns:
The graduation name (also to be use as axis title).

getUnit

Unit<?> getUnit()
Returns the graduation's units, or null if unknow.

Returns:
The graduation units, or null.

getLocale

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

Returns:
The locale for formatting title and labels.

getFormat

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.

Returns:
The labels format.

getTickIterator

TickIterator getTickIterator(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 null for the default hints.
reuse - An iterator to reuse if possible, or null 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 reuse object.

addPropertyChangeListener

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

Parameters:
listener - The listener to add.

removePropertyChangeListener

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

Parameters:
listener - The listener to remove.


Copyright © 1996-2009 Geotools. All Rights Reserved.