|
||||||||||
| 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 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(Shape aShape)
Creates an SWTPath in the given shape with the default paint and stroke. |
|
| Method Summary | |
|---|---|
Shape |
cloneShape(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(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. |
Point2D |
getCenter()
Return the center of this SWT path node, based on its bounds. |
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(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(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(Shape newShape)
Changes the underlying shape of this PSWTPath. |
void |
setStrokeColor(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(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 String PROPERTY_SHAPE
| Constructor Detail |
|---|
public PSWTPath()
public PSWTPath(Shape aShape)
aShape - the desired shape| Method 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(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 Paint getStrokePaint()
public void setStrokeColor(Paint strokeColor)
strokeColor - new stroke color
protected void internalUpdateBounds(double x,
double y,
double width,
double height)
internalUpdateBounds in class PNodex - new left position of boundsy - new top position of boundswidth - the new width of the boundsheight - the new height of the boundspublic boolean intersects(Rectangle2D aBounds)
intersects in class PNodeaBounds - bounds being tested for intersection
public void updateBoundsFromPath()
protected void paint(PPaintContext paintContext)
paint in class PNodepaintContext - the context onto which the path will be paintedpublic void setShape(Shape newShape)
newShape - new associated shape of this PSWTPathpublic void updateShapePoints(Shape aShape)
aShape - shape to read points frompublic Shape cloneShape(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 rectangle
public 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 rectangle
public 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(Point2D[] points)
points - points to that lie along the generated path
public 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 Point2D getCenter()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||