|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.gui.PathList
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:
move, line, quad,
cubic, and close to append PathNode
objects of a specific type to this PathList. These member
methods parallel the 5 static factory methods that are built into the class
PathNode.
PathList will now return a
reference to this object via the statement
return this. This will allow concatenation of such
append method calls.
JavaCode that returns in a String
the Java code that might be used to make a clone of this path list.
The Java code facility is used for experimental environments.
| 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 |
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
private static final int CAP_ROUND
private static final int JOIN_ROUND
public static final String standardMessage
public static final String String_WIND_NON_ZERO
public static final String String_WIND_EVEN_ODD
public static final String Alternate_WIND_NON_ZERO
public static final String Alternate_WIND_EVEN_ODD
protected Vector pathlist
protected WindingRule windingrule
| Constructor Detail |
public PathList()
public PathList(WindingRule rule)
rule - the desired winding rulepublic 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.
nodes - the nodes to add to the path list
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.
nodes - the nodes to add to the path listrule - the winding rule as an object
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.
nodes - the nodes to add to the path listrule - the winding rule as an intpublic PathList(PathList list)
The constructor that makes a deep clone of an existing path list.
list - the path list to clonepublic PathList(Shape shape)
The constructor that initializes the path list using
the path nodes and winding rule obtained from the given
Shape.
shape - the shape whose data is cloned to this list
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.
shape - the shape whose data is used to make this listtransform - the transform to apply to the shape data
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.
shape - the shape whose data is used to make this listtransform - the transform to apply to the shape dataflatness - the flatness to requirepublic 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.
iterator - the iterator whose data is cloned to this list
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.
points - the polygon pointsclose - whether or not to close the polygon
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).
points - the polygon pointsclose - whether or not to close the polygonrule - the winding rule as an object
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).
points - the polygon pointsclose - whether or not to close the polygonrule - the winding rule as an int| Method Detail |
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.
public final Shape makeVertexShape()
Returns a polygonal Shape that passes through
the vertex points of this pathlist.
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.
public final Shape makeVertexDotsShape()
Shape that consists of the vertex dots.
public final Shape makeBezierDotsShape()
Shape that consists of the bezier dots.
public final Shape makeControlDotsShape()
Shape that consists of the control dots.
public final PathListIterator makePathListIterator()
Factory method that returns a new PathListIterator
based on the current data in this path list.
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).
fillColor - the fill color for the shapedrawColor - the draw color for the shapevertexDotsColor - the color for the vertex dotscontrolDotsColor - the color for the control dotsvertexFrameColor - the color for the vertex framebezierFrameColor - the color for the bezier framepathPointsColor - the color for the path pointsthickness - the stroke thicknessdivisions - the number of subdivisions of a unit
interval when constructing path points
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.
fillColor - the fill color for the shapedrawColor - the draw color for the shapevertexDotsColor - the color for the vertex dotscontrolDotsColor - the color for the control dotsvertexFrameColor - the color for the vertex framebezierFrameColor - the color for the bezier framethickness - the stroke thickness
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.
fillColor - the fill color for the shapedrawColor - the draw color for the shapethickness - the stroke thicknesspublic 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.
thickness - the stroke thicknesspublic 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.
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.
list - the path list to clonepublic 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.
shape - the shape whose data is cloned to this list
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.
shape - the shape whose data is used to make this listtransform - the transform to apply to the shape data
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.
shape - the shape whose data is used to make this listtransform - the transform to apply to the shape dataflatness - the flatness to requirepublic 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.
iterator - the iterator whose data is cloned to this listpublic final int size()
public final void setWindingRule(WindingRule rule)
Sets the winding rule as an object.
Does nothing if the parameter is null.
rule - the winding rule as an objectpublic 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.
rule - the winding rule as an intpublic final WindingRule getWindingRule()
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.
nodes - the nodes to use for the path listpublic 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.
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.
index - the index of a path node in the path listnode - the path node to copypublic final PathNode get(int index)
Returns the PathNode at the given index
if the given index is in range;
otherwise returns null.
index - the index of a path node in the path list
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()
index - the list positionnode - the node to add to the list
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()
index - the list start positionnodes - the nodes to add to the list
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.
index - the list start positionnodes - the nodes to add to the listconnect - whether or not to modify the first inserted node in
order to connect the inserted nodes to the existing nodes
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()
index - the list positionnode - the node to add to the list
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()
index - the list start positionnodes - the nodes to clone and add to the list
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.
index - the list start positionnodes - the nodes to clone and add to the listconnect - whether or not to modify the first inserted node in
order to connect the inserted nodes to the existing nodes
public final PathList move(double x1,
double y1)
Append a new PathNode of type MOVE.
Returns this list to facilitate additional append operations.
public final PathList line(double x1,
double y1)
Append a new PathNode of type LINE.
Returns this list to facilitate additional append operations.
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.
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.
public final PathList close()
Append a new PathNode of type CLOSE.
Returns this list to facilitate additional append operations.
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.
node - the node to append to the listpublic 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.
nodes - the nodes to append to the list
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.
nodes - the nodes to append to the listconnect - whether or not to modify the first appended node in
order to connect the appended nodes to the existing nodespublic 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.
node - the node to clone and append to the listpublic 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.
nodes - the nodes to clone and append to the list
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.
nodes - the nodes to clone and append to the listconnect - whether or not to modify the first appended node in
order to connect the appended nodes to the existing nodespublic 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.
pathList - the path list whose nodes will be cloned and appended
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.
pathList - the path list whose nodes will be cloned and appendedconnect - whether or not to modify the first appended node in
order to connect the appended nodes to the existing nodespublic 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.
shape - the shape whose data is to be extracted
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.
shape - the shape whose data is to be extractedconnect - whether or not to modify the first appended node in
order to connect the appended nodes to the existing nodes
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.
shape - the shape whose data is to be extractedtransform - the transform to apply to the shape data
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.
shape - the shape whose data is to be extractedtransform - the transform to apply to the shape dataconnect - whether or not to modify the first appended node in
order to connect the appended nodes to the existing nodes
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.
shape - the shape whose data is to be extractedtransform - the transform to apply to the shape dataflatness - the flatness to require
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.
shape - the shape whose data is to be extractedtransform - the transform to apply to the shape dataflatness - the flatness to requireconnect - whether or not to modify the first appended node in
order to connect the appended nodes to the existing nodespublic 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.
iterator - the iterator whose data is to be extracted
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.
iterator - the iterator whose data is to be extractedconnect - whether or not to modify the first appended node in
order to connect the appended nodes to the existing nodespublic 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.
index - the index of the PathNode to 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.
m - the starting index inclusiven - the ending index exclusivepublic final PathNode[] removeAll()
PathNodes from the path list
and returns an array with the removed nodes.
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.
index - the index of a path node in the path listslot - the slot within the path node (1, 2, 3)x - the x-coordinatey - the y-coordinate
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.
index - the index of a path node in the path listslot - the slot within the path node (1, 2, 3)pair - the float[2] array with x, y
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.
index - the index of a path node in the path listslot - the slot within the path node (1, 2, 3)pair - the double[2] array with x, y
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.
indices - the index-slot pairx - the x-coordinatey - the y-coordinate
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.
indices - the index-slot pairpair - the float[2] array with x, y
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.
indices - the index-slot pairpair - the double[2] array with x, y
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.
index - the index of a path node in the path listslot - the slot within the path node (1, 2, 3)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.
indices - the index-slot pair
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.
x - the x-coordinate of the search pointy - the y-coordinate of the search pointepsilon - the measure of closeness
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.
x - the x-coordinate of the search pointy - the y-coordinate of the search pointepsilon - the measure of closenessmetric - the metric to do the distance computationpublic 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.
T - the affine transformpublic 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.
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.
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.
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.
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.
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].
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].
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].
public final PathListIterator makeVertexPathListIterator()
PathListIterator constructed from
an instance of makeVertexPathList().
public final PathListIterator makeBezierPathListIterator()
PathListIterator constructed from
an instance of makeBezierPathList().
public final PathListIterator makeVertexDotsPathListIterator()
PathListIterator constructed from
an instance of makeVertexDotsPathList().
public final PathListIterator makeBezierDotsPathListIterator()
PathListIterator constructed from
an instance of makeBezierDotsPathList().
public final PathListIterator makeControlDotsPathListIterator()
PathListIterator constructed from
an instance of makeControlDotsPathList().
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.
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.
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.
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.
shape - the shape whose vertex shape is desiredpublic 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.
shape - the shape whose bezier shape is desiredpublic 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.
shape - the shape whose vertex dots shape is desiredpublic 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.
shape - the shape whose bezier dots shape is desiredpublic 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.
shape - the shape whose control dots shape is desiredpublic 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.
shape - the shape whose vertex point array is desiredpublic 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.
shape - the shape whose bezier point array is desiredpublic 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.
shape - the shape whose control point array is desiredpublic 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.
t - the point function parameter as a doublepublic 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.
t - the point function parameter as a doublepublic 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.
t - the point function parameter as a doublepublic 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.
t - the point function parameter as a floatpublic 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.
public final String toStringData()
String as toString().
toStringData in interface StringableStringable.fromStringData(String)
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.
fromStringData in interface Stringabledata - the String with the list information
ParseExceptionStringable.toStringData()public final String getWindingRuleString()
Returns a String with the winding rule information.
Returns one of:
WIND_NON_ZERO
WIND_EVEN_ODD
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.
data - the String with the winding rule
ParseExceptionpublic final String[] getPathNodeStateArray()
Returns a String array with the value of the method
toStringData applied to each item in the array
returned by getPathNodes.
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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||