edu.neu.ccs.gui
Class PathList

java.lang.Object
  extended byedu.neu.ccs.gui.PathList
All Implemented Interfaces:
Stringable

public class PathList
extends Object
implements Stringable

The PathList class combines an explicit sequence of PathNode objects together with a winding rule to provide a flexible alternative to the Java class GeneralPath.

A PathList may be constructed or modifed using a list of PathNode objects or a Shape or a PathIterator.

Conversely, from a PathList, one can construct a Shape or a PathIterator.

Unlike GeneralPath, PathList does not implement Shape directly since we separate the aspects of collecting the path node data from the shape issues. This class provides methods that create not only the Shape directly associated with the PathList data but also various Shape objects that capture its vertex polygon and bezier frame polygon as well as the dots that make up these polygons. This flexibility is used in the methods makeStructurePaintable that construct a Paintable that visually reveals the internal structure of the Shape directly associated with the PathList data.

Note: GeneralPath is used as an implementation class for the various PathList methods that construct Shape objects.

Changes in 2.6.0a:

In 2.6.0a, the policy concerning how to handle a pathlist that does not start with a MOVE operation was changed. Here is the context.

In construction of a Shape via GeneralPath, Java requires that the start node have type MOVE. If this condition does not hold, Java throws IllegalPathStateException. The option of throwing an exception was not one we wished to choose.

Since the introduction of PathList, we have had a method isValid() that returns true if the start node has type MOVE. Our original policy on Shape construction was that if a path list was not valid, then we would return a non-null but empty shape. We now realize that this policy is too restrictive.

As of 2.6.0a, we will now use the following policy on Shape construction. We will search for the first PathNode in the PathList which is not a CLOSE. We will then extract the endpoint of that node and use that to define the first MOVE that is required in building a Java Shape. After that, each node in the path list will be added to the GeneralPath as usual. This will enable as much of a Shape to be created as possible which is a benefit to developers during debugging and to end users.

As of 2,6.0a, the fromStringData method will ignore text lines after the first line that contain only whitespace. This will avoid adding spurious path nodes that “move to 0,0”.

As of 2.6.0a, append methods were added to take the nodes of a given path list, clone them, and then append them to a path list. This allows one path list to maintain sub-path information that may be easily appended to another path list.

Prior to 2.6.0a, this class included methods and data to read and save the PathList information to a file. This was a design error since it made it impossible to use this class in an applet. The methods and data associated with file read and save have been removed.

Additional changes in 2.6.0d:

Since:
2.4.0
Version:
2.6.0d

Field Summary
static String Alternate_WIND_EVEN_ODD
          The alternate String constant for WindingRule.WIND_EVEN_ODD without underscore characters.
static String Alternate_WIND_NON_ZERO
          The alternate String constant for WindingRule.WIND_NON_ZERO without underscore characters.
private static int CAP_ROUND
          Constant used to contruct stroke.
static int CLOSE
          Shorthand constant for PathIterator.SEG_CLOSE.
static int CUBIC
          Shorthand constant for PathIterator.SEG_CUBICTO.
private static int JOIN_ROUND
          Constant used to contruct stroke.
static int LINE
          Shorthand constant for PathIterator.SEG_LINETO.
static int MOVE
          Shorthand constant for PathIterator.SEG_MOVETO.
protected  Vector pathlist
          The path list.
static int QUAD
          Shorthand constant for PathIterator.SEG_QUADTO.
static String standardMessage
          The standard error message for fromStringData.
static String String_WIND_EVEN_ODD
          The String constant for WindingRule.WIND_EVEN_ODD.
static String String_WIND_NON_ZERO
          The String constant for WindingRule.WIND_NON_ZERO.
protected  WindingRule windingrule
          The winding rule as an object.
 
Constructor Summary
PathList()
          The default constructor that sets the path list to empty and the winding rule to WindingRule.WIND_NON_ZERO.
PathList(PathIterator iterator)
          The constructor that initializes the path list using the path nodes and winding rule obtained from the given PathIterator.
PathList(PathList list)
          The constructor that makes a deep clone of an existing path list.
PathList(PathNode[] nodes)
          The constructor that initializes the path list using the given array of path nodes and sets the winding rule to WindingRule.WIND_NON_ZERO.
PathList(PathNode[] nodes, int rule)
          The constructor that initializes the path list using the given array of path nodes and the given winding rule.
PathList(PathNode[] nodes, WindingRule rule)
          The constructor that initializes the path list using the given array of path nodes and the given winding rule.
PathList(Point2D[] points, boolean close)
          The constructor that makes a polygon path list using the given array points of point data; the boolean close determines whether or the polygon is open or closed.
PathList(Point2D[] points, boolean close, int rule)
          The constructor that makes a polygon path list using the given array points of point data; the boolean close determines whether or the polygon is open or closed; the given winding rule determines the winding rule.
PathList(Point2D[] points, boolean close, WindingRule rule)
          The constructor that makes a polygon path list using the given array points of point data; the boolean close determines whether or the polygon is open or closed; the given winding rule determines the winding rule.
PathList(Shape shape)
          The constructor that initializes the path list using the path nodes and winding rule obtained from the given Shape.
PathList(Shape shape, AffineTransform transform)
          The constructor that initializes the path list using the path nodes and winding rule obtained from the given Shape after applying the given transform to the shape data.
PathList(Shape shape, AffineTransform transform, double flatness)
          The constructor that initializes the path list using the path nodes and winding rule obtained from the given Shape after applying the given transform and flatness to the shape data.
PathList(WindingRule rule)
          The constructor that sets the path list to empty and the winding rule to the given winding rule.
 
