public class TextureAtlasElement extends Object implements Disposable
TextureAtlas.
 
 TextureAtlasElement performs lazy retrieval and loading of its image source into its texture atlas. This loads the
 image source and adds it to the atlas only when the load(gov.nasa.worldwind.render.DrawContext) method is
 called. If the image source is a BufferedImage it is added to the atlas immediately when load is
 called. If the image source is a local file or a remote stream (URL), retrieval and loading is performed on a
 separate thread from the EDT.| Modifier and Type | Class and Description | 
|---|---|
| protected static class  | TextureAtlasElement.RequestTaskRequestTask is an implementation of the Runnable interface who's  runmethod retrieves and loads this
 element's image source. | 
| Modifier and Type | Field and Description | 
|---|---|
| protected TextureAtlas | atlasIndicates the texture atlas this element belongs to. | 
| protected BufferedImage | imageThe BufferedImage created as the image source is read. | 
| protected boolean | imageInitializationFailedIndicates that image initialization failed. | 
| protected Object | imageSourceIndicates the original image source associated with this element. | 
| protected PropertyChangeListener | listenerThe object to notify when the image is eventually loaded in memory. | 
| Constructor and Description | 
|---|
| TextureAtlasElement(TextureAtlas atlas,
                   Object imageSource)Creates a new texture atlas element with the specified atlas and image source. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected boolean | addAtlasImage()Adds this element's image source into its texture atlas. | 
| protected Runnable | createRequestTask()Returns an object that implements the Runnable interface, and who's  runmethod retrieves and loads
 this element's image source. | 
| void | dispose()Removes this element's image from its texture atlas and disposes of this element's image resource. | 
| boolean | equals(Object o)Indicates whether another texture atlas element is equivalent to this one. | 
| protected BufferedImage | getImage()Indicates the image created as the image source is read. | 
| Object | getImageSource()Indicates the original image source associated with this element. | 
| Dimension | getSize()Returns the image dimensions associated with this texture atlas element. | 
| TextureCoords | getTexCoords()Returns the OpenGL texture coordinates associated this texture atlas element. | 
| TextureAtlas | getTextureAtlas()Indicates the texture atlas this element belongs to. | 
| int | hashCode()Returns the hash code for this texture atlas element's image source. | 
| protected boolean | isBufferedImageSource()Indicates whether this element's image source is a BufferedImage. | 
| boolean | isImageInitializationFailed()Indicates whether this element's image failed to load. | 
| boolean | load(DrawContext dc)Loads this element's image and adds it to the texture atlas. | 
| protected boolean | loadImage()Loads this element's image source into its  imageproperty. | 
| protected void | notifyImageLoaded()Notifies this texture atlas element's listener that image loading has completed. | 
| protected BufferedImage | readImage(URL fileUrl)Reads and returns the specified image URL as a BufferedImage. | 
| protected boolean | requestImage(DrawContext dc)Requests that this element's image source be loaded into its texture atlas. | 
| protected void | setImage(BufferedImage image)Specifies the image created as the image source is read. | 
| String | toString()Returns the string representation of this texture atlas element's image source. | 
protected TextureAtlas atlas
protected volatile BufferedImage image
null once the image is loaded into the texture atlas. This field is volatile in order
 to synchronize atomic access among threads. This field is not used if the image source is
 BufferedImage.protected boolean imageInitializationFailed
true. Initially
 false.protected Object imageSource
protected PropertyChangeListener listener
null. This set to null once
 the image is loaded into the texture atlas.public TextureAtlasElement(TextureAtlas atlas, Object imageSource)
atlas - the texture atlas this element belongs to.imageSource - a general image source. The source type may be one of the following: URLInputStreamFileString containing a valid URL description or a file or resource name available on the
                    classpath.IllegalArgumentException - if either the atlas or the image source is null.protected boolean addAtlasImage()
image property.true if this element's image is successfully added to the texture atlas, and
         false otherwise.protected Runnable createRequestTask()
run method retrieves and loads
 this element's image source.public void dispose()
dispose in interface Disposablepublic boolean equals(Object o)
protected BufferedImage getImage()
setImage(java.awt.image.BufferedImage)public Object getImageSource()
public Dimension getSize()
load before
 calling this method to ensure that the element is loaded into its texture atlas.null if this texture
         atlas element has not yet loaded or has failed to load.load(gov.nasa.worldwind.render.DrawContext)public TextureCoords getTexCoords()
load
 before calling this method to ensure that the element is loaded into its texture atlas.
 
 The returned texture coordinates can change any time an element is added or removed from this element's texture
 atlas, and therefore should not be cached unless the caller has explicit knowledge of when this element's texture
 atlas has changed.null if this
         texture atlas element has not yet loaded or has failed to load.load(gov.nasa.worldwind.render.DrawContext)public TextureAtlas getTextureAtlas()
public int hashCode()
protected boolean isBufferedImageSource()
true if this element's image source is a BufferedImage, and false otherwise.public boolean isImageInitializationFailed()
true.true if this element's image failed to load, and false otherwise.public boolean load(DrawContext dc)
dc - the current draw context. Used to generate a repaint event when the image source retrieval completes.true if this element's image is successfully loaded and added to the texture atlas,
         otherwise false.protected boolean loadImage()
image property. If the image source is a remote resource,
 this initiates a request for it and returns null.true if the image source has been loaded successfully, and false otherwise.protected void notifyImageLoaded()
protected BufferedImage readImage(URL fileUrl)
fileUrl - the image URL to read.null if the image could not be read.protected boolean requestImage(DrawContext dc)
true. Otherwise, this
 initiates the retrieval of this element's image source in a separate thread and returns false. Once
 the image source is retrieved, a subsequent invocation of this method loads it into the texture atlas and returns
 true.dc - the current draw context. Used to generate a repaint event when the image source retrieval completes.true if this element's image is loaded into the texture atlas, and false
         otherwise.protected void setImage(BufferedImage image)
volatile in order to synchronize atomic access among threads.image - this element's image.