All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class CH.ifa.draw.figures.PolyLineFigure

java.lang.Object
   |
   +----CH.ifa.draw.standard.AbstractFigure
           |
           +----CH.ifa.draw.figures.PolyLineFigure

public class PolyLineFigure
extends AbstractFigure
A poly line figure consists of a list of points. It has an optional line decoration at the start and end.

See Also:
LineDecoration

Variable Index

 o ARROW_TIP_BOTH
 o ARROW_TIP_END
 o ARROW_TIP_NONE
 o ARROW_TIP_START
 o fEndDecoration
 o fFrameColor
 o fPoints
 o fStartDecoration

Constructor Index

 o PolyLineFigure()
 o PolyLineFigure(int)
 o PolyLineFigure(int, int)

Method Index

 o addPoint(int, int)
Adds a node to the list of points.
 o basicDisplayBox(Point, Point)
Sets the display box of a figure.
 o basicMoveBy(int, int)
Moves the figure.
 o connectorAt(int, int)
Returns the Figures connector for the specified location.
 o containsPoint(int, int)
Checks if a point is inside the figure.
 o displayBox()
Gets the display box of a figure.
 o draw(Graphics)
Draws the figure.
 o findSegment(int, int)
Gets the segment of the polyline that is hit by the given point.
 o getAttribute(String)
Gets the attribute with the given name.
 o getFrameColor()
 o handles()
Returns the handles of a Figure that can be used to manipulate some of its attributes.
 o insertPointAt(Point, int)
Insert a node at the given point.
 o isEmpty()
Checks if the figure is empty.
 o joinSegments(int, int)
Joins to segments into one if the given point hits a node of the polyline.
 o locator(int)
Creates a locator for the point with the given index.
 o pointAt(int)
 o pointCount()
 o points()
 o read(StorableInput)
Reads the Figure from a StorableInput.
 o removePointAt(int)
 o setAttribute(String, Object)
Sets the attribute with the given name.
 o setEndDecoration(LineDecoration)
Sets the end decoration.
 o setFrameColor(Color)
 o setPointAt(Point, int)
Changes the position of a node.
 o setStartDecoration(LineDecoration)
Sets the start decoration.
 o splitSegment(int, int)
Splits the segment at the given point if a segment was hit.
 o write(StorableOutput)
Stores the Figure to a StorableOutput.

Variables

 o ARROW_TIP_NONE
 public static final int ARROW_TIP_NONE
 o ARROW_TIP_START
 public static final int ARROW_TIP_START
 o ARROW_TIP_END
 public static final int ARROW_TIP_END
 o ARROW_TIP_BOTH
 public static final int ARROW_TIP_BOTH
 o fPoints
 protected Vector fPoints
 o fStartDecoration
 protected LineDecoration fStartDecoration
 o fEndDecoration
 protected LineDecoration fEndDecoration
 o fFrameColor
 protected Color fFrameColor

Constructors

 o PolyLineFigure
 public PolyLineFigure()
 o PolyLineFigure
 public PolyLineFigure(int size)
 o PolyLineFigure
 public PolyLineFigure(int x,
                       int y)

Methods

 o displayBox
 public Rectangle displayBox()
Gets the display box of a figure.

Overrides:
displayBox in class AbstractFigure
 o isEmpty
 public boolean isEmpty()
Checks if the figure is empty.

Overrides:
isEmpty in class AbstractFigure
 o handles
 public Vector handles()
Returns the handles of a Figure that can be used to manipulate some of its attributes.

Overrides:
handles in class AbstractFigure
 o basicDisplayBox
 public void basicDisplayBox(Point origin,
                             Point corner)
Sets the display box of a figure.

Overrides:
basicDisplayBox in class AbstractFigure
 o addPoint
 public void addPoint(int x,
                      int y)
Adds a node to the list of points.

 o points
 public Enumeration points()
 o pointCount
 public int pointCount()
 o basicMoveBy
 protected void basicMoveBy(int dx,
                            int dy)
Moves the figure.

Overrides:
basicMoveBy in class AbstractFigure
 o setPointAt
 public void setPointAt(Point p,
                        int i)
Changes the position of a node.

 o insertPointAt
 public void insertPointAt(Point p,
                           int i)
Insert a node at the given point.

 o removePointAt
 public void removePointAt(int i)
 o splitSegment
 public int splitSegment(int x,
                         int y)
Splits the segment at the given point if a segment was hit.

Returns:
the index of the segment or -1 if no segment was hit.
 o pointAt
 public Point pointAt(int i)
 o joinSegments
 public boolean joinSegments(int x,
                             int y)
Joins to segments into one if the given point hits a node of the polyline.

Returns:
true if the two segments were joined.
 o connectorAt
 public Connector connectorAt(int x,
                              int y)
Returns the Figures connector for the specified location.

Overrides:
connectorAt in class AbstractFigure
 o setStartDecoration
 public void setStartDecoration(LineDecoration l)
Sets the start decoration.

 o setEndDecoration
 public void setEndDecoration(LineDecoration l)
Sets the end decoration.

 o draw
 public void draw(Graphics g)
Draws the figure.

Overrides:
draw in class AbstractFigure
 o containsPoint
 public boolean containsPoint(int x,
                              int y)
Checks if a point is inside the figure.

Overrides:
containsPoint in class AbstractFigure
 o findSegment
 public int findSegment(int x,
                        int y)
Gets the segment of the polyline that is hit by the given point.

Returns:
the index of the segment or -1 if no segment was hit.
 o getAttribute
 public Object getAttribute(String name)
Gets the attribute with the given name. PolyLineFigure maps "ArrowMode"to a line decoration.

Overrides:
getAttribute in class AbstractFigure
 o setAttribute
 public void setAttribute(String name,
                          Object value)
Sets the attribute with the given name. PolyLineFigure interprets "ArrowMode"to set the line decoration.

Overrides:
setAttribute in class AbstractFigure
 o write
 public void write(StorableOutput dw)
Stores the Figure to a StorableOutput.

Overrides:
write in class AbstractFigure
 o read
 public void read(StorableInput dr) throws IOException
Reads the Figure from a StorableInput.

Overrides:
read in class AbstractFigure
 o locator
 public static Locator locator(int pointIndex)
Creates a locator for the point with the given index.

 o getFrameColor
 protected Color getFrameColor()
 o setFrameColor
 protected void setFrameColor(Color c)

All Packages  Class Hierarchy  This Package  Previous  Next  Index