Method Summary
 void add(int index, PathNode node)
          Inserts the specified node at the specified position in this PathList and shifts any elements right as needed.
 void add(int index, PathNode[] nodes)
          Inserts the specified array of nodes into this PathList starting at the specified position in the list and shifts any elements right as needed.
 void add(int index, PathNode[] nodes, boolean connect)
          Inserts the specified array of nodes into this PathList starting at the specified position in the list and shifts any elements right as needed.
 PathList append(PathIterator iterator)
          Extracts the path node data from the given iterator and appends the nodes to this path list.
 PathList append(PathIterator iterator, boolean connect)
          Extracts the path node data from the given iterator and appends the nodes to this path list.
 PathList append(PathList pathList)
          Extract the path nodes from the given path list, clone each of these nodes, and append the cloned nodes to this path list.
 PathList append(PathList pathList, boolean connect)
          Extract the path nodes from the given path list, clone each of these nodes, and append the cloned nodes to this path list.
 PathList append(PathNode node)
          Appends the specified node to this PathList.
 PathList append(PathNode[] nodes)
          Appends the specified array of nodes to this PathList.
 PathList append(PathNode[] nodes, boolean connect)
          Appends the specified array of nodes to this PathList.
 PathList append(Shape shape)
          Extracts the path node data from the given shape and appends the nodes to this path list.
 PathList append(Shape shape, AffineTransform transform)
          Extracts the path node data from the given shape and appends the nodes to this path list after applying the given transform.
 PathList append(Shape shape, AffineTransform transform, boolean connect)
          Extracts the path node data from the given shape and appends the nodes to this path list after applying the given transform.
 PathList append(Shape shape, AffineTransform transform, double flatness)
          Extracts the path node data from the given shape and appends the nodes to this path list after applying the given transform and flatness.
 PathList append(Shape shape, AffineTransform transform, double flatness, boolean connect)
          Extracts the path node data from the given shape and appends the nodes to this path list after applying the given transform and flatness.
 PathList append(Shape shape, boolean connect)
          Extracts the path node data from the given shape and appends the nodes to this path list.
 void cloneAndAdd(int index, PathNode node)
          Inserts a clone of the specified node at the specified position in this PathList and shifts any elements right as needed.
 void cloneAndAdd(int index, PathNode[] nodes)
          Inserts clones of the specified array of nodes to this PathList starting at the specified position in the list and shifts any elements right as needed.
 void cloneAndAdd(int index, PathNode[] nodes, boolean connect)
          Inserts clones of the specified array of nodes to this PathList starting at the specified position in the list and shifts any elements right as needed.
 PathList cloneAndAppend(PathNode node)
          Appends a clone of the specified node to this PathList.
 PathList cloneAndAppend(PathNode[] nodes)
          Appends clones of the specified array of nodes to this PathList.
 PathList cloneAndAppend(PathNode[] nodes, boolean connect)
          Appends clones of the specified array of nodes to this PathList.
 PathList close()
          Append a new PathNode of type CLOSE.
 PathList cubic(double x1, double y1, double x2, double y2, double x3, double y3)
          Append a new PathNode of type CUBIC.
 void fromStringData(String data)
          Sets the data of this path list using String data in the format produced by toString().
 PathNode get(int index)
          Returns the PathNode at the given index if the given index is in range; otherwise returns null.
 PathNode[] getPathNodes()
          Returns a PathNode array with the current path nodes in this path list.
 String[] getPathNodeStateArray()
          Returns a String array with the value of the method toStringData applied to each item in the array returned by getPathNodes.
 float[] getShapePoint(float t)
          Returns the point on the path corresponding to the parameter t as float[2].
 XPoint2D getShapePoint2D(double t)
          Returns the point on the path corresponding to the parameter t as XPoint2D.
 float[] getSlot(int[] indices)
          Returns the contents of the slot indices[1] of the PathNode at the index indices[0] if indices is non-null and of length 2 and if the index is in range and the slot is valid; otherwise returns null.
 float[] getSlot(int index, int slot)
          Returns the contents of the given slot of the PathNode at the given index if the index is in range and the slot is valid; otherwise returns null.
 WindingRule getWindingRule()
          Get the winding rule as an object.
 WindingRule getWindingRuleFromStringData(String data)
          Returns the WindingRule that corresponds to the given String data.
 String getWindingRuleString()
          Returns a String with the winding rule information.
 double getX(double t)
          Returns the x-coordinate of a point on the path corresponding to the parameter t.
 double getY(double t)
          Returns the y-coordinate of a point on the path corresponding to the parameter t.
 boolean isPolygon()
          Returns true if the list has at least 2 nodes, all nodes in the list have one of the following 3 types MOVE, LINE, CLOSE, and the first node is MOVE.
 boolean isStrictPolygon()
          Returns true if the list has at least 2 nodes, the initial node has type MOVE, the final node has type LINE or CLOSE, all inner nodes have type LINE, and at least one node has type LINE.
 boolean isValid()
          Returns true if this PathList is a valid path list for the construction of a Shape.
 String JavaCode()
          Returns in a String the Java code that might be used to make a clone of this path list.
 PathList line(double x1, double y1)
          Append a new PathNode of type LINE.
 PathList makeBezierDotsPathList()
          Returns a new PathList with the same winding rule as this path list and whose nodes are constructed from the nodes of this path list by the following operations.
 PathListIterator makeBezierDotsPathListIterator()
          Returns a PathListIterator constructed from an instance of makeBezierDotsPathList().
 Shape makeBezierDotsShape()
          Returns a Shape that consists of the bezier dots.
static Shape makeBezierDotsShape(Shape shape)
          Static method that returns the bezier dots shape corresponding to the given shape.
 PathList makeBezierPathList()
          Returns a new PathList with the same winding rule as this path list and whose nodes are constructed from the nodes of this path list by the following operations.
 PathListIterator makeBezierPathListIterator()
          Returns a PathListIterator constructed from an instance of makeBezierPathList().
 Point2D[] makeBezierPoints()
          Returns a new Point2D[] whose points are built to include the bezier points of the path list by the following operations.
static Point2D[] makeBezierPoints(Shape shape)
          Static method that returns the bezier point array for the given shape.
 Shape makeBezierShape()
          Returns a polygonal Shape that passes through the bezier points of this pathlist, that is, both the vertex points and the control points.
static Shape makeBezierShape(Shape shape)
          Static method that returns the bezier shape corresponding to the given shape.
 PathList makeControlDotsPathList()
          Returns a new PathList with the same winding rule as this path list and whose nodes are constructed from the nodes of this path list by the following operations.
 PathListIterator makeControlDotsPathListIterator()
          Returns a PathListIterator constructed from an instance of makeControlDotsPathList().
 Shape makeControlDotsShape()
          Returns a Shape that consists of the control dots.
static Shape makeControlDotsShape(Shape shape)
          Static method that returns the control dots shape corresponding to the given shape.
 Point2D[] makeControlPoints()
          Returns a new Point2D[] whose points are built to include the control points of the path list by the following operations.
static Point2D[] makeControlPoints(Shape shape)
          Static method that returns the control point array for the given shape.
 PathListIterator makePathListIterator()
          Factory method that returns a new PathListIterator based on the current data in this path list.
 Shape makeShape()
          Factory method that returns a new Shape based on the current data in this path list.
 PaintableSequence makeStructurePaintable()
          Returns a PaintableSequence whose components show the structure of the Shape associated with this PathList.
 PaintableSequence makeStructurePaintable(Color fillColor, Color drawColor, Color vertexDotsColor, Color controlDotsColor, Color vertexFrameColor, Color bezierFrameColor, Color pathPointsColor, int thickness, int divisions)
          Returns a PaintableSequence whose components show the structure of the Shape associated with this PathList.
 PaintableSequence makeStructurePaintable(Color fillColor, Color drawColor, Color vertexDotsColor, Color controlDotsColor, Color vertexFrameColor, Color bezierFrameColor, int thickness)
          Returns a PaintableSequence whose components show the structure of the Shape associated with this PathList.
 PaintableSequence makeStructurePaintable(Color fillColor, Color drawColor, int thickness)
          Returns a PaintableSequence whose components show the structure of the Shape associated with this PathList.
 PaintableSequence makeStructurePaintable(int thickness)
          Returns a PaintableSequence whose components show the structure of the Shape associated with this PathList.
 PathList makeVertexDotsPathList()
          Returns a new PathList with the same winding rule as this path list and whose nodes are constructed from the nodes of this path list by the following operations.
 PathListIterator makeVertexDotsPathListIterator()
          Returns a PathListIterator constructed from an instance of makeVertexDotsPathList().
 Shape makeVertexDotsShape()
          Returns a Shape that consists of the vertex dots.
static Shape makeVertexDotsShape(Shape shape)
          Static method that returns the vertex dots shape corresponding to the given shape.
 PathList makeVertexPathList()
          Returns a new PathList with the same winding rule as this path list and whose nodes are constructed from the nodes of this path list by the following operations.
 PathListIterator makeVertexPathListIterator()
          Returns a PathListIterator constructed from an instance of makeVertexPathList().
 Point2D[] makeVertexPoints()
          Returns a new Point2D[] whose points are built to include the vertex points of the path list by the following operations.
static Point2D[] makeVertexPoints(Shape shape)
          Static method that returns the vertex point array for the given shape.
 Shape makeVertexShape()
          Returns a polygonal Shape that passes through the vertex points of this pathlist.
