Top Description Constructors Methods
impl.org.controlsfx.tools.rectangle

public Class CoordinatePositions

extends Object
Class Inheritance
Imports
java.util.EnumSet, javafx.geometry.Point2D, .Rectangle2D

Computes coordinate positions relative to a rectangle.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static CoordinatePosition

Returns:

NORTH_EDGE, SOUTH_EDGE or null
closeToHorizontal
(Rectangle2D
the rectangle relative to which the point will be checked
rectangle
,
Point2D
the checked point
point
,
double
the tolerance in pixels used to determine whether the coordinates are on some edge
edgeTolerance
)

Returns the horizontal bound the specified coordinates are closest to, if the distance is smaller than the edge tolerance.

private static CoordinatePosition

Returns:

EAST_EDGE, WEST_EDGE or null
closeToVertical
(Rectangle2D
the rectangle relative to which the point will be checked
rectangle
,
Point2D
the checked point
point
,
double
the tolerance in pixels used to determine whether the coordinates are on some edge
edgeTolerance
)

Returns the vertical bound the specified coordinates are closest to, if the distance is smaller than the edge tolerance.

private static CoordinatePosition

Returns:

the single coordinate position which matches the specified positions
(e.g. NORTH for (null, NORTH) and SOUTHWEST for (WEST, SOUTH))
extractSingleCardinalDirection
(CoordinatePosition
a vertical edge (EAST or WEST) or null
vertical
,
CoordinatePosition
a horizontal edge (NORTH OR SOUTH) or null
horizontal
)

Extracts a single cardinal direction from the two specified positions.

public static CoordinatePosition

Returns:

depending on the point either IN_RECTANGLE or OUT_OF_RECTANGLE
inRectangle
(Rectangle2D
the rectangle relative to which the point will be checked
rectangle
,
Point2D
the checked point
point
)

Returns the position the specified coordinates have regarding the specified rectangle.

public static CoordinatePosition

Returns:

the edge position the coordinates have regarding the specified rectangle; the value will be null if the point is not near any edge
onEdges
(Rectangle2D
the rectangle relative to which the point will be checked
rectangle
,
Point2D
the checked point
point
,
double
the tolerance in pixels used to determine whether the coordinates are on some edge
edgeTolerance
)

Returns the position the specified coordinates have regarding the specified rectangle's edges using the specified tolerance.

public static EnumSet<CoordinatePosition>

Returns:

a set of those positions the coordinates have regarding the specified rectangle
onRectangleAndEdges
(Rectangle2D
the rectangle relative to which the point will be checked
rectangle
,
Point2D
the checked point
point
,
double
the tolerance in pixels used to determine whether the coordinates are on some edge
edgeTolerance
)

Returns all positions the specified point has regarding the specified rectangle and its edges (using the specified tolerance).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CoordinatePositionsback to summary
public CoordinatePositions()

Method Detail

closeToHorizontalback to summary
private static CoordinatePosition closeToHorizontal(Rectangle2D rectangle, Point2D point, double edgeTolerance)

Returns the horizontal bound the specified coordinates are closest to, if the distance is smaller than the edge tolerance. Otherwise, null is returned.

Parameters
rectangle:Rectangle2D

the rectangle relative to which the point will be checked

point:Point2D

the checked point

edgeTolerance:double

the tolerance in pixels used to determine whether the coordinates are on some edge

Returns:CoordinatePosition

NORTH_EDGE, SOUTH_EDGE or null

closeToVerticalback to summary
private static CoordinatePosition closeToVertical(Rectangle2D rectangle, Point2D point, double edgeTolerance)

Returns the vertical bound the specified coordinates are closest to, if the distance is smaller than the edge tolerance. Otherwise, null is returned.

Parameters
rectangle:Rectangle2D

the rectangle relative to which the point will be checked

point:Point2D

the checked point

edgeTolerance:double

the tolerance in pixels used to determine whether the coordinates are on some edge

Returns:CoordinatePosition

EAST_EDGE, WEST_EDGE or null

extractSingleCardinalDirectionback to summary
private static CoordinatePosition extractSingleCardinalDirection(CoordinatePosition vertical, CoordinatePosition horizontal)

Extracts a single cardinal direction from the two specified positions. The conditions stated below are not checked!

Parameters
vertical:CoordinatePosition

a vertical edge (EAST or WEST) or null

horizontal:CoordinatePosition

a horizontal edge (NORTH OR SOUTH) or null

Returns:CoordinatePosition

the single coordinate position which matches the specified positions
(e.g. NORTH for (null, NORTH) and SOUTHWEST for (WEST, SOUTH))

inRectangleback to summary
public static CoordinatePosition inRectangle(Rectangle2D rectangle, Point2D point)

Returns the position the specified coordinates have regarding the specified rectangle. Edges are not checked.

Parameters
rectangle:Rectangle2D

the rectangle relative to which the point will be checked

point:Point2D

the checked point

Returns:CoordinatePosition

depending on the point either IN_RECTANGLE or OUT_OF_RECTANGLE

onEdgesback to summary
public static CoordinatePosition onEdges(Rectangle2D rectangle, Point2D point, double edgeTolerance)

Returns the position the specified coordinates have regarding the specified rectangle's edges using the specified tolerance.

Parameters
rectangle:Rectangle2D

the rectangle relative to which the point will be checked

point:Point2D

the checked point

edgeTolerance:double

the tolerance in pixels used to determine whether the coordinates are on some edge

Returns:CoordinatePosition

the edge position the coordinates have regarding the specified rectangle; the value will be null if the point is not near any edge

onRectangleAndEdgesback to summary
public static EnumSet<CoordinatePosition> onRectangleAndEdges(Rectangle2D rectangle, Point2D point, double edgeTolerance)

Returns all positions the specified point has regarding the specified rectangle and its edges (using the specified tolerance).

Parameters
rectangle:Rectangle2D

the rectangle relative to which the point will be checked

point:Point2D

the checked point

edgeTolerance:double

the tolerance in pixels used to determine whether the coordinates are on some edge

Returns:EnumSet<CoordinatePosition>

a set of those positions the coordinates have regarding the specified rectangle