|
||||||||||
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.piccolo.nodes.PPath
public class PPath
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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class edu.umd.cs.piccolo.PNode |
---|
PNode.PSceneGraphDelegate |
Field Summary | |
---|---|
static int |
PROPERTY_CODE_PATH
|
static int |
PROPERTY_CODE_STROKE
|
static int |
PROPERTY_CODE_STROKE_PAINT
|
static java.lang.String |
PROPERTY_PATH
The property name that identifies a change of this node's path (see getPathReference ). |
static java.lang.String |
PROPERTY_STROKE
The property name that identifies a change of this node's stroke (see getStroke ). |
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 interface java.awt.print.Printable |
---|
NO_SUCH_PAGE, PAGE_EXISTS |
Constructor Summary | |
---|---|
PPath()
|
|
PPath(java.awt.Shape aShape)
|
|
PPath(java.awt.Shape aShape,
java.awt.Stroke aStroke)
Construct this path with the given shape and stroke. |
Method Summary | |
---|---|
void |
append(java.awt.Shape aShape,
boolean connect)
|
void |
closePath()
|
static PPath |
createEllipse(float x,
float y,
float width,
float height)
|
static PPath |
createLine(float x1,
float y1,
float x2,
float y2)
|
static PPath |
createPolyline(float[] xp,
float[] yp)
|
static PPath |
createPolyline(java.awt.geom.Point2D[] points)
|
static PPath |
createRectangle(float x,
float y,
float width,
float height)
|
static PPath |
createRoundRectangle(float x,
float y,
float width,
float height,
float arcWidth,
float arcHeight)
|
void |
curveTo(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
|
void |
endResizeBounds()
Notify this node that you have finished a resize bounds sequence. |
java.awt.geom.Rectangle2D |
getPathBoundsWithStroke()
|
java.awt.geom.GeneralPath |
getPathReference()
|
java.awt.Stroke |
getStroke()
|
java.awt.Paint |
getStrokePaint()
|
protected void |
internalUpdateBounds(double x,
double y,
double width,
double height)
Set the bounds of this path. |
boolean |
intersects(java.awt.geom.Rectangle2D aBounds)
Return true if this node intersects the given rectangle specified in local bounds. |
void |
lineTo(float x,
float y)
|
void |
moveTo(float x,
float y)
|
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. |
void |
quadTo(float x1,
float y1,
float x2,
float y2)
|
void |
reset()
|
void |
setPathTo(java.awt.Shape aShape)
|
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 |
setStroke(java.awt.Stroke aStroke)
|
void |
setStrokePaint(java.awt.Paint aPaint)
|
void |
startResizeBounds()
Notify this node that you will beging to repeadily call setBounds . |
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 int PROPERTY_CODE_STROKE_PAINT
public static final java.lang.String PROPERTY_STROKE
getStroke
). Both old and new value will be set
correctly to Stroke objects in any property change event.
public static final int PROPERTY_CODE_STROKE
public static final java.lang.String PROPERTY_PATH
getPathReference
). In any property change
event the new value will be a reference to this node's path, but old
value will always be null.
public static final int PROPERTY_CODE_PATH
Constructor Detail |
---|
public PPath()
public PPath(java.awt.Shape aShape)
public PPath(java.awt.Shape aShape, java.awt.Stroke aStroke)
Method Detail |
---|
public static PPath createRectangle(float x, float y, float width, float height)
public static PPath createRoundRectangle(float x, float y, float width, float height, float arcWidth, float arcHeight)
public static PPath createEllipse(float x, float y, float width, float height)
public static PPath createLine(float x1, float y1, float x2, float y2)
public static PPath createPolyline(java.awt.geom.Point2D[] points)
public static PPath createPolyline(float[] xp, float[] yp)
public java.awt.Paint getStrokePaint()
public void setStrokePaint(java.awt.Paint aPaint)
public java.awt.Stroke getStroke()
public void setStroke(java.awt.Stroke aStroke)
public void startResizeBounds()
PNode
setBounds
.
When you are done call endResizeBounds
to let the node know that
you are done.
startResizeBounds
in class PNode
public void endResizeBounds()
PNode
endResizeBounds
in class PNode
protected void internalUpdateBounds(double x, double y, double width, double height)
internalUpdateBounds
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 java.awt.geom.Rectangle2D getPathBoundsWithStroke()
public void updateBoundsFromPath()
protected void paint(PPaintContext paintContext)
PNode
paint
in class PNode
paintContext
- the paint context to use for painting the nodepublic java.awt.geom.GeneralPath getPathReference()
public void moveTo(float x, float y)
public void lineTo(float x, float y)
public void quadTo(float x1, float y1, float x2, float y2)
public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3)
public void append(java.awt.Shape aShape, boolean connect)
public void setPathTo(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)
public void closePath()
public void reset()
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 |