public abstract class TiledImageLayer extends AbstractLayer
Modifier and Type | Class and Description |
---|---|
protected class |
TiledImageLayer.CompositionRetrievalPostProcessor |
protected static class |
TiledImageLayer.LevelComparer |
Modifier and Type | Field and Description |
---|---|
protected boolean |
atMaxResolution |
protected TextureTile |
currentResourceTile |
protected java.util.ArrayList<TextureTile> |
currentTiles |
protected double |
detailHint |
protected double |
detailHintOrigin |
protected boolean |
drawBoundingVolumes |
protected boolean |
drawTileBoundaries |
protected boolean |
forceLevelZeroLoads |
protected static TiledImageLayer.LevelComparer |
levelComparer |
protected LevelSet |
levels |
protected boolean |
levelZeroLoaded |
protected java.util.concurrent.PriorityBlockingQueue<java.lang.Runnable> |
requestQ |
protected boolean |
retainLevelZeroTiles |
protected java.util.ArrayList<java.lang.String> |
supportedImageFormats |
protected java.lang.String |
textureFormat |
protected java.lang.String |
tileCountName |
protected java.util.ArrayList<TextureTile> |
topLevels |
protected boolean |
useMipMaps |
protected boolean |
useTransparentTextures |
Constructor and Description |
---|
TiledImageLayer(LevelSet levelSet) |
Modifier and Type | Method and Description |
---|---|
protected void |
addTile(DrawContext dc,
TextureTile tile) |
protected void |
addTileOrDescendants(DrawContext dc,
TextureTile tile) |
protected void |
addTileToCurrent(TextureTile tile) |
protected void |
assembleTiles(DrawContext dc) |
protected boolean |
atMaxLevel(DrawContext dc) |
protected void |
checkTextureExpiration(DrawContext dc,
java.util.List<TextureTile> tiles) |
java.awt.image.BufferedImage |
composeImageForSector(Sector sector,
int canvasWidth,
int canvasHeight,
double aspectRatio,
int levelNumber,
java.lang.String mimeType,
boolean abortOnError,
java.awt.image.BufferedImage image,
int timeout)
Create an image for the portion of this layer lying within a specified sector.
|
int |
computeLevelForResolution(Sector sector,
double resolution) |
protected Vec4 |
computeReferencePoint(DrawContext dc) |
long |
countImagesInSector(Sector sector) |
long |
countImagesInSector(Sector sector,
int levelNumber) |
static org.w3c.dom.Document |
createTiledImageLayerConfigDocument(AVList params)
Creates a configuration document for a TiledImageLayer described by the specified params.
|
static org.w3c.dom.Element |
createTiledImageLayerConfigElements(AVList params,
org.w3c.dom.Element context)
Appends TiledImageLayer configuration parameters as elements to the specified context.
|
protected void |
createTopLevelTiles() |
protected void |
doRender(DrawContext dc) |
protected void |
downloadImage(TextureTile tile,
java.lang.String mimeType,
int timeout) |
protected void |
draw(DrawContext dc) |
protected void |
drawBoundingVolumes(DrawContext dc,
java.util.ArrayList<TextureTile> tiles) |
protected void |
drawTileIDs(DrawContext dc,
java.util.ArrayList<TextureTile> tiles) |
protected abstract void |
forceTextureLoad(TextureTile tile) |
java.util.List<java.lang.String> |
getAvailableImageFormats() |
java.lang.String |
getDefaultImageFormat() |
protected double |
getDetailFactor() |
double |
getDetailHint()
Indicates the layer's detail hint, which is described in
setDetailHint(double) . |
protected java.awt.image.BufferedImage |
getImage(TextureTile tile,
java.lang.String mimeType,
int timeout) |
protected static AVList |
getLegacyTiledImageLayerConfigParams(org.w3c.dom.Element domElement,
AVList params)
Parses TiledImageLayer configuration parameters from previous versions of configuration documents.
|
LevelSet |
getLevels() |
java.lang.Double |
getMaxEffectiveAltitude(java.lang.Double radius)
Indicates the altitude above which this layer likely has low value or is not expected to be active.
|
java.lang.Double |
getMinEffectiveAltitude(java.lang.Double radius)
Indicates the altitude below which this layer likely has low value or is not expected to be active.
|
protected Vec4 |
getReferencePoint(DrawContext dc) |
protected java.util.concurrent.PriorityBlockingQueue<java.lang.Runnable> |
getRequestQ() |
java.lang.String |
getTextureFormat()
Returns the format used to store images in texture memory, or null if images are stored in their native format.
|
static AVList |
getTiledImageLayerConfigParams(org.w3c.dom.Element domElement,
AVList params)
Parses TiledImageLayer configuration parameters from the specified DOM document.
|
TextureTile[][] |
getTilesInSector(Sector sector,
int levelNumber) |
java.util.List<TextureTile> |
getTopLevels() |
java.lang.Object |
getValue(java.lang.String key)
Returns the value for a specified key.
|
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(java.lang.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() |
protected boolean |
isTileVisible(DrawContext dc,
TextureTile tile) |
boolean |
isUseMipMaps() |
boolean |
isUseTransparentTextures() |
protected void |
loadAllTopLevelTextures(DrawContext dc) |
protected boolean |
meetsRenderCriteria(DrawContext dc,
TextureTile tile) |
protected boolean |
needToSplit(DrawContext dc,
Sector sector,
Level level) |
void |
render(DrawContext dc)
Cause the layer to draw its representation.
|
protected java.awt.image.BufferedImage |
requestImage(TextureTile tile,
java.lang.String mimeType) |
protected abstract void |
requestTexture(DrawContext dc,
TextureTile tile) |
protected void |
retrieveLocalImage(TextureTile tile,
java.lang.String mimeType,
int timeout) |
protected void |
retrieveRemoteImage(TextureTile tile,
java.lang.String mimeType,
int timeout) |
protected void |
sendRequests() |
protected void |
setAvailableImageFormats(java.lang.String[] formats) |
protected void |
setBlendingFunction(DrawContext dc) |
void |
setDetailHint(double detailHint)
Modifies the default relationship of image resolution to screen resolution as the viewing altitude changes.
|
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(java.lang.String name)
Set the layer's name.
|
void |
setRetainLevelZeroTiles(boolean retainLevelZeroTiles) |
void |
setTextureFormat(java.lang.String textureFormat)
Specifies the format used to store images in texture memory, or null to store images in their native format.
|
void |
setUseMipMaps(boolean useMipMaps) |
void |
setUseTransparentTextures(boolean useTransparentTextures) |
java.lang.Object |
setValue(java.lang.String key,
java.lang.Object value)
Adds a key/value pair to the list.
|
createLayerConfigElements, dispose, doPick, doPreRender, getDataFileStore, getExpiryTime, getLayerConfigParams, getMaxActiveAltitude, getMinActiveAltitude, getName, getOpacity, getRestorableState, getScale, getScreenCredit, isEnabled, isLayerActive, isLayerConfigDocument, isNetworkRetrievalEnabled, isPickEnabled, pick, preRender, restoreState, setDataFileStore, setEnabled, setMaxActiveAltitude, setMinActiveAltitude, setNetworkRetrievalEnabled, setOpacity, setPickEnabled, setScreenCredit, toString
onMessage, propertyChange
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValues
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValues
onMessage
protected boolean atMaxResolution
protected TextureTile currentResourceTile
protected java.util.ArrayList<TextureTile> currentTiles
protected double detailHint
protected double detailHintOrigin
protected boolean drawBoundingVolumes
protected boolean drawTileBoundaries
protected boolean forceLevelZeroLoads
protected static final TiledImageLayer.LevelComparer levelComparer
protected final LevelSet levels
protected boolean levelZeroLoaded
protected java.util.concurrent.PriorityBlockingQueue<java.lang.Runnable> requestQ
protected boolean retainLevelZeroTiles
protected java.util.ArrayList<java.lang.String> supportedImageFormats
protected java.lang.String textureFormat
protected java.lang.String tileCountName
protected java.util.ArrayList<TextureTile> topLevels
protected boolean useMipMaps
protected boolean useTransparentTextures
public TiledImageLayer(LevelSet levelSet)
protected void addTile(DrawContext dc, TextureTile tile)
protected void addTileOrDescendants(DrawContext dc, TextureTile tile)
protected void addTileToCurrent(TextureTile tile)
protected void assembleTiles(DrawContext dc)
protected boolean atMaxLevel(DrawContext dc)
protected void checkTextureExpiration(DrawContext dc, java.util.List<TextureTile> tiles)
public java.awt.image.BufferedImage composeImageForSector(Sector sector, int canvasWidth, int canvasHeight, double aspectRatio, int levelNumber, java.lang.String mimeType, boolean abortOnError, java.awt.image.BufferedImage image, int timeout) throws java.lang.Exception
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.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.java.lang.IllegalArgumentException
- if sector
is null.java.lang.Exception
;
public int computeLevelForResolution(Sector sector, double resolution)
protected Vec4 computeReferencePoint(DrawContext dc)
public long countImagesInSector(Sector sector)
public long countImagesInSector(Sector sector, int levelNumber)
public static org.w3c.dom.Document createTiledImageLayerConfigDocument(AVList params)
BasicTiledImageLayer
.params
- parameters describing the TiledImageLayer.public static org.w3c.dom.Element createTiledImageLayerConfigElements(AVList params, org.w3c.dom.Element context)
Parameter | Element Path | Type |
---|---|---|
AVKey.SERVICE_NAME | Service/@serviceName | String |
AVKey.IMAGE_FORMAT | ImageFormat | String |
AVKey.AVAILABLE_IMAGE_FORMATS | AvailableImageFormats/ImageFormat | String array |
AVKey.FORCE_LEVEL_ZERO_LOADS | ForceLevelZeroLoads | Boolean |
AVKey.RETAIN_LEVEL_ZERO_TILES | RetainLevelZeroTiles | Boolean |
AVKey.TEXTURE_FORMAT | TextureFormat | String |
AVKey.USE_MIP_MAPS | UseMipMaps | Boolean |
AVKey.USE_TRANSPARENT_TEXTURES | UseTransparentTextures | Boolean |
AVKey.URL_CONNECT_TIMEOUT | RetrievalTimeouts/ConnectTimeout/Time | Integer milliseconds |
AVKey.URL_READ_TIMEOUT | RetrievalTimeouts/ReadTimeout/Time | Integer milliseconds |
AVKey.RETRIEVAL_QUEUE_STALE_REQUEST_LIMIT |
RetrievalTimeouts/StaleRequestLimit/Time | Integer milliseconds |
AbstractLayer.createLayerConfigElements(gov.nasa.worldwind.avlist.AVList,
org.w3c.dom.Element)
and DataConfigurationUtils.createLevelSetConfigElements(gov.nasa.worldwind.avlist.AVList,
org.w3c.dom.Element)
.params
- the key-value pairs which define the TiledImageLayer configuration parameters.context
- the XML document root on which to append TiledImageLayer configuration elements.java.lang.IllegalArgumentException
- if either the parameters or the context are null.protected void createTopLevelTiles()
protected final void doRender(DrawContext dc)
doRender
in class AbstractLayer
protected void downloadImage(TextureTile tile, java.lang.String mimeType, int timeout) throws java.lang.Exception
java.lang.Exception
protected void draw(DrawContext dc)
protected void drawBoundingVolumes(DrawContext dc, java.util.ArrayList<TextureTile> tiles)
protected void drawTileIDs(DrawContext dc, java.util.ArrayList<TextureTile> tiles)
protected abstract void forceTextureLoad(TextureTile tile)
public java.util.List<java.lang.String> getAvailableImageFormats()
public java.lang.String getDefaultImageFormat()
protected double getDetailFactor()
public double getDetailHint()
setDetailHint(double)
.setDetailHint(double)
protected java.awt.image.BufferedImage getImage(TextureTile tile, java.lang.String mimeType, int timeout) throws java.lang.Exception
java.lang.Exception
protected static AVList getLegacyTiledImageLayerConfigParams(org.w3c.dom.Element domElement, AVList params)
Parameter | Element Path | Type |
---|---|---|
AVKey.TEXTURE_FORMAT | CompressTextures | "image/dds" if CompressTextures is "true"; null otherwise |
domElement
- the XML document root to parse for legacy TiledImageLayer configuration parameters.params
- the output key-value pairs which recieve the TiledImageLayer configuration parameters. A null
reference is permitted.java.lang.IllegalArgumentException
- if the document is null.public LevelSet getLevels()
public java.lang.Double getMaxEffectiveAltitude(java.lang.Double radius)
Layer
Layer.setMaxActiveAltitude(double)
and does not reflect it.
The returned altitude is valid when the field of view indicated by View.getFieldOfView()
is set to its default value. Changing the field of view to any value other than the default may change this
layer's maximum effective altitude, but the returned altitude will not reflect that change.getMaxEffectiveAltitude
in interface Layer
getMaxEffectiveAltitude
in class AbstractLayer
radius
- the radius of the Globe
the layer is associated with. May be
null, in which case the Earth's equatorial radius is used, Earth.WGS84_EQUATORIAL_RADIUS
.public java.lang.Double getMinEffectiveAltitude(java.lang.Double radius)
Layer
Layer.setMinActiveAltitude(double)
and does not reflect it.
The returned altitude is valid when the field of view indicated by View.getFieldOfView()
is set to its default value. Changing the field of view to any value other than the default may change this
layer's minimum effective altitude, but the returned altitude will not reflect that change.getMinEffectiveAltitude
in interface Layer
getMinEffectiveAltitude
in class AbstractLayer
radius
- the radius of the Globe
the layer is associated with. May be
null, in which case the Earth's equatorial radius is used, Earth.WGS84_EQUATORIAL_RADIUS
.protected Vec4 getReferencePoint(DrawContext dc)
protected java.util.concurrent.PriorityBlockingQueue<java.lang.Runnable> getRequestQ()
public java.lang.String getTextureFormat()
setTextureFormat(String)
public static AVList getTiledImageLayerConfigParams(org.w3c.dom.Element domElement, AVList params)
Parameter | Element Path | Type |
---|---|---|
AVKey.SERVICE_NAME | Service/@serviceName | String |
AVKey.IMAGE_FORMAT | ImageFormat | String |
AVKey.AVAILABLE_IMAGE_FORMATS | AvailableImageFormats/ImageFormat | String array |
AVKey.FORCE_LEVEL_ZERO_LOADS | ForceLevelZeroLoads | Boolean |
AVKey.RETAIN_LEVEL_ZERO_TILES | RetainLevelZeroTiles | Boolean |
AVKey.TEXTURE_FORMAT | TextureFormat | Boolean |
AVKey.USE_MIP_MAPS | UseMipMaps | Boolean |
AVKey.USE_TRANSPARENT_TEXTURES | UseTransparentTextures | Boolean |
AVKey.URL_CONNECT_TIMEOUT | RetrievalTimeouts/ConnectTimeout/Time | Integer milliseconds |
AVKey.URL_READ_TIMEOUT | RetrievalTimeouts/ReadTimeout/Time | Integer milliseconds |
AVKey.RETRIEVAL_QUEUE_STALE_REQUEST_LIMIT |
RetrievalTimeouts/StaleRequestLimit/Time | Integer milliseconds |
AbstractLayer.getLayerConfigParams(org.w3c.dom.Element,
gov.nasa.worldwind.avlist.AVList)
and DataConfigurationUtils.getLevelSetConfigParams(org.w3c.dom.Element,
gov.nasa.worldwind.avlist.AVList)
.domElement
- the XML document root to parse for TiledImageLayer configuration parameters.params
- the output key-value pairs which recieve the TiledImageLayer configuration parameters. A null
reference is permitted.java.lang.IllegalArgumentException
- if the document is null.public TextureTile[][] getTilesInSector(Sector sector, int levelNumber)
public java.util.List<TextureTile> getTopLevels()
public java.lang.Object getValue(java.lang.String key)
AVList
getValue
in interface AVList
getValue
in class AVListImpl
key
- the attribute name. May not be null
.null
.public boolean isAtMaxResolution()
Layer
true
.
Typically such layers also return false
from Layer.isMultiResolution()
.isAtMaxResolution
in interface Layer
isAtMaxResolution
in class AbstractLayer
true
if the layer is at maximum resolution, otherwise false
.public boolean isDrawBoundingVolumes()
public boolean isDrawTileBoundaries()
public boolean isDrawTileIDs()
public boolean isForceLevelZeroLoads()
public boolean isImageFormatAvailable(java.lang.String imageFormat)
public boolean isLayerInView(DrawContext dc)
Layer
isLayerInView
in interface Layer
isLayerInView
in class AbstractLayer
dc
- the current draw contexttrue
if the layer is in the view, false
otherwise.public boolean isMultiResolution()
Layer
isMultiResolution
in interface Layer
isMultiResolution
in class AbstractLayer
true
if the layer provides multiple resolutions, else false
.public boolean isRetainLevelZeroTiles()
protected boolean isTileVisible(DrawContext dc, TextureTile tile)
public boolean isUseMipMaps()
public boolean isUseTransparentTextures()
protected void loadAllTopLevelTextures(DrawContext dc)
protected boolean meetsRenderCriteria(DrawContext dc, TextureTile tile)
protected boolean needToSplit(DrawContext dc, Sector sector, Level level)
public void render(DrawContext dc)
Layer
render
in interface Layer
render
in class AbstractLayer
dc
- the current draw contextprotected java.awt.image.BufferedImage requestImage(TextureTile tile, java.lang.String mimeType) throws java.net.URISyntaxException, java.io.InterruptedIOException, java.net.MalformedURLException
java.net.URISyntaxException
java.io.InterruptedIOException
java.net.MalformedURLException
protected abstract void requestTexture(DrawContext dc, TextureTile tile)
protected void retrieveLocalImage(TextureTile tile, java.lang.String mimeType, int timeout) throws java.lang.Exception
java.lang.Exception
protected void retrieveRemoteImage(TextureTile tile, java.lang.String mimeType, int timeout) throws java.lang.Exception
java.lang.Exception
protected void sendRequests()
protected void setAvailableImageFormats(java.lang.String[] formats)
protected void setBlendingFunction(DrawContext dc)
public void setDetailHint(double detailHint)
detailHint
- the degree to modify the default relationship of image resolution to screen resolution with
changing view altitudes. Values greater than 1 increase the resolution. Values less than zero
decrease the resolution. The default value is 0.public void setDrawBoundingVolumes(boolean drawBoundingVolumes)
public void setDrawTileBoundaries(boolean drawTileBoundaries)
public void setDrawTileIDs(boolean drawTileIDs)
public void setExpiryTime(long expiryTime)
setExpiryTime
in interface Layer
setExpiryTime
in class AbstractLayer
expiryTime
- the expiry time of any cached data, expressed as a number of milliseconds beyond the epoch. The
default expiry time is zero.for a description of milliseconds beyond the epoch.
public void setForceLevelZeroLoads(boolean forceLevelZeroLoads)
public void setName(java.lang.String name)
Layer
setName
in interface Layer
setName
in class AbstractLayer
name
- the name to assign to the layer.public void setRetainLevelZeroTiles(boolean retainLevelZeroTiles)
public void setTextureFormat(java.lang.String textureFormat)
image/dds
- Stores images in the compressed DDS
format. If the image is already in DDS format it's stored as-is.textureFormat
- the texture image format; null to store images in their native format.public void setUseMipMaps(boolean useMipMaps)
public void setUseTransparentTextures(boolean useTransparentTextures)
public java.lang.Object setValue(java.lang.String key, java.lang.Object value)
AVList
setValue
in interface AVList
setValue
in class AVListImpl
key
- the attribute name. May not be null
.value
- the attribute value. May be null
, in which case any existing value for the key is
removed from the collection.