NASA World Wind

gov.nasa.worldwind.util
Class DataConfigurationUtils

java.lang.Object
  extended by gov.nasa.worldwind.util.DataConfigurationUtils

public class DataConfigurationUtils
extends Object

A collection of static methods useful for opening, reading, and otherwise working with DataConfiguration resources.


Constructor Summary
DataConfigurationUtils()
           
 
Method Summary
static void checkAndSetBooleanParam(DataConfiguration context, AVList params, String paramKey, String paramName)
          Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name.
static void checkAndSetDoubleParam(DataConfiguration context, AVList params, String paramKey, String paramName)
          Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name.
static void checkAndSetIntegerParam(DataConfiguration context, AVList params, String paramKey, String paramName)
          Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name.
static void checkAndSetLatLonParam(DataConfiguration context, AVList params, String paramKey, String paramName)
          Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name.
static void checkAndSetLongParam(DataConfiguration context, AVList params, String paramKey, String paramName)
          Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name.
static void checkAndSetSectorParam(DataConfiguration context, AVList params, String paramKey, String paramName)
          Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name.
static void checkAndSetSectorResolutionParam(DataConfiguration context, AVList params, String paramKey, String paramName)
          Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name.
static void checkAndSetStringArrayParam(DataConfiguration context, AVList params, String paramKey, String paramName)
          Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name.
static void checkAndSetStringParam(DataConfiguration context, AVList params, String paramKey, String paramName)
          Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name.
static void checkAndSetTimeParam(DataConfiguration context, AVList params, String paramKey, String paramName)
          Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name.
static void checkAndSetTimeParamAsInteger(DataConfiguration context, AVList params, String paramKey, String paramName)
          Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name.
static void checkAndSetUniqueStringsParam(DataConfiguration context, AVList params, String paramKey, String paramName)
          Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name.
protected static String chooseImageFormat(Capabilities caps, String[] formatOrderPreference)
           
protected static int computeLayerNumLevels(Angle minDelta, Angle maxDelta)
           
protected static int computeLayerNumLevels(LatLon minDelta, LatLon maxDelta)
           
static DataConfiguration createDataConfig(Element domElement)
          Create a DataConfiguration from a specified Document.
static Element createLevelSetElements(AVList params, Element context)
          Appends LevelSet parameters as elements to a specified context.
static Element createWMSLayerElements(AVList params, Element context)
          Appends WMS layer parameters as elements to a specified context.
static URL findExistingDataConfigFile(FileStore fileStore, String fileName)
          Returns the URL of an existing data configuration file under the specified file store, or null if no configuration file exists.
static String getDataConfigFilename(AVList params, String suffix)
          Returns a file store path name for the specified parameters list.
static AVList getFileStoreParams(FileStore fileStore, String dataConfigFileName, AVList params)
          Convenience method for parsing parameters about a configuration file in a specified FileStore.
protected static String getInactiveLevels(LevelSet levelSet)
           
protected static int[] getLayerFixedWidthAndHeight(Capabilities caps, Element layer)
           
protected static LatLon getLayerGeographicMaxTileDelta(Element layer)
           
protected static LatLon getLayerGeographicMinTileDelta(Element layer)
           
protected static LatLon getLayerGeographicTileOrigin(Element layer)
           
protected static LatLon getLayerLatLon(Element layer, String path)
           
static AVList getLevelSetParams(DataConfiguration dataConfig, AVList params)
          Parses LevelSet parameters from the configuration information.
static AVList getLevelSetParams(Element domElement, AVList params)
          Parses LevelSet parameters from a specified DOM document.
static AVList getLevelSetParams(LevelSet levelSet, AVList params)
          Gathers LevelSet parameters from a specified LevelSet reference.
static AVList getNonComposableWMSLayerParams(Capabilities caps, AVList params)
          Parses non-composable WMS layer parameters from the WMS Capabilities document starting at domElement.
protected static int getNumEmptyLevels(LevelSet levelSet)
           
