Class PointQueryUtils

java.lang.Object
org.testfx.util.PointQueryUtils

public final class PointQueryUtils extends Object
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static javafx.geometry.Point2D
    atPosition(javafx.geometry.Bounds bounds, javafx.geometry.Pos position)
     
    static javafx.geometry.Point2D
    atPositionFactors(javafx.geometry.Bounds bounds, javafx.geometry.Point2D positionFactors)
    Returns the point within the given bounds computed using the given positionFactors.
    static javafx.geometry.Point2D
    computePositionFactors(javafx.geometry.Pos position)
    Computes the width/height factors for the point defined by the given position.
    private static double
    computePositionX(javafx.geometry.HPos hPos)
     
    private static double
    computePositionY(javafx.geometry.VPos vPos)
     
    private static double
    lerp(double start, double distance, double factor)
     

    Methods inherited from class java.lang.Object

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

    • PointQueryUtils

      private PointQueryUtils()
  • Method Details

    • atPosition

      public static javafx.geometry.Point2D atPosition(javafx.geometry.Bounds bounds, javafx.geometry.Pos position)
      Parameters:
      bounds - the given bounds
      position - the position within the bounds
      Returns:
      a point somewhere in the given bounds whose x and y values are determined by passing the given position to computePositionFactors(Pos).
    • atPositionFactors

      public static javafx.geometry.Point2D atPositionFactors(javafx.geometry.Bounds bounds, javafx.geometry.Point2D positionFactors)
      Returns the point within the given bounds computed using the given positionFactors.

      The x-component of the returned point is computed using:

      x = bounds.x + positionFactors.x * bounds.width

      and analogously the y-component of the returned point is computed using: y = bounds.y + positionFactors.y * bounds.height

      Parameters:
      bounds - the given bounds
      positionFactors - a Point2D object whose x and y values represent percentages (0.0 = 0% and 1.0 = 100%). As an example, an x value of 0 will return Bounds.getMinX(), 1.0 will return Bounds.getMaxX(), and 0.5 will return bounds.getMinX() + (bounds.getWidth() * positionFactors.getX().
      Returns:
      the point somewhere within the given bounds whose x and y values are determined by the given positionFactors.
    • computePositionFactors

      public static javafx.geometry.Point2D computePositionFactors(javafx.geometry.Pos position)
      Computes the width/height factors for the point defined by the given position.

      The width factor is returned in the x component and the height factor in the y component of the point. That is, Pos.TOP_LEFT has a width and height factor of 0.0, whereas Pos.BOTTOM_RIGHT has a width and height factor of 1.0.

      Parameters:
      position - the position to compute width/height factors for
      Returns:
      a Point2D that can be used as a positionFactor object in atPositionFactors(Bounds, Point2D).
    • lerp

      private static double lerp(double start, double distance, double factor)
    • computePositionX

      private static double computePositionX(javafx.geometry.HPos hPos)
    • computePositionY

      private static double computePositionY(javafx.geometry.VPos vPos)