|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.umd.cs.jazz.util.ZLayout
ZLayout is a utility class that provides general-purpose layout mechanisms to position nodes.
Constructor Summary | |
ZLayout()
|
Method Summary | |
protected static float |
computeDimensionTranslation(java.awt.geom.Point2D dim,
java.awt.geom.Point2D currentP,
java.awt.geom.Point2D remainderP,
java.awt.geom.Point2D finishedP,
java.awt.geom.Point2D dir,
java.util.Vector coordinates,
boolean ascending)
A helper function that computes the length of path in the given dimension. |
static void |
distribute(java.util.Vector objects,
java.util.Vector coordinates)
Distributes a set of objects (those being ZNodes)
along the path specified by |
static void |
distribute(java.util.Vector objects,
java.util.Vector coordinates,
boolean exact,
boolean closedPath)
Distributes a set of objects (those being ZNodes) along
the (optionally closed) path specified by coordinates . |
static void |
distribute(java.util.Vector objects,
java.util.Vector coordinates,
float tolerance,
boolean closedPath)
Distributes a set of objects (those being ZNodes) along
the (optionally closed) path specified by coordinates . |
static void |
distribute(java.util.Vector objects,
java.util.Vector coordinates,
float space,
float tolerance,
boolean exact,
boolean closedPath)
Distributes the given objects (those being ZNodes)
along the (optionally closed) path specified by
coordinates . |
protected static void |
normalizeVector(java.awt.geom.Point2D p)
Normalizes the given vector ie. |
protected static float |
pathLength(java.util.Vector coords)
Computes the length of the path for a given vector of coordinates |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public ZLayout()
Method Detail |
public static void distribute(java.util.Vector objects, java.util.Vector coordinates)
objects (those being ZNodes)
along the path specified by coordinates
. Assumes
exact spacing on a non-closed path with default tolerance.
- Parameters:
objects
- The objects to be distributed.coordinates
- The coordinates of the path.- See Also:
distribute(Vector, Vector, float, boolean)
public static void distribute(java.util.Vector objects, java.util.Vector coordinates, boolean exact, boolean closedPath)
objects
(those being ZNodes) along
the (optionally closed) path specified by coordinates
.
exact
specifies, if false, that the algorithm should
run once using a first guess at spacing or, if true, that the
algorithm should attempt to evenly space the objects using the entire
path.objects
- The objects to be distributed.coordinates
- The coordinates of the path.exact
- Should the algorithm run once and stop or iterate to
get exact spacing.closedPath
- Does the path represent a closed path?distribute(Vector, Vector, float, float, boolean, boolean)
public static void distribute(java.util.Vector objects, java.util.Vector coordinates, float tolerance, boolean closedPath)
objects
(those being ZNodes) along
the (optionally closed) path specified by coordinates
.
The algorithm will iterate until the objects are placed along the
path within tolerance
of the given path.objects
- The objects to be distributed.coordinates
- The coordinates of the path.tolerance
- The error allowed in placing the objectsclosedPath
- Does the path represent a closed path?distribute(Vector, Vector, float, float, boolean, boolean)
public static void distribute(java.util.Vector objects, java.util.Vector coordinates, float space, float tolerance, boolean exact, boolean closedPath)
objects
(those being ZNodes)
along the (optionally closed) path specified by
coordinates
. The algorithm initially distributes
the objects with the specified space
along the path.
If exact
spacing is not requested, the algorithm
does not iterate. Hence, the objects will be spaced with the
intial value of space
regardless of the objects' positions.
If exact
spacing is requested, the algorithm
iterates until the objects and spacing are within
tolerance
of the given path, where tolerance
is specified as a percentage of the total path length. The algorithm
will terminate with suboptimal results if the path is too short for
the objects or if an optimal result cannot be computed.objects
- The objects to be distributed.coordinates
- The coordinates of the path.space
- The initial amount of spacing to leave between objects.tolerance
- The percent of the total path length to which
the algorithm should compute, a value from 0.0-100.0.exact
- Should the algorithm iterate or make a single pass?closedPath
- Does the path represent a closed path?protected static float computeDimensionTranslation(java.awt.geom.Point2D dim, java.awt.geom.Point2D currentP, java.awt.geom.Point2D remainderP, java.awt.geom.Point2D finishedP, java.awt.geom.Point2D dir, java.util.Vector coordinates, boolean ascending)
dim
- The dimension of the bounds in which to perfrom the computationscurrentP
- The current point on the pathremainderP
- The remainder of path from previous pointfinishedP
- The storage location for the resultant destination pointdir
- The current direction of the pathcoordinates
- The coordinates of the pathascending
- Look at the points of the path in ascending or descending order?protected static float pathLength(java.util.Vector coords)
coords
- The path for which to compute the lengthprotected static void normalizeVector(java.awt.geom.Point2D p)
p
- Vector (vector in the physics sense, actually a point) to be normalized
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |