UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.awt.geom
Class ShapeLineIterator

java.lang.Object
  |
  +--edu.berkeley.guir.lib.awt.geom.ShapeLineIterator

public class ShapeLineIterator
extends Object

Abstracts a PathIterator into a line iterator. Get lines instead of points. Also uses the standard collection method names, like next() and hasNext(), instead of the ones in PathIterator.

This software is distributed under the Berkeley Software License.

 Revisions:  - GUIRLib-v1.3-1.0.0, Jul 17 1999, JH
               Created class
             - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH
               Touched for GUIRLib release
 

Since:
JDK 1.2.2
Version:
GUIRLib-v1.4-1.0.0, Aug 31 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu )

Constructor Summary
ShapeLineIterator(PathIterator it)
          Construct a line iterator from the specified path iterator.
ShapeLineIterator(Shape s)
          Construct a line iterator from the bounding points of the specified shape.
ShapeLineIterator(Shape s, AffineTransform tx)
          Construct a line iterator from the bounding points of the specified shape, applying the transform to the bounding points.
 
Method Summary
 boolean hasNext()
           
 boolean isDone()
           
 Line2D next()
          Get the next line.
 Line2D next(Line2D line)
          Get the next line, using the specified line as storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeLineIterator

public ShapeLineIterator(PathIterator it)
Construct a line iterator from the specified path iterator. Warning: assumes that the path iterator iterates over straight lines. It does not do any error checking.

ShapeLineIterator

public ShapeLineIterator(Shape s)
Construct a line iterator from the bounding points of the specified shape. Assumes that the shape is constructed of straight lines.

ShapeLineIterator

public ShapeLineIterator(Shape s,
                         AffineTransform tx)
Construct a line iterator from the bounding points of the specified shape, applying the transform to the bounding points.
Method Detail

isDone

public boolean isDone()

hasNext

public boolean hasNext()

next

public Line2D next()
Get the next line.
Returns:
the next line.

next

public Line2D next(Line2D line)
Get the next line, using the specified line as storage.
Parameters:
line - is used to store the next line, previous data will be overwritten.
Returns:
a reference to the specified line.

Copyright Information