NASA World Wind

gov.nasa.worldwind.layers
Class LayerConfiguration

java.lang.Object
  extended by gov.nasa.worldwind.BasicDataConfiguration
      extended by gov.nasa.worldwind.layers.LayerConfiguration
All Implemented Interfaces:
DataConfiguration

public class LayerConfiguration
extends BasicDataConfiguration

An implementation of the DataConfiguration interface, which uses a Layer configuration document as its backing store.


Field Summary
 
Fields inherited from class gov.nasa.worldwind.BasicDataConfiguration
dom, xpath
 
Constructor Summary
LayerConfiguration(Element domElement)
          Creates an instance of LayerConfiguration backed by a specified DOM Element.
 
Method Summary
protected  DataConfiguration createChildConfigInfo(Element domElement)
           
static Element createLayerElements(AVList params, Element context)
          Appends layer parameters as elements to a specified context.
static Document createTiledImageLayerDocument(AVList params)
          Creates a configuration document for the tiled image layer described by the specified params.
static Element createTiledImageLayerElements(AVList params, Element context)
          Appends tiled image layer parameters as elements to a specified context.
static Element createWMSTiledImageLayerElements(AVList params, Element context)
          Appends WMS tiled image layer parameters as elements to a specified context.
static AVList getLayerParams(Element domElement, AVList params)
          Parses layer parameters from a specified DOM document.
 String getName()
          Returns the text content of the DisplayName element.
static AVList getTiledImageLayerParams(Element domElement, AVList params)
          Parses tiled image layer parameters from a specified DOM document.
 String getType()
          Returns the string "Layer".
 String getVersion()
          Returns the layer's version.
static AVList getWMSTiledImageLayerParams(Capabilities caps, String[] formatOrderPreference, AVList params)
          Parses WMS tiled image layer parameters from a specified WMS Capabilities document.
static AVList getWMSTiledImageLayerParams(Element domElement, AVList params)
          Parses WMS tiled image layer parameters from a specified DOM document.
static boolean isLayerDocument(Element domElement)
          Returns true if a specified DOM document should be accepted as a Layer configuration document, and false otherwise.
 
Methods inherited from class gov.nasa.worldwind.BasicDataConfiguration
getBoolean, getChild, getChildren, getDouble, getInteger, getLatLon, getLong, getSector, getSectorResolutionLimit, getSource, getString, getStringArray, getTimeInMillis, getUniqueStrings, getXPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayerConfiguration

public LayerConfiguration(Element domElement)
Creates an instance of LayerConfiguration backed by a specified DOM Element.

Parameters:
domElement - the backing DOM Element.
Method Detail

createChildConfigInfo

protected DataConfiguration createChildConfigInfo(Element domElement)
Overrides:
createChildConfigInfo in class BasicDataConfiguration

createLayerElements

public static Element createLayerElements(AVList params,
                                          Element context)
Appends layer parameters as elements to a specified context. If a parameter key exists, that parameter is appended to the context. Supported key and element paths are:
KeyNameType
AVKey.DISPLAY_NAMEDisplayNameString
AVKey.OPACITYOpacityDouble
AVKey.MAX_ACTIVE_ALTITUDEActiveAltitudes/@maxDouble
AVKey.MIN_ACTIVE_ALTITUDEActiveAltitudes/@minDouble
AVKey.NETWORK_RETRIEVAL_ENABLEDNetworkRetrievalEnabledBoolean
AVKey.MAP_SCALEMapScaleDouble
AVKey.SCREEN_CREDITScreenCreditScreenCredit

Parameters:
params - the key-value pairs which define the layer parameters.
context - the XML document root on which to append parameter elements.
Returns:
a reference to context.
Throws:
IllegalArgumentException - if either the parameters or the context are null.

createTiledImageLayerDocument

public static Document createTiledImageLayerDocument(AVList params)
Creates a configuration document for the tiled image layer described by the specified params. This document's root element may be passed to a LayerConfiguration constructor, and it may be passed to the constructor of a BasicTiledImageLayer.

Parameters:
params - parameters describing the tiled image layer.
Returns:
a configuration document for the tiled image layer.

createTiledImageLayerElements

public static Element createTiledImageLayerElements(AVList params,
                                                    Element context)
Appends tiled image layer parameters as elements to a specified context. If a parameter key exists, that parameter is appended to the context. This also writes LevelSet parameters by invoking DataConfigurationUtils.createLevelSetElements(gov.nasa.worldwind.avlist.AVList, org.w3c.dom.Element). Supported key and element paths are:
KeyNameType
AVKey.SERVICE_NAMEService/@serviceNameString
AVKey.AVAILABLE_IMAGE_FORMATSAvailableImageFormats/ImageFormatString array
AVKey.FORCE_LEVEL_ZERO_LOADSForceLevelZeroLoadsBoolean
AVKey.RETAIN_LEVEL_ZERO_TILESRetainLevelZeroTilesBoolean
AVKey.USE_MIP_MAPSUseMipMapsBoolean
AVKey.USE_TRANSPARENT_TEXTURESUseTransparentTexturesBoolean
AVKey.URL_CONNECT_TIMEOUTRetrievalTimeouts/ConnectTimeout/TimeInteger milliseconds
AVKey.URL_READ_TIMEOUTRetrievalTimeouts/ReadTimeout/TimeInteger milliseconds
AVKey.RETRIEVAL_QUEUE_STALE_REQUEST_LIMITRetrievalTimeouts/StaleRequestLimit/TimeInteger milliseconds

Parameters:
params - the key-value pairs which define the tiled image layer parameters.
context - the XML document root on which to append parameter elements.
Returns:
a reference to context.
Throws:
IllegalArgumentException - if either the parameters or the context are null.

createWMSTiledImageLayerElements

public static Element createWMSTiledImageLayerElements(AVList params,
                                                       Element context)
Appends WMS tiled image layer parameters as elements to a specified context. If a parameter key exists, that parameter is appended to the context. This also writes common WMS layer elements by invoking DataConfigurationUtils.createWMSLayerElements(gov.nasa.worldwind.avlist.AVList, org.w3c.dom.Element).

Parameters:
params - the key-value pairs which define the WMS tiled image layer parameters.
context - the XML document root on which to append parameter elements.
Returns:
a reference to context.
Throws:
IllegalArgumentException - if either the parameters or the context are null.

getLayerParams

public static AVList getLayerParams(Element domElement,
                                    AVList params)
Parses layer parameters from a specified DOM document. This writes output as key-value pairs to params. If a parameter from the XML document already exists in params, that parameter is ignored. Supported key and parameter names are:
KeyNameType
AVKey.DISPLAY_NAMEDisplayNameString
AVKey.OPACITYOpacityDouble
AVKey.MAX_ACTIVE_ALTITUDEActiveAltitudes/@maxDouble
AVKey.MIN_ACTIVE_ALTITUDEActiveAltitudes/@minDouble
AVKey.NETWORK_RETRIEVAL_ENABLEDNetworkRetrievalEnabledBoolean
AVKey.MAP_SCALEMapScaleDouble
AVKey.SCREEN_CREDITScreenCreditScreenCredit

Parameters:
domElement - the XML document root to parse for layer parameters.
params - the output key-value pairs which recieve the layer parameters. A null reference is permitted.
Returns:
a reference to params, or a new AVList if params is null.
Throws:
IllegalArgumentException - if the document is null.

getName

public String getName()
Returns the text content of the DisplayName element.

Specified by:
getName in interface DataConfiguration
Overrides:
getName in class BasicDataConfiguration
Returns:
Layer's display name.

getTiledImageLayerParams

public static AVList getTiledImageLayerParams(Element domElement,
                                              AVList params)
