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 copy)
Creates a new copy 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 an image to the bottom and the center width.
|
static Offset |
bottomLeft()
This factory method returns a new offset used for anchoring an image to the bottom, left of its geographic
position.
|
static Offset |
bottomRight()
This factory method returns a new offset for anchoring an image to the bottom, right of its geographic position.
|
static Offset |
center()
This factory method returns a new offset for centering an image on its geographic position.
|
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.
|
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_FRACTION
WorldWind.OFFSET_INSET_PIXELS
WorldWind.OFFSET_PIXELS
x
- 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_FRACTION
WorldWind.OFFSET_INSET_PIXELS
WorldWind.OFFSET_PIXELS
y
- The offset in the Y dimension.public Offset(Offset copy)
public static Offset center()
public static Offset bottomLeft()
public static Offset bottomCenter()
public static Offset bottomRight()
public Offset set(Offset offset)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public 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