static Shape makeVertexShape(Shape shape)
          Static method that returns the vertex shape corresponding to the given shape.
 PathList move(double x1, double y1)
          Append a new PathNode of type MOVE.
 int[] nearSlot(double x, double y, double epsilon)
          Searches the nodes in this path list and for each such node searches the slots in the node to determine if the given (x,y) is within epsilon of the values in the slot; if successful, returns an array int[2] with value 0 equal to the node index and value 1 equal to the slot index; if unsuccessful, returns null.
 int[] nearSlot(double x, double y, double epsilon, Metric metric)
          Searches the nodes in this path list and for each such node searches the slots in the node to determine if the given (x,y) is within epsilon of the values in the slot relative to the given metric; if successful, returns an array int[2] with value 0 equal to the node index and value 1 equal to the slot index; if unsuccessful, returns null.
 PathList quad(double x1, double y1, double x2, double y2)
          Append a new PathNode of type QUAD.
 PathNode remove(int index)
          Removes the PathNode at the given index and returns the removed node.
 PathNode[] remove(int m, int n)
          Removes the PathNodes starting at the given index m inclusive and ending at the given index n exclusive; returns an array with the removed nodes.
 PathNode[] removeAll()
          Removes all PathNodes from the path list and returns an array with the removed nodes.
 void set(int index, PathNode node)
          Sets the PathNode at the given index to a copy of the given node if the given node is non-null and if the given index is in range; otherwise does nothing.
 void setPathList(PathIterator iterator)
          Sets the path list using the path nodes and winding rule obtained from the given PathIterator.
 void setPathList(PathList list)
          Sets this path list to be a deep clone of an existing path list.
 void setPathList(Shape shape)
          Sets the path list using the path nodes and winding rule obtained from the given Shape.
 void setPathList(Shape shape, AffineTransform transform)
          Sets the path list using the path nodes and winding rule obtained from the given Shape after applying the given transform to the shape data.
 void setPathList(Shape shape, AffineTransform transform, double flatness)
          Sets the path list using the path nodes and winding rule obtained from the given Shape after applying the given transform and flatness to the shape data.
 void setPathNodes(PathNode[] nodes)
          Removes the current nodes in the path list and sets the nodes to those in the given array of nodes.
 void setSlot(int[] indices, double[] pair)
          Sets the contents of the slot indices[1] of the PathNode at the index indices[0] to the coordinates of the given pair if indices is non-null and of length 2, if the index is in range and the slot is valid, and if pair is non-null and of length 2; otherwise does nothing.
 void setSlot(int[] indices, double x, double y)
          Sets the contents of the slot indices[1] of the PathNode at the index indices[0] to the given x, y if indices is non-null and of length 2 and if the index is in range and the slot is valid; otherwise does nothing.
 void setSlot(int[] indices, float[] pair)
          Sets the contents of the slot indices[1] of the PathNode at the index indices[0] to the coordinates of the given pair if indices is non-null and of length 2, if the index is in range and the slot is valid, and if pair is non-null and of length 2; otherwise does nothing.
 void setSlot(int index, int slot, double[] pair)
          Sets the contents of the given slot of the PathNode at the given index to the coordinates of the given pair if the index is in range and the slot is valid and if pair is non-null and of length 2; otherwise does nothing.
 void setSlot(int index, int slot, double x, double y)
          Sets the contents of the given slot of the PathNode at the given index to the given x, y if the index is in range and the slot is valid; otherwise does nothing.
 void setSlot(int index, int slot, float[] pair)
          Sets the contents of the given slot of the PathNode at the given index to the coordinates of the given pair if the index is in range and the slot is valid and if pair is non-null and of length 2; otherwise does nothing.
 void setWindingRule(int rule)
          Sets the winding rule via an int.
 void setWindingRule(WindingRule rule)
          Sets the winding rule as an object.
 int size()
          Returns the size of the list.
 String toString()
          Returns the data in this path list as a multi-line String.
 String toStringData()
          Returns the same String as toString().
 void transform(AffineTransform T)
          Transforms the internal data points in each path node using the given affine transform.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MOVE

public static final int MOVE
Shorthand constant for PathIterator.SEG_MOVETO.

See Also:
Constant Field Values

LINE

public static final int LINE
Shorthand constant for PathIterator.SEG_LINETO.

See Also:
Constant Field Values

QUAD

public static final int QUAD
Shorthand constant for PathIterator.SEG_QUADTO.

See Also:
Constant Field Values

CUBIC

public static final int CUBIC
Shorthand constant for PathIterator.SEG_CUBICTO.

See Also:
Constant Field Values

CLOSE

public static final int CLOSE
Shorthand constant for PathIterator.SEG_CLOSE.

See Also:
Constant Field Values

CAP_ROUND

private static final int CAP_ROUND
Constant used to contruct stroke.

See Also:
Constant Field Values

JOIN_ROUND

private static final int JOIN_ROUND
Constant used to contruct stroke.

See Also:
Constant Field Values

standardMessage

public static final String standardMessage
The standard error message for fromStringData.

See Also:
Constant Field Values

String_WIND_NON_ZERO

public static final String String_WIND_NON_ZERO
The String constant for WindingRule.WIND_NON_ZERO.

See Also:
Constant Field Values

String_WIND_EVEN_ODD

public static final String String_WIND_EVEN_ODD
The String constant for WindingRule.WIND_EVEN_ODD.

See Also:
Constant Field Values

Alternate_WIND_NON_ZERO

public static final String Alternate_WIND_NON_ZERO
The alternate String constant for WindingRule.WIND_NON_ZERO without underscore characters.

See Also:
Constant Field Values

Alternate_WIND_EVEN_ODD

public static final String Alternate_WIND_EVEN_ODD
The alternate String constant for WindingRule.WIND_EVEN_ODD without underscore characters.

See Also:
Constant Field Values

pathlist

protected Vector pathlist
The path list.


windingrule

protected WindingRule windingrule
The winding rule as an object.

Constructor Detail

PathList

public PathList()
The default constructor that sets the path list to empty and the winding rule to WindingRule.WIND_NON_ZERO.


PathList

public PathList(WindingRule rule)
The constructor that sets the path list to empty and the winding rule to the given winding rule.

Parameters:
rule - the desired winding rule

PathList

public PathList(PathNode[] nodes)

The constructor that initializes the path list using the given array of path nodes and sets the winding rule to WindingRule.WIND_NON_ZERO.

Parameters:
nodes - the nodes to add to the path list

PathList

public PathList(PathNode[] nodes,
                WindingRule rule)

The constructor that initializes the path list using the given array of path nodes and the given winding rule.

Parameters:
nodes - the nodes to add to the path list
rule - the winding rule as an object

PathList

public PathList(PathNode[] nodes,
                int rule)

The constructor that initializes the path list using the given array of path nodes and the given winding rule.

Parameters:
nodes - the nodes to add to the path list
rule - the winding rule as an int

PathList

public PathList(PathList list)

The constructor that makes a deep clone of an existing path list.

Parameters:
list - the path list to clone

PathList

public PathList(Shape shape)

The constructor that initializes the path list using the path nodes and winding rule obtained from the given Shape.

Parameters:
shape - the shape whose data is cloned to this list

PathList

public PathList(Shape shape,
                AffineTransform transform)

The constructor that initializes the path list using the path nodes and winding rule obtained from the given Shape after applying the given transform to the shape data.

Parameters:
shape - the shape whose data is used to make this list
transform - the transform to apply to the shape data

