|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectCH.ifa.draw.standard.AbstractFigure
CH.ifa.draw.figures.PolyLineFigure
public class PolyLineFigure
A poly line figure consists of a list of points. It has an optional line decoration at the start and end.
LineDecoration,
Serialized Form| Field Summary | |
|---|---|
static int |
ARROW_TIP_BOTH
|
static int |
ARROW_TIP_END
|
static int |
ARROW_TIP_NONE
|
static int |
ARROW_TIP_START
|
protected LineDecoration |
fEndDecoration
|
protected java.awt.Color |
fFrameColor
|
protected java.util.Vector |
fPoints
|
protected LineDecoration |
fStartDecoration
|
| Fields inherited from interface CH.ifa.draw.framework.Figure |
|---|
POPUP_MENU |
| Constructor Summary | |
|---|---|
PolyLineFigure()
|
|
PolyLineFigure(int size)
|
|
PolyLineFigure(int x,
int y)
|
|
| Method Summary | |
|---|---|
void |
addPoint(int x,
int y)
Adds a node to the list of points. |
void |
basicDisplayBox(java.awt.Point origin,
java.awt.Point corner)
Sets the display box of a figure. |
protected void |
basicMoveBy(int dx,
int dy)
Moves the figure. |
Connector |
connectorAt(int x,
int y)
Returns the Figures connector for the specified location. |
boolean |
containsPoint(int x,
int y)
Checks if a point is inside the figure. |
java.awt.Rectangle |
displayBox()
Gets the display box of a figure. |
void |
draw(java.awt.Graphics g)
Draws the figure. |
protected void |
drawLine(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2)
Can be overriden in subclasses to draw different types of lines (e.g. |
int |
findSegment(int x,
int y)
Gets the segment of the polyline that is hit by the given point. |
java.lang.Object |
getAttribute(java.lang.String name)
Gets the attribute with the given name. |
LineDecoration |
getEndDecoration()
Returns the end decoration. |
protected java.awt.Color |
getFrameColor()
|
LineDecoration |
getStartDecoration()
Returns the start decoration. |
java.util.Vector |
handles()
Returns the handles of a Figure that can be used to manipulate some of its attributes. |
void |
insertPointAt(java.awt.Point p,
int i)
Insert a node at the given point. |
boolean |
isEmpty()
Checks if the figure is empty. |
boolean |
joinSegments(int x,
int y)
Joins to segments into one if the given point hits a node of the polyline. |
static Locator |
locator(int pointIndex)
Creates a locator for the point with the given index. |
java.awt.Point |
pointAt(int i)
|
int |
pointCount()
|
java.util.Enumeration |
points()
|
void |
read(StorableInput dr)
Reads the Figure from a StorableInput. |
void |
removePointAt(int i)
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets the attribute with the given name. |
void |
setEndDecoration(LineDecoration l)
Sets the end decoration. |
protected void |
setFrameColor(java.awt.Color c)
|
void |
setPointAt(java.awt.Point p,
int i)
Changes the position of a node. |
void |
setStartDecoration(LineDecoration l)
Sets the start decoration. |
int |
splitSegment(int x,
int y)
Splits the segment at the given point if a segment was hit. |
void |
write(StorableOutput dw)
Stores the Figure to a StorableOutput. |
| Methods inherited from class CH.ifa.draw.standard.AbstractFigure |
|---|
addFigureChangeListener, addToContainer, canConnect, center, changed, clone, connectedTextLocator, connectionInsets, connectorVisibility, decompose, displayBox, displayBox, figures, findFigureInside, includes, invalidate, listener, moveBy, release, removeFigureChangeListener, removeFromContainer, 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 ARROW_TIP_NONE
public static final int ARROW_TIP_START
public static final int ARROW_TIP_END
public static final int ARROW_TIP_BOTH
protected java.util.Vector fPoints
protected LineDecoration fStartDecoration
protected LineDecoration fEndDecoration
protected java.awt.Color fFrameColor
| Constructor Detail |
|---|
public PolyLineFigure()
public PolyLineFigure(int size)
public PolyLineFigure(int x,
int y)
| Method Detail |
|---|
public java.awt.Rectangle displayBox()
AbstractFigure
displayBox in interface FiguredisplayBox in class AbstractFigureFigure.basicDisplayBox(java.awt.Point, java.awt.Point)public boolean isEmpty()
AbstractFigure
isEmpty in interface FigureisEmpty in class AbstractFigureFigure.isEmpty()public java.util.Vector handles()
AbstractFigure
handles in interface Figurehandles in class AbstractFigureHandle
public void basicDisplayBox(java.awt.Point origin,
java.awt.Point corner)
AbstractFigure
basicDisplayBox in interface FigurebasicDisplayBox in class AbstractFigureorigin - the new origincorner - the new cornerAbstractFigure.displayBox(java.awt.Point, java.awt.Point)
public void addPoint(int x,
int y)
public java.util.Enumeration points()
public int pointCount()
protected void basicMoveBy(int dx,
int dy)
AbstractFigure
basicMoveBy in class AbstractFigureAbstractFigure.moveBy(int, int)
public void setPointAt(java.awt.Point p,
int i)
public void insertPointAt(java.awt.Point p,
int i)
public void removePointAt(int i)
public int splitSegment(int x,
int y)
public java.awt.Point pointAt(int i)
public boolean joinSegments(int x,
int y)
public Connector connectorAt(int x,
int y)
AbstractFigure
connectorAt in interface FigureconnectorAt in class AbstractFigureChopBoxConnectorpublic void setStartDecoration(LineDecoration l)
public LineDecoration getStartDecoration()
public void setEndDecoration(LineDecoration l)
public LineDecoration getEndDecoration()
public void draw(java.awt.Graphics g)
Figure
g - the Graphics to draw into
protected void drawLine(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2)
public boolean containsPoint(int x,
int y)
AbstractFigure
containsPoint in interface FigurecontainsPoint in class AbstractFigure
public int findSegment(int x,
int y)
public java.lang.Object getAttribute(java.lang.String name)
getAttribute in interface FiguregetAttribute in class AbstractFigure
public void setAttribute(java.lang.String name,
java.lang.Object value)
setAttribute in interface FiguresetAttribute in class AbstractFigurepublic void write(StorableOutput dw)
AbstractFigure
write in interface Storablewrite in class AbstractFigure
public void read(StorableInput dr)
throws java.io.IOException
AbstractFigure
read in interface Storableread in class AbstractFigurejava.io.IOExceptionpublic static Locator locator(int pointIndex)
protected java.awt.Color getFrameColor()
protected void setFrameColor(java.awt.Color c)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||