|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.gui.PathListIterator
The PathListIterator class creates a Java
PathIterator based on an internal PathList.
The caller may query or modify the internal PathList.
If a path list is used in a constructor or in the method
setPathList, this iterator is linked to that path list.
The caller may reset the iterator to its initial state to allow for multiple uses of the iterator.
A factory method is provided to construct a new Java Shape
from the current iterator data. This method calls the corresponding
method for its path list.
As of 2.6.0a, this class was modified to reflect the changes to the
class PathList.
| Field Summary | |
static int |
CLOSE
Shorthand constant for PathIterator.SEG_CLOSE. |
static int |
CUBIC
Shorthand constant for PathIterator.SEG_CUBICTO. |
static int |
LINE
Shorthand constant for PathIterator.SEG_LINETO. |
static int |
MOVE
Shorthand constant for PathIterator.SEG_MOVETO. |
protected PathList |
pathList
The path list used by this iterator. |
private int |
pointer
The interator index. |
static int |
QUAD
Shorthand constant for PathIterator.SEG_QUADTO. |
private int |
start
The first index in the path list that does not have a path node of type CLOSE or else pathList.size(); |
private PathNode |
startNode
The adjusted start path node which is forced to be a MOVE node or else null. |
| Fields inherited from interface java.awt.geom.PathIterator |
SEG_CLOSE, SEG_CUBICTO, SEG_LINETO, SEG_MOVETO, SEG_QUADTO, WIND_EVEN_ODD, WIND_NON_ZERO |
| Constructor Summary | |
PathListIterator()
The default constructor that initializes the iterator to a new PathList object with zero nodes and
winding rule WindingRule.WIND_NON_ZERO. |
|
PathListIterator(PathList pathList)
The constructor that initializes the iterator using the given PathList object. |
|
| Method Summary | |
int |
currentSegment(double[] coords)
Returns the type of the current segment as the return value and stores the numeric data of the segment in the supplied array which must be non- null and of size at least 6. |
int |
currentSegment(float[] coords)
Returns the type of the current segment as the return value and stores the numeric data of the segment in the supplied array which must be non- null and of size at least 6. |
PathList |
getPathList()
Returns the internal PathList that is the basis
for this iterator. |
int |
getWindingRule()
Returns the winding rule of the iterator as an int. |
boolean |
isDone()
Returns true if the iteration pointer is beyond the last available path segment in the internal path list. |
boolean |
isValid()
Returns true if this PathListIterator is a valid path
iterator for the construction of a Shape. |
Shape |
makeShape()
Returns the Shape constructed from the internal
path list. |
void |
next()
Advances the iteration pointer one step or anchors it one step beyond the end of the internal path list. |
void |
reset()
Resets the iteration pointer to its initial state. |
void |
setPathList(PathList pathList)
Sets the internal PathList that is the basis
for this iterator. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int MOVE
public static final int LINE
public static final int QUAD
public static final int CUBIC
public static final int CLOSE
protected PathList pathList
private int pointer
private int start
private PathNode startNode
null.
| Constructor Detail |
public PathListIterator()
The default constructor that initializes the iterator
to a new PathList object with zero nodes and
winding rule WindingRule.WIND_NON_ZERO.
public PathListIterator(PathList pathList)
The constructor that initializes the iterator using
the given PathList object.
pathList - the path list to be used for the iterator| Method Detail |
public final void setPathList(PathList pathList)
Sets the internal PathList that is the basis
for this iterator.
Resets the iterator.
Sets the internal PathList to a new empty
path list if the given path list is null.
pathList - the path list to setpublic final PathList getPathList()
Returns the internal PathList that is the basis
for this iterator.
This method enables the user to query any properties of the internal path list.
In addition, the caller can modify the internal path list. We believe that under certain circumstances this ability might be quite valuable. Nevertheless, we recommend caution in using this ability.
In particular, if any changes are made to the internal path
list, then you MUST call reset() so the interator
will be reset to its initial state and certain critical
internal variables will be computed.
If the path list is empty or invalid then isDone()
may return true even when the iterator is in its reset state.
public final boolean isValid()
Returns true if this PathListIterator is a valid path
iterator for the construction of a Shape.
More precisely, returns true if the internal path list is valid, that is, its size is zero or its size is positive and its start node has type MOVE.
As of 2.6.0, this iterator will return the best possible partial shape even if it is not valid.
public final int getWindingRule()
getWindingRule in interface PathIteratorpublic final boolean isDone()
Returns true if the iteration pointer is beyond the last available path segment in the internal path list.
If an attempt is made to retrieve path segment data when
isDone() is true then an
IndexOutOfBoundsException will be thrown.
isDone in interface PathIteratorpublic final void next()
next in interface PathIteratorpublic final void reset()
Resets the iteration pointer to its initial state.
If the path list is empty or invalid then isDone() may
return true even when the iterator is in its reset state.
public final int currentSegment(float[] coords)
Returns the type of the current segment as the return value and
stores the numeric data of the segment in the supplied array which
must be non-null and of size at least 6.
Throws IllegalArgumentException if the supplied
array does not meet the preconditions.
Overwrites the existing contents of the first 6 cells of the supplied array.
Throws IndexOutOfBoundsException if this method
is called when isDone() is true.
currentSegment in interface PathIteratorcoords - an array of size 6 to hold the segment data
IllegalArgumentException
IndexOutOfBoundsExceptionpublic final int currentSegment(double[] coords)
Returns the type of the current segment as the return value and
stores the numeric data of the segment in the supplied array which
must be non-null and of size at least 6.
Throws IllegalArgumentException if the supplied
array does not meet the preconditions.
Overwrites the existing contents of the first 6 cells of the supplied array.
Throws IndexOutOfBoundsException if this method
is called when isDone() is true.
currentSegment in interface PathIteratorcoords - an array of size 6 to hold the segment data
IllegalArgumentException
IndexOutOfBoundsExceptionpublic final Shape makeShape()
Returns the Shape constructed from the internal
path list.
The state of the iterator is not used and is not changed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||