NASA World Wind

gov.nasa.worldwind.layers
Class TiledImageLayer

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.TiledImageLayer
All Implemented Interfaces:
AVList, Disposable, Layer, Restorable, WWObject, PropertyChangeListener, EventListener
Direct Known Subclasses:
BasicTiledImageLayer, RPFTiledImageLayer

public abstract class TiledImageLayer
extends AbstractLayer


Nested Class Summary
protected  class TiledImageLayer.HttpRetrievalPostProcessor
           
 
Field Summary
 
Fields inherited from class gov.nasa.worldwind.layers.AbstractLayer
screenCredit
 
Fields inherited from class gov.nasa.worldwind.avlist.AVListImpl
changeSupport
 
Constructor Summary
TiledImageLayer(LevelSet levelSet)
           
 
Method Summary
protected abstract  void checkResources()
           
 BufferedImage composeImageForSector(Sector sector, int canvasWidth, int canvasHeight, double aspectRatio, int levelNumber, String mimeType, boolean abortOnError, BufferedImage image, int timeout)
          Create an image for the portion of this layer lying within a specified sector.
 int computeLevelForResolution(Sector sector, double resolution)
           
 int countImagesInSector(Sector sector)
           
 int countImagesInSector(Sector sector, int levelNumber)
           
protected  void doRender(DrawContext dc)
           
protected  void downloadImage(TextureTile tile, String mimeType, int timeout)
           
protected abstract  void forceTextureLoad(TextureTile tile)
           
 ArrayList<String> getAvailableImageFormats()
           
 String getDefaultImageFormat()
           
protected  LevelSet getLevels()
           
protected  Vec4 getReferencePoint()
           
protected  PriorityBlockingQueue<Runnable> getRequestQ()
           
 TextureTile[][] getTilesInSector(Sector sector, int levelNumber)
           
 boolean isAtMaxResolution()
          Indicates whether the most recent rendering of the layer rendered the highest resolution imagery or other data available.
 boolean isDrawBoundingVolumes()
           
 boolean isDrawTileBoundaries()
           
 boolean isDrawTileIDs()
           
 boolean isForceLevelZeroLoads()
           
 boolean isImageFormatAvailable(String imageFormat)
           
 boolean isLayerInView(DrawContext dc)
          Indicates whether the layer is in the view.
 boolean isMultiResolution()
          Indicates whether the layer provides multiple resolutions of imagery or other data.
 boolean isRetainLevelZeroTiles()
           
 boolean isShowImageTileOutlines()
           
 boolean isUseMipMaps()
           
 boolean isUseTransparentTextures()
           
 void render(DrawContext dc)
          Cause the layer to draw its representation.
protected  BufferedImage requestImage(TextureTile tile, String mimeType)
           
protected abstract  void requestTexture(DrawContext dc, TextureTile tile)
           
protected  void setAvailableImageFormats(String[] formats)
           
protected  void setBlendingFunction(DrawContext dc)
           
 void setDrawBoundingVolumes(boolean drawBoundingVolumes)
           
 void setDrawTileBoundaries(boolean drawTileBoundaries)
           
 void setDrawTileIDs(boolean drawTileIDs)
           
 void setExpiryTime(long expiryTime)
          Specifies the time of the layer's most recent dataset update, beyond which cached data is invalid.
 void setForceLevelZeroLoads(boolean forceLevelZeroLoads)
           
 void setName(String name)
          Set the layer's name.
 void setRetainLevelZeroTiles(boolean retainLevelZeroTiles)
           
 void setShowImageTileOutlines(boolean showImageTileOutlines)
           
protected  void setSplitScale(double splitScale)
           
 void setUseMipMaps(boolean useMipMaps)
           
 void setUseTransparentTextures(boolean useTransparentTextures)
           
 
Methods inherited from class gov.nasa.worldwind.layers.AbstractLayer
dispose, doPick, doPreRender, getExpiryTime, getMaxActiveAltitude, getMinActiveAltitude, getName, getOpacity, getRestorableState, getScale, getScreenCredit, isEnabled, isLayerActive, isNetworkRetrievalEnabled, isPickEnabled, pick, preRender, restoreState, setEnabled, setMaxActiveAltitude, setMinActiveAltitude, setNetworkRetrievalEnabled, setOpacity, setPickEnabled, setScreenCredit, toString
 
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
 

Constructor Detail

TiledImageLayer

public TiledImageLayer(LevelSet levelSet)
Method Detail

checkResources

protected abstract void checkResources()

composeImageForSector

public BufferedImage composeImageForSector(Sector sector,
                                           int canvasWidth,
                                           int canvasHeight,
                                           double aspectRatio,
                                           int levelNumber,
                                           String mimeType,
                                           boolean abortOnError,
                                           BufferedImage image,
                                           int timeout)
                                    throws Exception
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.
levelNumber - the target level of the tiled image layer.
mimeType - the type of image to create, e.g., "png" and "jpg".
abortOnError - indicates whether to stop assembling the image if an error occurs. If false, processing continues until all portions of the layer that intersect the specified sector have been added to the image. Portions for which an error occurs will be blank.
image - if non-null, a BufferedImage in which to place the image. If null, a new buffered image is created. The image must be the width and height specified in the canvasWidth and canvasHeight arguments.
timeout - The amount of time to allow for reading the image from the server.
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.
Throws:
IllegalArgumentException - if sector is null.
Exception
See Also:
;

computeLevelForResolution

public int computeLevelForResolution(Sector sector,
                                     double resolution)

