|
||||||||||
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.ZBasicVisualComponent | +--edu.umd.cs.jazz.component.ZShape | +--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 |
coordListShape |
Fields inherited from class edu.umd.cs.jazz.component.ZBasicVisualComponent |
absPenWidth, DEFAULT_ABS_PEN_WIDTH, DEFAULT_FILL_PAINT, DEFAULT_PEN_PAINT, DEFAULT_PEN_WIDTH, DEFAULT_STROKE, fillPaint, penPaint, penWidth, stroke |
Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject |
bounds, listenerList, 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 aPoint)
Constructs a new ZPolyline with no points. |
|
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,
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. |
void |
lineTo(double x,
double y)
Return the append the given vertex onto the end of the list of points that define this polygon. |
boolean |
pick(java.awt.geom.Rectangle2D rect,
ZSceneGraphPath path)
Returns true if the specified rectangle is on the polygon. |
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 |
void |
setCoords(double[] xp,
double[] yp)
Set the coords of this polygon. |
void |
setCoords(java.awt.geom.Point2D pt1,
java.awt.geom.Point2D pt2)
Set the coords of this polygon. |
void |
setPenWidth(double width)
The arrow head shape depends on the ZPolyline's pen width, so when the pen width changes the arrow heads must be updated. |
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, add, getCoordListShape, getNumberPoints, getShape, getX, getXCoords, getY, getYCoords, isClosed, moveTo, setClosed, setState, writeObject |
Methods inherited from class edu.umd.cs.jazz.component.ZShape |
getFrame, getHeight, getWidth, getX, getY, pickStroke |
Methods inherited from class edu.umd.cs.jazz.component.ZBasicVisualComponent |
getAbsPenWidth, getFillColor, getFillPaint, getPenColor, getPenPaint, getPenWidth, getPenWidthForCurrentContext, getStroke, setAbsPenWidth, setFillColor, setFillPaint, setPenColor, setPenPaint, setStroke |
Methods inherited from class edu.umd.cs.jazz.ZVisualComponent |
addParent, getNumParents, getParents, getParentsReference, getRoot, paint, pickBounds, removeParent, repaint, repaint, trimToSize, updateBounds, updateObjectReferences, updateParentBounds, updateVolatility, writeObjectRecurse |
Methods inherited from class edu.umd.cs.jazz.ZSceneGraphObject |
addMouseListener, addMouseMotionListener, clone, dump, fireEvent, fireMouseEvent, getBounds, getBoundsReference, getListenerList, getVolatileBounds, hasLisenerOfType, hasMouseListener, processMouseEvent, removeEventListener, removeMouseListener, removeMouseMotionListener, 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 aPoint)
public 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()
duplicateObject
in class ZCoordList
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, int index)
add
in class ZCoordList
x,y
- The new pointindex
- The index of the new point.public void setCoords(java.awt.geom.Point2D pt1, java.awt.geom.Point2D pt2)
setCoords
in class ZCoordList
public void setCoords(double[] xp, double[] yp)
setCoords
in class ZCoordList
public void lineTo(double x, double y)
lineTo
in class ZCoordList
public void setPenWidth(double width)
setPenWidth
in class ZBasicVisualComponent
edu.umd.cs.jazz.component.ZBasicVisualComponent
width
- the pen width.ZBasicVisualComponent.setAbsPenWidth(double)
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.
render
in class ZShape
renderContext
- The graphics context to paint into.protected void computeBounds()
updateBounds
when needed.computeBounds
in class ZShape
public boolean pick(java.awt.geom.Rectangle2D rect, ZSceneGraphPath path)
ZShape
pick
in class ZShape
edu.umd.cs.jazz.component.ZShape
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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |