Record Class SvgDocument

java.lang.Object
java.lang.Record
io.leandev.appfuse.report.internal.svg.SvgDocument
Record Components:
viewX - viewBox 左上 x
viewY - viewBox 左上 y
viewWidth - viewBox 寬
viewHeight - viewBox 高
align - preserveAspectRatio 的對齊;null 表示 none
slice - slice(否則為 meet)
items - 繪圖項目

public record SvgDocument(double viewX, double viewY, double viewWidth, double viewHeight, SvgDocument.Align align, boolean slice, List<SvgDocument.Item> items) extends Record
解析並通過政策檢查的 SVG:viewBox 與依文件順序排列的繪圖項目(使用者座標)
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    preserveAspectRatio 的九種對齊;數值為水平、垂直的比例位置
    static interface 
    繪圖項目;transform 為祖先與自身 transform 的累積(不含 viewBox 映射)
    static final record 
    一段同樣式的文字;x/y 為 null 表示接續前一段的位置
    static final record 
     
    static final record 
    一個 text 元素;runs 為其文字與 tspan 依序展開
  • Constructor Summary

    Constructors
    Constructor
    Description
    SvgDocument(double viewX, double viewY, double viewWidth, double viewHeight, SvgDocument.Align align, boolean slice, List<SvgDocument.Item> items)
    Creates an instance of a SvgDocument record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the align record component.
    void
    checkRanges(double width, double height)
    以 Figure 的寬高檢查衍生數值範圍(REP-04 契約「衍生數值範圍」)
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the items record component.
    boolean
    Returns the value of the slice record component.
    final String
    Returns a string representation of this record class.
    view(double width, double height)
    viewBox 到 Figure 座標(pt,原點左上、y 向下)的映射
    double
    Returns the value of the viewHeight record component.
    double
    Returns the value of the viewWidth record component.
    double
    Returns the value of the viewX record component.
    double
    Returns the value of the viewY record component.

    Methods inherited from class Object

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

    • SvgDocument

      public SvgDocument(double viewX, double viewY, double viewWidth, double viewHeight, SvgDocument.Align align, boolean slice, List<SvgDocument.Item> items)
      Creates an instance of a SvgDocument record class.
      Parameters:
      viewX - the value for the viewX record component
      viewY - the value for the viewY record component
      viewWidth - the value for the viewWidth record component
      viewHeight - the value for the viewHeight record component
      align - the value for the align record component
      slice - the value for the slice record component
      items - the value for the items record component
  • Method Details

    • view

      public Transform view(double width, double height)
      viewBox 到 Figure 座標(pt,原點左上、y 向下)的映射
    • checkRanges

      public void checkRanges(double width, double height)
      以 Figure 的寬高檢查衍生數值範圍(REP-04 契約「衍生數值範圍」)
      Throws:
      SvgException - OUT_OF_RANGE
    • 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.
    • viewX

      public double viewX()
      Returns the value of the viewX record component.
      Returns:
      the value of the viewX record component
    • viewY

      public double viewY()
      Returns the value of the viewY record component.
      Returns:
      the value of the viewY record component
    • viewWidth

      public double viewWidth()
      Returns the value of the viewWidth record component.
      Returns:
      the value of the viewWidth record component
    • viewHeight

      public double viewHeight()
      Returns the value of the viewHeight record component.
      Returns:
      the value of the viewHeight record component
    • align

      public SvgDocument.Align align()
      Returns the value of the align record component.
      Returns:
      the value of the align record component
    • slice

      public boolean slice()
      Returns the value of the slice record component.
      Returns:
      the value of the slice record component
    • items

      public List<SvgDocument.Item> items()
      Returns the value of the items record component.
      Returns:
      the value of the items record component