- java.lang.Object
-
- org.testfx.util.PointQueryUtils
-
public final class PointQueryUtils extends Object
-
-
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 givenpositionFactors
.static javafx.geometry.Point2D
computePositionFactors(javafx.geometry.Pos position)
Computes the width/height factors for the point defined by the givenposition
.
-
-
-
Method Detail
-
atPosition
public static javafx.geometry.Point2D atPosition(javafx.geometry.Bounds bounds, javafx.geometry.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
position
tocomputePositionFactors(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 givenpositionFactors
.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 boundspositionFactors
- aPoint2D
object 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 javafx.geometry.Point2D computePositionFactors(javafx.geometry.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_LEFT
has a width and height factor of 0.0, whereasPos.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 apositionFactor
object inatPositionFactors(Bounds, Point2D)
.
-
-