PathList

public PathList(Shape shape,
                AffineTransform transform,
                double flatness)

The constructor that initializes the path list using the path nodes and winding rule obtained from the given Shape after applying the given transform and flatness to the shape data.

Parameters:
shape - the shape whose data is used to make this list
transform - the transform to apply to the shape data
flatness - the flatness to require

PathList

public PathList(PathIterator iterator)

The constructor that initializes the path list using the path nodes and winding rule obtained from the given PathIterator.

The constructor must execute the iteration so when it is complete then iterator.isDone() will be true.

Parameters:
iterator - the iterator whose data is cloned to this list

PathList

public PathList(Point2D[] points,
                boolean close)

The constructor that makes a polygon path list using the given array points of point data; the boolean close determines whether or the polygon is open or closed.

Does nothing if points is null.

Ignores null data items in points.

The path list is constructed by doing MOVE to the first point and LINE to all succeeding points. If the boolean close is true then CLOSE is appended at the end.

Parameters:
points - the polygon points
close - whether or not to close the polygon

PathList

public PathList(Point2D[] points,
                boolean close,
                WindingRule rule)

The constructor that makes a polygon path list using the given array points of point data; the boolean close determines whether or the polygon is open or closed; the given winding rule determines the winding rule.

Utilizes PathList(Point2D[], boolean).

Parameters:
points - the polygon points
close - whether or not to close the polygon
rule - the winding rule as an object

PathList

public PathList(Point2D[] points,
                boolean close,
                int rule)

The constructor that makes a polygon path list using the given array points of point data; the boolean close determines whether or the polygon is open or closed; the given winding rule determines the winding rule.

Utilizes PathList(Point2D[], boolean).

Parameters:
points - the polygon points
close - whether or not to close the polygon
rule - the winding rule as an int
Method Detail

makeShape

public final Shape makeShape()

Factory method that returns a new Shape based on the current data in this path list. The Shape is constructed using the Java class GeneralPath.

See the notes in the introduction to this class concerning how this Shape is constructed.


makeVertexShape

public final Shape makeVertexShape()

Returns a polygonal Shape that passes through the vertex points of this pathlist.


makeBezierShape

public final Shape makeBezierShape()

Returns a polygonal Shape that passes through the bezier points of this pathlist, that is, both the vertex points and the control points.


makeVertexDotsShape

public final Shape makeVertexDotsShape()
Returns a Shape that consists of the vertex dots.


makeBezierDotsShape

public final Shape makeBezierDotsShape()
Returns a Shape that consists of the bezier dots.


makeControlDotsShape

public final Shape makeControlDotsShape()
Returns a Shape that consists of the control dots.


makePathListIterator

public final PathListIterator makePathListIterator()

Factory method that returns a new PathListIterator based on the current data in this path list.


makeStructurePaintable

public final PaintableSequence makeStructurePaintable(Color fillColor,
                                                      Color drawColor,
                                                      Color vertexDotsColor,
                                                      Color controlDotsColor,
                                                      Color vertexFrameColor,
                                                      Color bezierFrameColor,
                                                      Color pathPointsColor,
                                                      int thickness,
                                                      int divisions)

Returns a PaintableSequence whose components show the structure of the Shape associated with this PathList.

Each component in the sequence corresponds to one of the Color parameters and if a particular parameter is null or has an alpha value of 0 then that particular component is omitted from the sequence.

The components are inserted into the sequence from top to bottom as follows.

At the top, the path points computed algorithmically with the given number of divisions of the unit interval. These points are computed using the methods of the class PathListFunction. The points are inserted as an internal paintable sequence. Each point uses a PointPaintable with the path points color.

Next, the dots corresponding to the Bezier control points are inserted as an internal paintable sequence. Each dot uses a PointPaintable with the control dots color.

Next, the dots corresponding to the vertex points are inserted as an internal paintable sequence. Each dot uses a PointPaintable with the vertex dots color.

Next, the shape constructed by makeShape is inserted into the sequence as a ShapePaintable to be drawn in the draw color.

Next, the frame constructed by makeBezierShape is inserted into the sequence as a ShapePaintable to be drawn in the bezier frame color.

Next, the frame constructed by makeVertexShape is inserted into the sequence as a ShapePaintable to be drawn in the vertex frame color.

Finally, the shape constructed by makeShape is inserted into the sequence as a ShapePaintable to be filled in the fill color.

This order of insertion ensures that the dots are on top, the drawn shape is next, the frames are next, and the filled shape is on the bottom. This order gives the maximum amount of information to the user of this method.

The thickness controls the thickness of the drawing stroke. Also, the PointPaintable for the dots uses a size equal to (thickness+2).

Parameters:
fillColor - the fill color for the shape
drawColor - the draw color for the shape
vertexDotsColor - the color for the vertex dots
controlDotsColor - the color for the control dots
vertexFrameColor - the color for the vertex frame
bezierFrameColor - the color for the bezier frame
pathPointsColor - the color for the path points
thickness - the stroke thickness
divisions - the number of subdivisions of a unit interval when constructing path points

makeStructurePaintable

public final PaintableSequence makeStructurePaintable(Color fillColor,
                                                      Color drawColor,
                                                      Color vertexDotsColor,
                                                      Color controlDotsColor,
                                                      Color vertexFrameColor,
                                                      Color bezierFrameColor,
                                                      int thickness)

Returns a PaintableSequence whose components show the structure of the Shape associated with this PathList.

Calls the most general method with the following defaults.

  pathPointsColor:  Colors.transparent
  divisions:        1

In particular, with these defaults, the path points are not included in the PaintableSequence.

Parameters:
fillColor - the fill color for the shape
drawColor - the draw color for the shape
vertexDotsColor - the color for the vertex dots
controlDotsColor - the color for the control dots
vertexFrameColor - the color for the vertex frame
bezierFrameColor - the color for the bezier frame
thickness - the stroke thickness

makeStructurePaintable

public final PaintableSequence makeStructurePaintable(Color fillColor,
                                                      Color drawColor,
                                                      int thickness)

Returns a PaintableSequence whose components show the structure of the Shape associated with this PathList.

Calls the most general method with the following defaults.

  vertexDotsColor:  Colors.red
  controlDotsColor: Colors.blue
  vertexFrameColor: Colors.transparent
  bezierFrameColor: Colors.darkorchid
  pathPointsColor:  Colors.transparent
  divisions:        1

In particular, with these defaults, the vertex frame and the path points are not included in the PaintableSequence.

Parameters:
fillColor - the fill color for the shape
drawColor - the draw color for the shape
thickness - the stroke thickness

makeStructurePaintable

public final PaintableSequence makeStructurePaintable(int thickness)

Returns a PaintableSequence whose components show the structure of the Shape associated with this PathList.

Calls the most general method with the following defaults.

  fillColor:        Colors.lime
  drawColor:        Colors.black
  vertexDotsColor:  Colors.red
  controlDotsColor: Colors.blue
  vertexFrameColor: Colors.transparent
  bezierFrameColor: Colors.darkorchid
  pathPointsColor:  Colors.transparent
  divisions:        1

In particular, with these defaults, the vertex frame and the path points are not included in the PaintableSequence.

Parameters:
thickness - the stroke thickness

makeStructurePaintable

public final PaintableSequence makeStructurePaintable()

Returns a PaintableSequence whose components show the structure of the Shape associated with this PathList.

