Class SurfaceImageLayer
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.layers.AbstractLayer
-
- gov.nasa.worldwind.layers.RenderableLayer
-
- gov.nasa.worldwind.layers.SurfaceImageLayer
-
- All Implemented Interfaces:
AVList
,Disposable
,MessageListener
,Layer
,Restorable
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
public class SurfaceImageLayer extends RenderableLayer
Displays a collection of local images on the globe.Note: The view input handlers detect surface images rather than the terrain as the top picked object in
SelectEvent
s and will not respond to the user's attempts at navigation when the cursor is over the image. If this is not the desired behavior, disable picking for the layer containing the surface image.
-
-
Field Summary
Fields Modifier and Type Field Description protected BasicDataRasterReaderFactory
factory
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.ArrayList<SurfaceImage>>
imageTable
protected ImageTiler
imageTiler
-
Fields inherited from class gov.nasa.worldwind.layers.RenderableLayer
pickSupport, renderables, renderablesOverride
-
-
Constructor Summary
Constructors Constructor Description SurfaceImageLayer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addImage(java.lang.String imagePath)
Add an image to the collection, reprojecting it to geographic (latitude and longitude) coordinates if necessary.void
addImage(java.lang.String imagePath, Sector sector)
Add an image to the collection and specify its coverage.void
addImage(java.lang.String name, java.awt.image.BufferedImage image, Sector sector)
Add aBufferedImage
to the collection at an explicitly specified location.void
addImage(java.lang.String name, java.awt.image.BufferedImage image, java.util.List<? extends LatLon> corners)
Add aBufferedImage
to the collection at an explicitly specified location.void
addImage(java.lang.String imagePath, java.util.List<? extends LatLon> corners)
Add an image to the collection at an explicitly specified location.java.awt.image.BufferedImage
composeImageForSector(Sector sector, int canvasWidth, int canvasHeight, double aspectRatio, java.awt.image.BufferedImage image)
Create an image for the portion of this layer lying within a specified sector.void
dispose()
Disposes the contents of this layer's internal Renderable collection, but does not remove any elements from that collection.protected java.awt.image.BufferedImage
getBufferedImage(DataRaster raster)
int
getNumImages()
protected DataRaster
openDataRaster(java.lang.Object src, AVList params)
void
removeImage(java.lang.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, addRenderable, addRenderables, clearRenderables, disposeRenderables, doPick, doPick, doPreRender, doPreRender, doRender, doRender, getActiveRenderables, getNumRenderables, getOpacity, getRenderables, onMessage, removeAllRenderables, removeRenderable, setRenderables, toString
-
Methods inherited from class gov.nasa.worldwind.layers.AbstractLayer
createLayerConfigElements, getDataFileStore, getExpiryTime, getLayerConfigParams, getMaxActiveAltitude, getMaxEffectiveAltitude, getMinActiveAltitude, getMinEffectiveAltitude, getName, getRestorableState, getScale, getScreenCredit, isAtMaxResolution, isEnabled, isLayerActive, isLayerConfigDocument, isLayerInView, isMultiResolution, isNetworkRetrievalEnabled, isPickEnabled, pick, preRender, render, restoreState, setDataFileStore, 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, 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, equals, 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
-
-
-
-
Field Detail
-
imageTiler
protected ImageTiler imageTiler
-
imageTable
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.ArrayList<SurfaceImage>> imageTable
-
factory
protected BasicDataRasterReaderFactory factory
-
-
Method Detail
-
dispose
public void dispose()
Description copied from class:RenderableLayer
Disposes the contents of this layer's internal Renderable collection, but does not remove any elements from that collection.If any of layer's internal Renderables implement
AVList
, this stops forwarding their property change events to the layer's property change listeners. Any property change listeners the layer attached to therenderables
inRenderableLayer.addRenderable(gov.nasa.worldwind.render.Renderable)
orRenderableLayer.addRenderables(Iterable)
are removed.- Specified by:
dispose
in interfaceDisposable
- Overrides:
dispose
in classRenderableLayer
-
addImage
public void addImage(java.lang.String imagePath) throws java.io.IOException
Add an image to the collection, reprojecting it to geographic (latitude and 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:
java.lang.IllegalArgumentException
- if the image path is null.java.io.IOException
- if an error occurs reading the image file.java.lang.IllegalStateException
- if an error occurs while reprojecting or otherwise processing the image.WWRuntimeException
- if the image type is unsupported.
-
getBufferedImage
protected java.awt.image.BufferedImage getBufferedImage(DataRaster raster)
-
openDataRaster
protected DataRaster openDataRaster(java.lang.Object src, AVList params) throws java.lang.IllegalArgumentException, WWRuntimeException
- Throws:
java.lang.IllegalArgumentException
WWRuntimeException
-
addImage
public void addImage(java.lang.String imagePath, Sector sector) throws java.io.IOException, WWRuntimeException
Add an image to the collection and specify its coverage. The image is assumed to be in geographic projection (latitude and longitude).- Parameters:
imagePath
- the path to the image file.sector
- the geographic location of the image.- Throws:
java.lang.IllegalArgumentException
- if the image path or sector is null.java.io.IOException
- if an error occurs reading the image file.WWRuntimeException
- if the image type is unsupported.
-
addImage
public void addImage(java.lang.String name, java.awt.image.BufferedImage image, Sector sector)
Add aBufferedImage
to the collection at an explicitly specified location. The image is assumed to be in geographic projection (latitude and 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 toremoveImage(String)
.image
- the image to add.sector
- the geographic location of the image.- Throws:
java.lang.IllegalArgumentException
- if the image path or sector is null.WWRuntimeException
- if the image type is unsupported.
-
addImage
public void addImage(java.lang.String imagePath, java.util.List<? extends LatLon> corners) throws java.io.IOException, WWRuntimeException
Add an image to the collection at an explicitly specified location. The image is assumed to be in geographic projection (latitude and 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, upper-left.- Throws:
java.lang.IllegalArgumentException
- if the image path or sector is null.java.io.IOException
- if an error occurs reading the image file.WWRuntimeException
- if the image type is unsupported.
-
addImage
public void addImage(java.lang.String name, java.awt.image.BufferedImage image, java.util.List<? extends LatLon> corners)
Add aBufferedImage
to the collection at an explicitly specified location. The image is assumed to be in geographic projection (latitude and 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 toremoveImage(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, upper-left.- Throws:
java.lang.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.
-
removeImage
public void removeImage(java.lang.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 interfaceLayer
- Overrides:
setOpacity
in classRenderableLayer
- Parameters:
opacity
- the current opacity value, which is ignored by this layer.
-
getNumImages
public int getNumImages()
-
composeImageForSector
public java.awt.image.BufferedImage composeImageForSector(Sector sector, int canvasWidth, int canvasHeight, double aspectRatio, java.awt.image.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, aBufferedImage
in which to place the image. If null, a new buffered image of typeBufferedImage.TYPE_INT_RGB
is created. The image must be the width and height specified in thecanvasWidth
andcanvasHeight
arguments.- Returns:
- image the assembelled image, of size indicated by the
canvasWidth
andcanvasHeight
. 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 theimage
argument was non-null, that buffered image is returned. - See Also:
ImageUtil.mergeImage(Sector, Sector, double, BufferedImage, BufferedImage)
-
-