static URL getOGCGetCapabilitiesURL(AVList params)
          Convenience metohd to get the OGC GetCapabilities URL from a specified parameter list.
static String[] getOGCLayerNames(AVList params)
          Convenience method to get the OGC AVKey.LAYER_NAMES parameter from a specified parameter list.
static AVList getWMSLayerParams(Capabilities caps, String[] formatOrderPreference, AVList params)
          Parses WMS layer parameters from the WMS Capabilities document starting at domElement.
static AVList getWMSLayerParams(Element domElement, AVList params)
          Parses WMS layer parameters from the XML configuration document starting at domElement.
static boolean hasDataConfigFile(FileStore fileStore, String fileName, boolean removeIfExpired, long expiryTime)
          Returns true if a configuration file name exists in the store which has not expired.
static boolean isDataConfig(Element domElement)
          Returns true if the specified Element should be accepted as a configuration document.
static boolean isNonComposableWMSLayer(Capabilities caps, AVList params)
          Returns true if the layer is a non-composable WMS layer, indicating that GetMap requests must be made by the client against a specific tiling structure.
protected static String makeTitle(Capabilities caps, String layerNames, String styleNames)
           
static DataConfiguration openDataConfigFile(String filePath, Class c)
          Opens a configuration file given the file's location in the file system or on the classpath.
static DataConfiguration openDataConfigStream(InputStream inputStream)
          Reads configuration information given an input stream.
static DataConfiguration openDataConfigURL(URL url)
          Reads configuration information given a URL.
static void saveDataConfigDocument(Document doc, FileStore fileStore, String fileName)
          Saves a specified configuration document to a specified file store, under a specified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataConfigurationUtils

public DataConfigurationUtils()
Method Detail

checkAndSetBooleanParam

public static void checkAndSetBooleanParam(DataConfiguration context,
                                           AVList params,
                                           String paramKey,
                                           String paramName)
Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name. If found, the key and value are added to the parameter list.

Parameters:
context - the context in which look for the parameter.
params - the parameter list.
paramKey - the key used to identify the paramater in the parameter list.
paramName - the parameter name identifying the parameter value within the specified context.
Throws:
IllegalArgumentException - if either the context, parameter list, parameter key or parameter name are null.

checkAndSetDoubleParam

public static void checkAndSetDoubleParam(DataConfiguration context,
                                          AVList params,
                                          String paramKey,
                                          String paramName)
Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name. If found, the key and value are added to the parameter list.

Parameters:
context - the context in which look for the parameter.
params - the parameter list.
paramKey - the key used to identify the paramater in the parameter list.
paramName - the parameter name identifying the parameter value within the specified context.
Throws:
IllegalArgumentException - if either the context, parameter list, parameter key or parameter name are null.

checkAndSetIntegerParam

public static void checkAndSetIntegerParam(DataConfiguration context,
                                           AVList params,
                                           String paramKey,
                                           String paramName)
Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name. If found, the key and value are added to the parameter list.

Parameters:
context - the context in which look for the parameter.
params - the parameter list.
paramKey - the key used to identify the paramater in the parameter list.
paramName - the parameter name identifying the parameter value within the specified context.
Throws:
IllegalArgumentException - if either the context, parameter list, parameter key or parameter name are null.

checkAndSetLatLonParam

public static void checkAndSetLatLonParam(DataConfiguration context,
                                          AVList params,
                                          String paramKey,
                                          String paramName)
Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name. If found, the key and value are added to the parameter list.

Parameters:
context - the context in which look for the parameter.
params - the parameter list.
paramKey - the key used to identify the paramater in the parameter list.
paramName - the parameter name identifying the parameter value within the specified context.
Throws:
IllegalArgumentException - if either the context, parameter list, parameter key or parameter name are null.

checkAndSetLongParam

public static void checkAndSetLongParam(DataConfiguration context,
                                        AVList params,
                                        String paramKey,
                                        String paramName)
Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name. If found, the key and value are added to the parameter list.

