NASA World Wind

gov.nasa.worldwind.render
Class SurfaceImage

java.lang.Object
  extended by gov.nasa.worldwind.render.SurfaceImage
All Implemented Interfaces:
Movable, Renderable, SurfaceTile

public class SurfaceImage
extends java.lang.Object
implements SurfaceTile, Renderable, Movable

Renders a single image tile. The image source can be a local file, a BufferedImage or a network http source.

Images from remote sources are downloaded in background and will be saved in the cache directory


Constructor Summary
SurfaceImage(java.lang.Object imageSource, Sector sector)
          Renders a single image tile from a local or remote network source.
SurfaceImage(java.lang.Object imageSource, Sector sector, Layer layer)
          Renders a single image tile from a local or remote network source.
SurfaceImage(java.lang.Object imageSource, Sector sector, Layer layer, java.lang.String cacheDirectory)
          Renders a single image tile from a local or remote network source.
 
Method Summary
 void applyInternalTransform(DrawContext dc)
           
 boolean bind(DrawContext dc)
           
 boolean equals(java.lang.Object o)
           
 Extent getExtent(DrawContext dc)
           
 java.lang.Object getImageSource()
          Get the image source object.
 Layer getLayer()
          Get the layer reference to which this SurfaceImage belongs.
 double getOpacity()
           
 Position getReferencePosition()
           
 Sector getSector()
           
 int hashCode()
           
 boolean hasProblem()
          Returns whether there was any problem loading texture data.
 boolean isLoading()
          Returns if the image is loading texture data.
 void move(Position position)
          Shift the shape over the globe's surface while maintaining its original azimuth -- its orientation relative to North.
 void moveTo(Position position)
          Move the shape over the globe's surface while maintaining its original azimuth -- its orientation relative to North.
 boolean reload(boolean useCache)
          Force texture data to be reloaded.
 void render(DrawContext dc)
          Causes this Renderable to render itself using the DrawContext provided.
 void setOpacity(double opacity)
           
 void setSector(Sector sector)
          Sets the sector for the image allowing to change its size or position.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SurfaceImage

public SurfaceImage(java.lang.Object imageSource,
                    Sector sector)
Renders a single image tile from a local or remote network source.

Parameters:
imageSource - can be a local image path, a BufferedImage or a url string pointing to an http server.
sector - the sector covered by the image.

SurfaceImage

public SurfaceImage(java.lang.Object imageSource,
                    Sector sector,
                    Layer layer)
Renders a single image tile from a local or remote network source.

Parameters:
imageSource - can be a local image path, a BufferedImage or a url string pointing to an http server.
sector - the sector covered by the image.
layer - a reference to the layer handling this image. This layer will fire an event when the image has finished downloading.

SurfaceImage

public SurfaceImage(java.lang.Object imageSource,
                    Sector sector,
                    Layer layer,
                    java.lang.String cacheDirectory)
Renders a single image tile from a local or remote network source.

Parameters:
imageSource - can be a local image path, a BufferedImage or a url string pointing to an http server.
sector - the sector covered by the image.
layer - a reference to the layer handling this image. This layer will fire an event when the image has finished downloading.
cacheDirectory - the cache directory where the downloaded image should be saved and retrieved.
Method Detail

applyInternalTransform

public void applyInternalTransform(DrawContext dc)
Specified by:
applyInternalTransform in interface SurfaceTile

bind

public boolean bind(DrawContext dc)
Specified by:
bind in interface SurfaceTile

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

getExtent

public Extent getExtent(DrawContext dc)
Specified by:
getExtent in interface SurfaceTile

getImageSource

public java.lang.Object getImageSource()
Get the image source object. It can be a String containing a path to either a local file or a networked file. It can also be a BufferedImage.

Returns:
the image source object.

getLayer

public Layer getLayer()
Get the layer reference to which this SurfaceImage belongs. May be null

Returns:
the layer reference.

getOpacity

public double getOpacity()

getReferencePosition

public Position getReferencePosition()
Specified by:
getReferencePosition in interface Movable

getSector

public Sector getSector()
Specified by:
getSector in interface SurfaceTile

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

hasProblem

public boolean hasProblem()
Returns whether there was any problem loading texture data.

Returns:
true if image data failed to download - or other problems.

isLoading

public boolean isLoading()
Returns if the image is loading texture data.

Returns:
true if the image data is being loaded.

move

public void move(Position position)
Description copied from interface: Movable
Shift the shape over the globe's surface while maintaining its original azimuth -- its orientation relative to North.

Specified by:
move in interface Movable
Parameters:
position - the latitude and longitude to add to the shapes reference position.

moveTo

public void moveTo(Position position)
Description copied from interface: Movable
Move the shape over the globe's surface while maintaining its original azimuth -- its orientation relative to North.

Specified by:
moveTo in interface Movable
Parameters:
position - the new position of the shapes reference position.

reload

public boolean reload(boolean useCache)
Force texture data to be reloaded.

Parameters:
useCache - true if data should be reloaded from the cache.
Returns:
true if reloading has been succesfully scheduled.

render

public void render(DrawContext dc)
Description copied from interface: Renderable
Causes this Renderable to render itself using the DrawContext provided. The DrawContext provides the elevation model, openGl instance, globe and other information required for drawing. It is recommended that the DrawContext is non-null as most implementations do not support null DrawContexts.

Specified by:
render in interface Renderable
Parameters:
dc - the DrawContext to be used
See Also:
DrawContext

setOpacity

public void setOpacity(double opacity)

setSector

public void setSector(Sector sector)
Sets the sector for the image allowing to change its size or position.

Parameters:
sector - the new sector.

NASA World Wind