Class GliderImage
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwindx.applications.glider.GliderImage
-
- All Implemented Interfaces:
AVList
public class GliderImage extends AVListImpl
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
GliderImage.RegionListener
-
Field Summary
Fields Modifier and Type Field Description protected double
altitude
protected java.util.List<LatLon>
corners
static java.lang.String
GLIDER_IMAGE_OPACITY
static java.lang.String
GLIDER_IMAGE_SOURCE
static java.lang.String
GLIDER_REGIONS_OF_INTEREST
protected java.lang.Object
imageSource
protected java.lang.String
name
protected double
opacity
protected java.beans.PropertyChangeListener
regionListener
protected Sector
sector
-
Constructor Summary
Constructors Constructor Description GliderImage(java.lang.String name, ImageUtil.AlignedImage alignedImage, double altitude)
Construct an image from a file orBufferedImage
and an arbitrary bounding region.GliderImage(java.lang.String imageSource, java.lang.Iterable<? extends LatLon> corners, double altitude)
Construct an image from a file.GliderImage(java.lang.String name, java.lang.Object imageSource, java.lang.Iterable<? extends LatLon> corners, double altitude)
Construct an image from a file orBufferedImage
and an arbitrary bounding region.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRegionOfInterest(GliderRegionOfInterest region)
Adds a region of interest to display on the image.static ImageUtil.AlignedImage
alignImage(java.awt.image.BufferedImage sourceImage, float[] latitudes, float[] longitudes)
Reprojects an image into an aligned image, one with edges of constant latitude and longitude.static void
alignImageDump(java.awt.image.BufferedImage sourceImage, float[] latitudes, float[] longitudes)
boolean
equals(java.lang.Object o)
double
getAltitude()
Return the image's altitude.java.util.List<LatLon>
getCorners()
java.lang.Object
getImageSource()
Returns the image source.java.lang.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(java.lang.String newSource)
Changes the image source.void
setImageSource(java.lang.String newName, java.lang.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
-
-
-
-
Field Detail
-
GLIDER_REGIONS_OF_INTEREST
public static final java.lang.String GLIDER_REGIONS_OF_INTEREST
- See Also:
- Constant Field Values
-
GLIDER_IMAGE_SOURCE
public static final java.lang.String GLIDER_IMAGE_SOURCE
- See Also:
- Constant Field Values
-
GLIDER_IMAGE_OPACITY
public static final java.lang.String GLIDER_IMAGE_OPACITY
- See Also:
- Constant Field Values
-
name
protected java.lang.String name
-
sector
protected Sector sector
-
corners
protected java.util.List<LatLon> corners
-
altitude
protected double altitude
-
opacity
protected double opacity
-
imageSource
protected java.lang.Object imageSource
-
regionListener
protected java.beans.PropertyChangeListener regionListener
-
-
Constructor Detail
-
GliderImage
public GliderImage(java.lang.String imageSource, java.lang.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 byImageIO
, 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:
java.lang.IllegalArgumentException
- if any of the first three arguments are null.
-
GliderImage
public GliderImage(java.lang.String name, ImageUtil.AlignedImage alignedImage, double altitude)
Construct an image from a file orBufferedImage
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 aBufferedImage
and aSector
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:
java.lang.IllegalArgumentException
- if any of the first three arguments are null.
-
GliderImage
public GliderImage(java.lang.String name, java.lang.Object imageSource, java.lang.Iterable<? extends LatLon> corners, double altitude)
Construct an image from a file orBufferedImage
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 theBufferedImage
containing it. Images can be any of those supported byImageIO
, 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:
java.lang.IllegalArgumentException
- if any of the first three arguments are null.
-
-
Method Detail
-
releaseImageSource
public void releaseImageSource()
-
getName
public java.lang.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.
-
getSector
public Sector getSector()
Return the image's location.- Returns:
- the image's location.
-
getCorners
public java.util.List<LatLon> getCorners()
-
getAltitude
public double getAltitude()
Return the image's altitude.- Returns:
- the image's altitude.
-
setImageSource
public void setImageSource(java.lang.String newSource)
Changes the image source. The allowable sources are those allowed byGliderImage(java.lang.String, java.lang.Object, java.lang.Iterable<? extends gov.nasa.worldwind.geom.LatLon>, double)
- Parameters:
newSource
- the new image source.- Throws:
java.lang.IllegalArgumentException
- ifnewSource
is null.
-
setImageSource
public void setImageSource(java.lang.String newName, java.lang.Object newSource)
Changes the image source and gives the image a new name. The allowable sources are those allowed byGliderImage(java.lang.String, java.lang.Object, java.lang.Iterable<? extends gov.nasa.worldwind.geom.LatLon>, double)
- Parameters:
newName
- the new image name.newSource
- the new image source.- Throws:
java.lang.IllegalArgumentException
- if either argument is null.
-
getImageSource
public java.lang.Object getImageSource()
Returns the image source.- Returns:
- the image source.
-
getOpacity
public double getOpacity()
-
setOpacity
public void setOpacity(double opacity)
-
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:
java.lang.IllegalArgumentException
- ifregion
is null.
-
removeRegionOfInterest
public void removeRegionOfInterest(GliderRegionOfInterest region)
Removes a region of interest.- Parameters:
region
- the region of interest to remove.- Throws:
java.lang.IllegalArgumentException
- ifregion
is null.
-
getRegionsOfInterest
public GliderRegionOfInterest.RegionSet getRegionsOfInterest()
-
alignImage
public static ImageUtil.AlignedImage alignImage(java.awt.image.BufferedImage sourceImage, float[] latitudes, float[] longitudes) throws java.lang.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 imagelatitudes
- 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:
java.lang.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(java.awt.image.BufferedImage sourceImage, float[] latitudes, float[] longitudes)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-