|
||||||||||
| 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.nodes.PLine
public class PLine
PLine a class for drawing multisegment lines.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class edu.umd.cs.piccolo.PNode |
|---|
PNode.PSceneGraphDelegate |
| Field Summary |
|---|
| Fields inherited from interface java.awt.print.Printable |
|---|
NO_SUCH_PAGE, PAGE_EXISTS |
| Constructor Summary | |
|---|---|
PLine()
Constructs a new PLine with an empty LineShape. |
|
PLine(LineShape lineShape)
Constructs a PLine object for displaying the provided line. |
|
PLine(LineShape line,
Stroke aStroke)
Constructs a PLine for the given lineShape and the given stroke. |
|
| Method Summary | |
|---|---|
void |
addPoint(int pointIndex,
double x,
double y)
Inserts a point at the provided index. |
Rectangle2D |
getLineBoundsWithStroke()
Calculates the bounds of the line taking stroke width into account. |
LineShape |
getLineReference()
Returns a reference to the underlying line shape. |
Point2D |
getPoint(int pointIndex,
Point2D dst)
Returns the point at the provided index. |
int |
getPointCount()
Returns the number of points in the line. |
Stroke |
getStroke()
Returns the stroke that will be used when drawing the line. |
Paint |
getStrokePaint()
Returns the paint to be used while drawing the line. |
boolean |
intersects(Rectangle2D aBounds)
|
protected void |
lineChanged()
Fires appropriate change events, updates line bounds and flags the PLine as requiring a repaint. |
protected void |
paint(PPaintContext paintContext)
Paints the PLine in the provided context if it has both a stroke and a stroke paint assigned. |
void |
removeAllPoints()
Removes all points from the underlying line. |
void |
removePoints(int startIndex,
int numberOfPoints)
Removes points from the line. |
boolean |
setBounds(double x,
double y,
double width,
double height)
|
void |
setPoint(int pointIndex,
double x,
double y)
Changes the point at the provided index. |
void |
setStroke(Stroke newStroke)
Sets stroke to use when drawing the line. |
void |
setStrokePaint(Paint newStrokePaint)
Changes the paint to be used while drawing the line. |
void |
updateBoundsFromLine()
Recalculates the bounds when a change to the underlying line occurs. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PLine()
public PLine(LineShape lineShape)
lineShape - will be displayed by this PLine
public PLine(LineShape line,
Stroke aStroke)
line - line to be wrapped by this PLineaStroke - stroke to use when drawling the line| Method Detail |
|---|
public Paint getStrokePaint()
public void setStrokePaint(Paint newStrokePaint)
newStrokePaint - paint to use when drawing the linepublic Stroke getStroke()
public void setStroke(Stroke newStroke)
newStroke - stroke to use when drawing the line
public boolean setBounds(double x,
double y,
double width,
double height)
setBounds in class PNodepublic boolean intersects(Rectangle2D aBounds)
intersects in class PNodepublic Rectangle2D getLineBoundsWithStroke()
public void updateBoundsFromLine()
protected void paint(PPaintContext paintContext)
paint in class PNodepaintContext - the context into which the line should be drawnpublic LineShape getLineReference()
public int getPointCount()
public Point2D getPoint(int pointIndex,
Point2D dst)
pointIndex - index of desired point in linedst - point to populate, may be null
protected void lineChanged()
public void setPoint(int pointIndex,
double x,
double y)
pointIndex - index of point to changex - x component to assign to the pointy - y component to assign to the point
public void addPoint(int pointIndex,
double x,
double y)
pointIndex - index at which to add the pointx - x component of new pointy - y component of new point
public void removePoints(int startIndex,
int numberOfPoints)
startIndex - index from which to remove the pointsnumberOfPoints - number of points to removepublic void removeAllPoints()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||