本文整理汇总了Java中gov.nasa.worldwind.util.WWXML类的典型用法代码示例。如果您正苦于以下问题:Java WWXML类的具体用法?Java WWXML怎么用?Java WWXML使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WWXML类属于gov.nasa.worldwind.util包,在下文中一共展示了WWXML类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFallbackParams
import gov.nasa.worldwind.util.WWXML; //导入依赖的package包/类
public static void setFallbackParams(Document dataConfig, String filename, AVList params) {
XPath xpath = WWXML.makeXPath();
Element domElement = dataConfig.getDocumentElement();
// If the data configuration document doesn't define a cache name, then compute one using the file's path
// relative to its file cache directory.
String s = WWXML.getText(domElement, "DataCacheName", xpath);
if (s == null || s.length() == 0) DataConfigurationUtils.getDataConfigCacheName(filename, params);
// If the data configuration document doesn't define the data's extreme elevations, provide default values using
// the minimum and maximum elevations of Earth.
String type = DataConfigurationUtils.getDataConfigType(domElement);
if (type.equalsIgnoreCase("ElevationModel")) {
if (WWXML.getDouble(domElement, "ExtremeElevations/@min", xpath) == null) params.setValue(AVKey.ELEVATION_MIN, Earth.ELEVATION_MIN);
if (WWXML.getDouble(domElement, "ExtremeElevations/@max", xpath) == null) params.setValue(AVKey.ELEVATION_MAX, Earth.ELEVATION_MAX);
}
}
示例2: getElevationModel
import gov.nasa.worldwind.util.WWXML; //导入依赖的package包/类
public static ElevationModel getElevationModel(File xml) {
try {
if(xml.exists()){
Document doc=null;
// Get standard document
doc = WWXML.openDocument(xml);
doc = DataConfigurationUtils.convertToStandardDataConfigDocument(doc);
AVList params = new AVListImpl();
WorldWindUtils.setFallbackParams(doc, Constants.ELEVATION_NAME, params);
// Return elevation model in xml file
BasicElevationModelFactory b = new BasicElevationModelFactory();
return (ElevationModel) b.createFromConfigSource(xml, params);
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
示例3: appendProperties
import gov.nasa.worldwind.util.WWXML; //导入依赖的package包/类
/**
* Append Property elements to a context element.
*
* @param context
* the context on which to append new element(s)
* @param properties
* AVList with properties to append.
*/
public static void appendProperties(Element context, AVList properties) {
if (null == context || properties == null) return;
StringBuilder sb = new StringBuilder();
// add properties
for (Map.Entry<String, Object> entry : properties.getEntries()) {
sb.setLength(0);
String key = entry.getKey();
sb.append(properties.getValue(key));
String value = sb.toString();
if (WWUtil.isEmpty(key) || WWUtil.isEmpty(value)) continue;
Element property = WWXML.appendElement(context, "Property");
WWXML.setTextAttribute(property, "name", key);
WWXML.setTextAttribute(property, "value", value);
}
}
示例4: createTiledImageLayerConfigDocument
import gov.nasa.worldwind.util.WWXML; //导入依赖的package包/类
/**
* Creates a configuration document for a TiledImageLayer described by the specified params. The returned document
* may be used as a construction parameter to {@link gov.nasa.worldwind.layers.BasicTiledImageLayer}.
*
* @param params parameters describing the TiledImageLayer.
*
* @return a configuration document for the TiledImageLayer.
*/
public static Document createTiledImageLayerConfigDocument(AVList params)
{
Document doc = WWXML.createDocumentBuilder(true).newDocument();
Element root = WWXML.setDocumentElement(doc, "Layer");
WWXML.setIntegerAttribute(root, "version", 1);
WWXML.setTextAttribute(root, "layerType", "TiledImageLayer");
createTiledImageLayerConfigElements(params, root);
return doc;
}