|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.gui.Path
Class Path encapsulates an interface Strategy
that defines the requirement for a strategy that can automatically build a
GeneralPath given vertex and tangent data.
Specifically, the strategy requires:
ClosureMode, andWindingRule.Class Path also provides some examples of Strategy objects
and some useful static methods.
Class Path cannot be instantiated.
In 2.4.0, the interface contract for Path.Strategy was changed
to permit the designer to specify what will happen if the tangent array that
is passed the method makePath happens to be null. In
prior versions of this class, the designer was forced to return an empty
GeneralPath and had no other choice.
In 2.4.0, the methods to show shape structure were refactored to use the
tools in the class PathList and to follow the corresponding
conventions for the parameters and their defaults.
Finally, in 2.4.0, certain static methods were moved to
BaseShape and renamed to be consistent with conventions there.
In 2.6.0b, added one additional showShapeStructure method
to correspond to an added method in PathList.
Shape,
GeneralPath| Nested Class Summary | |
static interface |
Path.Strategy
The Strategy interface requires one method that returns a
GeneralPath given its input parameters. |
| Field Summary | |
static Path.Strategy |
BEZIER_CUBIC
BEZIER_CUBIC is a Strategy that constructs a
GeneralPath as the Bezier cubic defined by the given vertex
and tangent arrays. |
static Path.Strategy |
BEZIER_FRAME
BEZIER_FRAME is a Strategy that constructs a
GeneralPath as the Bezier polygonal frame associated with the
given vertex and tangent arrays. |
static Path.Strategy |
BEZIER_TANGENT_SEGMENTS
BEZIER_TANGENT_SEGMENTS is a Strategy that
constructs a GeneralPath as a disjoint sequence of tangent
segments. |
static Rectangle2D.Double |
DOT
The standard dot centered at (0,0). |
static int |
HALF
Half of the standard dot size. |
static Path.Strategy |
POLYGON
POLYGON is a Strategy that constructs a
GeneralPath as the polygon defined by the given vertex
array. |
static Path.Strategy |
POLYGON_DOTS
POLYGON_DOTS is a Strategy that constructs
a GeneralPath using a sequence of moveTo,
lineTo pairs, one for each vertex in the vertex array. |
static int |
SIZE
The standard dot size. |
static BasicStroke |
STROKE
The standard stroke. |
static int |
THICK
The standard stroke thickness. |
| Constructor Summary | |
private |
Path()
Private constructor to prevent instantiation. |
| Method Summary | |
static GeneralPath |
append(GeneralPath path,
Shape[] shape,
boolean connect)
Returns the GeneralPath obtained by appending the
given sequence of Shape objects to the given
GeneralPath using the given boolean
value to determine the connection at every stage. |
static GeneralPath |
append(GeneralPath path,
Shape[] shape,
boolean[] connect)
Returns the GeneralPath obtained by appending the
given sequence of Shape objects to the given
GeneralPath using the given sequence of
boolean values to determine the connection at each
stage. |
static String |
shapeToString(Shape shape)
Returns the structural information about a Shape
as a large, multi-line String that contains all of
the information in the PathIterator for the shape. |
static void |
showShapeStructure(Graphics g,
Shape shape)
Shows the shape structure in the given graphics context. |
static void |
showShapeStructure(Graphics g,
Shape shape,
Color fillColor,
Color drawColor,
Color vertexDotsColor,
Color controlDotsColor,
Color vertexFrameColor,
Color bezierFrameColor,
Color pathPointsColor,
int thickness,
int divisions)
Shows the shape structure in the given graphics context. |
static void |
showShapeStructure(Graphics g,
Shape shape,
Color fillColor,
Color drawColor,
Color vertexDotsColor,
Color controlDotsColor,
Color vertexFrameColor,
Color bezierFrameColor,
int thickness)
Shows the shape structure in the given graphics context. |
static void |
showShapeStructure(Graphics g,
Shape shape,
Color fillColor,
Color drawColor,
int thickness)
Shows the shape structure in the given graphics context. |
static void |
showShapeStructure(Graphics g,
Shape shape,
int thickness)
Shows the shape structure in the given graphics context. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int SIZE
public static final int HALF
public static final Rectangle2D.Double DOT
public static final int THICK
public static final BasicStroke STROKE
public static final Path.Strategy POLYGON
POLYGON is a Strategy that constructs a
GeneralPath as the polygon defined by the given vertex
array.
The given tangent array is not used.
public static final Path.Strategy POLYGON_DOTS
POLYGON_DOTS is a Strategy that constructs
a GeneralPath using a sequence of moveTo,
lineTo pairs, one for each vertex in the vertex array.
The given tangent array is not used.
The given closuremode is not used. The path is geometrically open.
public static final Path.Strategy BEZIER_CUBIC
BEZIER_CUBIC is a Strategy that constructs a
GeneralPath as the Bezier cubic defined by the given vertex
and tangent arrays.
This strategy uses the tangent array but if the given tangent array is
null then the strategy Path.POLYGON is used on
the vertex array instead.
public static final Path.Strategy BEZIER_FRAME
BEZIER_FRAME is a Strategy that constructs a
GeneralPath as the Bezier polygonal frame associated with the
given vertex and tangent arrays.
The closuremode is used to determine whether the Bezier frame is closed or open.
This strategy uses the tangent array but if the given tangent array is
null then the strategy Path.POLYGON is used on
the vertex array instead.
public static final Path.Strategy BEZIER_TANGENT_SEGMENTS
BEZIER_TANGENT_SEGMENTS is a Strategy that
constructs a GeneralPath as a disjoint sequence of tangent
segments.
The tangent segments have the form:
vertex[i] - tangent[i]vertex[i] + tangent[i]using the given vertex and tangent arrays.
The given closuremode is not used. The path is OPEN.
This strategy uses the tangent array but if the given tangent array is
null then the strategy Path.POLYGON_DOTS is used
on the vertex array instead.
| Constructor Detail |
private Path()
| Method Detail |
public static GeneralPath append(GeneralPath path,
Shape[] shape,
boolean[] connect)
Returns the GeneralPath obtained by appending the
given sequence of Shape objects to the given
GeneralPath using the given sequence of
boolean values to determine the connection at each
stage.
There is one more boolean value than there is a
Shape object. The final boolean value
determines whether or not the GeneralPath will be
terminated by a closePath operation.
Precondition: For some integer N:
Shape[N]
boolean[N+1] or is null.
If connect is null
then it is replaced by new boolean[N+1].
If the precondition fails, no append actions will be taken.
If the path parameter is null then a new
GeneralPath will be created, modified, and returned.
Since a default GeneralPath uses the winding rule
GeneralPath.WIND_NON_ZERO, you are forced to accept
this choice if you pass a null argument for path.
To get the opposite winding rule with an empty path, you must
pass instead:
new GeneralPath(GeneralPath.WIND_EVEN_ODD)
path - the path to extend or nullshape - the array of shapes to appendconnect - the array of connection specifications or null
public static GeneralPath append(GeneralPath path,
Shape[] shape,
boolean connect)
Returns the GeneralPath obtained by appending the
given sequence of Shape objects to the given
GeneralPath using the given boolean
value to determine the connection at every stage.
Precondition: For some integer N, shape is Shape[N].
If the precondition fails, no append actions will be taken.
If the path parameter is null then a new
GeneralPath will be created, modified, and returned.
Since a default GeneralPath uses the winding rule
GeneralPath.WIND_NON_ZERO, you are forced to accept
this choice if you pass a null argument for path.
To get the opposite winding rule with an empty path, you must
pass instead:
new GeneralPath(GeneralPath.WIND_EVEN_ODD)
path - the path to extend or nullshape - the array of shapes to appendconnect - the array of connection specifications or null
public static void showShapeStructure(Graphics g,
Shape shape,
Color fillColor,
Color drawColor,
Color vertexDotsColor,
Color controlDotsColor,
Color vertexFrameColor,
Color bezierFrameColor,
Color pathPointsColor,
int thickness,
int divisions)
Shows the shape structure in the given graphics context.
If the graphics context or the shape is null,
then does nothing.
Uses PathList.makeStructurePaintable and follows
the conventions described in that class.
g - the graphics contextshape - the shapefillColor - 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 static void showShapeStructure(Graphics g,
Shape shape,
Color fillColor,
Color drawColor,
Color vertexDotsColor,
Color controlDotsColor,
Color vertexFrameColor,
Color bezierFrameColor,
int thickness)
Shows the shape structure in the given graphics context.
If the graphics context or the shape is null,
then does nothing.
Uses PathList.makeStructurePaintable and follows
the conventions described in that class.
g - the graphics contextshape - the shapefillColor - 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 static void showShapeStructure(Graphics g,
Shape shape,
Color fillColor,
Color drawColor,
int thickness)
Shows the shape structure in the given graphics context.
If the graphics context or the shape is null,
then does nothing.
Uses PathList.makeStructurePaintable and follows
the conventions described in that class.
g - the graphics contextshape - the shapefillColor - the fill color for the shapedrawColor - the draw color for the shapethickness - the stroke thickness
public static void showShapeStructure(Graphics g,
Shape shape,
int thickness)
Shows the shape structure in the given graphics context.
If the graphics context or the shape is null,
then does nothing.
Uses PathList.makeStructurePaintable and follows
the conventions described in that class.
g - the graphics contextshape - the shapethickness - the stroke thickness
public static void showShapeStructure(Graphics g,
Shape shape)
Shows the shape structure in the given graphics context.
If the graphics context or the shape is null,
then does nothing.
Uses PathList.makeStructurePaintable and follows
the conventions described in that class.
g - the graphics contextshape - the shapepublic static String shapeToString(Shape shape)
Returns the structural information about a Shape
as a large, multi-line String that contains all of
the information in the PathIterator for the shape.
If the given shape is null returns "Null shape\n".
If the given shape is non-null then, as of 2.4.0,
returns the String:
new PathList(shape).toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||