Calls the most general method with the following defaults.

  fillColor:        Colors.lime
  drawColor:        Colors.black
  vertexDotsColor:  Colors.red
  controlDotsColor: Colors.blue
  vertexFrameColor: Colors.transparent
  bezierFrameColor: Colors.darkorchid
  pathPointsColor:  Colors.transparent
  thickness:        2
  divisions:        1

In particular, with these defaults, the vertex frame and the path points are not included in the PaintableSequence.


setPathList

public final void setPathList(PathList list)

Sets this path list to be a deep clone of an existing path list.

If the given path list is null then does nothing.

Parameters:
list - the path list to clone

setPathList

public final void setPathList(Shape shape)

Sets the path list using the path nodes and winding rule obtained from the given Shape.

If the given shape is null then does nothing.

Parameters:
shape - the shape whose data is cloned to this list

setPathList

public final void setPathList(Shape shape,
                              AffineTransform transform)

Sets the path list using the path nodes and winding rule obtained from the given Shape after applying the given transform to the shape data.

Parameters:
shape - the shape whose data is used to make this list
transform - the transform to apply to the shape data

setPathList

public final void setPathList(Shape shape,
                              AffineTransform transform,
                              double flatness)

Sets the path list using the path nodes and winding rule obtained from the given Shape after applying the given transform and flatness to the shape data.

Parameters:
shape - the shape whose data is used to make this list
transform - the transform to apply to the shape data
flatness - the flatness to require

setPathList

public final void setPathList(PathIterator iterator)

Sets the path list using the path nodes and winding rule obtained from the given PathIterator.

This method must execute the iteration so when it is complete then iterator.isDone() will be true.

If the given iterator is null then does nothing.

Parameters:
iterator - the iterator whose data is cloned to this list

size

public final int size()
Returns the size of the list.


setWindingRule

public final void setWindingRule(WindingRule rule)

Sets the winding rule as an object.

Does nothing if the parameter is null.

Parameters:
rule - the winding rule as an object

setWindingRule

public final void setWindingRule(int rule)

Sets the winding rule via an int.

GeneralPath.WIND_NON_ZERO corresponds to WindingRule.WIND_NON_ZERO.

GeneralPath.WIND_EVEN_ODD corresponds to WindingRule.WIND_EVEN_ODD.

Ignores an invalid parameter.

Parameters:
rule - the winding rule as an int

getWindingRule

public final WindingRule getWindingRule()
Get the winding rule as an object.

Returns:
the winding rule

setPathNodes

public final void setPathNodes(PathNode[] nodes)

Removes the current nodes in the path list and sets the nodes to those in the given array of nodes.

If the given nodes array is null then does nothing.

Parameters:
nodes - the nodes to use for the path list

getPathNodes

public final PathNode[] getPathNodes()

Returns a PathNode array with the current path nodes in this path list.

The PathNode items in the array are live, that is, they are identical to the current items in the path list. This means that the user of this array may make changes to the path list directly. Obviously, this facility must be used with care.

The length of the array is size().

If the user changes the path list by adding or removing items then this array will be out of synchronization with the data in the path list.


set

public final void set(int index,
                      PathNode node)

Sets the PathNode at the given index to a copy of the given node if the given node is non-null and if the given index is in range; otherwise does nothing.

Parameters:
index - the index of a path node in the path list
node - the path node to copy

get

public final PathNode get(int index)

Returns the PathNode at the given index if the given index is in range; otherwise returns null.

Parameters:
index - the index of a path node in the path list

add

public final void add(int index,
                      PathNode node)

Inserts the specified node at the specified position in this PathList and shifts any elements right as needed.

Does not clone the node but adds the node as is.

Does nothing if the given node is null. It is therefore impossible to place a null node in the list.

Forces the given index into the range:

    0 <= index <= size()

Parameters:
index - the list position
node - the node to add to the list

add

public final void add(int index,
                      PathNode[] nodes)

Inserts the specified array of nodes into this PathList starting at the specified position in the list and shifts any elements right as needed.

Does not clone any nodes but adds them as is.

Does nothing if the given node array is null and ignores any null items in the array.

Forces the given start index into the range:

    0 <= index <= size()

Parameters:
index - the list start position
nodes - the nodes to add to the list

add

public final void add(int index,
                      PathNode[] nodes,
                      boolean connect)

Inserts the specified array of nodes into this PathList starting at the specified position in the list and shifts any elements right as needed.

Does not clone any nodes but adds them as is.

Does nothing if the given node array is null and ignores any null items in the array.

Forces the given start index into the range:

    0 <= index <= size()

If the connect parameter is true and if the insert start index is not zero then if the first inserted node is a MOVE it will be changed to a LINE. If the connect parameter is false then there will be no change to the first inserted node.

Parameters:
index - the list start position
nodes - the nodes to add to the list
connect - whether or not to modify the first inserted node in order to connect the inserted nodes to the existing nodes

cloneAndAdd

public final void cloneAndAdd(int index,
                              PathNode node)

Inserts a clone of the specified node at the specified position in this PathList and shifts any elements right as needed.

Does nothing if the given node is null. It is therefore impossible to place a null node in the list.

Forces the given index into the range:

    0 <= index <= size()

Parameters:
index - the list position
node - the node to add to the list

cloneAndAdd

public final void cloneAndAdd(int index,
                              PathNode[] nodes)

Inserts clones of the specified array of nodes to this PathList starting at the specified position in the list and shifts any elements right as needed.

Does nothing if the given node array is null and ignores any null items in the array.

Forces the given start index into the range:

    0 <= index <= size()

Parameters:
index - the list start position
nodes - the nodes to clone and add to the list

cloneAndAdd

public final void cloneAndAdd(int index,
                              PathNode[] nodes,
                              boolean connect)

Inserts clones of the specified array of nodes to this PathList starting at the specified position in the list and shifts any elements right as needed.

Does nothing if the given node array is null and ignores any null items in the array.

Forces the given start index into the range:

    0 <= index <= size()

If the connect parameter is true and if the insert start index is not zero then if the first inserted node is a MOVE it will be changed to a LINE. If the connect parameter is false then there will be no change to the first inserted node.

Parameters:
index - the list start position
nodes - the nodes to clone and add to the list
connect - whether or not to modify the first inserted node in order to connect the inserted nodes to the existing nodes

move

public final PathList move(double x1,
                           double y1)

Append a new PathNode of type MOVE.

Returns this list to facilitate additional append operations.


line

public final PathList line(double x1,
                           double y1)

Append a new PathNode of type LINE.

Returns this list to facilitate additional append operations.


quad

public final PathList quad(double x1,
                           double y1,
                           double x2,
                           double y2)

Append a new PathNode of type QUAD.

Returns this list to facilitate additional append operations.


cubic

public final PathList cubic(double x1,
                            double y1,
                            double x2,
                            double y2,
                            double x3,
                            double y3)

Append a new PathNode of type CUBIC.

Returns this list to facilitate additional append operations.


close

public final PathList close()

Append a new PathNode of type CLOSE.

Returns this list to facilitate additional append operations.


append

public final PathList append(PathNode node)

Appends the specified node to this PathList.

Does not clone the node but appends the node as is.

Does nothing if the given node is null.

Returns this list to facilitate additional append operations.

Parameters:
node - the node to append to the list

append

public final PathList append(PathNode[] nodes)

Appends the specified array of nodes to this PathList.

Does not clone any nodes but appends them as is.

Does nothing if the given node array is null and ignores any null items in the array.

Returns this list to facilitate additional append operations.

Parameters:
nodes - the nodes to append to the list

append

public final PathList append(PathNode[] nodes,
                             boolean connect)

