NASA World Wind

gov.nasa.worldwind.data
Class BasicRasterServer

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.data.BasicRasterServer
All Implemented Interfaces:
AVList, RasterServer, MessageListener, WWObject, PropertyChangeListener, 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
protected static MemoryCache cache
           
protected  List<DataRaster> dataRasterList
           
protected  DataRasterReaderFactory readerFactory
           
protected  String XPATH_RASTER_SERVER
           
protected  String XPATH_RASTER_SERVER_PROPERTY
           
protected  String XPATH_RASTER_SERVER_SOURCE
           
protected  String XPATH_RASTER_SERVER_SOURCE_SECTOR
           
 
Constructor Summary
BasicRasterServer(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
 DataRaster composeRaster(AVList reqParams)
          Composes a DataRaster of the given width and height for the specific geographic region of interest (ROI).
protected  void extractProperties(Element domElement, XPath xpath)
          Extracts all key and values from the given DOM element
protected  DataRasterReader findDataRasterReader(Object source, AVList params)
           
 MemoryCache getCache()
          Returns an instance of the MemoryCache that contains DataRasters and their properties
protected  String getDataSetName()
           
protected  String getDataSetPixelFormat()
          Returns DataSet's pixel format (AVKey.IMAGE or AVKey.ELEVATION), or empty string if not set
 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
 Sector getSector()
          Returns a Geographic extend (coverage) of the composer
 boolean hasDataRasters()
          Returns TRUE, if the DataRaster list is not empty
protected  void init(Object o)
           
protected  boolean readRasterSources(Element domElement, XPath xpath)
          Reads XML document and extracts raster sources
protected  void setDataSetPixelFormat(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, finalize, 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

cache

protected static final MemoryCache cache

dataRasterList

protected List<DataRaster> dataRasterList

readerFactory

protected DataRasterReaderFactory readerFactory

XPATH_RASTER_SERVER

protected final String XPATH_RASTER_SERVER
See Also:
Constant Field Values

XPATH_RASTER_SERVER_PROPERTY

protected final String XPATH_RASTER_SERVER_PROPERTY
See Also:
Constant Field Values

XPATH_RASTER_SERVER_SOURCE

protected final String XPATH_RASTER_SERVER_SOURCE
See Also:
Constant Field Values

XPATH_RASTER_SERVER_SOURCE_SECTOR

protected final String XPATH_RASTER_SERVER_SOURCE_SECTOR
See Also:
Constant Field Values
Constructor Detail

BasicRasterServer

public BasicRasterServer(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 a File, a file path, a URL or an Element
params - optional metadata associated with the data source that might be useful to the BasicRasterServer.
Method Detail

composeRaster

public DataRaster composeRaster(AVList reqParams)
                         throws 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 drivers
IllegalArgumentException - if any of the required parameters or values are missing

extractProperties

protected void extractProperties(Element domElement,
                                 XPath xpath)
Extracts all key and values from the given DOM element

Parameters:
domElement - XML object as DOM
xpath - XPath instance

findDataRasterReader

protected DataRasterReader findDataRasterReader(Object source,
                                                AVList params)

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

getDataSetName

protected String getDataSetName()

getDataSetPixelFormat

protected 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

getRasterAsByteBuffer

public 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:
getRasterAsByteBuffer in interface RasterServer
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 drivers
IllegalArgumentException - if any of the required parameters or values are missing

getSector

public Sector getSector()
Description copied from interface: RasterServer
Returns a Geographic extend (coverage) of the composer

Specified by:
getSector in interface RasterServer
Returns:
returns a Geographic extend (coverage) of the composer as a Sector

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(Object o)

readRasterSources

protected boolean readRasterSources(Element domElement,
                                    XPath xpath)
Reads XML document and extracts raster sources

Parameters:
domElement - DOM element
xpath - XPath instance
Returns:
TRUE, if all raster sources are available, FALSE otherwise

setDataSetPixelFormat

protected void setDataSetPixelFormat(String pixelFormat)

NASA World Wind