countImagesInSector

public int countImagesInSector(Sector sector)

countImagesInSector

public int countImagesInSector(Sector sector,
                               int levelNumber)

doRender

protected final void doRender(DrawContext dc)
Specified by:
doRender in class AbstractLayer

downloadImage

protected void downloadImage(TextureTile tile,
                             String mimeType,
                             int timeout)
                      throws Exception
Throws:
Exception

forceTextureLoad

protected abstract void forceTextureLoad(TextureTile tile)

getAvailableImageFormats

public ArrayList<String> getAvailableImageFormats()

getDefaultImageFormat

public String getDefaultImageFormat()

getLevels

protected LevelSet getLevels()

getReferencePoint

protected Vec4 getReferencePoint()

getRequestQ

protected PriorityBlockingQueue<Runnable> getRequestQ()

getTilesInSector

public TextureTile[][] getTilesInSector(Sector sector,
                                        int levelNumber)

isAtMaxResolution

public boolean isAtMaxResolution()
Description copied from interface: Layer
Indicates whether the most recent rendering of the layer rendered the highest resolution imagery or other data available. Some layers do not track resolution. For those layers this value will always be true. Typically such layers also return false from Layer.isMultiResolution().

Specified by:
isAtMaxResolution in interface Layer
Overrides:
isAtMaxResolution in class AbstractLayer
Returns:
true if the layer is at maximum resolution, otherwise false.

isDrawBoundingVolumes

public boolean isDrawBoundingVolumes()

isDrawTileBoundaries

public boolean isDrawTileBoundaries()

isDrawTileIDs

public boolean isDrawTileIDs()

isForceLevelZeroLoads

public boolean isForceLevelZeroLoads()

isImageFormatAvailable

public boolean isImageFormatAvailable(String imageFormat)

isLayerInView

public boolean isLayerInView(DrawContext dc)
Description copied from class: AbstractLayer
Indicates whether the layer is in the view. The method implemented here is a default indicating the layer is in view. Subclasses able to determine their presence in the view should override this implementation.

Overrides:
isLayerInView in class AbstractLayer
Parameters:
dc - the current draw context
Returns:
true if the layer is in the view, false otherwise.

isMultiResolution

public boolean isMultiResolution()
Description copied from interface: Layer
Indicates whether the layer provides multiple resolutions of imagery or other data.

Specified by:
isMultiResolution in interface Layer
Overrides:
isMultiResolution in class AbstractLayer
Returns:
true if the layer provides multiple resolutions, else false.

isRetainLevelZeroTiles

public boolean isRetainLevelZeroTiles()

isShowImageTileOutlines

public boolean isShowImageTileOutlines()

isUseMipMaps

public boolean isUseMipMaps()

isUseTransparentTextures

public boolean isUseTransparentTextures()

render

public void render(DrawContext dc)
Description copied from interface: Layer
Cause the layer to draw its representation.

Specified by:
render in interface Layer
Overrides:
render in class AbstractLayer
Parameters:
dc - the current draw context

requestImage

protected BufferedImage requestImage(TextureTile tile,
                                     String mimeType)
                              throws URISyntaxException,
                                     InterruptedIOException,
                                     MalformedURLException
Throws:
URISyntaxException
InterruptedIOException
MalformedURLException

requestTexture

protected abstract void requestTexture(DrawContext dc,
                                       TextureTile tile)

setAvailableImageFormats

protected void setAvailableImageFormats(String[] formats)

setBlendingFunction

protected void setBlendingFunction(DrawContext dc)

setDrawBoundingVolumes

public void setDrawBoundingVolumes(boolean drawBoundingVolumes)

setDrawTileBoundaries

public void setDrawTileBoundaries(boolean drawTileBoundaries)

setDrawTileIDs

public void setDrawTileIDs(boolean drawTileIDs)

setExpiryTime

public void setExpiryTime(long expiryTime)
Specifies the time of the layer's most recent dataset update, beyond which cached data is invalid. If greater than zero, the layer ignores and eliminates any in-memory or on-disk cached data older than the time specified, and requests new information from the data source. If zero, the default, the layer applies any expiry times associated with its individual levels, but only for on-disk cached data. In-memory cached data is expired only when the expiry time is specified with this method and is greater than zero. This method also overwrites the expiry times of the layer's individual levels if the value specified to the method is greater than zero.

Specified by:
setExpiryTime in interface Layer
Overrides:
setExpiryTime in class AbstractLayer
Parameters:
expiryTime - the expiry time of any cached data, expressed as a number of milliseconds beyond the epoch. The default expiry time is zero.
See Also:
for a description of milliseconds beyond the epoch.

setForceLevelZeroLoads

public void setForceLevelZeroLoads(boolean forceLevelZeroLoads)

setName

public void setName(String name)
Description copied from interface: Layer
Set the layer's name. The name is a convenience attribute typically used to identify the layer in user interfaces. By default, a layer has no name.

Specified by:
setName in interface Layer
Overrides:
setName in class AbstractLayer
Parameters:
name - the name to assign to the layer.

setRetainLevelZeroTiles

public void setRetainLevelZeroTiles(boolean retainLevelZeroTiles)

setShowImageTileOutlines

public void setShowImageTileOutlines(boolean showImageTileOutlines)

setSplitScale

protected void setSplitScale(double splitScale)

setUseMipMaps

public void setUseMipMaps(boolean useMipMaps)

setUseTransparentTextures

public void setUseTransparentTextures(boolean useTransparentTextures)

NASA World Wind