|
JHotDraw 7.0.6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jhotdraw.draw.AbstractFigure
org.jhotdraw.draw.AttributedFigure
org.jhotdraw.draw.BezierFigure
public class BezierFigure
A BezierFigure can be used to draw arbitrary shapes using a BezierPath. It can be used to draw an open path or a closed shape.
| Field Summary | |
|---|---|
static AttributeKey<java.lang.Boolean> |
CLOSED
|
protected BezierPath |
path
The BezierPath. |
| Fields inherited from class org.jhotdraw.draw.AbstractFigure |
|---|
changingDepth, decorator, listenerList |
| Constructor Summary | |
|---|---|
BezierFigure()
Creates a new instance. |
|
BezierFigure(boolean isClosed)
Creates a new instance. |
|
| Method Summary | |
|---|---|
void |
addNode(BezierPath.Node p)
Adds a control point. |
void |
addNode(int index,
BezierPath.Node p)
Adds a node to the list of points. |
void |
basicAddNode(BezierPath.Node p)
Adds a control point. |
void |
basicAddNode(int index,
BezierPath.Node p)
Adds a control point. |
boolean |
basicJoinSegments(java.awt.geom.Point2D.Double join)
Joins two segments into one if the given Point2D.Double hits a node of the polyline. |
int |
basicJoinSegments(java.awt.geom.Point2D.Double join,
float tolerance)
Joins two segments into one if the given Point2D.Double hits a node of the polyline. |
protected void |
basicRemoveAllNodes()
Removes the Point2D.Double at the specified index. |
protected void |
basicRemoveNode(int index)
Removes the Point2D.Double at the specified index. |
void |
basicSetAttribute(AttributeKey key,
java.lang.Object newValue)
Sets an attribute of the figure. |
void |
basicSetBezierPath(BezierPath newValue)
Sets the bezier path, without cloning and without firing events. |
void |
basicSetBounds(java.awt.geom.Point2D.Double anchor,
java.awt.geom.Point2D.Double lead)
Sets the logical bounds of the figure and of its decorator figure. |
void |
basicSetEndPoint(java.awt.geom.Point2D.Double p)
Convenience method for setting the point coordinate of the end point. |
void |
basicSetNode(int index,
BezierPath.Node p)
Sets a control point. |
void |
basicSetPoint(int index,
int coord,
java.awt.geom.Point2D.Double p)
Sets the point coordinate of a control point. |
void |
basicSetPoint(int index,
java.awt.geom.Point2D.Double p)
Sets the point coordinate of control point 0 at the specified node. |
void |
basicSetStartPoint(java.awt.geom.Point2D.Double p)
Convenience method for setting the point coordinate of the start point. |
int |
basicSplitSegment(java.awt.geom.Point2D.Double split)
Splits the segment at the given Point2D.Double if a segment was hit. |
int |
basicSplitSegment(java.awt.geom.Point2D.Double split,
float tolerance)
Splits the segment at the given Point2D.Double if a segment was hit. |
void |
basicTransform(java.awt.geom.AffineTransform tx)
Moves the figure. |
boolean |
canConnect()
Checks if this figure can be connected. |
java.awt.geom.Point2D.Double |
chop(java.awt.geom.Point2D.Double p)
|
BezierFigure |
clone()
Returns a clone of the figure. |
boolean |
contains(java.awt.geom.Point2D.Double p)
Checks if a point is contained by the figure. |
java.util.Collection<Handle> |
createHandles(int detailLevel)
Creates handles used to manipulate the figure. |
protected void |
drawCaps(java.awt.Graphics2D g)
|
protected void |
drawFill(java.awt.Graphics2D g)
This method is called by method draw() to draw the fill area of the figure. |
protected void |
drawStroke(java.awt.Graphics2D g)
This method is called by method draw() to draw the text of the figure . |
Connector |
findCompatibleConnector(Connector c,
boolean isStart)
Gets a compatible connector. |
Connector |
findConnector(java.awt.geom.Point2D.Double p,
ConnectionFigure prototype)
Returns the Figures connector for the specified location. |
int |
findNode(java.awt.geom.Point2D.Double p)
Finds a control point index. |
int |
findSegment(java.awt.geom.Point2D.Double find)
Gets the segment of the polyline that is hit by the given Point2D.Double. |
BezierPath |
getBezierPath()
Returns a clone of the bezier path of this figure. |
java.awt.geom.Rectangle2D.Double |
getBounds()
Returns the logical bounds of the figure as a Rectangle. |
protected BezierPath |
getCappedPath()
Returns a path which is cappedPath at the ends, to prevent it from drawing under the end caps. |
java.awt.geom.Point2D.Double |
getCenter()
|
java.awt.geom.Point2D.Double |
getEndPoint()
Convenience method for getting the end point. |
java.awt.geom.Rectangle2D.Double |
getFigureDrawBounds()
|
BezierPath.Node |
getNode(int index)
Gets a control point. |
int |
getNodeCount()
Gets the node count. |
java.awt.geom.Point2D.Double |
getOutermostPoint()
|
java.awt.geom.Point2D.Double |
getPoint(int index)
Convenience method for getting the point coordinate of the first control point of the specified node. |
java.awt.geom.Point2D.Double |
getPoint(int index,
int coord)
Gets the point coordinate of a control point. |
int |
getPointCount()
Gets the point count. |
java.awt.geom.Point2D.Double |
getPointOnPath(float relative,
double flatness)
|
java.lang.Object |
getRestoreData()
Gets data which can be used to restore the shape of the figure after a basicTransform has been applied to it. |
java.awt.geom.Point2D.Double |
getStartPoint()
Convenience method for getting the start point. |
boolean |
handleMouseClick(java.awt.geom.Point2D.Double p,
java.awt.event.MouseEvent evt,
DrawingView view)
Handles a mouse click. |
void |
invalidate()
Informs that a figure needs to be redrawn. |
protected void |
invalidateCappedPath()
|
boolean |
isClosed()
|
void |
layout()
|
void |
read(DOMInput in)
|
protected void |
readPoints(DOMInput in)
|
void |
removeAllNodes()
Removes all points. |
void |
removeNode(int index)
Removes the Point2D.Double at the specified index. |
void |
restoreTo(java.lang.Object geometry)
Restores the shape of the figure to a previously stored state. |
void |
setClosed(boolean newValue)
|
void |
setNode(int index,
BezierPath.Node p)
Sets a control point. |
void |
setPoint(int index,
int coord,
java.awt.geom.Point2D.Double p)
Sets the point coordinate of a control point. |
protected void |
validate()
|
void |
write(DOMOutput out)
|
protected void |
writePoints(DOMOutput out)
|
| Methods inherited from class org.jhotdraw.draw.AttributedFigure |
|---|
applyAttributesTo, drawConnectors, drawFigure, drawText, getAttribute, getAttributeKey, getAttributes, getStroke, getStrokeMiterLimitFactor, hasAttribute, isAttributeEnabled, readAttributes, removeAttribute, setAttribute, setAttributeEnabled, setAttributes, writeAttributes |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final AttributeKey<java.lang.Boolean> CLOSED
protected BezierPath path
| Constructor Detail |
|---|
public BezierFigure()
public BezierFigure(boolean isClosed)
| Method Detail |
|---|
public Connector findConnector(java.awt.geom.Point2D.Double p,
ConnectionFigure prototype)
findConnector in interface FigurefindConnector in class AbstractFigurep - the location of the connector.prototype - The prototype used to create a connection or null if
unknown. This allows for specific connectors for different
connection figures.ChopDiamondConnector
public Connector findCompatibleConnector(Connector c,
boolean isStart)
Figure
findCompatibleConnector in interface FigurefindCompatibleConnector in class AbstractFigureprotected void drawStroke(java.awt.Graphics2D g)
AttributedFigure
drawStroke in class AttributedFigureprotected void drawCaps(java.awt.Graphics2D g)
protected void drawFill(java.awt.Graphics2D g)
AttributedFigure
drawFill in class AttributedFigurepublic boolean contains(java.awt.geom.Point2D.Double p)
FigureThis is used for hit testing by Tool's.
public boolean canConnect()
canConnect in interface FigurecanConnect in class AbstractFigurepublic java.util.Collection<Handle> createHandles(int detailLevel)
Figure
createHandles in interface FigurecreateHandles in class AbstractFiguredetailLevel - The detail level of the handles. Usually this is 0 for
bounding box handles and 1 for point handles.
Handlepublic java.awt.geom.Rectangle2D.Double getBounds()
Figure
public java.awt.geom.Rectangle2D.Double getFigureDrawBounds()
getFigureDrawBounds in class AttributedFigureprotected void validate()
validate in class AbstractFigurepublic BezierPath getBezierPath()
public java.awt.geom.Point2D.Double getPointOnPath(float relative,
double flatness)
public void basicSetBezierPath(BezierPath newValue)
public boolean isClosed()
public void setClosed(boolean newValue)
public void basicSetAttribute(AttributeKey key,
java.lang.Object newValue)
AttributedFigure
basicSetAttribute in interface FigurebasicSetAttribute in class AttributedFigureAttributeKey.set(org.jhotdraw.draw.Figure, T)
public void basicSetBounds(java.awt.geom.Point2D.Double anchor,
java.awt.geom.Point2D.Double lead)
FigureThis is used by Tool's which create a new Figure and by Tool's which connect a Figure to another Figure.
This is a basic operation which does not fire events.
anchor - the start point of the boundslead - the end point of the boundsFigure.getBounds()public void basicTransform(java.awt.geom.AffineTransform tx)
AbstractFigureThis is a basic operation for which no events are fired.
basicTransform in interface FigurebasicTransform in class AbstractFiguretx - The transformation.public void invalidate()
AbstractFigure
invalidate in interface Figureinvalidate in class AbstractFigureprotected void invalidateCappedPath()
protected BezierPath getCappedPath()
public void layout()
public void addNode(BezierPath.Node p)
public void addNode(int index,
BezierPath.Node p)
public void basicAddNode(BezierPath.Node p)
public void basicAddNode(int index,
BezierPath.Node p)
public void setNode(int index,
BezierPath.Node p)
public void basicSetNode(int index,
BezierPath.Node p)
public BezierPath.Node getNode(int index)
public java.awt.geom.Point2D.Double getPoint(int index)
public java.awt.geom.Point2D.Double getPoint(int index,
int coord)
public void setPoint(int index,
int coord,
java.awt.geom.Point2D.Double p)
public void basicSetPoint(int index,
java.awt.geom.Point2D.Double p)
public void basicSetPoint(int index,
int coord,
java.awt.geom.Point2D.Double p)
public void basicSetStartPoint(java.awt.geom.Point2D.Double p)
public void basicSetEndPoint(java.awt.geom.Point2D.Double p)
public java.awt.geom.Point2D.Double getStartPoint()
getStartPoint in interface FiguregetStartPoint in class AbstractFigureFigure.basicSetBounds(java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Double)public java.awt.geom.Point2D.Double getEndPoint()
getEndPoint in interface FiguregetEndPoint in class AbstractFigureFigure.basicSetBounds(java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Double)public int findNode(java.awt.geom.Point2D.Double p)
public final void removeAllNodes()
public final void removeNode(int index)
public int findSegment(java.awt.geom.Point2D.Double find)
public boolean basicJoinSegments(java.awt.geom.Point2D.Double join)
public int basicSplitSegment(java.awt.geom.Point2D.Double split)
protected void basicRemoveNode(int index)
protected void basicRemoveAllNodes()
public int getNodeCount()
public int getPointCount()
public BezierFigure clone()
Figure
clone in interface Figureclone in class AttributedFigurepublic void restoreTo(java.lang.Object geometry)
Figure
public java.lang.Object getRestoreData()
Figure
Figure.basicTransform(AffineTransform)public java.awt.geom.Point2D.Double chop(java.awt.geom.Point2D.Double p)
public java.awt.geom.Point2D.Double getCenter()
public java.awt.geom.Point2D.Double getOutermostPoint()
public int basicJoinSegments(java.awt.geom.Point2D.Double join,
float tolerance)
public int basicSplitSegment(java.awt.geom.Point2D.Double split,
float tolerance)
public boolean handleMouseClick(java.awt.geom.Point2D.Double p,
java.awt.event.MouseEvent evt,
DrawingView view)
handleMouseClick in interface FigurehandleMouseClick in class AbstractFigurep - The location of the mouse event.evt - The mouse event.view - The drawing view which is the source of the mouse event.
public void write(DOMOutput out)
throws java.io.IOException
write in interface DOMStorablewrite in class AttributedFigurejava.io.IOException
protected void writePoints(DOMOutput out)
throws java.io.IOException
java.io.IOException
public void read(DOMInput in)
throws java.io.IOException
read in interface DOMStorableread in class AttributedFigurejava.io.IOException
protected void readPoints(DOMInput in)
throws java.io.IOException
java.io.IOException
|
Copyright 1996-2006 © JHotDraw.org | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||