|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | 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.ZLine
ZLine is a simple ZShape implementation that uses a Line2D as the underlying shape model.
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 | |
protected java.awt.geom.Line2D |
line |
| 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, inTransaction, invalidBounds, invalidVolatileBounds, listenerList, volatileBounds, volatileBounds_DEFAULT |
| Constructor Summary | |
ZLine()ZLine constructor. |
|
ZLine(double x1, double y1, double x2, double y2)ZLine constructor. |
|
ZLine(java.awt.geom.Line2D aLine)ZLine constructor. |
|
ZLine(java.awt.geom.Point2D pt1, java.awt.geom.Point2D pt2)ZLine constructor. |
|
| Method Summary | |
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. |
java.awt.geom.Line2D |
getLine()Return the line. |
java.awt.Shape |
getShape()Return the current shape. |
void |
render(ZRenderContext renderContext)Paints this object. |
void |
setAbsPenWidth(double width)Set the absolute width of the pen used to draw the perimeter of this shape. |
void |
setLine(double x1, double y1, double x2, double y2)Set the line. |
void |
setLine(java.awt.geom.Line2D aLine)Set the line. |
void |
setLine(java.awt.geom.Point2D pt1, java.awt.geom.Point2D pt2)Set the line. |
void |
setPenWidth(double width)Set the width of the pen used to draw the visual component. |
void |
setState(java.lang.String fieldType, java.lang.String fieldName, java.lang.Object fieldValue)Set some state of this object as it gets read back in. |
void |
writeObject(ZObjectOutputStream out)Write out all of this object's state. |
| Methods inherited from class edu.umd.cs.jazz.component.ZShape |
getFrame, getHeight, getStrokeTransformForAbsPenWidth, getWidth, getX, getY, pick, pickStroke |
| Methods inherited from class edu.umd.cs.jazz.component.ZBasicVisualComponent |
getAbsPenWidth, getFillColor, getFillPaint, getPenColor, getPenPaint, getPenWidth, getPenWidthForCurrentContext, getStroke, 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, updateVolatility, writeObjectRecurse |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected transient java.awt.geom.Line2D line
| Constructor Detail |
public ZLine()
public ZLine(java.awt.geom.Line2D aLine)
public ZLine(java.awt.geom.Point2D pt1,
java.awt.geom.Point2D pt2)
public ZLine(double x1,
double y1,
double x2,
double y2)
| Method Detail |
protected java.lang.Object duplicateObject()
duplicateObject in class ZBasicVisualComponentZSceneGraphObject.duplicateObject()public java.awt.geom.Line2D getLine()
public void setAbsPenWidth(double width)
When drawing with an abs pen width the component is stroked on the inside of its bounds, not along the center as is the standard method for Java and Jazz. This is done so that the global bounds of the shape do not need to change when the camera zooms.
A consequence of stroking on the inside of the component is that components with zero width or height will not get drawn even if they have a non zero pen width, since there is no interior space for the pen width to expand into. This could happen for instance if a ZPolyline is drawn with all its points in a line along the same axis. SO BE WARNED!
ZLine presents an extreme case of this, since whenever it is drawn along the x or y axis it will not get drawn. Because of this ZLine implements abs pen width differently. ZLines are always stroked along the center of the line, so as the camera moves a ZLines global bounds will change if it has abs pen width.
setAbsPenWidth in interface ZStrokesetAbsPenWidth in class ZBasicVisualComponentwidth - the pen width.public void setPenWidth(double width)
setPenWidth in interface ZStrokesetPenWidth in class ZBasicVisualComponentwidth - the pen width.setAbsPenWidth(double)protected void computeBounds()
updateBounds when needed.
computeBounds in class ZShapepublic 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 ZShapepublic java.awt.Shape getShape()
getShape in class ZShapepublic void setLine(java.awt.geom.Line2D aLine)
public void setLine(java.awt.geom.Point2D pt1,
java.awt.geom.Point2D pt2)
public void setLine(double x1,
double y1,
double x2,
double y2)
public void writeObject(ZObjectOutputStream out)
throws java.io.IOException
writeObject in interface ZSerializablewriteObject in class ZBasicVisualComponentout - The stream that this object writes intojava.io.IOException
public void setState(java.lang.String fieldType,
java.lang.String fieldName,
java.lang.Object fieldValue)
setState in interface ZSerializablesetState in class ZBasicVisualComponentfieldType - The fully qualified type of the fieldfieldName - The name of the fieldfieldValue - The value of the field
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||