Appends the specified array of nodes to this PathList.

Does not clone any nodes but appends them as is.

Does nothing if the given node array is null and ignores any null items in the array.

If the connect parameter is true and if the current list is not empty then if the first appended node is a MOVE it will be changed to a LINE. If the connect parameter is false then there will be no change to the first appended node.

Returns this list to facilitate additional append operations.

Parameters:
nodes - the nodes to append to the list
connect - whether or not to modify the first appended node in order to connect the appended nodes to the existing nodes

cloneAndAppend

public final PathList cloneAndAppend(PathNode node)

Appends a clone of the specified node to this PathList.

Does nothing if the given node is null.

Returns this list to facilitate additional append operations.

Parameters:
node - the node to clone and append to the list

cloneAndAppend

public final PathList cloneAndAppend(PathNode[] nodes)

Appends clones of the specified array of nodes to this PathList.

Does nothing if the given node array is null and ignores any null items in the array.

Returns this list to facilitate additional append operations.

Parameters:
nodes - the nodes to clone and append to the list

cloneAndAppend

public final PathList cloneAndAppend(PathNode[] nodes,
                                     boolean connect)

Appends clones of the specified array of nodes to this PathList.

Does nothing if the given node array is null and ignores any null items in the array.

If the connect parameter is true and if the current list is not empty then if the first appended node is a MOVE it will be changed to a LINE. If the connect parameter is false then there will be no change to the first appended node.

Returns this list to facilitate additional append operations.

Parameters:
nodes - the nodes to clone and append to the list
connect - whether or not to modify the first appended node in order to connect the appended nodes to the existing nodes

append

public final PathList append(PathList pathList)

Extract the path nodes from the given path list, clone each of these nodes, and append the cloned nodes to this path list.

Does nothing if the given path list is null.

Does not change the winding rule of this path list.

Note: To append without cloning, use the idiom:

    append(pathList.getPathNodes());

It is not recommended to append a path list without cloning.

Returns this list to facilitate additional append operations.

Parameters:
pathList - the path list whose nodes will be cloned and appended

append

public final PathList append(PathList pathList,
                             boolean connect)

Extract the path nodes from the given path list, clone each of these nodes, and append the cloned nodes to this path list.

Does nothing if the given path list is null.

Does not change the winding rule of this path list.

If the connect parameter is true and if the current list is not empty then if the first appended node is a MOVE it will be changed to a LINE. If the connect parameter is false then there will be no change to the first appended node.

Note: To append without cloning, use the idiom:

    append(pathList.getPathNodes(), connect);

It is not recommended to append a path list without cloning.

Returns this list to facilitate additional append operations.

Parameters:
pathList - the path list whose nodes will be cloned and appended
connect - whether or not to modify the first appended node in order to connect the appended nodes to the existing nodes

append

public final PathList append(Shape shape)

Extracts the path node data from the given shape and appends the nodes to this path list.

Returns this list to facilitate additional append operations.

Parameters:
shape - the shape whose data is to be extracted

append

public final PathList append(Shape shape,
                             boolean connect)

Extracts the path node data from the given shape and appends the nodes to this path list.

If the connect parameter is true and if the current list is not empty then the first appended node will be changed from a MOVE to a LINE.

Returns this list to facilitate additional append operations.

Parameters:
shape - the shape whose data is to be extracted
connect - whether or not to modify the first appended node in order to connect the appended nodes to the existing nodes

append

public final PathList append(Shape shape,
                             AffineTransform transform)

Extracts the path node data from the given shape and appends the nodes to this path list after applying the given transform.

Returns this list to facilitate additional append operations.

Parameters:
shape - the shape whose data is to be extracted
transform - the transform to apply to the shape data

append

public final PathList append(Shape shape,
                             AffineTransform transform,
                             boolean connect)

Extracts the path node data from the given shape and appends the nodes to this path list after applying the given transform.

If the connect parameter is true and if the current list is not empty then the first appended node will be changed from a MOVE to a LINE.

Returns this list to facilitate additional append operations.

Parameters:
shape - the shape whose data is to be extracted
transform - the transform to apply to the shape data
connect - whether or not to modify the first appended node in order to connect the appended nodes to the existing nodes

append

public final PathList append(Shape shape,
                             AffineTransform transform,
                             double flatness)

Extracts the path node data from the given shape and appends the nodes to this path list after applying the given transform and flatness.

Returns this list to facilitate additional append operations.

Parameters:
shape - the shape whose data is to be extracted
transform - the transform to apply to the shape data
flatness - the flatness to require

append

public final PathList append(Shape shape,
                             AffineTransform transform,
                             double flatness,
                             boolean connect)

Extracts the path node data from the given shape and appends the nodes to this path list after applying the given transform and flatness.

If the connect parameter is true and if the current list is not empty then the first appended node will be changed from a MOVE to a LINE.

Returns this list to facilitate additional append operations.

Parameters:
shape - the shape whose data is to be extracted
transform - the transform to apply to the shape data
flatness - the flatness to require
connect - whether or not to modify the first appended node in order to connect the appended nodes to the existing nodes

append

public final PathList append(PathIterator iterator)

Extracts the path node data from the given iterator and appends the nodes to this path list.

The method must execute the iteration so when it is complete then iterator.isDone() will be true.

Returns this list to facilitate additional append operations.

Parameters:
iterator - the iterator whose data is to be extracted

append

public final PathList append(PathIterator iterator,
                             boolean connect)

Extracts the path node data from the given iterator and appends the nodes to this path list.

If the connect parameter is true and if the current list is not empty then if the first appended node is a MOVE it will be changed to a LINE. If the connect parameter is false then there will be no change to the first appended node.

The method must execute the iteration so when it is complete then iterator.isDone() will be true.

Returns this list to facilitate additional append operations.

Parameters:
iterator - the iterator whose data is to be extracted
connect - whether or not to modify the first appended node in order to connect the appended nodes to the existing nodes

remove

public final PathNode remove(int index)

Removes the PathNode at the given index and returns the removed node.

Returns null if the index is not valid.

Parameters:
index - the index of the PathNode to remove

remove

public final PathNode[] remove(int m,
                               int n)

Removes the PathNodes starting at the given index m inclusive and ending at the given index n exclusive; returns an array with the removed nodes.

Forces m and n into range if needed.

Returns an array of length 0 if no nodes are removed.

Parameters:
m - the starting index inclusive
n - the ending index exclusive

removeAll

public final PathNode[] removeAll()
Removes all PathNodes from the path list and returns an array with the removed nodes.


setSlot

public final void setSlot(int index,
                          int slot,
                          double x,
                          double y)

Sets the contents of the given slot of the PathNode at the given index to the given x, y if the index is in range and the slot is valid; otherwise does nothing.

Parameters:
index - the index of a path node in the path list
slot - the slot within the path node (1, 2, 3)
x - the x-coordinate
y - the y-coordinate

setSlot

public final void setSlot(int index,
                          int slot,
                          float[] pair)

Sets the contents of the given slot of the PathNode at the given index to the coordinates of the given pair if the index is in range and the slot is valid and if pair is non-null and of length 2; otherwise does nothing.

Parameters:
index - the index of a path node in the path list
slot - the slot within the path node (1, 2, 3)
pair - the float[2] array with x, y

setSlot

public final void setSlot(int index,
                          int slot,
                          double[] pair)

Sets the contents of the given slot of the PathNode at the given index to the coordinates of the given pair if the index is in range and the slot is valid and if pair is non-null and of length 2; otherwise does nothing.

Parameters:
index - the index of a path node in the path list
slot - the slot within the path node (1, 2, 3)
pair - the double[2] array with x, y

setSlot

public final void setSlot(int[] indices,
                          double x,
                          double y)

Sets the contents of the slot indices[1] of the PathNode at the index indices[0] to the given x, y if indices is non-null and of length 2 and if the index is in range and the slot is valid; otherwise does nothing.

Parameters:
indices - the index-slot pair
x - the x-coordinate
y - the y-coordinate

setSlot

public final void setSlot(int[] indices,
                          float[] pair)

Sets the contents of the slot indices[1] of the PathNode at the index indices[0] to the coordinates of the given pair if indices is non-null and of length 2, if the index is in range and the slot is valid, and if pair is non-null and of length 2; otherwise does nothing.

Parameters:
indices - the index-slot pair
pair - the float[2] array with x, y

setSlot

public final void setSlot(int[] indices,
                          double[] pair)

Sets the contents of the slot indices[1] of the PathNode at the index indices[0] to the coordinates of the given pair if indices is non-null and of length 2, if the index is in range and the slot is valid, and if pair is non-null and of length 2; otherwise does nothing.

Parameters:
indices - the index-slot pair
pair - the double[2] array with x, y

getSlot

public final float[] getSlot(int index,
                             int slot)

Returns the contents of the given slot of the PathNode at the given index if the index is in range and the slot is valid; otherwise returns null.

Parameters:
index - the index of a path node in the path list
slot - the slot within the path node (1, 2, 3)

getSlot

public final float[] getSlot(int[] indices)

Returns the contents of the slot indices[1] of the PathNode at the index indices[0] if indices is non-null and of length 2 and if the index is in range and the slot is valid; otherwise returns null.

Parameters:
indices - the index-slot pair

nearSlot

public final int[] nearSlot(double x,
                            double y,
                            double epsilon)

Searches the nodes in this path list and for each such node searches the slots in the node to determine if the given (x,y) is within epsilon of the values in the slot; if successful, returns an array int[2] with value 0 equal to the node index and value 1 equal to the slot index; if unsuccessful, returns null.

The metric Metric.MAX is used.

Parameters:
x - the x-coordinate of the search point
y - the y-coordinate of the search point
epsilon - the measure of closeness

nearSlot

public final int[] nearSlot(double x,
                            double y,
                            double epsilon,
                            Metric metric)

Searches the nodes in this path list and for each such node searches the slots in the node to determine if the given (x,y) is within epsilon of the values in the slot relative to the given metric; if successful, returns an array int[2] with value 0 equal to the node index and value 1 equal to the slot index; if unsuccessful, returns null.

If the given metric is null then Metric.MAX is used.

Parameters:
x - the x-coordinate of the search point
y - the y-coordinate of the search point
epsilon - the measure of closeness
metric - the metric to do the distance computation

transform

public final void transform(AffineTransform T)

Transforms the internal data points in each path node using the given affine transform.

Does nothing if the given affine transform is null.

Parameters:
T - the affine transform

isValid

public final boolean isValid()

Returns true if this PathList is a valid path list for the construction of a Shape.

More precisely, returns true if the list is empty (size is zero) or if the initial PathNode has type MOVE.

As of 2.6.0a, the method makeShape will attempt to construct the best possible shape even if this path list is not valid.


isPolygon

public final boolean isPolygon()

Returns true if the list has at least 2 nodes, all nodes in the list have one of the following 3 types MOVE, LINE, CLOSE, and the first node is MOVE.

This is a "loose" definition of "polygon" since the method does not make assertions about whether the path consists of one open or closed chain of line segments.


isStrictPolygon

public final boolean isStrictPolygon()

Returns true if the list has at least 2 nodes, the initial node has type MOVE, the final node has type LINE or CLOSE, all inner nodes have type LINE, and at least one node has type LINE.

Historical note: Java defines java.awt.Polygon. Since this class is awt-based, the coordinates of a point must be integers not floating point numbers. In addition, this class requires that a polygon be closed and have WIND_EVEN_ODD at its winding rule. This method intentionally does not test for these constraints since we do believe them to be essential.


makeVertexPathList

public final PathList makeVertexPathList()

Returns a new PathList with the same winding rule as this path list and whose nodes are constructed from the nodes of this path list by the following operations.

If the type of a node is MOVE, LINE, or CLOSE, then a copy of the node is inserted in the new list.

A node of the form QUAD[x1;y1;x2;y2] is replaced by a node LINE[x2;y2].

A node of the form CUBIC[x1;y1;x2;y2;x3;y3] is replaced by a node LINE[x3;y3].

If isPolygon() is true then this method just returns a copy of this path list.


makeBezierPathList

public final PathList makeBezierPathList()

Returns a new PathList with the same winding rule as this path list and whose nodes are constructed from the nodes of this path list by the following operations.

If the type of a node is MOVE, LINE, or CLOSE, then a copy of the node is inserted in the new list.

A node of the form QUAD[x1;y1;x2;y2] is replaced by 2 nodes LINE[x1;y1], LINE[x2;y2].

A node of the form CUBIC[x1;y1;x2;y2;x3;y3] is replaced by 3 nodes LINE[x1;y1], LINE[x2;y2], LINE[x3;y3].

If isPolygon() is true then this method just returns a copy of this path list.


makeVertexDotsPathList

public final PathList makeVertexDotsPathList()

Returns a new PathList with the same winding rule as this path list and whose nodes are constructed from the nodes of this path list by the following operations.

If the type of a node is CLOSE, then the node is ignored.

A node of the form MOVE[x1;y1] or the form LINE[x1;y1] is replaced by 2 nodes MOVE[x1;y1], LINE[x1;y1].

A node of the form QUAD[x1;y1;x2;y2] is replaced by 2 nodes MOVE[x2;y2], LINE[x2;y2].

A node of the form CUBIC[x1;y1;x2;y2;x3;y3] is replaced by 2 nodes MOVE[x3;y3], LINE[x3;y3].


makeBezierDotsPathList

public final PathList makeBezierDotsPathList()

Returns a new PathList with the same winding rule as this path list and whose nodes are constructed from the nodes of this path list by the following operations.

If the type of a node is CLOSE, then the node is ignored.

A node of the form MOVE[x1;y1] or the form LINE[x1;y1] is replaced by 2 nodes MOVE[x1;y1], LINE[x1;y1].

A node of the form QUAD[x1;y1;x2;y2] is replaced by 4 nodes MOVE[x1;y1], LINE[x1;y1], MOVE[x2;y2], LINE[x2;y2].

A node of the form CUBIC[x1;y1;x2;y2;x3;y3] is replaced by 6 nodes MOVE[x1;y1], LINE[x1;y1], MOVE[x2;y2], LINE[x2;y2], MOVE[x3;y3], LINE[x3;y3].


makeControlDotsPathList

public final PathList makeControlDotsPathList()

Returns a new PathList with the same winding rule as this path list and whose nodes are constructed from the nodes of this path list by the following operations.

If the type of a node is MOVE, LINE, or CLOSE, then the node is ignored.

A node of the form QUAD[x1;y1;x2;y2] is replaced by 2 nodes MOVE[x1;y1], LINE[x1;y1].

A node of the form CUBIC[x1;y1;x2;y2;x3;y3] is replaced by 4 nodes MOVE[x1;y1], LINE[x1;y1], MOVE[x2;y2], LINE[x2;y2].


makeVertexPathListIterator

