Package net.atthegate.server.service.pdf
Class Line
java.lang.Object
net.atthegate.server.service.pdf.Line
- All Implemented Interfaces:
Drawable
Used to create line objects.
Please see Example_01.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat[]
Draws this line on the specified page.int
Returns the line cap style.Returns the end point of this line.Returns the start point of this line.Places this line in the specified box at position (0.0f, 0.0f).Places this line in the specified box.Places this line in the specified box.scaleBy
(double factor) Scales this line by the spacified factor.scaleBy
(float factor) Scales this line by the spacified factor.setActualText
(String actualText) Sets the actual text for this line.setAltDescription
(String altDescription) Sets the alternate description of this line.setCapStyle
(int style) Sets the line cap style.setColor
(int color) Sets the color for this line.setEndPoint
(double x, double y) Sets the x and y coordinates of the end point.setEndPoint
(float x, float y) Sets the x and y coordinates of the end point.setPattern
(String pattern) The line dash pattern controls the pattern of dashes and gaps used to stroke paths.setPointA
(float x, float y) Sets the x and y coordinates of the start point.setPointB
(float x, float y) Sets the x and y coordinates of the end point.setStartPoint
(double x, double y) Sets the x and y coordinates of the start point.setStartPoint
(float x, float y) Sets the x and y coordinates of the start point.setWidth
(double width) Sets the width of this line.setWidth
(float width) Sets the width of this line.
-
Constructor Details
-
Line
public Line()The default constructor. -
Line
public Line(double x1, double y1, double x2, double y2) Create a line object.- Parameters:
x1
- the x coordinate of the start point.y1
- the y coordinate of the start point.x2
- the x coordinate of the end point.y2
- the y coordinate of the end point.
-
Line
public Line(float x1, float y1, float x2, float y2) Create a line object.- Parameters:
x1
- the x coordinate of the start point.y1
- the y coordinate of the start point.x2
- the x coordinate of the end point.y2
- the y coordinate of the end point.
-
-
Method Details
-
setPattern
The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by a dash array and a dash phase. The elements of the dash array are positive numbers that specify the lengths of alternating dashes and gaps. The dash phase specifies the distance into the dash pattern at which to start the dash. The elements of both the dash array and the dash phase are expressed in user space units.Examples of line dash patterns: "[Array] Phase" Appearance Description _______________ _________________ ____________________________________ "[] 0" ----------------- Solid line "[3] 0" --- --- --- 3 units on, 3 units off, ... "[2] 1" - -- -- -- -- 1 on, 2 off, 2 on, 2 off, ... "[2 1] 0" -- -- -- -- -- -- 2 on, 1 off, 2 on, 1 off, ... "[3 5] 6" --- --- 2 off, 3 on, 5 off, 3 on, 5 off, ... "[2 3] 11" - -- -- -- 1 on, 3 off, 2 on, 3 off, 2 on, ...
- Parameters:
pattern
- the line dash pattern.- Returns:
- this Line object.
-
setStartPoint
Sets the x and y coordinates of the start point.- Parameters:
x
- the x coordinate of the start point.y
- the y coordinate of the start point.- Returns:
- this Line object.
-
setStartPoint
Sets the x and y coordinates of the start point.- Parameters:
x
- the x coordinate of the start point.y
- the y coordinate of the start point.- Returns:
- this Line object.
-
setPointA
Sets the x and y coordinates of the start point.- Parameters:
x
- the x coordinate of the start point.y
- the y coordinate of the start point.- Returns:
- this Line object.
-
getStartPoint
Returns the start point of this line.- Returns:
- Point the point.
-
setEndPoint
Sets the x and y coordinates of the end point.- Parameters:
x
- the x coordinate of the end point.y
- the y coordinate of the end point.- Returns:
- this Line object.
-
setEndPoint
Sets the x and y coordinates of the end point.- Parameters:
x
- the x coordinate of the end point.y
- the t coordinate of the end point.- Returns:
- this Line object.
-
setPointB
Sets the x and y coordinates of the end point.- Parameters:
x
- the x coordinate of the end point.y
- the t coordinate of the end point.- Returns:
- this Line object.
-
getEndPoint
Returns the end point of this line.- Returns:
- Point the point.
-
setWidth
Sets the width of this line.- Parameters:
width
- the width.- Returns:
- this Line object.
-
setWidth
Sets the width of this line.- Parameters:
width
- the width.- Returns:
- this Line object.
-
setColor
Sets the color for this line.- Parameters:
color
- the color specified as an integer.- Returns:
- this Line object.
-
setCapStyle
Sets the line cap style.- Parameters:
style
- the cap style of the current line. Supported values: Cap.BUTT, Cap.ROUND and Cap.PROJECTING_SQUARE- Returns:
- this Line object.
-
getCapStyle
public int getCapStyle()Returns the line cap style.- Returns:
- the cap style.
-
setAltDescription
Sets the alternate description of this line.- Parameters:
altDescription
- the alternate description of the line.- Returns:
- this Line.
-
setActualText
Sets the actual text for this line.- Parameters:
actualText
- the actual text for the line.- Returns:
- this Line.
-
placeIn
Places this line in the specified box at position (0.0f, 0.0f).- Parameters:
box
- the specified box.- Returns:
- this Line object.
- Throws:
Exception
-
placeIn
Places this line in the specified box.- Parameters:
box
- the specified box.x_offset
- the x offset from the top left corner of the box.y_offset
- the y offset from the top left corner of the box.- Returns:
- this Line object.
- Throws:
Exception
-
placeIn
Places this line in the specified box.- Parameters:
box
- the specified box.x_offset
- the x offset from the top left corner of the box.y_offset
- the y offset from the top left corner of the box.- Returns:
- this Line object.
- Throws:
Exception
-
scaleBy
Scales this line by the spacified factor.- Parameters:
factor
- the factor used to scale the line.- Returns:
- this Line object.
- Throws:
Exception
-
scaleBy
Scales this line by the spacified factor.- Parameters:
factor
- the factor used to scale the line.- Returns:
- this Line object.
- Throws:
Exception
-
drawOn
Draws this line on the specified page.
-