Package gov.nasa.worldwind.data
Class BasicRasterServer
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.data.BasicRasterServer
-
- All Implemented Interfaces:
AVList,RasterServer,MessageListener,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
public class BasicRasterServer extends WWObjectImpl implements RasterServer
BasicRasterServer maintains a list of data sources and their properties in the BasicRasterServerCache and is used to compose (mosaic) a data raster of the given region of interest from data sources.
-
-
Field Summary
Fields Modifier and Type Field Description protected static MemoryCachecacheprotected java.util.List<DataRaster>dataRasterListprotected DataRasterReaderFactoryreaderFactory
-
Constructor Summary
Constructors Constructor Description BasicRasterServer(java.lang.Object o, AVList params)BasicRasterServer constructor reads a list of data raster sources from *.RasterServer.xml (the file that accompanies layer description XML file), reads sector of each source and maintains a list of data sources, their properties,
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DataRastercomposeRaster(AVList reqParams)Composes a DataRaster of the given width and height for the specific geographic region of interest (ROI).protected voidextractProperties(RasterServerConfiguration config)Extracts all Property key and values from the given DOM elementprotected DataRasterReaderfindDataRasterReader(java.lang.Object source, AVList params)MemoryCachegetCache()Returns an instance of the MemoryCache that contains DataRasters and their propertiesprotected java.lang.StringgetDataSetName()protected java.lang.StringgetDataSetPixelFormat()Returns DataSet's pixel format (AVKey.IMAGE or AVKey.ELEVATION), or empty string if not setjava.nio.ByteBuffergetRasterAsByteBuffer(AVList params)Composes a DataRaster of the given width and height for the specific geographic region of interest (ROI), in the requested file format (AVKey.IMAGE_FORMAT) and returns as a ByteBufferSectorgetSector()Returns a Geographic extend (coverage) of the composerbooleanhasDataRasters()Returns TRUE, if the DataRaster list is not emptyprotected voidinit(java.lang.Object o)protected booleanreadRasterSources(RasterServerConfiguration config)Reads XML document and extracts raster sourcesprotected voidsetDataSetPixelFormat(java.lang.String pixelFormat)-
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, 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, toString, 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
-
dataRasterList
protected java.util.List<DataRaster> dataRasterList
-
readerFactory
protected DataRasterReaderFactory readerFactory
-
cache
protected static final MemoryCache cache
-
-
Constructor Detail
-
BasicRasterServer
public BasicRasterServer(java.lang.Object o, AVList params)BasicRasterServer constructor reads a list of data raster sources from *.RasterServer.xml (the file that accompanies layer description XML file), reads sector of each source and maintains a list of data sources, their properties,- Parameters:
o- the RasterServer.xml source to read. May by aFile, a file path, a URL or anElementparams- optional metadata associated with the data source that might be useful to the BasicRasterServer.
-
-
Method Detail
-
getCache
public MemoryCache getCache()
Returns an instance of the MemoryCache that contains DataRasters and their properties- Returns:
- an instance of the MemoryCache that contains DataRasters and their properties
-
hasDataRasters
public boolean hasDataRasters()
Returns TRUE, if the DataRaster list is not empty- Returns:
- true, if the DataRaster list is not empty
-
init
protected void init(java.lang.Object o)
-
getDataSetName
protected java.lang.String getDataSetName()
-
getDataSetPixelFormat
protected java.lang.String getDataSetPixelFormat()
Returns DataSet's pixel format (AVKey.IMAGE or AVKey.ELEVATION), or empty string if not set- Returns:
- DataSet's pixel format (AVKey.IMAGE or AVKey.ELEVATION), or empty string if not set
-
setDataSetPixelFormat
protected void setDataSetPixelFormat(java.lang.String pixelFormat)
-
extractProperties
protected void extractProperties(RasterServerConfiguration config)
Extracts all Property key and values from the given DOM element- Parameters:
config- Parsed configuration document.
-
readRasterSources
protected boolean readRasterSources(RasterServerConfiguration config)
Reads XML document and extracts raster sources- Parameters:
config- Parsed configuration document.- Returns:
- TRUE, if all raster sources are available, FALSE otherwise
-
findDataRasterReader
protected DataRasterReader findDataRasterReader(java.lang.Object source, AVList params)
-
getSector
public Sector getSector()
Description copied from interface:RasterServerReturns a Geographic extend (coverage) of the composer- Specified by:
getSectorin interfaceRasterServer- Returns:
- returns a Geographic extend (coverage) of the composer as a Sector
-
composeRaster
public DataRaster composeRaster(AVList reqParams) throws java.lang.IllegalArgumentException, WWRuntimeException
Composes a DataRaster of the given width and height for the specific geographic region of interest (ROI).- Parameters:
reqParams- This is a required parameter, must not be null or empty; Must contain AVKey.WIDTH, AVKey.HEIGHT, and AVKey.SECTOR values.Optional keys are: AVKey.PIXEL_FORMAT (AVKey.ELEVATION | AVKey.IMAGE) AVKey.DATA_TYPE AVKey.BYTE_ORDER (AVKey.BIG_ENDIAN | AVKey.LITTLE_ENDIAN )
- Returns:
- a DataRaster for the requested ROI
- Throws:
WWRuntimeException- if there is no intersection of the source rasters with the requested ROI or the source format is unknown or not supported by currently loaded driversjava.lang.IllegalArgumentException- if any of the required parameters or values are missing
-
getRasterAsByteBuffer
public java.nio.ByteBuffer getRasterAsByteBuffer(AVList params)
Composes a DataRaster of the given width and height for the specific geographic region of interest (ROI), in the requested file format (AVKey.IMAGE_FORMAT) and returns as a ByteBuffer- Specified by:
getRasterAsByteBufferin interfaceRasterServer- Parameters:
params- This is a required parameter, must not be null or empty; Must contain AVKey.WIDTH, AVKey.HEIGHT, AVKey.SECTOR, and AVKey.IMAGE_FORMAT (mime type) values. Supported mime types are: "image/png", "image/jpeg", "image/dds".Optional keys are: AVKey.PIXEL_FORMAT (AVKey.ELEVATION | AVKey.IMAGE) AVKey.DATA_TYPE AVKey.BYTE_ORDER (AVKey.BIG_ENDIAN | AVKey.LITTLE_ENDIAN )
- Returns:
- a DataRaster for the requested ROI
- Throws:
WWRuntimeException- if there is no intersection of the source rasters with the requested ROI or the source format is unknown or not supported by currently loaded driversjava.lang.IllegalArgumentException- if any of the required parameters or values are missing
-
-