Class FXRectangles

java.lang.Object
org.jhotdraw8.geom.FXRectangles

public class FXRectangles extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static javafx.geometry.BoundingBox
    add(javafx.geometry.Bounds a, javafx.geometry.Bounds b)
     
    static javafx.geometry.Point2D
     
    static javafx.geometry.Point2D
    center(javafx.geometry.Bounds r)
    Calculate the center of the given bounds
    static javafx.geometry.Point2D
    center(javafx.geometry.Rectangle2D r)
    Calculate the center of the given bounds
    static boolean
    contains(javafx.geometry.Bounds r, double x, double y, double tolerance)
    Returns true if the bounds contain the specified point within the given tolerance.
    static boolean
    contains(javafx.geometry.Bounds r, javafx.geometry.Point2D p, double tolerance)
    Returns true if the bounds contain the specified point within the given tolerance.
    static boolean
    contains(javafx.geometry.Rectangle2D r1, javafx.geometry.Rectangle2D r2)
    Returns true, if rectangle 1 contains rectangle 2.
    static javafx.geometry.Point2D
    east(javafx.geometry.Rectangle2D r)
     
    static javafx.geometry.BoundingBox
    Gets the bounds of the specified shape.
    static javafx.geometry.Bounds
    getBounds(javafx.geometry.Rectangle2D r)
    Gets the bounds of the specified shape.
    static javafx.geometry.Bounds
    grow(javafx.geometry.Bounds r, double hv)
    Resizes the Bounds both horizontally and vertically.
    static javafx.geometry.Bounds
    grow(javafx.geometry.Bounds r, double h, double v)
    Resizes the Bounds both horizontally and vertically.
    static javafx.geometry.Rectangle2D
    grow(javafx.geometry.Rectangle2D r, double h, double v)
    Resizes the Rectangle2D both horizontally and vertically.
    static javafx.geometry.Bounds
    intersection(javafx.geometry.Bounds a, javafx.geometry.Bounds b)
     
    static boolean
    isEmpty(javafx.geometry.Rectangle2D b)
    Returns true if the widht or the height is less or equal 0.
    static boolean
    isFinite(javafx.geometry.Bounds bounds)
    Returns true if the given bounds are finite.
    static javafx.geometry.Point2D
    north(javafx.geometry.Rectangle2D r)
     
    static int
    outcode(javafx.geometry.Rectangle2D r1, javafx.geometry.Rectangle2D r2)
    This method computes a binary OR of the appropriate mask values indicating, for each side of Rectangle2D r1, whether or not the Rectangle2D r2 is on the same side of the edge as the rest of this Rectangle2D.
    static javafx.geometry.Point2D
    south(javafx.geometry.Rectangle2D r)
     
    toAwtRectangle2D(javafx.geometry.Bounds r)
    Converts a bounding box to a AWT rectangle.
    static javafx.geometry.Rectangle2D
    toRectangle2D(javafx.geometry.Bounds r)
    Converts a bounding box to a FX rectangle.
    static String
    toString(@Nullable javafx.geometry.Bounds b)
     
    static String
    toString(@Nullable javafx.geometry.Rectangle2D b)
     
    static javafx.geometry.Bounds
    union(javafx.geometry.Bounds a, javafx.geometry.Bounds... bs)
     
    static javafx.geometry.Point2D
    west(javafx.geometry.Rectangle2D r)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FXRectangles

      public FXRectangles()
  • Method Details

    • getBounds

      public static javafx.geometry.BoundingBox getBounds(Shape shape)
      Gets the bounds of the specified shape.
      Parameters:
      shape - an AWT shape
      Returns:
      JavaFX bounds
    • toAwtRectangle2D

      public static Rectangle2D.Double toAwtRectangle2D(javafx.geometry.Bounds r)
      Converts a bounding box to a AWT rectangle.
      Parameters:
      r - a bounding box
      Returns:
      the rectangle
    • toRectangle2D

      public static javafx.geometry.Rectangle2D toRectangle2D(javafx.geometry.Bounds r)
      Converts a bounding box to a FX rectangle.
      Parameters:
      r - a bounding box
      Returns:
      the rectangle
    • add

      public static javafx.geometry.BoundingBox add(javafx.geometry.Bounds a, javafx.geometry.Bounds b)
    • center

      public static javafx.geometry.Point2D center(javafx.geometry.Bounds r)
      Calculate the center of the given bounds
      Parameters:
      r - the bounds
      Returns:
      the center
    • contains

      public static boolean contains(javafx.geometry.Bounds r, javafx.geometry.Point2D p, double tolerance)
      Returns true if the bounds contain the specified point within the given tolerance.
      Parameters:
      r - the bounds
      p - the point
      tolerance - the tolerance
      Returns:
      true if inside
    • contains

      public static boolean contains(javafx.geometry.Bounds r, double x, double y, double tolerance)
      Returns true if the bounds contain the specified point within the given tolerance.
      Parameters:
      r - the bounds
      x - the x-coordinate of the point
      y - the y-coordinate of the point
      tolerance - the tolerance
      Returns:
      true if inside
    • getBounds

      public static javafx.geometry.Bounds getBounds(javafx.geometry.Rectangle2D r)
      Gets the bounds of the specified shape.
      Parameters:
      r - a rectangle
      Returns:
      JavaFX bounds
    • grow

      public static javafx.geometry.Bounds grow(javafx.geometry.Bounds r, double h, double v)
      Resizes the Bounds both horizontally and vertically.

      This method returns a new Bounds so that it is h units larger on both the left and right side, and v units larger at both the top and bottom.

      The new Bounds has (x - h, y - v) as its top-left corner, a width of width + 2h, and a height of height + 2v.

      If negative values are supplied for h and v, the size of the Rectangle2D decreases accordingly. The grow method does not check whether the resulting values of width and height are non-negative.

      Parameters:
      r - the bounds
      h - the horizontal expansion
      v - the vertical expansion
      Returns:
      the new rectangle
    • grow

      public static javafx.geometry.Bounds grow(javafx.geometry.Bounds r, double hv)
      Resizes the Bounds both horizontally and vertically.
      Parameters:
      r - the bounds
      hv - the horizontal and vertical expansion
      Returns:
      the new rectangle
      See Also:
    • union

      public static javafx.geometry.Bounds union(javafx.geometry.Bounds a, javafx.geometry.Bounds... bs)
    • isFinite

      public static boolean isFinite(javafx.geometry.Bounds bounds)
      Returns true if the given bounds are finite.
      Parameters:
      bounds - the bounds
      Returns:
      true if finiite
    • intersection

      public static javafx.geometry.Bounds intersection(javafx.geometry.Bounds a, javafx.geometry.Bounds b)
    • center

      public static javafx.geometry.Point2D center(Rectangle2D r)
    • center

      public static javafx.geometry.Point2D center(javafx.geometry.Rectangle2D r)
      Calculate the center of the given bounds
      Parameters:
      r - the bounds
      Returns:
      the center
    • east

      public static javafx.geometry.Point2D east(javafx.geometry.Rectangle2D r)
    • north

      public static javafx.geometry.Point2D north(javafx.geometry.Rectangle2D r)
    • outcode

      public static int outcode(javafx.geometry.Rectangle2D r1, javafx.geometry.Rectangle2D r2)
      This method computes a binary OR of the appropriate mask values indicating, for each side of Rectangle2D r1, whether or not the Rectangle2D r2 is on the same side of the edge as the rest of this Rectangle2D.
      Parameters:
      r1 - rectangle 1
      r2 - rectangle 2
      Returns:
      the logical OR of all appropriate out codes OUT_RIGHT, OUT_LEFT, OUT_BOTTOM, OUT_TOP.
    • south

      public static javafx.geometry.Point2D south(javafx.geometry.Rectangle2D r)
    • isEmpty

      public static boolean isEmpty(javafx.geometry.Rectangle2D b)
      Returns true if the widht or the height is less or equal 0.
      Parameters:
      b - a rectangle
      Returns:
      true if empty
    • toString

      public static String toString(@Nullable javafx.geometry.Bounds b)
    • contains

      public static boolean contains(javafx.geometry.Rectangle2D r1, javafx.geometry.Rectangle2D r2)
      Returns true, if rectangle 1 contains rectangle 2.

      This method is similar to Rectangle2D.contains, but also returns true, when rectangle1 contains rectangle2 and either or both of them are empty.

      Parameters:
      r1 - Rectangle2D 1.
      r2 - Rectangle2D 2.
      Returns:
      true if r1 contains r2.
    • grow

      public static javafx.geometry.Rectangle2D grow(javafx.geometry.Rectangle2D r, double h, double v)
      Resizes the Rectangle2D both horizontally and vertically.

      This method returns a new Rectangle2D so that it is h units larger on both the left and right side, and v units larger at both the top and bottom.

      The new Rectangle2D has (x - h, y - v) as its top-left corner, a width of width + 2h, and a height of height + 2v.

      If negative values are supplied for h and v, the size of the Rectangle2D decreases accordingly. The grow method does not check whether the resulting values of width and height are non-negative.

      Parameters:
      r - the rectangle
      h - the horizontal expansion
      v - the vertical expansion
      Returns:
      the new rectangle
    • toString

      public static String toString(@Nullable javafx.geometry.Rectangle2D b)
    • west

      public static javafx.geometry.Point2D west(javafx.geometry.Rectangle2D r)