org.geotools.axis
Class NumberGraduation

java.lang.Object
  extended byorg.geotools.axis.AbstractGraduation
      extended byorg.geotools.axis.NumberGraduation
All Implemented Interfaces:
Graduation, java.io.Serializable
Direct Known Subclasses:
LogarithmicNumberGraduation

public class NumberGraduation
extends AbstractGraduation

A graduation using numbers on a linear axis.

Since:
2.0
Version:
$Id: NumberGraduation.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.geotools.axis.AbstractGraduation
listenerList
 
Fields inherited from interface org.geotools.axis.Graduation
AXIS_TITLE_FONT, TICK_LABEL_FONT, VISUAL_AXIS_LENGTH, VISUAL_TICK_SPACING
 
Constructor Summary
NumberGraduation(javax.units.Unit unit)
          Construct a graduation with the supplied units.
 
Method Summary
 boolean equals(java.lang.Object object)
          Compares this graduation with the specified object for equality.
 java.text.Format getFormat()
          Returns the format to use for formatting 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.
 int hashCode()
          Returns a hash value for this graduation.
 boolean setMaximum(double value)
          Set the maximum value for this graduation.
 boolean setMinimum(double value)
          Set the minimum value for this graduation.
 void setRange(double min, double max, javax.units.Unit unit)
          Sets the graduation's minimum, maximum and units.
 void setUnit(javax.units.Unit newUnit)
          Changes the graduation's units.
 
Methods inherited from class org.geotools.axis.AbstractGraduation
addPropertyChangeListener, getLocale, getTitle, getUnit, removePropertyChangeListener, setLocale, setTitle
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberGraduation

public NumberGraduation(javax.units.Unit unit)
Construct a graduation with the supplied units.

Parameters:
unit - The axis's units, or if unknow.
Method Detail

setMinimum

public boolean setMinimum(double value)
                   throws java.lang.IllegalArgumentException
Set the minimum value for this graduation. If the new minimum is greater than the current maximum, then the maximum will also be set to a value greater than or equals to the minimum.

Specified by:
setMinimum in class AbstractGraduation
Parameters:
value - The new minimum in AbstractGraduation.getUnit() units.
Returns:
if the state of this graduation changed as a result of this call, or if the new value is identical to the previous one.
Throws:
java.lang.IllegalArgumentException - Si is NaN ou infinite.
See Also:
getMinimum(), setMaximum(double)

setMaximum

public boolean setMaximum(double value)
                   throws java.lang.IllegalArgumentException
Set the maximum value for this graduation. If the new maximum is less than the current minimum, then the minimum will also be set to a value less than or equals to the maximum.

Specified by:
setMaximum in class AbstractGraduation
Parameters:
value - The new maximum in AbstractGraduation.getUnit() units.
Returns:
if the state of this graduation changed as a result of this call, or if the new value is identical to the previous one.
Throws:
java.lang.IllegalArgumentException - If is NaN ou infinite.
See Also:
getMaximum(), setMinimum(double)

getMinimum

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

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

getMaximum

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

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

getRange

public double getRange()
Returns the graduation's range. This is equivalents to computing getMaximum()-getMinimum().


setRange

public void setRange(double min,
                     double max,
                     javax.units.Unit unit)
Sets the graduation's minimum, maximum and units. This method will fire property change events for , and property names.


setUnit

public void setUnit(javax.units.Unit newUnit)
             throws javax.units.ConversionException
Changes the graduation's units. This method will automatically convert minimum and maximum values from the old units to the new one.

Overrides:
setUnit in class AbstractGraduation
Parameters:
newUnit - The new units, or if unknow. If null, minimum and maximum values are not converted.
Throws:
javax.units.ConversionException - if units are not convertible.

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 Graduation.VISUAL_AXIS_LENGTH and Graduation.VISUAL_TICK_SPACING keys.

Parameters:
hints - Rendering hints, 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.

equals

public boolean equals(java.lang.Object object)
Compares this graduation with the specified object for equality. This method do not compare registered listeners.

Overrides:
equals in class AbstractGraduation

hashCode

public int hashCode()
Returns a hash value for this graduation.

Overrides:
hashCode in class AbstractGraduation


Copyright © GeoTools. All Rights Reserved.