Parameters:
context - the context in which look for the parameter.
params - the parameter list.
paramKey - the key used to identify the paramater in the parameter list.
paramName - the parameter name identifying the parameter value within the specified context.
Throws:
IllegalArgumentException - if either the context, parameter list, parameter key or parameter name are null.

checkAndSetSectorParam

public static void checkAndSetSectorParam(DataConfiguration context,
                                          AVList params,
                                          String paramKey,
                                          String paramName)
Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name. If found, the key and value are added to the parameter list.

Parameters:
context - the context in which look for the parameter.
params - the parameter list.
paramKey - the key used to identify the paramater in the parameter list.
paramName - the parameter name identifying the parameter value within the specified context.
Throws:
IllegalArgumentException - if either the context, parameter list, parameter key or parameter name are null.

checkAndSetSectorResolutionParam

public static void checkAndSetSectorResolutionParam(DataConfiguration context,
                                                    AVList params,
                                                    String paramKey,
                                                    String paramName)
Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name. If found, the key and value are added to the parameter list.

Parameters:
context - the context in which look for the parameter.
params - the parameter list.
paramKey - the key used to identify the paramater in the parameter list.
paramName - the parameter name identifying the parameter value within the specified context.
Throws:
IllegalArgumentException - if either the context, parameter list, parameter key or parameter name are null.

checkAndSetStringArrayParam

public static void checkAndSetStringArrayParam(DataConfiguration context,
                                               AVList params,
                                               String paramKey,
                                               String paramName)
Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name. If found, the key and value are added to the parameter list.

Parameters:
context - the context in which look for the parameter.
params - the parameter list.
paramKey - the key used to identify the paramater in the parameter list.
paramName - the parameter name identifying the parameter value within the specified context.
Throws:
IllegalArgumentException - if either the context, parameter list, parameter key or parameter name are null.

checkAndSetStringParam

public static void checkAndSetStringParam(DataConfiguration context,
                                          AVList params,
                                          String paramKey,
                                          String paramName)
Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name. If found, the key and value are added to the parameter list.

Parameters:
context - the context in which look for the parameter.
params - the parameter list.
paramKey - the key used to identify the paramater in the parameter list.
paramName - the parameter name identifying the parameter value within the specified context.
Throws:
IllegalArgumentException - if either the context, parameter list, parameter key or parameter name are null.

checkAndSetTimeParam

public static void checkAndSetTimeParam(DataConfiguration context,
                                        AVList params,
                                        String paramKey,
                                        String paramName)
Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name. If found, the key and value are added to the parameter list.

Parameters:
context - the context in which look for the parameter.
params - the parameter list.
paramKey - the key used to identify the paramater in the parameter list.
paramName - the parameter name identifying the parameter value within the specified context.
Throws:
IllegalArgumentException - if either the context, parameter list, parameter key or parameter name are null.

checkAndSetTimeParamAsInteger

public static void checkAndSetTimeParamAsInteger(DataConfiguration context,
                                                 AVList params,
                                                 String paramKey,
                                                 String paramName)
Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name. If found, the key and value are added to the parameter list.

Parameters:
context - the context in which look for the parameter.
params - the parameter list.
paramKey - the key used to identify the paramater in the parameter list.
paramName - the parameter name identifying the parameter value within the specified context.
Throws:
IllegalArgumentException - if either the context, parameter list, parameter key or parameter name are null.

checkAndSetUniqueStringsParam

public static void checkAndSetUniqueStringsParam(DataConfiguration context,
                                                 AVList params,
                                                 String paramKey,
                                                 String paramName)
Checks a parameter list for a specified key and if not present attempts to find a value for the key from an parameter matching a specified name. If found, the key and value are added to the parameter list.

Parameters:
context - the context in which look for the parameter.
params - the parameter list.
paramKey - the key used to identify the paramater in the parameter list.
paramName - the parameter name identifying the parameter value within the specified context.
Throws:
IllegalArgumentException - if either the context, parameter list, parameter key or parameter name are null.