Parses tiled image layer parameters from a specified DOM document. This also parses common LevelSet parameters by invoking DataConfigurationUtils.getLevelSetParams(org.w3c.dom.Element, gov.nasa.worldwind.avlist.AVList). This writes output as key-value pairs to params. If a parameter from the XML document already exists in params, that parameter is ignored. Supported key and parameter names are:
KeyNameType
AVKey.SERVICE_NAMEService/@serviceNameString
AVKey.AVAILABLE_IMAGE_FORMATSAvailableImageFormats/ImageFormatString array
AVKey.FORCE_LEVEL_ZERO_LOADSForceLevelZeroLoadsBoolean
AVKey.RETAIN_LEVEL_ZERO_TILESRetainLevelZeroTilesBoolean
AVKey.USE_MIP_MAPSUseMipMapsBoolean
AVKey.USE_TRANSPARENT_TEXTURESUseTransparentTexturesBoolean
AVKey.URL_CONNECT_TIMEOUTRetrievalTimeouts/ConnectTimeout/TimeInteger milliseconds
AVKey.URL_READ_TIMEOUTRetrievalTimeouts/ReadTimeout/TimeInteger milliseconds
AVKey.RETRIEVAL_QUEUE_STALE_REQUEST_LIMITRetrievalTimeouts/StaleRequestLimit/TimeInteger milliseconds

Parameters:
domElement - the XML document root to parse for tiled image layer parameters.
params - the output key-value pairs which recieve the tiled image layer parameters. A null reference is permitted.
Returns:
a reference to params, or a new AVList if params is null.
Throws:
IllegalArgumentException - if the document is null.

getType

public String getType()
Returns the string "Layer".

Specified by:
getType in interface DataConfiguration
Overrides:
getType in class BasicDataConfiguration
Returns:
"Layer"

getVersion

public String getVersion()
Returns the layer's version.

Specified by:
getVersion in interface DataConfiguration
Overrides:
getVersion in class BasicDataConfiguration
Returns:
layer's version.

getWMSTiledImageLayerParams

public static AVList getWMSTiledImageLayerParams(Capabilities caps,
                                                 String[] formatOrderPreference,
                                                 AVList params)
Parses WMS tiled image layer parameters from a specified WMS Capabilities document. This also parses common WMS layer parameters by invoking DataConfigurationUtils.getWMSLayerParams(gov.nasa.worldwind.wms.Capabilities, String[], gov.nasa.worldwind.avlist.AVList). This writes output as key-value pairs to params.

Parameters:
caps - the WMS Capabilities document to parse for WMS layer parameters.
formatOrderPreference - an ordered array of preferred image formats, or null to use the default format.
params - the output key-value pairs which recieve the WMS layer parameters.
Returns:
a reference to params.
Throws:
IllegalArgumentException - if either the document or params are null, or if params does not contain the required key-value pairs.
WWRuntimeException - if the Capabilities document does not contain any of the required information.

getWMSTiledImageLayerParams

public static AVList getWMSTiledImageLayerParams(Element domElement,
                                                 AVList params)
Parses WMS tiled image layer parameters from a specified DOM document. This also parses common WMS layer parameters by invoking DataConfigurationUtils.getWMSLayerParams(org.w3c.dom.Element, gov.nasa.worldwind.avlist.AVList). This writes output as key-value pairs to params. If a parameter from the XML document already exists in params, that parameter is ignored.

Parameters:
domElement - the XML document root to parse for WMS tiled image layer parameters.
params - the output key-value pairs which recieve the WMS tiled image layer parameters. A null reference is permitted.
Returns:
a reference to params, or a new AVList if params is null.
Throws:
IllegalArgumentException - if the document is null.

isLayerDocument

public static boolean isLayerDocument(Element domElement)
Returns true if a specified DOM document should be accepted as a Layer configuration document, and false otherwise.

Parameters:
domElement - the DOM document in question.
Returns:
true if the document is a Layer configuration document; false otherwise.
Throws:
IllegalArgumentException - if document is null.

NASA World Wind