public class Offset
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
double |
x
The offset in the X dimension, interpreted according to this instance's xUnits argument.
|
int |
xUnits
The units of this instance's X offset.
|
double |
y
The offset in the Y dimension, interpreted according to this instance's yUnits argument.
|
int |
yUnits
The units of this instance's Y offset.
|
| Constructor and Description |
|---|
Offset(int xUnits,
double x,
int yUnits,
double y)
Constructs an offset instance given specified units and offsets.
|
Offset(Offset offset)
Creates a new offset of this offset with identical property values.
|
| Modifier and Type | Method and Description |
|---|---|
static Offset |
bottomCenter()
This factory method returns a new offset for anchoring a rectangle to its center of its bottom edge.
|
static Offset |
bottomLeft()
This factory method returns a new offset used for anchoring a rectangle to its bottom-left corner.
|
static Offset |
bottomRight()
This factory method returns a new offset for anchoring a rectangle to its bottom-right corner.
|
static Offset |
center()
This factory method returns a new offset used for anchoring a rectangle to its center.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
Vec2 |
offsetForSize(double width,
double height,
Vec2 result)
Returns this offset's absolute X and Y coordinates in pixels for a rectangle of a specified size in pixels.
|
Offset |
set(Offset offset)
Sets this offset to identical property values of the specified offset.
|
static Offset |
topCenter()
This factory method returns a new offset for anchoring a rectangle to the center of its top edge.
|
static Offset |
topLeft()
This factory method returns a new offset for anchoring a rectangle its top-left corner.
|
static Offset |
topRight()
This factory method returns a new offset for anchoring a rectangle to its top-right corner.
|
java.lang.String |
toString() |
public double x
public double y
public int xUnits
public int yUnits
public Offset(int xUnits,
double x,
int yUnits,
double y)
xUnits - The type of units specified for the X dimension. May be one of the following: WorldWind.OFFSET_FRACTIONWorldWind.OFFSET_INSET_PIXELSWorldWind.OFFSET_PIXELSx - The offset in the X dimension.yUnits - The type of units specified for the Y dimension, assuming a lower-left Y origin. May be one of the
following: WorldWind.OFFSET_FRACTIONWorldWind.OFFSET_INSET_PIXELSWorldWind.OFFSET_PIXELSy - The offset in the Y dimension.public Offset(Offset offset)
public static Offset center()
public static Offset bottomLeft()
public static Offset bottomCenter()
public static Offset bottomRight()
public static Offset topLeft()
public static Offset topCenter()
public static Offset topRight()
public Offset set(Offset offset)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic Vec2 offsetForSize(double width, double height, Vec2 result)
width - the rectangle's width in pixelsheight - the rectangles height in pixelsresult - a pre-allocated Vec2 in which to return the computed offset relative to the rectangle's origin