Class Size

java.lang.Object
cn.mapway.ui.client.mvc.Size

@JsType public class Size extends Object
Size 该size可以被javascript使用
  • Field Details

    • x

      public double x
    • y

      public double y
  • Constructor Details

    • Size

      protected Size()
    • Size

      @JsConstructor public Size(double x, double y)
  • Method Details

    • distanceTo

      @JsMethod(name="distanceToXY") public double distanceTo(double tx, double ty)
    • distanceTo

      @JsMethod(name="distanceToOtherSize") public double distanceTo(Size target)
    • create

      public static Size create(double x, double y)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toSVGString

      public String toSVGString()
      SVG representation Sizes="50,0 21,90 98,35 2,35 79,90" x,y format
      Returns:
    • offset

      public Size offset(double offsetX, double offsetY)
    • set

      public Size set(double x, double y)
    • getX

      public double getX()
    • getY

      public double getY()
    • getXAsInt

      public int getXAsInt()
    • getYAsInt

      public int getYAsInt()
    • copyFrom

      public Size copyFrom(Size src)
    • clone

      public Size clone()
      Overrides:
      clone in class Object
    • copyTo

      public Size copyTo(Size dest)
    • scale

      public Size scale(double scaleX, double scaleY)
    • calculateArrowheadSizes

      public static Size[] calculateArrowheadSizes(Size startSize, Size endSize, double arrowLength, double arrowHalfWidth)
      Calculates the two base coordinates of an arrowhead given a line segment. The arrowhead tip is at 'endSize'.
      Parameters:
      startSize - The starting Size of the line segment.
      endSize - The ending Size of the line segment (arrowhead tip).
      arrowLength - The length of the arrowhead (distance from tip to base).
      arrowHalfWidth - The half-width of the arrowhead at its base.
      Returns:
      An array of two Size objects representing the base corners of the arrowhead. Returns null if the line segment has zero length (start and end Sizes are the same).