Package com.adobe.xfa.ut
Class CoordPair
java.lang.Object
com.adobe.xfa.ut.CoordPair
A class to describe a coordinate (in Euclidean space).
It consists of a pair of (x, y) values.
Instances of this class are immutable. All change operations
return a new instance of this CoordPair
class.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns aCoordPair
representing the addition of this object and the givenCoordPair
.boolean
Determines if this object is equal to the givenObject
.Returns aCoordPair
representing thisCoordPair
snaped to the nearest grid coordinates of the givenCoordPair
.boolean
Determines if this object is greater than the givenCoordPair
.int
hashCode()
boolean
Determines if this object is less than the givenCoordPair
.boolean
Determines if this object is not equal to the givenObject
.rotatePoint
(CoordPair oRPoint, Angle oAngle) Returns aCoordPair
representing the rotation of this object through the givenAngle
and about the givenCoordPair
.Returns aCoordPair
representing the rounding of this object's coordinates to the givenCoordPair
.scale
(double dXScale, double dYScale) Returns aCoordPair
representing the scaling of this object to the given scaling factors.Returns aCoordPair
representing the subtraction of this object and the givenCoordPair
.x()
Gets this object's x coordinate.y()
Gets this object's y coordinate.static CoordPair
zeroZero()
The zero (0, 0) coordinate.
-
Field Details
-
ZERO_ZERO
TheCoordPair
corresponding to the (0, 0) origin.
-
-
Constructor Details
-
CoordPair
public CoordPair()Instantiates aCoordPair
with the coordinate (0, 0).- See Also:
-
CoordPair
Deprecated.CoordPair is immutable, so there is no need to copy an instance.Instantiates aCoordPair
from the givenCoordPair
.- Parameters:
source
- theCoordPair
to copy to this object.
-
CoordPair
Instantiates aCoordPair
from the givenUnitSpan
(s).- Parameters:
x
- the x coordinate.y
- the y coordinate.
-
-
Method Details
-
grid
Returns aCoordPair
representing thisCoordPair
snaped to the nearest grid coordinates of the givenCoordPair
.- Parameters:
grid
- the grid coordinate- Returns:
- a coordinate aligned to the grid.
- See Also:
-
round
Returns aCoordPair
representing the rounding of this object's coordinates to the givenCoordPair
.- Parameters:
round
- the rounding coordinate.- Returns:
- a coordinate of the rounding.
- See Also:
-
x
Gets this object's x coordinate.- Returns:
- the x coordinate.
-
y
Gets this object's y coordinate.- Returns:
- the y coordinate.
-
rotatePoint
Returns aCoordPair
representing the rotation of this object through the givenAngle
and about the givenCoordPair
.- Parameters:
oRPoint
- the point of rotation.oAngle
- the angle of rotation.- Returns:
- a coordinate of the rotation.
-
equals
Determines if this object is equal to the givenObject
. Comparisons with instances of non-CoordPair
objects are never equal. When comparing instances ofCoordPair
objects, the object'sUnitSpan
coordinates are each compared for equality. -
hashCode
public int hashCode() -
notEquals
Determines if this object is not equal to the givenObject
. Comparisons with instances of non-CoordPair
objects are always not equal. When comparing instances ofCoordPair
objects, the object'sUnitSpan
coordinates are each compared for inequality.- Parameters:
compare
- theObject
to compare.- Returns:
- true if not equal, false othewise.
- See Also:
-
add
Returns aCoordPair
representing the addition of this object and the givenCoordPair
.- Parameters:
add
- theCoordPair
to add.- Returns:
- a coordinate of the addition.
-
subtract
Returns aCoordPair
representing the subtraction of this object and the givenCoordPair
.- Parameters:
subtract
- theCoordPair
to subtract.- Returns:
- a coordinate of the subtraction.
-
scale
Returns aCoordPair
representing the scaling of this object to the given scaling factors.- Parameters:
dXScale
- the X coordinate scaling factor.dYScale
- the Y coordinate scaling factor.- Returns:
- a coordinate of the scaling.
-
gt
Determines if this object is greater than the givenCoordPair
. Coordinate comparisons rules are as follows: order by the y coordnate first, and if equal, then by the x coordinate.- Parameters:
compare
- theCoordPair
to compare.- Returns:
- true if greater than, false otherwise.
-
lt
Determines if this object is less than the givenCoordPair
. Coordinate comparisons rules as as follows: order by the y coordnate first, and if equal, then by the x coordinate.- Parameters:
compare
- theCoordPair
to compare.- Returns:
- true if greater than, false otherwise.
-
zeroZero
The zero (0, 0) coordinate.- Returns:
- the coordinate equal to (0, 0).
-