|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.axis.Axis2D.TickIterator
Iterates along the graduation ticks and provides access to the graduation values. Each
object traverses the graduation of the unclosing Axis2D
object independently from any other TickIterator
objects in use at the same time.
If a change occurs in the underlying Axis2D
object during the iteration, then
refresh()
must be invoked in order to reset the iterator as if a new instance was
created. Except for refresh()
method, using the iterator after a change in the
underlying Axis2D
may thrown a ConcurrentModificationException
.
Constructor Summary | |
Axis2D.TickIterator(java.awt.font.FontRenderContext fontContext)
Construct an iterator. |
Method Summary | |
java.lang.String |
currentLabel()
Returns the label for current tick. |
java.awt.geom.Rectangle2D |
currentLabelBounds()
Returns a bounding vector for the current tick label. |
java.awt.font.GlyphVector |
currentLabelGlyphs()
Returns the label for current tick as a glyphs vector. |
double |
currentPosition()
Returns the position where to draw the current tick. |
java.awt.geom.Point2D |
currentPosition(java.awt.geom.Point2D dest)
Returns the coordinates of the intersection point between current tick and the underlying axis. |
java.awt.geom.Line2D |
currentTick(java.awt.geom.Line2D dest)
Returns the coordinates of the current tick. |
double |
currentValue()
Returns the value for current tick. |
java.util.Locale |
getLocale()
Returns the locale used for formatting tick labels. |
boolean |
hasNext()
Tests if the iterator has more ticks. |
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 |
refresh()
Reset the iterator on its first tick. |
void |
rewind()
Reset the iterator on its first tick. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Axis2D.TickIterator(java.awt.font.FontRenderContext fontContext)
fontContext
- Information needed to correctly measure text, or
if unknow. This object is usually given by
Graphics2D.getFontRenderContext()
.Method Detail |
public boolean hasNext()
hasNext
in interface TickIterator
public boolean isMajorTick()
isMajorTick
in interface TickIterator
public double currentPosition()
currentValue()
. The mean exception is for logarithmic graduation,
in which the tick position is not proportional to the tick value.
currentPosition
in interface TickIterator
public double currentValue()
currentValue
in interface TickIterator
public java.awt.geom.Point2D currentPosition(java.awt.geom.Point2D dest)
dest
- A destination point that stores the intersection coordinates,
or to create a new Point2D
object.
Point2D
object if was null.public java.awt.geom.Line2D currentTick(java.awt.geom.Line2D dest)
dest
- A destination line that stores the current tick coordinates,
or to create a new Line2D
object.
Line2D
object if was null.public java.lang.String currentLabel()
currentLabel
in interface TickIterator
public java.awt.font.GlyphVector currentLabelGlyphs()
currentLabelBounds()
for labels rendering. Do
not change the returned GlyphVector
, since the glyphs vector
is not cloned for performance raisons. This method returns
if it can't produces a glyph vector for current tick.
public java.awt.geom.Rectangle2D currentLabelBounds()
This method returns if it can't compute bounding box for current tick.Axis2D.TickIterator
iterator = axis.newTickIterator
(null}; while (iterator.hasNext()
) {GlyphVector
glyphs = iterator.currentLabelGlyphs()
;Rectangle2D
bounds = iterator.currentLabelBounds()
; graphics.drawGlyphVector(glyphs, (float)bounds.getMinX(), (float)bounds.getMaxY()); iterator.next()
; }
public void next()
next
in interface TickIterator
public void nextMajor()
nextMajor
in interface TickIterator
public void rewind()
rewind
in interface TickIterator
public void refresh()
refresh()
method help to reduce garbage-collection by constructing an
object only once and reuse it for each axis's rendering.
public java.util.Locale getLocale()
getLocale
in interface TickIterator
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |