Record Class FixedDocument.Line

java.lang.Object
java.lang.Record
io.leandev.appfuse.pdf.FixedDocument.Line
All Implemented Interfaces:
FixedDocument.Element
Enclosing class:
FixedDocument

public static record FixedDocument.Line(String id, FixedDocument.Layer layer, double x1, double y1, double x2, double y2, double strokePt, int rgb, List<Double> dashPatternPt, double dashPhasePt) extends Record implements FixedDocument.Element
任意方向線段,可用於撕線、點線或虛線分隔。 dashPatternPt 為交替的線段與空白長度(pt,與線寬同單位);空清單為實線,奇數個元素由 PDF 重複兩次形成週期。 dashPhasePt 為週期起點偏移,實線必須為 0。整條線以單一路徑繪製,不需拆段。
Since:
4.0.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final List<Double>
    舊版 dashed=true 的固定線型:3 pt 線段/3 pt 空白。
  • Constructor Summary

    Constructors
    Constructor
    Description
    Line(String id, FixedDocument.Layer layer, double x1, double y1, double x2, double y2, double strokePt, int rgb, boolean dashed)
    保留既有建構器;dashed 為 true 時使用 DEFAULT_DASH。
    Line(String id, FixedDocument.Layer layer, double x1, double y1, double x2, double y2, double strokePt, int rgb, List<Double> dashPatternPt, double dashPhasePt)
    Creates an instance of a Line record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    Returns the value of the dashPatternPt record component.
    double
    Returns the value of the dashPhasePt record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    id()
    Returns the value of the id record component.
    Returns the value of the layer record component.
    int
    rgb()
    Returns the value of the rgb record component.
    double
    Returns the value of the strokePt record component.
    final String
    Returns a string representation of this record class.
    withDash(List<Double> patternPt, double phasePt)
     
    double
    x1()
    Returns the value of the x1 record component.
    double
    x2()
    Returns the value of the x2 record component.
    double
    y1()
    Returns the value of the y1 record component.
    double
    y2()
    Returns the value of the y2 record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • DEFAULT_DASH

      public static final List<Double> DEFAULT_DASH
      舊版 dashed=true 的固定線型:3 pt 線段/3 pt 空白。
  • Constructor Details

    • Line

      public Line(String id, FixedDocument.Layer layer, double x1, double y1, double x2, double y2, double strokePt, int rgb, List<Double> dashPatternPt, double dashPhasePt)
      Creates an instance of a Line record class.
      Parameters:
      id - the value for the id record component
      layer - the value for the layer record component
      x1 - the value for the x1 record component
      y1 - the value for the y1 record component
      x2 - the value for the x2 record component
      y2 - the value for the y2 record component
      strokePt - the value for the strokePt record component
      rgb - the value for the rgb record component
      dashPatternPt - the value for the dashPatternPt record component
      dashPhasePt - the value for the dashPhasePt record component
    • Line

      public Line(String id, FixedDocument.Layer layer, double x1, double y1, double x2, double y2, double strokePt, int rgb, boolean dashed)
      保留既有建構器;dashed 為 true 時使用 DEFAULT_DASH。
  • Method Details

    • dashed

      public boolean dashed()
      Returns:
      是否為非實線
    • withDash

      public FixedDocument.Line withDash(List<Double> patternPt, double phasePt)
      Parameters:
      patternPt - 交替的線段/空白長度(pt);空清單為實線
      phasePt - 非負起點偏移(pt)
      Returns:
      只改線型的新線段
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public String id()
      Returns the value of the id record component.
      Specified by:
      id in interface FixedDocument.Element
      Returns:
      the value of the id record component
    • layer

      public FixedDocument.Layer layer()
      Returns the value of the layer record component.
      Specified by:
      layer in interface FixedDocument.Element
      Returns:
      the value of the layer record component
    • x1

      public double x1()
      Returns the value of the x1 record component.
      Returns:
      the value of the x1 record component
    • y1

      public double y1()
      Returns the value of the y1 record component.
      Returns:
      the value of the y1 record component
    • x2

      public double x2()
      Returns the value of the x2 record component.
      Returns:
      the value of the x2 record component
    • y2

      public double y2()
      Returns the value of the y2 record component.
      Returns:
      the value of the y2 record component
    • strokePt

      public double strokePt()
      Returns the value of the strokePt record component.
      Returns:
      the value of the strokePt record component
    • rgb

      public int rgb()
      Returns the value of the rgb record component.
      Returns:
      the value of the rgb record component
    • dashPatternPt

      public List<Double> dashPatternPt()
      Returns the value of the dashPatternPt record component.
      Returns:
      the value of the dashPatternPt record component
    • dashPhasePt

      public double dashPhasePt()
      Returns the value of the dashPhasePt record component.
      Returns:
      the value of the dashPhasePt record component