- java.lang.Object
-
- org.testfx.util.PointQueryUtils
-
public final class PointQueryUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Point2DatPosition(Bounds bounds, Pos position)static Point2DatPositionFactors(Bounds bounds, Point2D positionFactors)Returns the point within the given bounds computed using the givenpositionFactors.static Point2DcomputePositionFactors(Pos position)Computes the width/height factors for the point defined by the givenposition.
-
-
-
Method Detail
-
atPosition
public static Point2D atPosition(Bounds bounds, Pos position)
- Parameters:
bounds- the given boundsposition- the position within the bounds- Returns:
- a point somewhere in the given bounds whose x and y values are determined by
passing the given
positiontocomputePositionFactors(Pos).
-
atPositionFactors
public static Point2D atPositionFactors(Bounds bounds, Point2D positionFactors)
Returns the point within the given bounds computed using the givenpositionFactors.The x-component of the returned point is computed using:
x = bounds.x + positionFactors.x * bounds.widthand analogously the y-component of the returned point is computed using:
y = bounds.y + positionFactors.y * bounds.height- Parameters:
bounds- the given boundspositionFactors- aPoint2Dobject whose x and y values represent percentages (0.0 = 0% and 1.0 = 100%). As an example, an x value of 0 will returnBounds.getMinX(), 1.0 will returnBounds.getMaxX(), and 0.5 will returnbounds.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 Point2D computePositionFactors(Pos position)
Computes the width/height factors for the point defined by the givenposition.The width factor is returned in the x component and the height factor in the y component of the point. That is,
Pos.TOP_LEFThas a width and height factor of 0.0, whereasPos.BOTTOM_RIGHThas a width and height factor of 1.0.- Parameters:
position- the position to compute width/height factors for- Returns:
- a
Point2Dthat can be used as apositionFactorobject inatPositionFactors(Bounds, Point2D).
-
-