|
|||||||||
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
public class PSWTPath
PSWTPath is a wrapper around a java.awt.geom.GeneralPath, with workarounds for drawing shapes in SWT where necessary.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class edu.umd.cs.piccolo.PNode |
---|
PNode.PSceneGraphDelegate |
Field Summary | |
---|---|
static java.lang.String |
PROPERTY_SHAPE
The property name that identifies a change of this node's path. |
Fields inherited from interface java.awt.print.Printable |
---|
NO_SUCH_PAGE, PAGE_EXISTS |
Constructor Summary | |
---|---|
PSWTPath()
Creates an empty PSWTPath. |
|
PSWTPath(java.awt.Shape aShape)
Creates an SWTPath in the given shape with the default paint and stroke. |
Method Summary | |
---|---|
java.awt.Shape |
cloneShape(java.awt.Shape aShape)
Clone's the shape provided. |
static PSWTPath |
createEllipse(float x,
float y,
float width,
float height)
Creates a path representing an ellipse that covers the rectangle provided. |
static PSWTPath |
createPolyline(float[] xp,
float[] yp)
Creates a PPath for the poly-line for the given points. |
static PSWTPath |
createPolyline(java.awt.geom.Point2D[] points)
Creates a PPath for the poly-line for the given points. |
static PSWTPath |
createRectangle(float x,
float y,
float width,
float height)
Creates a path representing the rectangle provided. |
static PSWTPath |
createRoundRectangle(float x,
float y,
float width,
float height,
float arcWidth,
float arcHeight)
Creates a path representing the rounded rectangle provided. |
java.awt.geom.Point2D |
getCenter()
Return the center of this SWT path node, based on its bounds. |
java.awt.Paint |
getStrokePaint()
Returns the paint to use when drawing the stroke of the shape. |
protected void |
internalUpdateBounds(double x,
double y,
double width,
double height)
Set the bounds of this path. |
boolean |
intersects(java.awt.geom.Rectangle2D aBounds)
Returns true if path crosses the provided bounds. |
protected void |
paint(PPaintContext paintContext)
Paints the path on the context provided. |
void |
setPathToEllipse(float x,
float y,
float width,
float height)
Resets the path to an ellipse positioned at the coordinate provided with the dimensions provided. |
void |
setPathToPolyline(float[] xp,
float[] yp)
Sets the path to a sequence of segments described by the point components provided. |
void |
setPathToPolyline(java.awt.geom.Point2D[] points)
Sets the path to a sequence of segments described by the points. |
void |
setPathToRectangle(float x,
float y,
float width,
float height)
Resets the path to a rectangle with the dimensions and position provided. |
void |
setPathToRoundRectangle(float x,
float y,
float width,
float height,
float arcWidth,
float arcHeight)
Resets the path to a rectangle with the dimensions and position provided. |
void |
setShape(java.awt.Shape newShape)
Changes the underlying shape of this PSWTPath. |
void |
setStrokeColor(java.awt.Paint strokeColor)
Sets the paint to use when drawing the stroke of the shape. |
void |
updateBoundsFromPath()
Recalculates the path's bounds by examining it's associated shape. |
void |
updateShapePoints(java.awt.Shape aShape)
Updates the internal points used to draw the shape. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PROPERTY_SHAPE
Constructor Detail |
---|
public PSWTPath()
public PSWTPath(java.awt.Shape aShape)
aShape
- the desired shapeMethod Detail |
---|
public static PSWTPath createRectangle(float x, float y, float width, float height)
x
- left of rectangley
- top of rectanglewidth
- width of rectangleheight
- height of rectangle
public static PSWTPath createRoundRectangle(float x, float y, float width, float height, float arcWidth, float arcHeight)
x
- left of rectangley
- top of rectanglewidth
- width of rectangleheight
- height of rectanglearcWidth
- width of the arc at the cornersarcHeight
- height of arc at the corners
public static PSWTPath createEllipse(float x, float y, float width, float height)
x
- left of rectangley
- top of rectanglewidth
- width of rectangleheight
- height of rectangle
public static PSWTPath createPolyline(java.awt.geom.Point2D[] points)
points
- array of points for the point lines
public static PSWTPath createPolyline(float[] xp, float[] yp)
xp
- array of x components of the points of the poly-linesyp
- array of y components of the points of the poly-lines
public java.awt.Paint getStrokePaint()
public void setStrokeColor(java.awt.Paint strokeColor)
strokeColor
- new stroke colorprotected void internalUpdateBounds(double x, double y, double width, double height)
internalUpdateBounds
in class PNode
x
- new left position of boundsy
- new top position of boundswidth
- the new width of the boundsheight
- the new height of the boundspublic boolean intersects(java.awt.geom.Rectangle2D aBounds)
intersects
in class PNode
aBounds
- bounds being tested for intersection
public void updateBoundsFromPath()
protected void paint(PPaintContext paintContext)
paint
in class PNode
paintContext
- the context onto which the path will be paintedpublic void setShape(java.awt.Shape newShape)
newShape
- new associated shape of this PSWTPathpublic void updateShapePoints(java.awt.Shape aShape)
aShape
- shape to read points frompublic java.awt.Shape cloneShape(java.awt.Shape aShape)
aShape
- shape to be cloned
public void setPathToRectangle(float x, float y, float width, float height)
x
- left of the rectangley
- top of te rectanglewidth
- width of the rectangleheight
- height of the rectanglepublic void setPathToRoundRectangle(float x, float y, float width, float height, float arcWidth, float arcHeight)
x
- left of the rectangley
- top of te rectanglewidth
- width of the rectangleheight
- height of the rectanglearcWidth
- width of arc in the corners of the rectanglearcHeight
- height of arc in the corners of the rectanglepublic void setPathToEllipse(float x, float y, float width, float height)
x
- left of the ellipsey
- top of the ellipsewidth
- width of the ellipseheight
- height of the ellipsepublic void setPathToPolyline(java.awt.geom.Point2D[] points)
points
- points to that lie along the generated pathpublic void setPathToPolyline(float[] xp, float[] yp)
xp
- the x components of the points along the pathyp
- the y components of the points along the pathpublic java.awt.geom.Point2D getCenter()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |