NASA World Wind

gov.nasa.worldwind.applications.glider
Class GliderImage

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.applications.glider.GliderImage
All Implemented Interfaces:
AVList

public class GliderImage
extends AVListImpl


Nested Class Summary
protected  class GliderImage.RegionListener
           
 
Field Summary
protected  double altitude
           
protected  List<LatLon> corners
           
static String GLIDER_IMAGE_OPACITY
           
static String GLIDER_IMAGE_SOURCE
           
static String GLIDER_REGIONS_OF_INTEREST
           
protected  Object imageSource
           
protected  String name
           
protected  double opacity
           
protected  PropertyChangeListener regionListener
           
protected  Sector sector
           
 
Constructor Summary
GliderImage(String name, ImageUtil.AlignedImage alignedImage, double altitude)
          Construct an image from a file or BufferedImage and an arbitrary bounding region.
GliderImage(String imageSource, Iterable<? extends LatLon> corners, double altitude)
          Construct an image from a file.
GliderImage(String name, Object imageSource, Iterable<? extends LatLon> corners, double altitude)
          Construct an image from a file or BufferedImage and an arbitrary bounding region.
 
Method Summary
 void addRegionOfInterest(GliderRegionOfInterest region)
          Adds a region of interest to display on the image.
static ImageUtil.AlignedImage alignImage(BufferedImage sourceImage, float[] latitudes, float[] longitudes)
          Reprojects an image into an aligned image, one with edges of constant latitude and longitude.
static void alignImageDump(BufferedImage sourceImage, float[] latitudes, float[] longitudes)
           
 boolean equals(Object o)
           
 double getAltitude()
          Return the image's altitude.
 List<LatLon> getCorners()
           
 Object getImageSource()
          Returns the image source.
 String getName()
          Returns the name of the image, as specified at construction.
 double getOpacity()
           
 GliderRegionOfInterest.RegionSet getRegionsOfInterest()
           
 Sector getSector()
          Return the image's location.
 int hashCode()
           
 void releaseImageSource()
           
 void removeRegionOfInterest(GliderRegionOfInterest region)
          Removes a region of interest.
 void setImageSource(String newSource)
          Changes the image source.
 void setImageSource(String newName, Object newSource)
          Changes the image source and gives the image a new name.
 void setOpacity(double opacity)
           
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

altitude

protected double altitude

corners

protected List<LatLon> corners

GLIDER_IMAGE_OPACITY

public static final String GLIDER_IMAGE_OPACITY
See Also:
Constant Field Values

GLIDER_IMAGE_SOURCE

public static final String GLIDER_IMAGE_SOURCE
See Also:
Constant Field Values

GLIDER_REGIONS_OF_INTEREST

public static final String GLIDER_REGIONS_OF_INTEREST
See Also:
Constant Field Values

imageSource

protected Object imageSource

name

protected String name

opacity

protected double opacity

regionListener

protected PropertyChangeListener regionListener

sector

protected Sector sector
Constructor Detail

GliderImage

public GliderImage(String name,
                   ImageUtil.AlignedImage alignedImage,
                   double altitude)
Construct an image from a file or BufferedImage and an arbitrary bounding region.

Parameters:
name - A unique name to identify the image. If the image source is a file, the file path can be used as the name.
alignedImage - An aligned image containing a BufferedImage and a Sector specifying the image and the location to place it.The image will be stretched as necessary to fully fill the region.
altitude - The altitude at which to display the image. Specify 0 to have the image draped over the globe's surface.
Throws:
IllegalArgumentException - if any of the first three arguments are null.

GliderImage

public GliderImage(String imageSource,
                   Iterable<? extends LatLon> corners,
                   double altitude)
Construct an image from a file.

Parameters:
imageSource - The path to the source image. Images can be any of those supported by ImageIO, as well as uncompressed TIFF images..
corners - The lat/lon locations of the region in which to map the image. The image will be stretched as necessary to fully fill the region. The locations must be specified in counterclockwise order beginning with the lower-left image corner.
altitude - The altitude at which to display the image. Specify 0 to have the image draped over the globe's surface.
Throws:
IllegalArgumentException - if any of the first three arguments are null.

