public class LabelledLine extends Object
Constructor and Description |
---|
LabelledLine(Point2D[] gps,
String label)
Constructs a labelled line with an arbitrary number of points.
|
LabelledLine(Point2D gp0,
Point2D gp1,
String label)
Constructs a straight labelled line between two points.
|
Modifier and Type | Method and Description |
---|---|
void |
drawLabel(Graphics2D g2,
Color bg)
Draws the label in the middle of the line to a given graphics context.
|
void |
drawLine(Graphics2D g2)
Draws the line to a given graphics context.
|
String |
getLabel()
Returns the annotation.
|
Path2D |
getPath()
Returns a path object corresponding to this line.
|
Point2D[] |
getPoints()
Returns the array of points defining this line.
|
String |
toString() |
public LabelledLine(Point2D gp0, Point2D gp1, String label)
gp0
- start point in graphics spacegp1
- end point in graphics spacelabel
- human-readable annotation for line (may be null)public LabelledLine(Point2D[] gps, String label)
gps
- array of points in graphics space defining the linelabel
- human-readable annotation for line (may be null)public Point2D[] getPoints()
public String getLabel()
public void drawLine(Graphics2D g2)
g2
- graphics contextpublic Path2D getPath()
public void drawLabel(Graphics2D g2, Color bg)
g2
- graphics contextbg
- background colour, or nullCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.