public final PathListIterator makeVertexPathListIterator()
Returns a PathListIterator constructed from an instance of makeVertexPathList().


makeBezierPathListIterator

public final PathListIterator makeBezierPathListIterator()
Returns a PathListIterator constructed from an instance of makeBezierPathList().


makeVertexDotsPathListIterator

public final PathListIterator makeVertexDotsPathListIterator()
Returns a PathListIterator constructed from an instance of makeVertexDotsPathList().


makeBezierDotsPathListIterator

public final PathListIterator makeBezierDotsPathListIterator()
Returns a PathListIterator constructed from an instance of makeBezierDotsPathList().


makeControlDotsPathListIterator

public final PathListIterator makeControlDotsPathListIterator()
Returns a PathListIterator constructed from an instance of makeControlDotsPathList().


makeVertexPoints

public final Point2D[] makeVertexPoints()

Returns a new Point2D[] whose points are built to include the vertex points of the path list by the following operations.

For a node of the form MOVE[x1;y1] or LINE[x1;y1], 1 point [x1;y1] is added to the array.

For a node of the form QUAD[x1;y1;x2;y2], 1 point [x2;y2] is added to the array.

For a node of the form CUBIC[x1;y1;x2;y2;x3;y3], 1 point [x3;y3] is added to the array.


makeBezierPoints

public final Point2D[] makeBezierPoints()

Returns a new Point2D[] whose points are built to include the bezier points of the path list by the following operations.

For a node of the form MOVE[x1;y1] or LINE[x1;y1], 1 point [x1;y1] is added to the array.

For a node of the form QUAD[x1;y1;x2;y2], 2 points [x1;y1], [x2;y2] are added to the array.

For a node of the form CUBIC[x1;y1;x2;y2;x3;y3], 3 points [x1;y1], [x2;y2], [x3;y3] are added to the array.


makeControlPoints

public final Point2D[] makeControlPoints()

Returns a new Point2D[] whose points are built to include the control points of the path list by the following operations.

For a node of the form QUAD[x1;y1;x2;y2], 1 point [x1;y1] is added to the array.

For a node of the form CUBIC[x1;y1;x2;y2;x3;y3], 2 points [x1;y1], [x2;y2] are added to the array.


makeVertexShape

public static Shape makeVertexShape(Shape shape)

Static method that returns the vertex shape corresponding to the given shape.

Current implementation: Use the shape to make a path list and then use the path list to make the associated vertex shape.

Parameters:
shape - the shape whose vertex shape is desired

makeBezierShape

public static Shape makeBezierShape(Shape shape)

Static method that returns the bezier shape corresponding to the given shape.

Current implementation: Use the shape to make a path list and then use the path list to make the associated bezier shape.

Parameters:
shape - the shape whose bezier shape is desired

makeVertexDotsShape

public static Shape makeVertexDotsShape(Shape shape)

Static method that returns the vertex dots shape corresponding to the given shape.

Current implementation: Use the shape to make a path list and then use the path list to make the associated vertex dots shape.

Parameters:
shape - the shape whose vertex dots shape is desired

makeBezierDotsShape

public static Shape makeBezierDotsShape(Shape shape)

Static method that returns the bezier dots shape corresponding to the given shape.

Current implementation: Use the shape to make a path list and then use the path list to make the associated bezier dots shape.

Parameters:
shape - the shape whose bezier dots shape is desired

makeControlDotsShape

public static Shape makeControlDotsShape(Shape shape)

Static method that returns the control dots shape corresponding to the given shape.

Current implementation: Use the shape to make a path list and then use the path list to make the associated control dots shape.

Parameters:
shape - the shape whose control dots shape is desired

makeVertexPoints

public static Point2D[] makeVertexPoints(Shape shape)

Static method that returns the vertex point array for the given shape.

Current implementation: Use the shape to make a path list and then use the path list to make the associated vertex point array.

Parameters:
shape - the shape whose vertex point array is desired

makeBezierPoints

public static Point2D[] makeBezierPoints(Shape shape)

Static method that returns the bezier point array for the given shape.

Current implementation: Use the shape to make a path list and then use the path list to make the associated bezier point array.

Parameters:
shape - the shape whose bezier point array is desired

makeControlPoints

public static Point2D[] makeControlPoints(Shape shape)

Static method that returns the control point array for the given shape.

Current implementation: Use the shape to make a path list and then use the path list to make the associated control point array.

Parameters:
shape - the shape whose control point array is desired

getX

public final double getX(double t)

Returns the x-coordinate of a point on the path corresponding to the parameter t.

Uses this path list to construct a PathListFunction object and then calls the corresponding method of that class.

To compute multiple points, it is more efficient to create a PathListFunction object once and then to use that object repeatedly.

Parameters:
t - the point function parameter as a double

getY

public final double getY(double t)

Returns the y-coordinate of a point on the path corresponding to the parameter t.

Uses this path list to construct a PathListFunction object and then calls the corresponding method of that class.

To compute multiple points, it is more efficient to create a PathListFunction object once and then to use that object repeatedly.

Parameters:
t - the point function parameter as a double

getShapePoint2D

public final XPoint2D getShapePoint2D(double t)

Returns the point on the path corresponding to the parameter t as XPoint2D.

Uses this path list to construct a PathListFunction object and then calls the corresponding method of that class.

To compute multiple points, it is more efficient to create a PathListFunction object once and then to use that object repeatedly.

Parameters:
t - the point function parameter as a double

getShapePoint

public final float[] getShapePoint(float t)

Returns the point on the path corresponding to the parameter t as float[2].

Uses this path list to construct a PathListFunction object and then calls the corresponding method of that class.

To compute multiple points, it is more efficient to create a PathListFunction object once and then to use that object repeatedly.

Parameters:
t - the point function parameter as a float

toString

public final String toString()

Returns the data in this path list as a multi-line String.

The first line returned is one of the following two lines:

WIND_NON_ZERO
WIND_EVEN_ODD

The remaining lines give the PathNode information for each path node in the path list using the toString() method of that class.


toStringData

public final String toStringData()
Returns the same String as toString().

Specified by:
toStringData in interface Stringable
See Also:
Stringable.fromStringData(String)

fromStringData

public final void fromStringData(String data)
                          throws ParseException

Sets the data of this path list using String data in the format produced by toString().

Throws ParseException if the data is not in the correct format.

Specified by:
fromStringData in interface Stringable
Parameters:
data - the String with the list information
Throws:
ParseException
See Also:
Stringable.toStringData()

getWindingRuleString

public final String getWindingRuleString()

Returns a String with the winding rule information.

Returns one of:

WIND_NON_ZERO
WIND_EVEN_ODD


getWindingRuleFromStringData

public final WindingRule getWindingRuleFromStringData(String data)
                                               throws ParseException

Returns the WindingRule that corresponds to the given String data.

The valid input data is:

WIND_NON_ZERO
WIND_EVEN_ODD

Throws ParseException if the winding rule data does not match either of the above strings.

Parameters:
data - the String with the winding rule
Throws:
ParseException

getPathNodeStateArray

public final String[] getPathNodeStateArray()

Returns a String array with the value of the method toStringData applied to each item in the array returned by getPathNodes.


JavaCode

public final String JavaCode()

Returns in a String the Java code that might be used to make a clone of this path list.

The Java code has the following format:

new PathList(WindingRule.???)

followed by zero or more lines of the form:

.move(x1,y1)
.line(x1,y1)
.quad(x1,y1,x2,y2)
.cubic(x1,y1,x2,y2,x3,y3)
.close()