GliderImage

public GliderImage(String name,
                   Object imageSource,
                   Iterable<? extends LatLon> corners,
                   double altitude)
Construct an image from a file or BufferedImage and an arbitrary bounding region.

Parameters:
name - A unique name to identify the image. If the image source is a file, the file path can be used as the name.
imageSource - Either the file path to the source image or a reference to the BufferedImage containing it. Images can be any of those supported by ImageIO, as well as uncompressed TIFF images.
corners - The lat/lon locations of the region in which to map the image. The image will be stretched as necessary to fully fill the region. The locations must be specified in counterclockwise order beginning with the lower-left image corner.
altitude - The altitude at which to display the image. Specify 0 to have the image draped over the globe's surface.
Throws:
IllegalArgumentException - if any of the first three arguments are null.
Method Detail

addRegionOfInterest

public void addRegionOfInterest(GliderRegionOfInterest region)
Adds a region of interest to display on the image.

Parameters:
region - the region of interest to add.
Throws:
IllegalArgumentException - if region is null.

alignImage

public static ImageUtil.AlignedImage alignImage(BufferedImage sourceImage,
                                                float[] latitudes,
                                                float[] longitudes)
                                         throws InterruptedException
Reprojects an image into an aligned image, one with edges of constant latitude and longitude.

Parameters:
sourceImage - the image to reproject, typically a non-aligned image
latitudes - an array identifying the latitude of each pixels if the source image. There must be an entry in the array for all pixels. The values are taken to be in row-major order relative to the image -- the horizontal component varies fastest.
longitudes - an array identifying the longitude of each pixels if the source image. There must be an entry in the array for all pixels. The values are taken to be in row-major order relative to the image -- the horizontal component varies fastest.
Returns:
a new image containing the original image but reprojected to align to the sector. Pixels in the new image that have no correspondence with the source image are transparent.
Throws:
InterruptedException - if any thread has interrupted the current thread while alignImage is running. The interrupted status of the current thread is cleared when this exception is thrown.

alignImageDump

public static void alignImageDump(BufferedImage sourceImage,
                                  float[] latitudes,
                                  float[] longitudes)

equals

public boolean equals(Object o)
Overrides:
equals in class Object

getAltitude

public double getAltitude()
Return the image's altitude.

Returns:
the image's altitude.

getCorners

public List<LatLon> getCorners()

getImageSource

public Object getImageSource()
Returns the image source.

Returns:
the image source.

getName

public String getName()
Returns the name of the image, as specified at construction. If no name was specified at construction the name is that of the image file path.

Returns:
the image name.

getOpacity

public double getOpacity()

getRegionsOfInterest

public GliderRegionOfInterest.RegionSet getRegionsOfInterest()

getSector

public Sector getSector()
Return the image's location.

Returns:
the image's location.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

releaseImageSource

public void releaseImageSource()

removeRegionOfInterest

public void removeRegionOfInterest(GliderRegionOfInterest region)
Removes a region of interest.

Parameters:
region - the region of interest to remove.
Throws:
IllegalArgumentException - if region is null.

setImageSource

public void setImageSource(String newSource)
Changes the image source. The allowable sources are those allowed by GliderImage(java.lang.String, java.lang.Object, java.lang.Iterable, double)

Parameters:
newSource - the new image source.
Throws:
IllegalArgumentException - if newSource is null.

setImageSource

public void setImageSource(String newName,
                           Object newSource)
Changes the image source and gives the image a new name. The allowable sources are those allowed by GliderImage(java.lang.String, java.lang.Object, java.lang.Iterable, double)

Parameters:
newName - the new image name.
newSource - the new image source.
Throws:
IllegalArgumentException - if either argument is null.

setOpacity

public void setOpacity(double opacity)

NASA World Wind