|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectCH.ifa.draw.standard.AbstractFigure
org.openbp.cockpit.modeler.figures.spline.PolySplineFigure
public class PolySplineFigure
A poly spline figure is a line figure consisting of an arbitary number of
cubic Bezier curves.
It has handles for all waypoints as well as for each control point.
A waypoint can have three different states:
A corner means that both control points are completely independent of each other.
A curve means that both control points are on opposite angles but may have a different distance.
An even curve means that one control point is the direct mirror of its counterpart.
| Field Summary | |
|---|---|
protected boolean |
drawDecorations
Only draw decorations if this is true |
static int |
LEFT_CONTROLPOINT
|
static int |
RIGHT_CONTROLPOINT
|
protected java.util.List |
segments
Contains the actual curve segements (contains CubicCurve2D objects) |
| Fields inherited from interface CH.ifa.draw.framework.Figure |
|---|
POPUP_MENU |
| Constructor Summary | |
|---|---|
PolySplineFigure()
Constructor. |
|
| Method Summary | |
|---|---|
protected void |
adjustOpposite(int index,
int side)
|
void |
basicDisplayBox(java.awt.Point origin,
java.awt.Point corner)
|
protected void |
basicMoveBy(int dx,
int dy)
|
protected void |
basicSetCtrlPoint(int index,
int side,
java.awt.geom.Point2D target)
|
boolean |
canConnect()
Spline figures cannot be connected and return false. |
protected void |
clearShapeCache()
Clears the shape cache used for hit detection. |
CH.ifa.draw.framework.Connector |
connectorAt(int x,
int y)
|
protected java.awt.geom.Point2D |
constrainCtrlPoint(int index,
int side,
java.awt.geom.Point2D target)
|
boolean |
containsPoint(int x,
int y)
Returns true if the given point is near to the spline. |
java.awt.Rectangle |
displayBox()
The display box equals the bounds of the spline enlarged by 30 pixels vertically and horizontally. |
void |
draw(java.awt.Graphics g)
|
protected void |
drawDecorations(java.awt.Graphics g)
Draws the start and end decorations of the spline. |
protected void |
drawSpline(java.awt.Graphics2D g2)
Draws the spline itself. |
int |
findSegment(int x,
int y)
Gets the segment of the polyline that is hit by the given point. |
CH.ifa.draw.figures.LineDecoration |
getAnimationDecoration()
Gets the decoration for the spline animation. |
java.lang.Object |
getAttribute(java.lang.String name)
Gets the attribute with the given name. |
java.awt.geom.Point2D |
getCtrlPointAt(int i,
int side)
|
CH.ifa.draw.figures.LineDecoration |
getEndDecoration()
Gets the decoration for the end point of the spline. |
java.awt.Color |
getFrameColor()
Gets the color of the spline. |
java.awt.geom.Point2D |
getPointAt(int i)
|
protected java.awt.geom.Point2D |
getPointOnCurve(double position)
Determines a point on the spline, specified by a ratio. |
java.awt.Rectangle |
getSplineBounds()
Gets the display box of the spline's segments. |
CH.ifa.draw.figures.LineDecoration |
getStartDecoration()
Gets the decoration for the start point of the spline. |
java.awt.Stroke |
getStroke()
Gets the stroke. |
java.util.Vector |
handles()
|
boolean |
isEmpty()
|
boolean |
joinSegments(int x,
int y)
Joins to segments into one if the given point hits a node of the polyline. |
java.awt.Point |
pointAt(int i)
|
int |
pointCount()
|
void |
read(CH.ifa.draw.util.StorableInput dr)
|
protected void |
rebuildShapeCache()
Rebuilds the shape cache used for hit detection. |
void |
removePoint(int i)
|
java.awt.geom.CubicCurve2D |
segmentAt(int i)
Gets the segment at the given index. |
void |
setAnimationDecoration(CH.ifa.draw.figures.LineDecoration animationDecoration)
Sets the decoration for the spline animation. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets the attribute with the given name. |
void |
setCtrlPointAt(int index,
int side,
java.awt.geom.Point2D target)
|
void |
setDrawDecorations(boolean drawDecorations)
Sets the flag if decorations should be drawn. |
void |
setEndDecoration(CH.ifa.draw.figures.LineDecoration endDecoration)
Sets the decoration for the end point of the spline. |
void |
setFrameColor(java.awt.Color frameColor)
Sets the color of the spline. |
void |
setPointAt(int index,
java.awt.geom.Point2D target)
|
void |
setStartDecoration(CH.ifa.draw.figures.LineDecoration startDecoration)
Sets the decoration for the start point of the spline. |
void |
setStroke(java.awt.Stroke stroke)
Sets the stroke. |
int |
splitSegment(int x,
int y)
Splits the segment at the given point if a segment was hit. |
void |
write(CH.ifa.draw.util.StorableOutput dw)
|
| Methods inherited from class CH.ifa.draw.standard.AbstractFigure |
|---|
addFigureChangeListener, addToContainer, center, changed, clone, connectedTextLocator, connectionInsets, connectorVisibility, decompose, displayBox, displayBox, figures, findFigureInside, getZValue, includes, invalidate, listener, moveBy, release, removeFigureChangeListener, removeFromContainer, setZValue, size, willChange |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LEFT_CONTROLPOINT
public static final int RIGHT_CONTROLPOINT
protected java.util.List segments
protected boolean drawDecorations
| Constructor Detail |
|---|
public PolySplineFigure()
| Method Detail |
|---|
public java.awt.Rectangle displayBox()
displayBox in interface CH.ifa.draw.framework.FiguredisplayBox in class CH.ifa.draw.standard.AbstractFigure
public void basicDisplayBox(java.awt.Point origin,
java.awt.Point corner)
basicDisplayBox in interface CH.ifa.draw.framework.FigurebasicDisplayBox in class CH.ifa.draw.standard.AbstractFigurepublic boolean isEmpty()
isEmpty in interface CH.ifa.draw.framework.FigureisEmpty in class CH.ifa.draw.standard.AbstractFigurepublic java.util.Vector handles()
handles in interface CH.ifa.draw.framework.Figurehandles in class CH.ifa.draw.standard.AbstractFigure
public boolean containsPoint(int x,
int y)
containsPoint in interface CH.ifa.draw.framework.FigurecontainsPoint in class CH.ifa.draw.standard.AbstractFigurepublic boolean canConnect()
canConnect in interface CH.ifa.draw.framework.FigurecanConnect in class CH.ifa.draw.standard.AbstractFigure
public CH.ifa.draw.framework.Connector connectorAt(int x,
int y)
connectorAt in interface CH.ifa.draw.framework.FigureconnectorAt in class CH.ifa.draw.standard.AbstractFigure
protected void basicMoveBy(int dx,
int dy)
basicMoveBy in class CH.ifa.draw.standard.AbstractFigurepublic void draw(java.awt.Graphics g)
draw in interface CH.ifa.draw.framework.Figuredraw in class CH.ifa.draw.standard.AbstractFigureprotected void drawSpline(java.awt.Graphics2D g2)
g2 - Graphics to draw topublic java.awt.Rectangle getSplineBounds()
protected void adjustOpposite(int index,
int side)
public java.lang.Object getAttribute(java.lang.String name)
getAttribute in interface CH.ifa.draw.framework.FiguregetAttribute in class CH.ifa.draw.standard.AbstractFigure
public void setAttribute(java.lang.String name,
java.lang.Object value)
setAttribute in interface CH.ifa.draw.framework.FiguresetAttribute in class CH.ifa.draw.standard.AbstractFigurepublic int pointCount()
public java.awt.Point pointAt(int i)
public java.awt.geom.Point2D getPointAt(int i)
public java.awt.geom.Point2D getCtrlPointAt(int i,
int side)
public void setPointAt(int index,
java.awt.geom.Point2D target)
public void setCtrlPointAt(int index,
int side,
java.awt.geom.Point2D target)
protected void basicSetCtrlPoint(int index,
int side,
java.awt.geom.Point2D target)
public void removePoint(int i)
protected java.awt.geom.Point2D constrainCtrlPoint(int index,
int side,
java.awt.geom.Point2D target)
protected java.awt.geom.Point2D getPointOnCurve(double position)
position - Ratio that determines the postion on the spline, ranging from 0 (startpoint) to 1 (endpoint)
public java.awt.geom.CubicCurve2D segmentAt(int i)
i - Index
public int findSegment(int x,
int y)
x - Document coordinatey - Document coordinate
protected void rebuildShapeCache()
protected void clearShapeCache()
public int splitSegment(int x,
int y)
x - Document coordinatey - Document coordinate
public boolean joinSegments(int x,
int y)
x - Document coordinatey - Document coordinate
protected void drawDecorations(java.awt.Graphics g)
g - Graphics to draw topublic CH.ifa.draw.figures.LineDecoration getStartDecoration()
public void setStartDecoration(CH.ifa.draw.figures.LineDecoration startDecoration)
public CH.ifa.draw.figures.LineDecoration getEndDecoration()
public void setEndDecoration(CH.ifa.draw.figures.LineDecoration endDecoration)
public CH.ifa.draw.figures.LineDecoration getAnimationDecoration()
public void setAnimationDecoration(CH.ifa.draw.figures.LineDecoration animationDecoration)
public void setDrawDecorations(boolean drawDecorations)
public java.awt.Color getFrameColor()
public void setFrameColor(java.awt.Color frameColor)
public java.awt.Stroke getStroke()
public void setStroke(java.awt.Stroke stroke)
public void write(CH.ifa.draw.util.StorableOutput dw)
write in interface CH.ifa.draw.util.Storablewrite in class CH.ifa.draw.standard.AbstractFigure
public void read(CH.ifa.draw.util.StorableInput dr)
throws java.io.IOException
read in interface CH.ifa.draw.util.Storableread in class CH.ifa.draw.standard.AbstractFigurejava.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||