public class LineString extends java.lang.Object implements GraphicalPrimitive, java.lang.Iterable<Point>
Modifier and Type | Field and Description |
---|---|
java.awt.Color |
drawColor
The drawing color of the line string.
|
Constructor and Description |
---|
LineString()
Builds and initializes a line string with a default drawing color (light gray).
|
LineString(java.awt.Color dc)
Builds and initializes a line string with no point at the beginning.
|
Modifier and Type | Method and Description |
---|---|
void |
addPoint(Point p)
Adds a point at the end of the line string.
|
void |
draw(java.awt.Graphics2D g2d,
CoordinateConverter converter)
The function that draws the primitive
|
BoundingBox |
getBoundingBox()
Computes the bounding box of the graphical primitive.
|
java.util.Iterator<Point> |
iterator()
Gets an iterator over the points of the line string.
|
public LineString(java.awt.Color dc)
dc
- the drawing color.public LineString()
public void draw(java.awt.Graphics2D g2d, CoordinateConverter converter)
GraphicalPrimitive
draw
in interface GraphicalPrimitive
g2d
- the Graphics2D object on which the shape must be drawn.converter
- the coordinate converter used to convert the primitive's coordinates into the screen (hence Graphics2D) coordinates.public void addPoint(Point p)
p
- the point to be added.public java.util.Iterator<Point> iterator()
iterator
in interface java.lang.Iterable<Point>
public BoundingBox getBoundingBox()
GraphicalPrimitive
getBoundingBox
in interface GraphicalPrimitive