chooseImageFormat

protected static String chooseImageFormat(Capabilities caps,
                                          String[] formatOrderPreference)

computeLayerNumLevels

protected static int computeLayerNumLevels(Angle minDelta,
                                           Angle maxDelta)

computeLayerNumLevels

protected static int computeLayerNumLevels(LatLon minDelta,
                                           LatLon maxDelta)

createDataConfig

public static DataConfiguration createDataConfig(Element domElement)
Create a DataConfiguration from a specified Document. Maps the document type to the appropriate base DataConfiguration type. Document types recognized are:
  • "Layer" for Layer configuration documents
  • "ElevationModel" for ElevationModel configuration documents
  • "dataDescriptor" for DataDescriptor documents
  • "LevelSet" for World Wind .NET LayerSet documents
If the document type is not recognized, this returns a default implementation of DataConfiguration.

Parameters:
domElement - the document to create
Returns:
a DataConfiguration with the document as its backing contents.
Throws:
IllegalArgumentException - if the document is null.

createLevelSetElements

public static Element createLevelSetElements(AVList params,
                                             Element context)
Appends LevelSet 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:
KeyNamePath
AVKey.DATASET_NAMEDatasetNameString
AVKey.DATA_CACHE_NAMEDataCacheNameString
AVKey.SERVICEService/URLString
AVKey.EXPIRY_TIMEExpiryTimeLong
AVKey.EXPIRY_TIMELastUpdateLong
AVKey.FORMAT_SUFFIXFormatSuffixString
AVKey.NUM_LEVELSNumLevels/@countInteger
AVKey.NUM_EMPTY_LEVELSNumLevels/@numEmptyInteger
AVKey.INACTIVE_LEVELSNumLevels/@inactiveString
AVKey.SECTORSectorSector
AVKey.SECTOR_RESOLUTION_LIMITSSectorResolutionLimit LevelSet.SectorResolution
AVKey.TILE_ORIGINTileOrigin/LatLonLatLon
AVKey.TILE_WIDTHTileSize/Dimension/@widthInteger
AVKey.TILE_HEIGHTTileSize/Dimension/@heightInteger
AVKey.LEVEL_ZERO_TILE_DELTALastUpdateLatLon
AVKey.MAX_ABSENT_TILE_ATTEMPTSMaxAbsentTileAttemptsInteger
AVKey.MIN_ABSENT_TILE_CHECK_INTERVALMinAbsentTileCheckIntervalInteger

Parameters:
params - the key-value pairs which define the LevelSet 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.

createWMSLayerElements

public static Element createWMSLayerElements(AVList params,
                                             Element context)
Appends WMS 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.WMS_VERSIONService/@versionString
AVKey.LAYER_NAMESService/LayerNamesString
AVKey.STYLE_NAMESService/StyleNamesString
AVKey.GET_MAP_URLService/GetMapURLString
AVKey.GET_CAPABILITIES_URLService/GetCapabilitiesURLString
AVKey.IMAGE_FORMATImageFormatString
AVKey.SERVICEAVKey#GET_MAP_URLString
AVKey.DATASET_NAMEAVKey.LAYER_NAMESString

Parameters:
params - the key-value pairs which define the WMS 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.

findExistingDataConfigFile

public static URL findExistingDataConfigFile(FileStore fileStore,
                                             String fileName)
Returns the URL of an existing data configuration file under the specified file store, or null if no configuration file exists. This first looks for a configuration file with the specified name. If that does not exists, this checks the siblings of the specified file for a configuration file match.

Parameters:
fileStore - the file store in which to look.
fileName - the file name to look for. If a file with this nname does not exist in the store, this looks at the file's siblings for a match.
Returns:
the URL of an existing configuration file in the store, or null if none exists.
Throws:
IllegalArgumentException - if either the file store or file name are null.

