public final class CubicPath extends AbstractShape
The scale factor is used to limit the magnitude of the the control points.
Several methods have two sets of arguments:
nodeIndex. This looks at all nodes in the entire shape. nodeIndex and pathIndex. This breaks the shape up into separate paths, and looks at all the nodes in a given path.com.bric.plaf.CubicPathCreationUI
| Constructor and Description |
|---|
CubicPath()
Creates an empty
CubicPath.
|
CubicPath(int windingRule)
Creates an empty
CubicPath.
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(Shape
This will append the argument to this shape.
|
void |
clear()
Empties this shape.
|
Object |
clone()
Clones this
CubicPath.
|
void |
curveTo(float cx1, float cy1, float cx2, float cy2, float x2, float y2)
This is analogous to
GeneralPath.curveTo().
|
void |
curveTo(int pathIndex, float cx1, float cy1, float cx2, float cy2, float x2, float y2)
This is analogous to
GeneralPath.curveTo().
|
Point2D |
getNextControlForNode(int pathIndex, int nodeIndex, Point2D
Returns the next control point.
|
Point2D |
getNextControlForNode(int nodeIndex, Point2D
Returns the next control point.
|
Point2D |
getNextNode(int pathIndex, int nodeIndex, Point2D
Gets the next node after the indicated node.
|
Point2D |
getNextNode(int nodeIndex, Point2D
Gets the next node after the indicated node.
|
Point2D |
getNode(int pathIndex, int nodeIndex, Point2D
Returns the coordinates of a node.
|
Point2D |
getNode(int nodeIndex, Point2D
Returns the coordinates of a node.
|
int |
getNodeCount()
Return the number of nodes in all paths.
|
int |
getNodeCount(int pathIndex)
Return the number of nodes in a given path.
|
int |
getPathCount()
Return the number of paths in this shape.
|
PathIterator |
getPathIterator(AffineTransform
Returns a
PathIterator that iterates over this shape.
|
Point2D |
getPrevControlForNode(int pathIndex, int nodeIndex, Point2D
Returns the previous control point.
|
Point2D |
getPrevControlForNode(int nodeIndex, Point2D
Returns the previous control point.
|
Point2D |
getPrevNode(int pathIndex, int nodeIndex, Point2D
Gets the previous node before the indicated node.
|
Point2D |
getPrevNode(int nodeIndex, Point2D
Gets the previous node before the indicated node.
|
double |
getScaleFactor()
Returns the scale factor.
|
int |
getWindingRule()
Returns the winding rule.
|
boolean |
hasNextControlForNode(int nodeIndex)
Returns whether a node has a next control point.
|
boolean |
hasNextControlForNode(int pathIndex, int nodeIndex)
Returns whether a node has a next control point.
|
boolean |
hasPrevControlForNode(int nodeIndex)
Returns whether a node has a previous control point.
|
boolean |
hasPrevControlForNode(int pathIndex, int nodeIndex)
Returns whether a node has a previous control point.
|
boolean |
isEmpty()
Return true if this path is empty.
|
boolean |
isNodeSharp(int nodeIndex)
A "sharp" node is a node that doesn't have a control points.
|
boolean |
isNodeSharp(int pathIndex, int nodeIndex)
A "sharp" node is a node that doesn't have a control points.
|
boolean |
isNodeSmooth(int nodeIndex, boolean equalDistance)
A "smooth" node is a node where the two control points are collinear.
|
boolean |
isNodeSmooth(int pathIndex, int nodeIndex, boolean equalDistance)
A "smooth" node is a node where the two control points are collinear.
|
void |
lineTo(float x, float y)
This is analogous to
GeneralPath.lineTo().
|
void |
lineTo(int pathIndex, float x, float y)
This is analogous to
GeneralPath.lineTo().
|
int |
moveTo(float x, float y)
This starts a new path.
|
void |
removeNode(int nodeIndex)
Removes a node from the last path in this shape.
|
void |
removeNode(int pathIndex, int nodeIndex)
Removes a node from a specified path.
|
boolean |
setNextControlForNode(int nodeIndex, double x, double y)
Sets the next control point for a node.
|
boolean |
setNextControlForNode(int pathIndex, int nodeIndex, double x, double y)
Sets the next control point for a node.
|
boolean |
setNextControlForNode(int pathIndex, int nodeIndex, Point2D
Sets the next control point for a node.
|
boolean |
setNextControlForNode(int nodeIndex, Point2D
Sets the next control point for a node.
|
boolean |
setNextControlForNodeFromPrev(int nodeIndex, boolean includeDistance)
Sets the coordinates of the next control point for a node based on the previous control point.
|
boolean |
setNextControlForNodeFromPrev(int pathIndex, int nodeIndex, boolean includeDistance)
Sets the coordinates of the next control point for a node based on the previous control point.
|
boolean |
setNode(int nodeIndex, double x, double y, boolean translateControlPoints)
Sets a node's location.
|
boolean |
setNode(int pathIndex, int nodeIndex, double x, double y, boolean translateControlPoints)
Sets a node's location.
|
boolean |
setNode(int pathIndex, int nodeIndex, Point2D
Sets a node's location.
|
boolean |
setNode(int nodeIndex, Point2D
Sets a node's location.
|
boolean |
setPrevControlForNode(int nodeIndex, double x, double y)
Sets the previous control point for a node.
|
boolean |
setPrevControlForNode(int pathIndex, int nodeIndex, double x, double y)
Sets the previous control point for a node.
|
boolean |
setPrevControlForNode(int pathIndex, int nodeIndex, Point2D
Sets the previous control point for a node.
|
boolean |
setPrevControlForNode(int nodeIndex, Point2D
Sets the coordinates of the previous control point for a node.
|
boolean |
setPrevControlForNodeFromNext(int nodeIndex, boolean includeDistance)
Sets the coordinates of the previous control point for a node based on the next control point.
|
boolean |
setPrevControlForNodeFromNext(int pathIndex, int nodeIndex, boolean includeDistance)
Sets the coordinates of the previous control point for a node based on the next control point.
|
boolean |
setScaleFactor(double sf)
This sets the scale factor for this shape.
|
void |
setWindingRule(int newRule)
Sets the winding rule.
|
String |
toString()
Returns a
String representation of this shape.
|
contains, contains, contains, contains, contains, contains, contains, contains, countCrossings, getBounds, getBounds, getBounds, getBounds2D, getBounds2D, getPathIterator, identifyCrossings, intersects, intersects, intersectspublic CubicPath()
CubicPath.
public CubicPath(int windingRule)
CubicPath.
windingRule - the winding rule.
public boolean setScaleFactor(double sf)
sf - new the scale factor. This must be greater than zero.
public double getScaleFactor()
public Objectclone()
CubicPath.
public boolean isNodeSharp(int nodeIndex)
nodeIndex - the node to examine.
public boolean isEmpty()
public boolean isNodeSharp(int pathIndex,
int nodeIndex)
pathIndex - the path to examine.
nodeIndex - the node to examine.
public boolean isNodeSmooth(int nodeIndex,
boolean equalDistance)
nodeIndex - the node to examine.
equalDistance - if this is true then the control points have to be collinear
and equidistant to the node point.
public boolean isNodeSmooth(int pathIndex,
int nodeIndex,
boolean equalDistance)
pathIndex - the path to examine.
nodeIndex - the node to examine.
equalDistance - if this is true then the control points have to be collinear
and equidistant to the node point.
public boolean setNode(int nodeIndex,
Point2D p,
boolean translateControlPoints)
nodeIndex - the node to change.
p - the new coordinates of the node.
translateControlPoints - whether the control points should translate similarly.
public boolean setNode(int nodeIndex,
double x,
double y,
boolean translateControlPoints)
nodeIndex - the node to change.
x - the new x-coordinate of the node.
y - the new y-coordinate of the node.
translateControlPoints - whether the control points should translate similarly.
public boolean setNode(int pathIndex,
int nodeIndex,
Point2D p,
boolean translateControlPoints)
pathIndex - the path to change.
nodeIndex - the node to change.
p - the new coordinates of the node.
translateControlPoints - whether the control points should translate similarly.
public boolean setNode(int pathIndex,
int nodeIndex,
double x,
double y,
boolean translateControlPoints)
pathIndex - the path to change.
nodeIndex - the node to change.
x - the new x-coordinate of the node.
y - the new y-coordinate of the node.
translateControlPoints - whether the control points should translate similarly.
public int getPathCount()
public int getNodeCount(int pathIndex)
pathIndex - the path to get the node count of.
public int getNodeCount()
public void removeNode(int nodeIndex)
public void removeNode(int pathIndex,
int nodeIndex)
public Point2DgetNode(int nodeIndex, Point2D dest)
nodeIndex - the node index.
dest - the object to store the coordinates in. May be null.
dest argument if it wasn't null.
public void clear()
public Point2DgetNode(int pathIndex, int nodeIndex, Point2D dest)
pathIndex - the path index.
nodeIndex - the node index.
dest - the object to store the coordinates in. May be null.
dest argument if it wasn't null.
public boolean setPrevControlForNode(int nodeIndex,
Point2D p)
nodeIndex - the node index.
p - the object to store the coordinates in. May be null.
null if there is no previous control point for this node. Or this will return
p if it wasn't null.
public boolean setNextControlForNodeFromPrev(int pathIndex,
int nodeIndex,
boolean includeDistance)
pathIndex - the path index.
nodeIndex - the node index.
includeDistance - whether the distances between control points and the node should be equal.
public boolean setNextControlForNodeFromPrev(int nodeIndex,
boolean includeDistance)
nodeIndex - the node index.
includeDistance - whether the distances between control points and the node should be equal.
public boolean setPrevControlForNodeFromNext(int pathIndex,
int nodeIndex,
boolean includeDistance)
pathIndex - the path index.
nodeIndex - the node index.
includeDistance - whether the distances between control points and the node should be equal.
public boolean setPrevControlForNodeFromNext(int nodeIndex,
boolean includeDistance)
nodeIndex - the node index.
includeDistance - whether the distances between control points and the node should be equal.
public boolean setPrevControlForNode(int nodeIndex,
double x,
double y)
nodeIndex - the node index.
x - the new x-coordinate of the control point.
y - the new y-coordinate of the control point.
public boolean setNextControlForNode(int nodeIndex,
Point2D p)
nodeIndex - the node index.
p - the new coordinates of the control point.
public boolean setNextControlForNode(int nodeIndex,
double x,
double y)
nodeIndex - the node index.
x - the new x-coordinate of the control point.
y - the new y-coordinate of the control point.
public Point2DgetNextNode(int nodeIndex, Point2D dest)
nodeIndex is the last node of a path and the "next" node is the zeroth node in this path.
nodeIndex - the node index.
dest - the optional destination for the coordinates.
public Point2DgetNextNode(int pathIndex, int nodeIndex, Point2D dest)
nodeIndex is the last node of a path and the "next" node is the zeroth node in this path.
pathIndex - the path index.
nodeIndex - the node index.
dest - the optional destination for the coordinates.
public Point2DgetPrevNode(int nodeIndex, Point2D dest)
nodeIndex is the zeroth node of a path and the "previous" node is the last node in this path.
nodeIndex - the node index.
dest - the optional destination for the coordinates.
public Point2DgetPrevNode(int pathIndex, int nodeIndex, Point2D dest)
nodeIndex is the zeroth node of a path and the "previous" node is the last node in this path.
pathIndex - the path index.
nodeIndex - the node index.
dest - the optional destination for the coordinates.
public boolean setPrevControlForNode(int pathIndex,
int nodeIndex,
Point2D p)
pathIndex - the path index.
nodeIndex - the node index.
p - the new coordinates of the control point.
public boolean setPrevControlForNode(int pathIndex,
int nodeIndex,
double x,
double y)
pathIndex - the path index.
nodeIndex - the node index.
x - the new x-coordinate of the control point.
y - the new y-coordinate of the control point.
public boolean setNextControlForNode(int pathIndex,
int nodeIndex,
Point2D p)
pathIndex - the path index.
nodeIndex - the node index.
p - the new coordinates of the control point.
public boolean setNextControlForNode(int pathIndex,
int nodeIndex,
double x,
double y)
pathIndex - the path index.
nodeIndex - the node index.
x - the new x-coordinate of the control point.
y - the new y-coordinate of the control point.
public Point2DgetNextControlForNode(int nodeIndex, Point2D dest)
nodeIndex - the node index.
dest - the optional destination to store the control point in.
null if there is no next control point for a node. Otherwise this will return
dest if it is non-null.
public boolean hasNextControlForNode(int nodeIndex)
nodeIndex - the node index.
public boolean hasPrevControlForNode(int nodeIndex)
nodeIndex - the node index.
public boolean hasNextControlForNode(int pathIndex,
int nodeIndex)
pathIndex - the path index.
nodeIndex - the node index.
public boolean hasPrevControlForNode(int pathIndex,
int nodeIndex)
pathIndex - the path index.
nodeIndex - the node index.
public Point2DgetPrevControlForNode(int nodeIndex, Point2D dest)
nodeIndex - the node index.
dest - the optional destination to store the control point in.
null if there is no next control point for a node. Otherwise this will return
dest if it is non-null.
public Point2DgetPrevControlForNode(int pathIndex, int nodeIndex, Point2D dest)
nodeIndex - the node index.
dest - the optional destination to store the control point in.
null if there is no next control point for a node. Otherwise this will return
dest if it is non-null.
public Point2DgetNextControlForNode(int pathIndex, int nodeIndex, Point2D dest)
pathIndex - the path index.
nodeIndex - the node index.
dest - the optional destination to store the control point in.
null if there is no next control point for a node. Otherwise this will return
dest if it is non-null.
public int moveTo(float x,
float y)
x - the x-coordinate to move to.
y - the y-coordinate to move to.
public void curveTo(float cx1,
float cy1,
float cx2,
float cy2,
float x2,
float y2)
GeneralPath.curveTo().
cx1 - the x-coordinate of the first control point.
cy1 - the y-coordinate of the first control point.
cx2 - the x-coordinate of the second control point.
cy2 - the y-coordinate of the second control point.
x2 - the x-coordinate of the end point.
y2 - the y-coordinate of the end point.
public void curveTo(int pathIndex,
float cx1,
float cy1,
float cx2,
float cy2,
float x2,
float y2)
GeneralPath.curveTo().
pathIndex - the path to append this curve to.
cx1 - the x-coordinate of the first control point.
cy1 - the y-coordinate of the first control point.
cx2 - the x-coordinate of the second control point.
cy2 - the y-coordinate of the second control point.
x2 - the x-coordinate of the end point.
y2 - the y-coordinate of the end point.
public void lineTo(float x,
float y)
GeneralPath.lineTo().
x - the x-coordinate of the end point.
y - the y-coordinate of the end point.
public void lineTo(int pathIndex,
float x,
float y)
GeneralPath.lineTo().
pathIndex - the path index.
x - the x-coordinate of the end point.
y - the y-coordinate of the end point.
public final void append(Shapes)
s - the shape to append.
public StringtoString()
String representation of this shape.
public int getWindingRule()
getWindingRule in class
AbstractShape
WIND_NON_ZERO or
WIND_EVEN_ODD.
public void setWindingRule(int newRule)
newRule - the new winding rule. This must be
WIND_NON_ZERO or
WIND_EVEN_ODD.
public PathIteratorgetPathIterator(AffineTransform transform)
PathIterator that iterates over this shape.