|
Jazz API Documentation | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.umd.cs.jazz.ZSceneGraphObject | +--edu.umd.cs.jazz.ZVisualComponent | +--edu.umd.cs.jazz.component.ZCoordList | +--edu.umd.cs.jazz.component.ZPolyline
ZPolyline is a visual component that represents a line with one or more segments.
Warning: Serialized and ZSerialized objects of this class will not be compatible with future Jazz releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Jazz. A future release of Jazz will provide support for long term persistence.
Field Summary | |
static int |
ARROW_BOTH
|
static int |
ARROW_CLOSED
|
static int |
ARROW_FIRST
|
static int |
ARROW_LAST
|
static int |
ARROW_NONE
|
static int |
ARROW_OPEN
|
Fields inherited from class edu.umd.cs.jazz.component.ZCoordList |
absPenWidth,
closed,
DEFAULT_ABS_PEN_WIDTH,
DEFAULT_CLOSED,
DEFAULT_PEN_COLOR,
DEFAULT_PEN_WIDTH,
empty,
np,
path,
penColor,
penWidth,
stroke,
tmpBounds,
xp,
yp |
Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject |
bounds,
volatileBounds,
volatileBounds_DEFAULT |
Constructor Summary | |
ZPolyline()
Constructs a new ZPolyline with no points. |
|
ZPolyline(double[] xp,
double[] yp)
Constructs a new ZPolyline from an array of points. |
|
ZPolyline(double x,
double y)
Constructs a new ZPolyline with a single point. |
|
ZPolyline(double x1,
double y1,
double x2,
double y2)
Constructs a new ZPolyline with a two points |
|
ZPolyline(java.awt.geom.Point2D pt)
Constructs a new ZPolyline with a single point. |
|
ZPolyline(java.awt.geom.Point2D pt1,
java.awt.geom.Point2D pt2)
Constructs a new ZPolyline with two points. |
Method Summary | |
void |
add(double x,
double y)
Add a point to the end of this polyline. |
void |
add(double x,
double y,
int index)
Add a point to the specified part of this coordinate list. |
protected java.awt.geom.GeneralPath |
computeArrowHead(int ah,
java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
Calculate the points used to represent the arrowhead. |
protected void |
computeBounds()
Notifies this object that it has changed and that it should update its notion of its bounding box. |
protected java.lang.Object |
duplicateObject()
Returns a clone of this object. |
int |
getArrowHead()
Get the arrowhead type used by this ZPolyline. |
boolean |
pick(java.awt.geom.Rectangle2D rect,
ZSceneGraphPath path)
Returns true if the specified rectangle is on the polyline. |
protected void |
removeArrowHead(int ah)
Remove one or both arrowheads from the polyline. |
void |
render(ZRenderContext renderContext)
Renders this object. |
void |
setArrowHead(int ah)
Set arrowheads for this polyline. |
void |
setArrowHeadType(int aht)
Set arrowHeads for this polyline to a certain style: open, closed, etc |
protected void |
setCoords(boolean updateArrowHeads,
double[] xp,
double[] yp)
Set the coordinates of this polyline. |
void |
setCoords(double[] xp,
double[] yp)
Set the coordinates of this polyline. |
void |
setCoords(java.awt.geom.Point2D pt1,
java.awt.geom.Point2D pt2)
Set the coordinates of this polyline to two points. |
protected boolean |
updateArrowHeads()
Updates the internal representation of the arrowheads to reflect the current state of the polyline. |
Methods inherited from class edu.umd.cs.jazz.component.ZCoordList |
add,
add,
ensureSpace,
getAbsPenWidth,
getNumberPoints,
getPath,
getPenColor,
getPenWidth,
getStroke,
getXCoords,
getYCoords,
isClosed,
setAbsPenWidth,
setClosed,
setPenColor,
setPenWidth,
setState,
setStroke,
trimToSize,
updatePath,
writeObject |
Methods inherited from class edu.umd.cs.jazz.ZVisualComponent |
addParent,
getParents,
getRoot,
paint,
pickBounds,
removeParent,
repaint,
repaint,
updateBounds,
updateObjectReferences,
updateParentBounds,
updateVolatility,
writeObjectRecurse |
Methods inherited from class edu.umd.cs.jazz.ZSceneGraphObject |
clone,
dump,
getBounds,
getBoundsReference,
getVolatileBounds,
reshape,
setBounds,
setVolatileBounds |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int ARROW_NONE
public static final int ARROW_FIRST
public static final int ARROW_LAST
public static final int ARROW_BOTH
public static final int ARROW_CLOSED
public static final int ARROW_OPEN
Constructor Detail |
public ZPolyline()
public ZPolyline(java.awt.geom.Point2D pt)
pt
- Initial pointpublic ZPolyline(java.awt.geom.Point2D pt1, java.awt.geom.Point2D pt2)
pt1
- First pointpt2
- Second pointpublic ZPolyline(double x, double y)
x,y
- Initial pointpublic ZPolyline(double x1, double y1, double x2, double y2)
x,y
- First pointx,y
- Second pointpublic ZPolyline(double[] xp, double[] yp)
xp
- Array of X pointsyp
- Array of Y pointsMethod Detail |
protected java.lang.Object duplicateObject()
ZSceneGraphObject.duplicateObject()
protected void removeArrowHead(int ah)
ah
- ARROW_FIRST, ARROW_LAST or ARROW_BOTHpublic int getArrowHead()
public void setArrowHead(int ah)
ah
- ArrowHead Specification, such as ARROW_FIRST, ARROW_LAST, ARROW_BOTH, ARROW_NONE.public void setArrowHeadType(int aht)
ah
- ArrowHead type, such as ARROW_OPEN OR ARROW_CLOSED.public void add(double x, double y)
x,y
- The new pointpublic void add(double x, double y, int index)
x,y
- The new pointindex
- The index of the new point.public void setCoords(double[] xp, double[] yp)
xp
- An array of the X coordinates of the new points.yp
- An array of the Y coordinates of the new points.public void setCoords(java.awt.geom.Point2D pt1, java.awt.geom.Point2D pt2)
pt1
- The first point of the polylinept2
- The second first point of the polylineprotected void setCoords(boolean updateArrowHeads, double[] xp, double[] yp)
xp
- An array of the X coordinates of the new points.yp
- An array of the Y coordinates of the new points.updateArrowHeads
- Updates the internal representation of the arrowheads.public void render(ZRenderContext renderContext)
The transform, clip, and composite will be set appropriately when this object is rendered. It is up to this object to restore the transform, clip, and composite of the Graphics2D if this node changes any of them. However, the color, font, and stroke are unspecified by Jazz. This object should set those things if they are used, but they do not need to be restored.
renderContext
- The graphics context to paint into.protected void computeBounds()
updateBounds
when needed.public boolean pick(java.awt.geom.Rectangle2D rect, ZSceneGraphPath path)
rect
- Pick rectangle of object coordinates.path
- The path through the scenegraph to the picked node. Modified by this call.ZDrawingSurface.pick(int, int)
protected boolean updateArrowHeads()
protected java.awt.geom.GeneralPath computeArrowHead(int ah, java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
|
Jazz API Documentation | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |