Class BoundsLocator

java.lang.Object
org.jhotdraw8.draw.locator.AbstractLocator
org.jhotdraw8.draw.locator.BoundsLocator
All Implemented Interfaces:
Locator

public class BoundsLocator extends AbstractLocator
A locator that specifies a point that is relative to the bounds of a figure.

The locator has the following parameters:

relativeX
Defines a position on the X-axis of the figure, relative to its width. Where 0.0 lies at the left edge of the figure and 1.0 at the right edge.
relativeY
Defines a position on the Y-axis of the figure, relative to its height. Where 0.0 lies at the top edge of the figure and 1.0 at the bottom edge.
Author:
Werner Randelshofer
  • Field Details

    • CENTER

      public static final BoundsLocator CENTER
    • EAST

      public static final BoundsLocator EAST
    • NORTH

      public static final BoundsLocator NORTH
    • NORTH_EAST

      public static final BoundsLocator NORTH_EAST
    • NORTH_WEST

      public static final BoundsLocator NORTH_WEST
    • SOUTH

      public static final BoundsLocator SOUTH
    • SOUTH_EAST

      public static final BoundsLocator SOUTH_EAST
    • SOUTH_WEST

      public static final BoundsLocator SOUTH_WEST
    • WEST

      public static final BoundsLocator WEST
    • relativeX

      protected final double relativeX
      Relative x-coordinate on the bounds of the figure. The value 0 is on the left boundary of the figure, the value 1 on the right boundary.
    • relativeY

      protected final double relativeY
      Relative y-coordinate on the bounds of the figure. The value 0 is on the top boundary of the figure, the value 1 on the bottom boundary.
  • Constructor Details

    • BoundsLocator

      public BoundsLocator()
      Creates a new instance.
    • BoundsLocator

      public BoundsLocator(double relativeX, double relativeY)
      Creates a new instance.
      Parameters:
      relativeX - x-position relative to bounds expressed as a value between 0 and 1.
      relativeY - y-position relative to bounds expressed as a value between 0 and 1.
    • BoundsLocator

      public BoundsLocator(@NonNull javafx.geometry.Bounds bounds, @NonNull javafx.geometry.Point2D p)
      Creates a new instance.
      Parameters:
      bounds - current local bounds of a figure
      p - a local coordinate on the figure
    • BoundsLocator

      public BoundsLocator(@NonNull javafx.geometry.Bounds bounds, double x, double y)
      Creates a new instance.
      Parameters:
      bounds - current local bounds of a figure
      x - a local coordinate on the figure
      y - a local coordinate on the figre
  • Method Details

    • getRelativeX

      public double getRelativeX()
    • getRelativeY

      public double getRelativeY()
    • locate

      public @NonNull javafx.geometry.Point2D locate(@NonNull Figure owner)
      Description copied from interface: Locator
      Locates a position on the provided figure.
      Parameters:
      owner - provided figure
      Returns:
      a point on the figure in local coordinates.
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object