Class Line

java.lang.Object
net.atthegate.server.service.pdf.Line
All Implemented Interfaces:
Drawable

public class Line extends Object implements Drawable
Used to create line objects. Please see Example_01.
  • Constructor Summary

    Constructors
    Constructor
    Description
    The default constructor.
    Line(double x1, double y1, double x2, double y2)
    Create a line object.
    Line(float x1, float y1, float x2, float y2)
    Create a line object.
  • Method Summary

    Modifier and Type
    Method
    Description
    float[]
    drawOn(Page page)
    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.
    placeIn(Box box)
    Places this line in the specified box at position (0.0f, 0.0f).
    placeIn(Box box, double x_offset, double y_offset)
    Places this line in the specified box.
    placeIn(Box box, float x_offset, float y_offset)
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public Line setPattern(String pattern)
      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

      public Line setStartPoint(double x, double y)
      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

      public Line setStartPoint(float x, float y)
      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

      public Line setPointA(float x, float y)
      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

      public Point getStartPoint()
      Returns the start point of this line.
      Returns:
      Point the point.
    • setEndPoint

      public Line setEndPoint(double x, double y)
      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

      public Line setEndPoint(float x, float y)
      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

      public Line setPointB(float x, float y)
      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

      public Point getEndPoint()
      Returns the end point of this line.
      Returns:
      Point the point.
    • setWidth

      public Line setWidth(double width)
      Sets the width of this line.
      Parameters:
      width - the width.
      Returns:
      this Line object.
    • setWidth

      public Line setWidth(float width)
      Sets the width of this line.
      Parameters:
      width - the width.
      Returns:
      this Line object.
    • setColor

      public Line setColor(int color)
      Sets the color for this line.
      Parameters:
      color - the color specified as an integer.
      Returns:
      this Line object.
    • setCapStyle

      public Line setCapStyle(int style)
      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

      public Line setAltDescription(String altDescription)
      Sets the alternate description of this line.
      Parameters:
      altDescription - the alternate description of the line.
      Returns:
      this Line.
    • setActualText

      public Line setActualText(String actualText)
      Sets the actual text for this line.
      Parameters:
      actualText - the actual text for the line.
      Returns:
      this Line.
    • placeIn

      public Line placeIn(Box box) throws Exception
      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

      public Line placeIn(Box box, double x_offset, double y_offset) throws Exception
      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

      public Line placeIn(Box box, float x_offset, float y_offset) throws Exception
      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

      public Line scaleBy(double factor) throws Exception
      Scales this line by the spacified factor.
      Parameters:
      factor - the factor used to scale the line.
      Returns:
      this Line object.
      Throws:
      Exception
    • scaleBy

      public Line scaleBy(float factor) throws Exception
      Scales this line by the spacified factor.
      Parameters:
      factor - the factor used to scale the line.
      Returns:
      this Line object.
      Throws:
      Exception
    • drawOn

      public float[] drawOn(Page page) throws Exception
      Draws this line on the specified page.
      Specified by:
      drawOn in interface Drawable
      Parameters:
      page - the page to draw this line on.
      Returns:
      x and y coordinates of the bottom right corner of this component.
      Throws:
      Exception