getDataConfigFilename

public static String getDataConfigFilename(AVList params,
                                           String suffix)
Returns a file store path name for the specified parameters list. This returns null if the parameter list does not contain enough information to construct a path name.

Parameters:
params - the parameter list to extract a configuration filename from.
suffix - the file suffix to append on the path name, or null to append no suffix.
Returns:
a file store path name with the specified suffix, or null if a path name cannot be constructed.
Throws:
IllegalArgumentException - if the parameter list is null.

getFileStoreParams

public static AVList getFileStoreParams(FileStore fileStore,
                                        String dataConfigFileName,
                                        AVList params)
Convenience method for parsing parameters about a configuration file in a specified FileStore. 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.DATA_CACHE_NAMEDataCacheNameString

The parameter DataCacheName is chosen as the file name's relative parent directory path in the file store. This convention is chosen so that the configuration file sits along side the component's cached data, therefore the cache name points to the directory containing both the configuration file and the contents. This enables the component described by DataCacheName to be moved withing the file store (along with the configuration file), because the DataCacheName parameter is bound at discovery time, and not hard wired in the configuration file itself.

Parameters:
fileStore - file store which contains the file path.
dataConfigFileName - file store path of the configuration information.
params - the output key-value pairs which recieve the LevelSet parameters. A null reference is permitted.
Returns:
a reference to params, or a new AVList if params is null. Returns null if the configuration file cannot be read.
Throws:
IllegalArgumentException - if either the file store or file name is null, or if the configuration file cannot be read for any reason.

getInactiveLevels

protected static String getInactiveLevels(LevelSet levelSet)

getLayerFixedWidthAndHeight

protected static int[] getLayerFixedWidthAndHeight(Capabilities caps,
                                                   Element layer)

getLayerGeographicMaxTileDelta

protected static LatLon getLayerGeographicMaxTileDelta(Element layer)

getLayerGeographicMinTileDelta

protected static LatLon getLayerGeographicMinTileDelta(Element layer)

getLayerGeographicTileOrigin

protected static LatLon getLayerGeographicTileOrigin(Element layer)

getLayerLatLon

protected static LatLon getLayerLatLon(Element layer,
                                       String path)

getLevelSetParams

public static AVList getLevelSetParams(DataConfiguration dataConfig,
                                       AVList params)
Parses LevelSet parameters from the configuration information. This writes output as key-value pairs to params. If a parameter from the configuration already exists in params, that parameter is ignored. Supported key and parameter names are:
KeyNameType
AVKey.DATASET_NAMEDatasetNameString
AVKey.DATA_CACHE_NAMEDataCacheNameString
AVKey.SERVICEService/URLString
AVKey.EXPIRY_TIMEExpiryTimeLong
AVKey.EXPIRY_TIMELastUpdateLong
AVKey.FORMAT_SUFFIXFormatSuffixString
AVKey.NUM_LEVELSNumLevels/@countInteger
AVKey.NUM_EMPTY_LEVELSNumLevels/@numEmptyInteger
AVKey.INACTIVE_LEVELSNumLevels/@inactiveString
AVKey.SECTORSectorSector
AVKey.SECTOR_RESOLUTION_LIMITSSectorResolutionLimit LevelSet.SectorResolution
AVKey.TILE_ORIGINTileOrigin/LatLonLatLon
AVKey.TILE_WIDTHTileSize/Dimension/@widthInteger
AVKey.TILE_HEIGHTTileSize/Dimension/@heightInteger
AVKey.LEVEL_ZERO_TILE_DELTALastUpdateLatLon
AVKey.MAX_ABSENT_TILE_ATTEMPTSAbsentTiles/MaxAttemptsInteger
AVKey.MIN_ABSENT_TILE_CHECK_INTERVALAbsentTiles/MinCheckInterval/TimeInteger milliseconds

