org.geotoolkit.display.axis
Interface TickIterator

All Known Implementing Classes:
Axis2D.TickIterator

public interface TickIterator

Provides the mechanism for Graduation objects to return the values and labels of their ticks one tick at a time. This interface returns tick values from some minimal value up to some maximal value, using some increment value. Note that the increment value may not be constant. For example, a graduation for the time axis may use a slightly variable increment between differents months, since all months doesn't have the same number of days.

On construction or after a call to rewind(), the TickIterator is positionned on the first minor or major tick (i.e. calls to currentValue() return the value of the first tick). The method next() or nextMajor() must be invoked in order to move to the next tick.

Since:
2.0
Version:
3.00
Author:
Martin Desruisseaux (MPO, IRD)
Module:
display/geotk-display (download)    View source code for this class

Method Summary
 String currentLabel()
          Returns the label for the current tick.
 double currentPosition()
          Returns the position where to draw the current tick.
 double currentValue()
          Returns the value for current tick.
 boolean isDone()
          Tests if the iterator position is behind the latest valid tick.
 boolean isMajorTick()
          Tests if the current tick is a major one.
 void next()
          Moves the iterator to the next minor or major tick.
 void nextMajor()
          Moves the iterator to the next major tick.
 void rewind()
          Resets the iterator on its first tick.
 

Method Detail

isDone

boolean isDone()
Tests if the iterator position is behind the latest valid tick. This method can be invoked after TickIterator creation, or after a call to next() or nextMajor() methods, for determining if the iteration is done.

Returns:
false if the iterator position is on a valid tick.

isMajorTick

boolean isMajorTick()
Tests if the current tick is a major one.

Returns:
true if current tick is a major tick, or false if it is a minor tick.

currentPosition

double currentPosition()
Returns the position where to draw the current tick. The position is scaled from the graduation's minimum to maximum. This is usually the same number than currentValue(). The mean exception is for logarithmic graduation, in which the tick position is not proportional to the tick value.

Returns:
The position where to draw the current tick.

currentValue

double currentValue()
Returns the value for current tick. The current tick may be major or minor.

Returns:
The value for the current tick.

currentLabel

String currentLabel()
Returns the label for the current tick. This method is usually invoked only for major ticks, but may be invoked for minor ticks as well. This method returns null if it can't produces a label for the current tick.

Returns:
The label for the current tick.

next

void next()
Moves the iterator to the next minor or major tick.


nextMajor

void nextMajor()
Moves the iterator to the next major tick. This move ignore any minor ticks between the current position and the next major tick.


rewind

void rewind()
Resets the iterator on its first tick. All other properties are left unchanged.



Copyright © 2009-2013 Geotoolkit.org. All Rights Reserved.