Class Anchor2D

java.lang.Object
com.here.sdk.core.Anchor2D

public final class Anchor2D extends Object

Represents a point in a rectangle as a ratio of this rectangle's width and height.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    Defines the x axis where the left is 0, the right is 1 and the middle is 0.5.
    double
    Defines the y axis where the top is 0, the bottom is 1 and the middle is 0.5.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance of an Anchor2D with the default parameters
    Anchor2D(double horizontal, double vertical)
    Creates a new instance of an Anchor2D.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Anchor2D
    Returns an anchor positioned at the bottom center.
    static Anchor2D
    Returns an anchor positioned at the bottom left.
    static Anchor2D
    Returns an anchor positioned at the bottom right.
    static Anchor2D
    Returns an anchor positioned at the center.
    boolean
     
    int
     
    static Anchor2D
    Returns an anchor positioned at the left center.
    static Anchor2D
    Returns an anchor positioned at the right center.
    static Anchor2D
    top()
    Returns an anchor positioned at the top center.
    static Anchor2D
    Returns an anchor positioned at the top left.
    static Anchor2D
    Returns an anchor positioned at the top right.

    Methods inherited from class java.lang.Object

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

    • horizontal

      public double horizontal

      Defines the x axis where the left is 0, the right is 1 and the middle is 0.5. The default value is 0.5.

    • vertical

      public double vertical

      Defines the y axis where the top is 0, the bottom is 1 and the middle is 0.5. The default value is 0.5.

  • Constructor Details

    • Anchor2D

      public Anchor2D()

      Creates a new instance of an Anchor2D with the default parameters

    • Anchor2D

      public Anchor2D(double horizontal, double vertical)

      Creates a new instance of an Anchor2D.

      Parameters:
      horizontal -

      Defines the x axis where the left is 0, the right is 1 and the middle is 0.5.

      vertical -

      Defines the y axis where the top is 0, the bottom is 1 and the middle is 0.5.

  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • center

      @NonNull public static Anchor2D center()

      Returns an anchor positioned at the center.

      Returns:

      An Anchor2D at (0.5, 0.5).

    • top

      @NonNull public static Anchor2D top()

      Returns an anchor positioned at the top center.

      Returns:

      An Anchor2D at (0.5, 0.0).

    • topRight

      @NonNull public static Anchor2D topRight()

      Returns an anchor positioned at the top right.

      Returns:

      An Anchor2D at (1.0, 0.0).

    • right

      @NonNull public static Anchor2D right()

      Returns an anchor positioned at the right center.

      Returns:

      An Anchor2D at (1.0, 0.5).

    • bottomRight

      @NonNull public static Anchor2D bottomRight()

      Returns an anchor positioned at the bottom right.

      Returns:

      An Anchor2D at (1.0, 1.0).

    • bottom

      @NonNull public static Anchor2D bottom()

      Returns an anchor positioned at the bottom center.

      Returns:

      An Anchor2D at (0.5, 1.0).

    • bottomLeft

      @NonNull public static Anchor2D bottomLeft()

      Returns an anchor positioned at the bottom left.

      Returns:

      An Anchor2D at (0.0, 1.0).

    • left

      @NonNull public static Anchor2D left()

      Returns an anchor positioned at the left center.

      Returns:

      An Anchor2D at (0.0, 0.5).

    • topLeft

      @NonNull public static Anchor2D topLeft()

      Returns an anchor positioned at the top left.

      Returns:

      An Anchor2D at (0.0, 0.0).