Class LineElement
- java.lang.Object
-
- org.openscience.cdk.renderer.elements.LineElement
-
- All Implemented Interfaces:
IRenderingElement
- Direct Known Subclasses:
WedgeLineElement
public class LineElement extends Object implements IRenderingElement
A line between two points.- Source code:
- main
- Belongs to CDK module:
- renderbasic
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLineElement.LineTypeThe type of the line.
-
Field Summary
Fields Modifier and Type Field Description ColorcolorThe color of the line.doublefirstPointXThe x-coordinate of the first point.doublefirstPointYThe y-coordinate of the first point.doublesecondPointXThe x-coordinate of the second point.doublesecondPointYThe y-coordinate of the second point.doublewidthThe width of the line.
-
Constructor Summary
Constructors Constructor Description LineElement(double firstPointX, double firstPointY, double secondPointX, double secondPointY, double width, Color color)Make a line element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(IRenderingVisitor visitor)Converts thisTextElementinto widget specific objects.AreatoArea()Convert the Line to an awt.Area, by default the line will have an approximation of rounded end caps.AreatoArea(boolean endCaps)Convert the Line to an awt.Area specifying whether to include the end caps or not.
-
-
-
Field Detail
-
firstPointX
public final double firstPointX
The x-coordinate of the first point.
-
firstPointY
public final double firstPointY
The y-coordinate of the first point.
-
secondPointX
public final double secondPointX
The x-coordinate of the second point.
-
secondPointY
public final double secondPointY
The y-coordinate of the second point.
-
width
public final double width
The width of the line.
-
color
public final Color color
The color of the line.
-
-
Constructor Detail
-
LineElement
public LineElement(double firstPointX, double firstPointY, double secondPointX, double secondPointY, double width, Color color)Make a line element.- Parameters:
firstPointX- x-coordinate of the first pointfirstPointY- y-coordinate of the first pointsecondPointX- x-coordinate of the second pointsecondPointY- y-coordinate of the second pointwidth- the width of the linecolor- the color of the line
-
-
Method Detail
-
accept
public void accept(IRenderingVisitor visitor)
Converts thisTextElementinto widget specific objects.- Specified by:
acceptin interfaceIRenderingElement- Parameters:
visitor- Toolkit specific widget factory.
-
toArea
public Area toArea()
Convert the Line to an awt.Area, by default the line will have an approximation of rounded end caps.- Returns:
- the area
-
toArea
public Area toArea(boolean endCaps)
Convert the Line to an awt.Area specifying whether to include the end caps or not.- Parameters:
endCaps- include the end caps- Returns:
- the area
-
-