Parameters:
dataConfig - the configuration information in which to look for for LevelSet parameters.
params - the output key-value pairs which recieve the LevelSet parameters. A null reference is permitted.
Returns:
a reference to params, or a new AVList if params is null.
Throws:
IllegalArgumentException - if the configuration information is null.

getLevelSetParams

public static AVList getLevelSetParams(Element domElement,
                                       AVList params)
Parses LevelSet 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.DATASET_NAMEDatasetNameString
AVKey.DATA_CACHE_NAMEDataCacheNameString
AVKey.SERVICEService/URLString
AVKey.EXPIRY_TIMEExpiryTimeLong
AVKey.EXPIRY_TIMELastUpdateLong
AVKey.FORMAT_SUFFIXFormatSuffixString
AVKey.NUM_LEVELSNumLevels/@countInteger
AVKey.NUM_EMPTY_LEVELSNumLevels/@numEmptyInteger
AVKey.INACTIVE_LEVELSNumLevels/@inactiveString
AVKey.SECTORSectorSector
AVKey.SECTOR_RESOLUTION_LIMITSSectorResolutionLimit LevelSet.SectorResolution
AVKey.TILE_ORIGINTileOrigin/LatLonLatLon
AVKey.TILE_WIDTHTileSize/Dimension/@widthInteger
AVKey.TILE_HEIGHTTileSize/Dimension/@heightInteger
AVKey.LEVEL_ZERO_TILE_DELTALastUpdateLatLon
AVKey.MAX_ABSENT_TILE_ATTEMPTSAbsentTiles/MaxAttemptsInteger
AVKey.MIN_ABSENT_TILE_CHECK_INTERVALAbsentTiles/MinCheckInterval/TimeInteger milliseconds

Parameters:
domElement - the XML document root to parse for LevelSet parameters.
params - the output key-value pairs which recieve the LevelSet parametres. 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.

getLevelSetParams

public static AVList getLevelSetParams(LevelSet levelSet,
                                       AVList params)
Gathers LevelSet parameters from a specified LevelSet reference. This writes output as key-value pairs params. If a parameter from the XML document already exists in params, that parameter is ignored. Supported key and parameter names are:
KeyValueType
AVKey.DATASET_NAMEFirst Level's datasetString
AVKey.DATA_CACHE_NAMEFirst Level's cacheNameString
AVKey.SERVICEFirst Level's serviceString
AVKey.EXPIRY_TIMEFirst Level's expiryTimeLong
AVKey.FORMAT_SUFFIXFirstLevel's formatSuffixString
AVKey.NUM_LEVELSnumLevelsInteger
AVKey.NUM_EMPTY_LEVELS1 + index of first non-empty LevelInteger
AVKey.INACTIVE_LEVELSComma delimited string of Level numbersString
AVKey.SECTORsectorSector
AVKey.SECTOR_RESOLUTION_LIMITSsectorLevelLimits LevelSet.SectorResolution
AVKey.TILE_ORIGINtileOriginLatLon
AVKey.TILE_WIDTHFirst Level's tileWidthInteger
AVKey.TILE_HEIGHTFirst Level's tileHeightInteger
AVKey.LEVEL_ZERO_TILE_DELTAlevelZeroTileDeltaLatLon

Parameters:
levelSet - the LevelSet reference to gather parameters from.
params - the output key-value pairs which recieve the LevelSet 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.

getNonComposableWMSLayerParams

public static AVList getNonComposableWMSLayerParams(Capabilities caps,
                                                    AVList params)
Parses non-composable WMS layer parameters from the WMS Capabilities document starting at domElement. The specified parameter list must contain a non-empty String value under the key AVKey.LAYER_NAMES, and it must match one of the names layers in the specified Capabilities document. This writes output as key-value pairs to params. Supported key and parameter names are:
KeyValueType
AVKey.TILE_WIDTHWMS layer's fixedWidth attributeInteger
AVKey.TILE_HEIGHTWMS layer's fixedHeight attributeInteger
AVKey.TILE_ORIGINWMS layer's GeographicTileOrigin elementLatLon
AVKey.LEVEL_ZERO_TILE_DELTAWMS layer's GeographicTileDelta/MaxTileDelta elementLatLon
AVKey.NUM_LEVELSFunction of WMS layer's GeographicTileDelta/MaxTileDelta and GeographictileDelta/MinTileDelta elementsInteger

