|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.piccolo.PNode
edu.umd.cs.piccolox.swt.PSWTPath
PPath is a wrapper around a java.awt.geom.GeneralPath. The setBounds method works by scaling the path to fit into the specified bounds. This normally works well, but if the specified base bounds get too small then it is impossible to expand the path shape again since all its numbers have tended to zero, so application code may need to take this into consideration.
One option that applications have is to call startResizeBounds
before
starting an interaction that may make the bounds very small, and calling
endResizeBounds
when this interaction is finished. When this is done
PPath will use a copy of the original path to do the resizing so the numbers
in the path wont loose resolution.
This class also provides methods for constructing common shapes using a general path.
Field Summary | |
static java.lang.String |
PROPERTY_SHAPE
The property name that identifies a change of this node's path. |
static java.lang.String |
PROPERTY_STROKE_PAINT
The property name that identifies a change of this node's stroke paint (see getStrokePaint ). |
Fields inherited from class edu.umd.cs.piccolo.PNode |
PROPERTY_BOUNDS, PROPERTY_CHILDREN, PROPERTY_CHILDREN_PICKABLE, PROPERTY_CLIENT_PROPERTIES, PROPERTY_FULL_BOUNDS, PROPERTY_PAINT, PROPERTY_PARENT, PROPERTY_PICKABLE, PROPERTY_TRANSFORM, PROPERTY_TRANSPARENCY, PROPERTY_VISIBLE |
Fields inherited from interface java.awt.print.Printable |
NO_SUCH_PAGE, PAGE_EXISTS |
Constructor Summary | |
PSWTPath()
|
|
PSWTPath(java.awt.Shape aShape)
|
Method Summary | |
static PSWTPath |
createEllipse(float x,
float y,
float width,
float height)
|
static PSWTPath |
createPolyline(float[] xp,
float[] yp)
|
static PSWTPath |
createPolyline(java.awt.geom.Point2D[] points)
|
static PSWTPath |
createRectangle(float x,
float y,
float width,
float height)
|
java.awt.Paint |
getStrokePaint()
|
boolean |
intersects(java.awt.geom.Rectangle2D aBounds)
Return true if this node intersects the given rectangle specified in local bounds. |
protected void |
paint(PPaintContext paintContext)
Paint this node behind any of its children nodes. |
protected java.lang.String |
paramString()
Returns a string representing the state of this node. |
boolean |
setBounds(double x,
double y,
double width,
double height)
Set the bounds of this node to the given value. |
void |
setPathToEllipse(float x,
float y,
float width,
float height)
|
void |
setPathToPolyline(float[] xp,
float[] yp)
|
void |
setPathToPolyline(java.awt.geom.Point2D[] points)
|
void |
setPathToRectangle(float x,
float y,
float width,
float height)
|
void |
setShape(java.awt.Shape aShape)
|
void |
setStrokeColor(java.awt.Paint aPaint)
|
void |
updateBoundsFromPath()
|
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String PROPERTY_STROKE_PAINT
getStrokePaint
). Both old and new value will
be set correctly to Paint objects in any property change event.
public static final java.lang.String PROPERTY_SHAPE
Constructor Detail |
public PSWTPath()
public PSWTPath(java.awt.Shape aShape)
Method Detail |
public static PSWTPath createRectangle(float x, float y, float width, float height)
public static PSWTPath createEllipse(float x, float y, float width, float height)
public static PSWTPath createPolyline(java.awt.geom.Point2D[] points)
public static PSWTPath createPolyline(float[] xp, float[] yp)
public java.awt.Paint getStrokePaint()
public void setStrokeColor(java.awt.Paint aPaint)
public boolean setBounds(double x, double y, double width, double height)
PNode
setBounds
in class PNode
public boolean intersects(java.awt.geom.Rectangle2D aBounds)
PNode
fullIntersects
is used
for quick rejects before calling this method.
intersects
in class PNode
aBounds
- the bounds to test for intersection against
public void updateBoundsFromPath()
protected void paint(PPaintContext paintContext)
PNode
paint
in class PNode
paintContext
- the paint context to use for painting the nodepublic void setShape(java.awt.Shape aShape)
public void setPathToRectangle(float x, float y, float width, float height)
public void setPathToEllipse(float x, float y, float width, float height)
public void setPathToPolyline(java.awt.geom.Point2D[] points)
public void setPathToPolyline(float[] xp, float[] yp)
protected java.lang.String paramString()
null
.
paramString
in class PNode
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |