NASA World Wind

gov.nasa.worldwind.layers
Class SurfaceImageLayer

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.layers.AbstractLayer
              extended by gov.nasa.worldwind.layers.RenderableLayer
                  extended by gov.nasa.worldwind.layers.SurfaceImageLayer
All Implemented Interfaces:
AVList, Disposable, Layer, Restorable, WWObject, PropertyChangeListener, EventListener
Direct Known Subclasses:
HawaiianIslandsLayer

public class SurfaceImageLayer
extends RenderableLayer

Displays a collecion of local images on the globe.


Field Summary
protected  ConcurrentHashMap<String,ArrayList<SurfaceImage>> imageTable
           
protected  ImageTiler imageTiler
           
 
Fields inherited from class gov.nasa.worldwind.layers.RenderableLayer
delegateOwner, pickSupport
 
Fields inherited from class gov.nasa.worldwind.layers.AbstractLayer
screenCredit
 
Fields inherited from class gov.nasa.worldwind.avlist.AVListImpl
changeSupport
 
Constructor Summary
SurfaceImageLayer()
           
 
Method Summary
 void addImage(String imagePath)
          Add an image to the collection, reprojecting it to geographic (latitude & longitude) coordinates if necessary.
 void addImage(String name, BufferedImage image, List<? extends LatLon> corners)
          Add a BufferedImage to the collection at an explicitly specified location.
 void addImage(String name, BufferedImage image, Sector sector)
          Add a BufferedImage to the collection at an explicitly specified location.
 void addImage(String imagePath, List<? extends LatLon> corners)
          Add an image to the collection at an explicitly specified location.
 void addImage(String imagePath, Sector sector)
          Add an image to the collection at an explicitly specified location.
 BufferedImage composeImageForSector(Sector sector, int canvasWidth, int canvasHeight, double aspectRatio, BufferedImage image)
          Create an image for the portion of this layer lying within a specified sector.
 int getNumImages()
           
 void removeImage(String imagePath)
           
 void setOpacity(double opacity)
          Opacity is not applied to layers of this type because each renderable typically has its own opacity control.
 
Methods inherited from class gov.nasa.worldwind.layers.RenderableLayer
addRenderable, addRenderables, clearRenderables, dispose, disposeRenderables, doPick, doPick, doPreRender, doPreRender, doRender, doRender, getActiveRenderables, getDelegateOwner, getNumRenderables, getOpacity, getRenderables, removeAllRenderables, removeRenderable, setRenderables, toString
 
Methods inherited from class gov.nasa.worldwind.layers.AbstractLayer
getExpiryTime, getMaxActiveAltitude, getMinActiveAltitude, getName, getRestorableState, getScale, getScreenCredit, isAtMaxResolution, isEnabled, isLayerActive, isLayerInView, isMultiResolution, isNetworkRetrievalEnabled, isPickEnabled, pick, preRender, render, restoreState, setEnabled, setExpiryTime, setMaxActiveAltitude, setMinActiveAltitude, setName, setNetworkRetrievalEnabled, setPickEnabled, setScreenCredit
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
propertyChange
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 

Field Detail

imageTable

protected ConcurrentHashMap<String,ArrayList<SurfaceImage>> imageTable

imageTiler

protected ImageTiler imageTiler
Constructor Detail

SurfaceImageLayer

public SurfaceImageLayer()
Method Detail

addImage

public void addImage(String imagePath)
              throws IOException
Add an image to the collection, reprojecting it to geographic (latitude & longitude) coordinates if necessary. The image's location is determined from metadata files co-located with the image file. The number, names and contents of these files are governed by the type of the specified image. Location metadata must be available.

If projection information is available and reprojection of the image's projection type is supported, the image will be reprojected to geographic coordinates. If projection information is not available then it's assumed that the image is already in geographic projection.

Only reprojection from UTM is currently provided.

Parameters:
imagePath - the path to the image file.
Throws:
IllegalArgumentException - if the image path is null.
IOException - if an error occurs reading the image file.
IllegalStateException - if an error occurs while reprojecting or otherwise processing the image.
WWRuntimeException - if the image type is unsupported.

addImage

public void addImage(String name,
                     BufferedImage image,
                     List<? extends LatLon> corners)
Add a BufferedImage to the collection at an explicitly specified location. The image is assumed to be in geographic projection (latitude & longitude).

Parameters:
name - a unique name to associate with the image so that it can be subsequently referred to without having to keep a reference to the image itself. Use this name in calls to removeImage(java.lang.String).
image - the image to add.
corners - the geographic location of the image's corners, specified in order of lower-left, lower-right, upper-right, lower-left.
Throws:
IllegalArgumentException - if the image path is null, the corners list is null, contains null values or fewer than four locations.
WWRuntimeException - if the image type is unsupported.

addImage

public void addImage(String name,
                     BufferedImage image,
                     Sector sector)
Add a BufferedImage to the collection at an explicitly specified location. The image is assumed to be in geographic projection (latitude & longitude).

Parameters:
name - a unique name to associate with the image so that it can be subsequently referred to without having to keep a reference to the image itself. Use this name in calls to removeImage(java.lang.String).
image - the image to add.
sector - the geographic location of the image.
Throws:
IllegalArgumentException - if the image path or sector is null.
WWRuntimeException - if the image type is unsupported.

addImage

public void addImage(String imagePath,
                     List<? extends LatLon> corners)
              throws IOException
Add an image to the collection at an explicitly specified location. The image is assumed to be in geographic projection (latitude & longitude).

Parameters:
imagePath - the path to the image file.
corners - the geographic location of the image's corners, specified in order of lower-left, lower-right, upper-right, lower-left.
Throws:
IllegalArgumentException - if the image path or sector is null.
IOException - if an error occurs reading the image file.
WWRuntimeException - if the image type is unsupported.

addImage

public void addImage(String imagePath,
                     Sector sector)
              throws IOException
Add an image to the collection at an explicitly specified location. The image is assumed to be in geographic projection (latitude & longitude).

Parameters:
imagePath - the path to the image file.
sector - the geographic location of the image.
Throws:
IllegalArgumentException - if the image path or sector is null.
IOException - if an error occurs reading the image file.
WWRuntimeException - if the image type is unsupported.

composeImageForSector

public BufferedImage composeImageForSector(Sector sector,
                                           int canvasWidth,
                                           int canvasHeight,
                                           double aspectRatio,
                                           BufferedImage image)
Create an image for the portion of this layer lying within a specified sector. The image is created at a specified aspect ratio within a canvas of a specified size.

Parameters:
sector - the sector of interest.
canvasWidth - the width of the canvas.
canvasHeight - the height of the canvas.
aspectRatio - the aspect ratio, width/height, of the window. If the aspect ratio is greater or equal to one, the full width of the canvas is used for the image; the height used is proportional to the inverse of the aspect ratio. If the aspect ratio is less than one, the full height of the canvas is used, and the width used is proportional to the aspect ratio.
image - if non-null, a BufferedImage in which to place the image. If null, a new buffered image of type BufferedImage.TYPE_INT_RGB is created. The image must be the width and height specified in the canvasWidth and canvasHeight arguments.
Returns:
image the assembelled image, of size indicated by the canvasWidth and canvasHeight. If the specified aspect ratio is one, all pixels contain values. If the aspect ratio is greater than one, a full-width segment along the top of the canvas is blank. If the aspect ratio is less than one, a full-height segment along the right side of the canvase is blank. If the image argument was non-null, that buffered image is returned.
See Also:
ImageUtil.mergeImage(gov.nasa.worldwind.geom.Sector, gov.nasa.worldwind.geom.Sector, double, java.awt.image.BufferedImage, java.awt.image.BufferedImage)

getNumImages

public int getNumImages()

removeImage

public void removeImage(String imagePath)

setOpacity

public void setOpacity(double opacity)
Description copied from class: RenderableLayer
Opacity is not applied to layers of this type because each renderable typically has its own opacity control.

Specified by:
setOpacity in interface Layer
Overrides:
setOpacity in class RenderableLayer
Parameters:
opacity - the current opacity value, which is ignored by this layer.

NASA World Wind