Parameters:
caps - the WMS Capabilities document to parse for WMS layer parameters.
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.
See Also:
isNonComposableWMSLayer(gov.nasa.worldwind.wms.Capabilities, gov.nasa.worldwind.avlist.AVList)

getNumEmptyLevels

protected static int getNumEmptyLevels(LevelSet levelSet)

getOGCGetCapabilitiesURL

public static URL getOGCGetCapabilitiesURL(AVList params)
Convenience metohd to get the OGC GetCapabilities URL from a specified parameter list. If all the necessary parameters are available, this returns the GetCapabilities URL. Otherwise this returns null.

Parameters:
params - parameter list to get the GetCapabilities parameters from.
Returns:
a OGC GetCapabilities URL, or null if the necessary parameters are not available.
Throws:
IllegalArgumentException - if the parameter list is null.

getOGCLayerNames

public static String[] getOGCLayerNames(AVList params)
Convenience method to get the OGC AVKey.LAYER_NAMES parameter from a specified parameter list. If the parameter is available as a String, this returns all the OGC layer names found in that String. Otherwise this returns null.

Parameters:
params - parameter list to get the layer names from.
Returns:
an array of layer names, or null if none exist.
Throws:
IllegalArgumentException - if the parameter list is null.

getWMSLayerParams

public static AVList getWMSLayerParams(Capabilities caps,
                                       String[] formatOrderPreference,
                                       AVList params)
Parses WMS layer parameters from the WMS Capabilities document starting at domElement. The specified parameter list must contain a non-empty String value under the key AVKey.LAYER_NAMES, and it must match one of the names layers in the specified Capabilities document. The parameter list may optionally contain a String value under the key AVKey.STYLE_NAMES. This writes output as key-value pairs to params. Supported key and parameter names are:
KeyValueType
AVKey.DISPLAY_NAMECombination of WMS layer names and style namesString
AVKey.DATASET_NAMEWMS layer namesString
AVKey.EXPIRY_TIMEWMS layer last update timeString
AVKey.GET_MAP_URLWMS GetMap Get URLString
AVKey.GET_CAPABILITIES_URLWMS GetCapabilities Get URLString
AVKey.SERVICEWMS GetMap Get URLString
AVKey.SERVICE_NAMECapabilities#WMS_SERVICE_NAMEString
AVKey.WMS_VERSIONWMS versionString
AVKey.DATA_CACHE_NAMECombination of WMS layer names and style namesString
AVKey.IMAGE_FORMATFirst WMS image format matching the specified formatsString
AVKey.SECTORUnion of WMS layer bounding boxesSector

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.

getWMSLayerParams

public static AVList getWMSLayerParams(Element domElement,
                                       AVList params)
Parses WMS layer parameters from the XML configuration document starting at domElement. 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.WMS_VERSIONService/@versionString
AVKey.LAYER_NAMESService/LayerNamesString
AVKey.STYLE_NAMESService/StyleNamesString
AVKey.GET_MAP_URLService/GetMapURLString
AVKey.GET_CAPABILITIES_URLService/GetCapabilitiesURLString
AVKey.IMAGE_FORMATImageFormatString
AVKey.SERVICEAVKey#GET_MAP_URLString
AVKey.DATASET_NAMEAVKey.LAYER_NAMESString

Parameters:
domElement - the XML document root to parse for WMS layer parameters.
params - the output key-value pairs which recieve the WMS 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.

hasDataConfigFile

public static boolean hasDataConfigFile(FileStore fileStore,
                                        String fileName,
                                        boolean removeIfExpired,
                                        long expiryTime)
