

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object  +edu.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.
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 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. 
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 float[][] 
bezierTangentSegments(float[][] vertex,
float[][] tangent)
Returns a float array that contains the Bezier tangent segments for the given vertex and tangent arrays. 
static float[][] 
closedBezierFrame(float[][] vertex,
float[][] tangent)
Returns a float array that contains the points on the closed Bezier frame for the given vertex and tangent arrays. 
static void 
dot(Graphics g,
double x,
double y,
Color color)
Paints a dot of size 4 at the given position (x, y), in the given color, in the given graphics context. 
static void 
line(Graphics g,
double x1,
double y1,
double x2,
double y2,
Color color)
Paints a line of thickness 2 from (x1, y1) to (x2, y2), in the given color, in the given graphics context. 
static float[][] 
openBezierFrame(float[][] vertex,
float[][] tangent)
Returns a float array that contains the points on the open Bezier frame for the given vertex and tangent arrays. 
static String 
shapeToString(Shape shape)
Returns the structural information about a Shape
as a large, multiline String that contains all of
the information in the PathIterator for the shape. 
static void 
showShapeDots(Graphics g,
Shape shape,
Color dotColor)
Shows the dots of the given shape, in the given dot color, in the given graphics context. 
static void 
showShapeFrame(Graphics g,
Shape shape,
Color frameColor)
Shows the shape of the frame of the given shape, in the given frame color, in the given graphics context. 
static void 
showShapeFrameDots(Graphics g,
Shape shape,
Color dotColor)
Shows the dots of the frame of the given shape, in the given dot color, in the given graphics context. 
static void 
showShapeStructure(Graphics g,
Shape shape)
Shows the shape, its frame, its frame dots, and its own dots, in the default colors, in the given graphics context. 
static void 
showShapeStructure(Graphics g,
Shape shape,
Color shapeColor,
Color frameColor,
Color shapeDotColor,
Color frameDotColor)
Shows the shape, its frame, its frame dots, and its own dots, in the given colors or their defaults, 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 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 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.
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.
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.
Method Detail 
public static float[][] closedBezierFrame(float[][] vertex, float[][] tangent)
Returns a float array that contains the points on the closed Bezier frame for the given vertex and tangent arrays.
Precondition: For some integer N:
Postcondition: For M = 3 * N, the array returned is float[M][2]. For each index i less than N, with j = (i + 1) (mod N), the sequence of three points
vertex[i]
vertex[i] + tangent[i]
vertex[j]  tangent[j]
is placed in the next available set of three array slots.
If the precondition fails, then float[0][2] is returned.
vertex
 the array of vertex informationtangent
 the array of tangent information
public static float[][] openBezierFrame(float[][] vertex, float[][] tangent)
Returns a float array that contains the points on the open Bezier frame for the given vertex and tangent arrays.
Precondition: For some integer N:
Postcondition: If N is nonzero, then for M = 3 * N  2, the array returned is float[M][2]. For each index i less than (N  1), with j = i + 1, the sequence of three points
vertex[i]
vertex[i] + tangent[i]
vertex[j]  tangent[j]
is placed in the next available set of three array slots. Then the final vertex is placed in the final array slot.
If the precondition fails or N is 0, then float[0][2] is returned.
vertex
 the array of vertex informationtangent
 the array of tangent information
public static float[][] bezierTangentSegments(float[][] vertex, float[][] tangent)
Returns a float array that contains the Bezier tangent segments for the given vertex and tangent arrays.
Precondition: For some integer N:
Postcondition: For M = 2 * N, the array returned is float[M][2]. For each index i, the sequence of two points
vertex[i]  tangent[i]
vertex[i] + tangent[i]
is placed in the next available set of two array slots.
If the precondition fails, then float[0][2] is returned.
vertex
 the array of vertex informationtangent
 the array of tangent information
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.
If the path parameter is null
then a new
GeneralPath
will be created, modified, and returned.
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.
path
 the path to extend or null
shape
 the array of shapes to appendconnect
 the array of connection specifications or null
GeneralPath.append(java.awt.Shape, boolean)
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.
If the path parameter is null
then a new
GeneralPath
will be created, modified, and returned.
Precondition: For some integer N, shape is Shape[N].
If the precondition fails, no append actions will be taken.
path
 the path to extend or null
shape
 the array of shapes to appendconnect
 the array of connection specifications or null
GeneralPath.append(java.awt.Shape, boolean)
public static void dot(Graphics g, double x, double y, Color color)
Paints a dot of size 4 at the given position (x, y), in the given color, in the given graphics context.
If the graphics context is null
,
then does nothing.
If the color is null
,
it is set to Color.red
.
g
 the graphics contextx
 the xpositiony
 the ypositioncolor
 the color for paintingpublic static void line(Graphics g, double x1, double y1, double x2, double y2, Color color)
Paints a line of thickness 2 from (x1, y1) to (x2, y2), in the given color, in the given graphics context.
If the graphics context is null
,
then does nothing.
If the color is null
,
it is set to Color.green
.
g
 the graphics contextx1
 the start xpositiony1
 the start ypositionx2
 the final xpositiony2
 the final ypositioncolor
 the color for paintingpublic static void showShapeFrame(Graphics g, Shape shape, Color frameColor)
Shows the shape of the frame of the given shape, in the given frame color, in the given graphics context.
If the graphics context or the shape is null
,
then does nothing.
If the frame color is null
,
it is set to Color.green
.
g
 the graphics contextshape
 the shape to frameframeColor
 the color of the framepublic static void showShapeDots(Graphics g, Shape shape, Color dotColor)
Shows the dots of the given shape, in the given dot color, in the given graphics context.
If the graphics context or the shape is null
,
then does nothing.
If the dot color is null
,
it is set to Color.red
.
g
 the graphics contextshape
 the shape to show dotsdotColor
 the color of the dotspublic static void showShapeFrameDots(Graphics g, Shape shape, Color dotColor)
Shows the dots of the frame of the given shape, in the given dot color, in the given graphics context.
If the graphics context or the shape is null
,
then does nothing.
If the dot color is null
,
it is set to Color.orange
.
g
 the graphics contextshape
 the shape to show frame dotsdotColor
 the color of the frame dotspublic static void showShapeStructure(Graphics g, Shape shape, Color shapeColor, Color frameColor, Color shapeDotColor, Color frameDotColor)
Shows the shape, its frame, its frame dots, and its own dots, in the given colors or their defaults, in the given graphics context.
If the graphics context or the shape is null
,
then does nothing.
Defaults for null
color values:
shapeColor
: Color.black
frameColor
: Color.green
shapeDotColor
: Color.red
frameDotColor
: Color.orange
g
 the graphics contextshape
 the shape to show frame dotsshapeColor
 the color of the shapeframeColor
 the color of the frameshapeDotColor
 the color of the shape dotsframeDotColor
 the color of the frame dotspublic static void showShapeStructure(Graphics g, Shape shape)
Shows the shape, its frame, its frame dots, and its own dots, in the default colors, in the given graphics context.
If the graphics context or the shape is null
,
then does nothing.
Defaults for color values:
shapeColor
: Color.black
frameColor
: Color.green
shapeDotColor
: Color.red
frameDotColor
: Color.orange
g
 the graphics contextshape
 the shape to show frame dotspublic static String shapeToString(Shape shape)
Returns the structural information about a Shape
as a large, multiline String
that contains all of
the information in the PathIterator
for the shape.


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 