|
|||||||||||
| 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
This class is designed to be extended. It takes care of managing a fillPaint, a penPaint, and a stroke, but leaves picking, and rendering to its subclasses.
| Field Summary | |
protected boolean |
absPenWidthCurrent absolute pen width. |
static boolean |
DEFAULT_ABS_PEN_WIDTHDefault absolute pen width. |
static java.awt.Paint |
DEFAULT_FILL_PAINTDefault fill paint. |
static java.awt.Paint |
DEFAULT_PEN_PAINTDefault pen paint. |
static double |
DEFAULT_PEN_WIDTHDefault pen width. |
static java.awt.Stroke |
DEFAULT_STROKEDefault stroke. |
protected java.awt.Paint |
fillPaintCurrent fill paint. |
protected java.awt.Paint |
penPaintCurrent pen paint. |
protected double |
penWidthCurrent pen width. |
protected java.awt.BasicStroke |
strokeCurrent stroke. |
| Fields inherited from class edu.umd.cs.jazz.ZSceneGraphObject |
bounds, inTransaction, invalidBounds, invalidVolatileBounds, listenerList, volatileBounds, volatileBounds_DEFAULT |
| Constructor Summary | |
ZBasicVisualComponent()ZBasicVisualComponent constructor comment. |
|
| Method Summary | |
protected java.lang.Object |
duplicateObject()Returns a clone of this object. |
double |
getAbsPenWidth()Get the absolute width of the pen used to draw the visual component. |
java.awt.Color |
getFillColor()Deprecated. As of Jazz version 1.1, replaced by ZFillPaint.getFillPaint(). |
java.awt.Paint |
getFillPaint()Get the fill paint of this visual component. |
java.awt.Color |
getPenColor()Deprecated. As of Jazz version 1.1, replaced by ZPenPaint.getPenPaint(). |
java.awt.Paint |
getPenPaint()Get the pen paint of this visual component. |
double |
getPenWidth()Get the width of the pen used to draw the visual component. |
protected double |
getPenWidthForCurrentContext()Get the width of the pen used to draw the visual component while taking the current render context into consideration. |
java.awt.Stroke |
getStroke()Get the stroke used to draw the visual component. |
void |
setAbsPenWidth(double width)Set the absolute width of the pen used to draw the perimeter of this shape. |
void |
setFillColor(java.awt.Color color)Deprecated. As of Jazz version 1.1, replaced by ZFillPaint.setFillPaint(Paint aPaint). |
void |
setFillPaint(java.awt.Paint aPaint)Set the fill paint of this visual component. |
void |
setPenColor(java.awt.Color color)Deprecated. As of Jazz version 1.1, replaced by ZPenPaint.setPenPaint(Paint aPaint). |
void |
setPenPaint(java.awt.Paint aPaint)Set the pen paint of this visual component. |
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 |
setStroke(java.awt.Stroke stroke)Set the stroke used to draw the visual component. |
void |
writeObject(ZObjectOutputStream out)Write out all of this object's state. |
| Methods inherited from class edu.umd.cs.jazz.ZVisualComponent |
addParent, getNumParents, getParents, getParentsReference, getRoot, paint, pick, pickBounds, removeParent, render, 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 |
public static final double DEFAULT_PEN_WIDTH
public static final boolean DEFAULT_ABS_PEN_WIDTH
public static final java.awt.Paint DEFAULT_PEN_PAINT
public static final java.awt.Paint DEFAULT_FILL_PAINT
public static final java.awt.Stroke DEFAULT_STROKE
protected transient java.awt.Paint fillPaint
protected transient java.awt.Paint penPaint
protected transient java.awt.BasicStroke stroke
protected double penWidth
protected boolean absPenWidth
| Constructor Detail |
public ZBasicVisualComponent()
| Method Detail |
protected java.lang.Object duplicateObject()
duplicateObject in class ZVisualComponentZSceneGraphObject.duplicateObject()public double getAbsPenWidth()
getAbsPenWidth in interface ZStrokegetPenWidth()public java.awt.Color getFillColor()
ZFillPaint.getFillPaint().
getFillColor in interface ZFillColorpublic java.awt.Paint getFillPaint()
getFillPaint in interface ZFillPaintpublic java.awt.Color getPenColor()
ZPenPaint.getPenPaint().
getPenColor in interface ZPenColorpublic java.awt.Paint getPenPaint()
getPenPaint in interface ZPenPaintpublic double getPenWidth()
getPenWidth in interface ZStrokegetAbsPenWidth()protected double getPenWidthForCurrentContext()
public java.awt.Stroke getStroke()
getStroke in interface ZStrokepublic 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 ZStrokewidth - the pen width.ZStroke.setPenWidth(double)public void setFillColor(java.awt.Color color)
ZFillPaint.setFillPaint(Paint aPaint).
setFillColor in interface ZFillColorcolor - the fill color, or null if none.public void setFillPaint(java.awt.Paint aPaint)
setFillPaint in interface ZFillPaintaPaint - the fill paint, or null if none.public void setPenColor(java.awt.Color color)
ZPenPaint.setPenPaint(Paint aPaint).
setPenColor in interface ZPenColorcolor - the pen color, or null if none.public void setPenPaint(java.awt.Paint aPaint)
setPenPaint in interface ZPenPaintaPaint - the pen paint, or null if none.public void setPenWidth(double width)
setPenWidth in interface ZStrokewidth - the pen width.setAbsPenWidth(double)public void setStroke(java.awt.Stroke stroke)
setStroke in interface ZStrokestroke - the stroke.
public void setState(java.lang.String fieldType,
java.lang.String fieldName,
java.lang.Object fieldValue)
setState in interface ZSerializablesetState in class ZVisualComponentfieldType - The fully qualified type of the fieldfieldName - The name of the fieldfieldValue - The value of the field
public void writeObject(ZObjectOutputStream out)
throws java.io.IOException
writeObject in interface ZSerializablewriteObject in class ZVisualComponentout - The stream that this object writes intojava.io.IOException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||