Returns true if a configuration file name exists in the store which has not expired. This returns false if a configuration file does not exist, or it has expired. This invokes findExistingDataConfigFile(gov.nasa.worldwind.cache.FileStore, String) to determine the URL of any existing file names. If an existing file has expired, and removeIfExpired is true, this removes the existing file.

Parameters:
fileStore - the file store in which to look.
fileName - the file name to look for. If a file with this nname does not exist in the store, this looks at the file's siblings for a match.
removeIfExpired - true to remove the existing file, if it exists and is expired; false otherwise.
expiryTime - the time in milliseconds, before which a file is considered to be expired.
Returns:
whether a configuration file already exists which has not expired.
Throws:
IllegalArgumentException - if either the file store or file name are null.

isDataConfig

public static boolean isDataConfig(Element domElement)
Returns true if the specified Element should be accepted as a configuration document.

Parameters:
domElement - the document in question.
Returns:
true if the document should be accepted; false otherwise.
Throws:
IllegalArgumentException - if the document is null.

isNonComposableWMSLayer

public static boolean isNonComposableWMSLayer(Capabilities caps,
                                              AVList params)
Returns true if the layer is a non-composable WMS layer, indicating that GetMap requests must be made by the client against a specific tiling structure. The specified arameter list must contain a non-empty String value under the key AVKey.LAYER_NAMES, and it must match one of the names layers in the specified Capabilities document.

Parameters:
caps - the WMS Capabilities document to parse for WMS layer parameters.
params - the output key-value pairs which recieve the WMS layer parameters.
Returns:
true if a specified WMS layer is non-composable, false otherwise.
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.

makeTitle

protected static String makeTitle(Capabilities caps,
                                  String layerNames,
                                  String styleNames)

openDataConfigFile

public static DataConfiguration openDataConfigFile(String filePath,
                                                   Class c)
Opens a configuration file given the file's location in the file system or on the classpath.

Parameters:
filePath - the path to the file. Must be an absolute path or a path relative to a location in the classpath.
c - the class that is used to find a path relative to the classpath.
Returns:
a DataConfiguration for the file, or null if the file cannot be understood as a configuration file.
Throws:
IllegalArgumentException - if the file path is null.
WWRuntimeException - if an exception or error occurs while opening and parsing the file. The causing exception is included in this exception's Throwable.initCause(Throwable) .

openDataConfigStream

public static DataConfiguration openDataConfigStream(InputStream inputStream)
Reads configuration information given an input stream.

Parameters:
inputStream - the configuration information as an input stream.
Returns:
a DataConfiguration for the stream content, or null if the stream cannot be understood as configuration information.
Throws:
IllegalArgumentException - if the input stream is null.
WWRuntimeException - if an exception or error occurs while parsing the string. The causing exception is included in this exception's Throwable.initCause(Throwable)

openDataConfigURL

public static DataConfiguration openDataConfigURL(URL url)
Reads configuration information given a URL.

Parameters:
url - the configuration information .
Returns:
a DataConfiguration for the stream content, or null if the stream cannot be understood as configuration information.
Throws:
IllegalArgumentException - if the input stream is null.
WWRuntimeException - if an exception or error occurs while parsing the string. The causing exception is included in this exception's Throwable.initCause(Throwable)

saveDataConfigDocument

public static void saveDataConfigDocument(Document doc,
                                          FileStore fileStore,
                                          String fileName)
Saves a specified configuration document to a specified file store, under a specified name.

Parameters:
doc - the DOM document to save.
fileStore - the file store to save the document under.
fileName - the path to the file. Must be an relative path in the file store.
Throws:
IllegalArgumentException - if either the document, file store, or file name are null.
WWRuntimeException - if the file cannot be created, or if an exception or error occurs while writing the document. The causing exception is included in this exception's Throwable.initCause(Throwable)

NASA World Wind

Hosted by docs.bugaco.com