public class PLine extends PNode
PNode.PSceneGraphDelegate
FILL_STRATEGY_ASPECT_COVER, FILL_STRATEGY_ASPECT_FIT, FILL_STRATEGY_EXACT_FIT, PROPERTY_BOUNDS, PROPERTY_CHILDREN, PROPERTY_CHILDREN_PICKABLE, PROPERTY_CLIENT_PROPERTIES, PROPERTY_CODE_BOUNDS, PROPERTY_CODE_CHILDREN, PROPERTY_CODE_CHILDREN_PICKABLE, PROPERTY_CODE_CLIENT_PROPERTIES, PROPERTY_CODE_FULL_BOUNDS, PROPERTY_CODE_PAINT, PROPERTY_CODE_PARENT, PROPERTY_CODE_PICKABLE, PROPERTY_CODE_TRANSFORM, PROPERTY_CODE_TRANSPARENCY, PROPERTY_CODE_VISIBLE, PROPERTY_FULL_BOUNDS, PROPERTY_PAINT, PROPERTY_PARENT, PROPERTY_PICKABLE, PROPERTY_TRANSFORM, PROPERTY_TRANSPARENCY, PROPERTY_VISIBLE, SCENE_GRAPH_DELEGATE
NO_SUCH_PAGE, PAGE_EXISTS
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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)
Return true if this node intersects the given rectangle specified in
local bounds.
|
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)
Set the bounds of this node to the given position and size.
|
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.
|
addActivity, addAttribute, addChild, addChild, addChildren, addClientProperty, addInputEventListener, addPropertyChangeListener, addPropertyChangeListener, animateToBounds, animateToColor, animateToPositionScaleRotation, animateToRelativePosition, animateToTransform, animateToTransparency, animateTransformToBounds, centerBoundsOnPoint, centerFullBoundsOnPoint, clone, computeFullBounds, endResizeBounds, findIntersectingNodes, fireChildPropertyChange, firePropertyChange, fullIntersects, fullPaint, fullPick, getAllNodes, getAllNodes, getAttribute, getAttribute, getBooleanAttribute, getBounds, getBoundsChanged, getBoundsReference, getBoundsVolatile, getChild, getChildBoundsInvalid, getChildBoundsVolatile, getChildPaintInvalid, getChildrenCount, getChildrenIterator, getChildrenPickable, getChildrenReference, getClientProperties, getClientProperty, getClientPropertyKeysEnumeration, getClientPropertyKeysIterator, getDoubleAttribute, getFullBounds, getFullBoundsInvalid, getFullBoundsReference, getGlobalBounds, getGlobalFullBounds, getGlobalRotation, getGlobalScale, getGlobalToLocalTransform, getGlobalTranslation, getHeight, getInputEventListeners, getIntegerAttribute, getInverseTransform, getListenerList, getLocalToGlobalTransform, getName, getOccluded, getOffset, getPaint, getPaintInvalid, getParent, getPickable, getPropertyChangeParentMask, getRoot, getRotation, getScale, getTransform, getTransformReference, getTransparency, getUnionOfChildrenBounds, getVisible, getWidth, getX, getXOffset, getY, getYOffset, globalToLocal, globalToLocal, globalToLocal, indexOfChild, internalUpdateBounds, invalidateFullBounds, invalidateLayout, invalidatePaint, isAncestorOf, isDescendentOf, isDescendentOfRoot, isOpaque, layoutChildren, lerp, localToGlobal, localToGlobal, localToGlobal, localToParent, localToParent, localToParent, moveInBackOf, moveInFrontOf, moveToBack, moveToFront, offset, paintAfterChildren, paramString, parentBoundsChanged, parentToLocal, parentToLocal, parentToLocal, pick, pickAfterChildren, position, print, print, removeAllChildren, removeChild, removeChild, removeChildren, removeFromParent, removeInputEventListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaintFrom, reparent, replaceWith, resetBounds, rotate, rotateAboutPoint, rotateAboutPoint, rotateInPlace, scale, scaleAboutPoint, scaleAboutPoint, setBounds, setBoundsChanged, setChildBoundsInvalid, setChildBoundsVolatile, setChildPaintInvalid, setChildrenPickable, setFullBoundsInvalid, setGlobalRotation, setGlobalScale, setGlobalTranslation, setHeight, setName, setOccluded, setOffset, setOffset, setPaint, setPaintInvalid, setParent, setPickable, setPropertyChangeParentMask, setRotation, setScale, setTransform, setTransparency, setVisible, setWidth, setX, setY, signalBoundsChanged, startResizeBounds, toImage, toImage, toImage, toImage, transformBy, translate, validateFullBounds, validateFullPaint
public PLine()
public PLine(LineShape lineShape)
lineShape
- will be displayed by this PLinepublic 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 linepublic boolean setBounds(double x, double y, double width, double height)
public boolean intersects(Rectangle2D aBounds)
fullIntersects
is used for quick rejects before calling this
method.intersects
in class PNode
aBounds
- the bounds to test for intersection againstpublic Rectangle2D getLineBoundsWithStroke()
public void updateBoundsFromLine()
protected void paint(PPaintContext paintContext)
public LineShape getLineReference()
public int getPointCount()
public Point2D getPoint(int pointIndex, Point2D dst)
pointIndex
- index of desired point in linedst
- point to populate, may be nullprotected 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 pointpublic 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 pointpublic void removePoints(int startIndex, int numberOfPoints)
startIndex
- index from which to remove the pointsnumberOfPoints
- number of points to removepublic void removeAllPoints()
Copyright © 1995-2013 Piccolo2D. All Rights Reserved.