NASA World Wind

gov.nasa.worldwind.util
Class TextureAtlas.Entry

java.lang.Object
  extended by gov.nasa.worldwind.util.TextureAtlas.Entry
All Implemented Interfaces:
Comparable<TextureAtlas.Entry>
Enclosing class:
TextureAtlas

protected static class TextureAtlas.Entry
extends Object
implements Comparable<TextureAtlas.Entry>

Represents an image element in a texture atlas. Each entry indicates the element's key, the image's rectangle in the backing image, the actual image's offset within that rectangle, the image's actual width and height, and a timestamp indicating the last time the element was used. Implements the Comparable interface by comparing the lastUsed timestamp, ordered from least recently used to most recently used.


Field Summary
 int imageHeight
          Indicates the element's image height.
 int imageOffsetX
          Indicates the element's image X offset withing the bounding rectangle.
 int imageOffsetY
          Indicates the element's image Y offset withing the bounding rectangle.
 int imageWidth
          Indicates the element's image width.
 Object key
          Indicates the element's key.
 long lastUsed
          Indicates the last time this entry was used.
 Rect rect
          Indicates the element's bounding rectangle within the texture atlas.
 
Constructor Summary
TextureAtlas.Entry(Object key, Rect rect, int imageOffsetX, int imageOffsetY, int imageWidth, int imageHeight)
          Constructs a texture atlas entry corresponding with a texture atlas element with the specified key, bounding rectangle, and image offsets within the bounding rectangle.
 
Method Summary
 int compareTo(TextureAtlas.Entry that)
          Compares this texture atlas entry's last used timestamp to that of the specified entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageHeight

public int imageHeight
Indicates the element's image height. May be smaller than the bounding rectangle's height. Initialized during construction.


imageOffsetX

public int imageOffsetX
Indicates the element's image X offset withing the bounding rectangle. Initialized during construction.


imageOffsetY

public int imageOffsetY
Indicates the element's image Y offset withing the bounding rectangle. Initialized during construction.


imageWidth

public int imageWidth
Indicates the element's image width. May be smaller than the bounding rectangle's width. Initialized during construction.


key

public final Object key
Indicates the element's key. Initialized during construction.


lastUsed

public long lastUsed
Indicates the last time this entry was used.


rect

public Rect rect
Indicates the element's bounding rectangle within the texture atlas. Initialized during construction.

Constructor Detail

TextureAtlas.Entry

public TextureAtlas.Entry(Object key,
                          Rect rect,
                          int imageOffsetX,
                          int imageOffsetY,
                          int imageWidth,
                          int imageHeight)
Constructs a texture atlas entry corresponding with a texture atlas element with the specified key, bounding rectangle, and image offsets within the bounding rectangle.

Parameters:
key - the element's key.
rect - the element's bounding rectangle within the texture atlas.
imageOffsetX - the element's image X offset withing the bounding rectangle.
imageOffsetY - the element's image Y offset withing the bounding rectangle.
imageWidth - the element's image width. May be smaller than the bounding rectangle's width.
imageHeight - the element's image height. May be smaller than the bounding rectangle's height.
Method Detail

compareTo

public int compareTo(TextureAtlas.Entry that)
Compares this texture atlas entry's last used timestamp to that of the specified entry. This returns -1 if this entry's last used time is earlier than the specified entry's, 0 if the two entries have the same last used time, and 1 if this entry's last used time is later than the specified entry's.

Specified by:
compareTo in interface Comparable<TextureAtlas.Entry>
Parameters:
that - the texture atlas entry this entry is compared to.
Returns:
-1, 0, or 1 if this entry's last used time is earlier than, the same as, or later than the specified entry's last used time.
Throws:
IllegalArgumentException - if the specified entry is null.

NASA World Wind