|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.render.Offset
public class Offset
Defines the relationship of an image, label or other screen-space item relative to another screen-space item. An offset contains an X coordinate, a Y coordinate, and for each of these a separate "units" string indicating the coordinate units.
Recognized "units" values areAVKey.PIXELS, which indicates pixel units relative to the lower left corner of
the screen-space item, AVKey.FRACTION, which indicates that the units are fractions of the screen-space
item's width and height, relative to its lower left corner, and AVKey.INSET_PIXELS, which indicates units of
pixels but with origin at the screen-space item's upper right.
This class implements the functionality of a KML Offset.
| Field Summary | |
|---|---|
static Offset |
BOTTOM_CENTER
|
static Offset |
CENTER
|
static Offset |
LEFT_CENTER
|
static Offset |
RIGHT_CENTER
|
static Offset |
TOP_CENTER
|
protected Double |
x
|
protected String |
xUnits
|
protected Double |
y
|
protected String |
yUnits
|
| Constructor Summary | |
|---|---|
Offset(Double x,
Double y,
String xUnits,
String yUnits)
|
|
| Method Summary | |
|---|---|
Point2D.Double |
computeOffset(double width,
double height,
Double xScale,
Double yScale)
Computes the X and Y offset specified by this offset applied to a specified rectangle. |
boolean |
equals(Object o)
|
static Offset |
fromFraction(double xFraction,
double yFraction)
Creates a new offset from explicit fraction coordinates. |
void |
getRestorableState(RestorableSupport restorableSupport,
RestorableSupport.StateObject context)
Saves the offset's current state in the specified restorableSupport. |
Double |
getX()
Returns the hot spot's X coordinate. |
String |
getXUnits()
Returns the units of the offset X value. |
Double |
getY()
Returns the hot spot's Y coordinate. |
String |
getYUnits()
Returns the units of the offset Y value. |
int |
hashCode()
|
void |
restoreState(RestorableSupport restorableSupport,
RestorableSupport.StateObject context)
Restores the state of any offset parameters contained in the specified RestorableSupport. |
void |
setX(Double x)
Specifies the hot spot's X coordinate, in units specified by setXUnits(String). |
void |
setXUnits(String units)
Specifies the units of the offset X value. |
void |
setY(Double y)
Specifies the hot spot's Y coordinate, in units specified by setYUnits(String). |
void |
setYUnits(String units)
Specifies the units of the offset Y value. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Offset BOTTOM_CENTER
public static final Offset CENTER
public static final Offset LEFT_CENTER
public static final Offset RIGHT_CENTER
public static final Offset TOP_CENTER
protected Double x
protected String xUnits
protected Double y
protected String yUnits
| Constructor Detail |
|---|
public Offset(Double x,
Double y,
String xUnits,
String yUnits)
| Method Detail |
|---|
public Point2D.Double computeOffset(double width,
double height,
Double xScale,
Double yScale)
width - the rectangle width.height - the rectangle height.xScale - an optional scale to apply to the X coordinate of the offset. May be null.yScale - an optional scale to apply to the Y coordinate of the offset. May be null.
public boolean equals(Object o)
equals in class Object
public static Offset fromFraction(double xFraction,
double yFraction)
xFraction - the offset's X coordinate as a fraction of the containing rectangle.yFraction - the offset's Y coordinate as a fraction of the containing rectangle.
public void getRestorableState(RestorableSupport restorableSupport,
RestorableSupport.StateObject context)
restorableSupport. If context is not
null, the state is appended to it. Otherwise the state is added to the
RestorableSupport root. This state can be restored later by calling restoreState(gov.nasa.worldwind.util.RestorableSupport, gov.nasa.worldwind.util.RestorableSupport.StateObject).
restorableSupport - the RestorableSupport that receives the offset's state.context - the StateObject the state is appended to, if not null.
IllegalArgumentException - if restorableSupport is null.public Double getX()
setXUnits(String) for a description of the hot spot.
public String getXUnits()
setXUnits(String) for a description of the recognized
values.
public Double getY()
setYUnits(String) for a description of the hot spot.
public String getYUnits()
setYUnits(String) for a description of the recognized
values.
public int hashCode()
hashCode in class Object
public void restoreState(RestorableSupport restorableSupport,
RestorableSupport.StateObject context)
RestorableSupport. If the
StateObject is not null it's searched for state values, otherwise the
RestorableSupport root is searched.
restorableSupport - the RestorableSupport that contains the offset's state.context - the StateObject to search for state values, if not null.
IllegalArgumentException - if restorableSupport is null.public void setX(Double x)
setXUnits(String).
x - the hot spot's X coordinate. May be null, in which case 0 is used during rendering.public void setXUnits(String units)
AVKey.PIXELS, which indicates pixel
units relative to the lower left corner of the placemark image, AVKey.FRACTION, which indicates the units
are fractions of the placemark image width and height, and AVKey.INSET_PIXELS, which indicates units of
pixels but with origin in the upper left.
units - the units of the offset X value. If null, AVKey.PIXELS is used during rendering.public void setY(Double y)
setYUnits(String).
y - the hot spot's Y coordinate. May be null, in which case 0 is used during rendering.public void setYUnits(String units)
AVKey.PIXELS, which indicates pixel
units relative to the lower left corner of the placemark image, AVKey.FRACTION, which indicates the units
are fractions of the placemark image width and height, and AVKey.INSET_PIXELS, which indicates units of
pixels but with origin in the upper left.
units - the units of the offset Y value. If null, AVKey.PIXELS is used during rendering.
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||