01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2003-2006, Geotools Project Managment Committee (PMC)
05: * (C) 2000, Institut de Recherche pour le Développement
06: * (C) 1999, Pêches et Océans Canada
07: *
08: * This library is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU Lesser General Public
10: * License as published by the Free Software Foundation; either
11: * version 2.1 of the License, or (at your option) any later version.
12: *
13: * This library is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * Lesser General Public License for more details.
17: */
18: package org.geotools.axis;
19:
20: // Miscellaneous
21: import java.util.Locale;
22:
23: /**
24: * Provides the mechanism for {@link Graduation} objects to return the
25: * values and labels of their ticks one tick at a time. This interface
26: * returns tick values from some minimal value up to some maximal value,
27: * using some increment value. Note that the increment value <strong>may
28: * not be constant</strong>. For example, a graduation for the time axis
29: * may use a slightly variable increment between differents months, since
30: * all months doesn't have the same number of days.
31: *
32: * @since 2.0
33: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/extension/widgets-swing/src/main/java/org/geotools/axis/TickIterator.java $
34: * @version $Id: TickIterator.java 20883 2006-08-07 13:48:09Z jgarnett $
35: * @author Martin Desruisseaux
36: */
37: public interface TickIterator {
38: /**
39: * Tests if the iterator has more ticks.
40: */
41: public abstract boolean hasNext();
42:
43: /**
44: * Tests if the current tick is a major one.
45: *
46: * @return {@code true} if current tick is a major tick,
47: * or {@code false} if it is a minor tick.
48: */
49: public abstract boolean isMajorTick();
50:
51: /**
52: * Returns the position where to draw the current tick. The position is scaled
53: * from the graduation's minimum to maximum. This is usually the same number
54: * than {@link #currentValue}. The mean exception is for logarithmic graduation,
55: * in which the tick position is not proportional to the tick value.
56: */
57: public abstract double currentPosition();
58:
59: /**
60: * Returns the value for current tick. The current tick may be major or minor.
61: */
62: public abstract double currentValue();
63:
64: /**
65: * Returns the label for current tick. This method is usually invoked
66: * only for major ticks, but may be invoked for minor ticks as well.
67: * This method returns {@code null} if it can't produces a label
68: * for current tick.
69: */
70: public abstract String currentLabel();
71:
72: /**
73: * Moves the iterator to the next minor or major tick.
74: */
75: public abstract void next();
76:
77: /**
78: * Moves the iterator to the next major tick. This move
79: * ignore any minor ticks between current position and
80: * the next major tick.
81: */
82: public abstract void nextMajor();
83:
84: /**
85: * Reset the iterator on its first tick.
86: * All other properties are left unchanged.
87: */
88: public abstract void rewind();
89:
90: /**
91: * Returns the locale used for formatting tick labels.
92: */
93: public abstract Locale getLocale();
94: }
|