本文整理汇总了Java中gov.nasa.worldwind.util.WWUtil.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java WWUtil.isEmpty方法的具体用法?Java WWUtil.isEmpty怎么用?Java WWUtil.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gov.nasa.worldwind.util.WWUtil
的用法示例。
在下文中一共展示了WWUtil.isEmpty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLayerInfo
import gov.nasa.worldwind.util.WWUtil; //导入方法依赖的package包/类
protected LayerInfo createLayerInfo(WMSCapabilities caps, WMSLayerCapabilities layerCaps, WMSLayerStyle style)
{
// Create the layer info specified by the layer's capabilities entry and the selected style.
LayerInfo linfo = new LayerInfo();
linfo.caps = caps;
linfo.params = new AVListImpl();
linfo.params.setValue(AVKey.LAYER_NAMES, layerCaps.getName());
if (style != null)
linfo.params.setValue(AVKey.STYLE_NAMES, style.getName());
String abs = layerCaps.getLayerAbstract();
if (!WWUtil.isEmpty(abs))
linfo.params.setValue(AVKey.LAYER_ABSTRACT, abs);
linfo.params.setValue(AVKey.DISPLAY_NAME, makeTitle(caps, linfo));
return linfo;
}
示例2: formName
import gov.nasa.worldwind.util.WWUtil; //导入方法依赖的package包/类
protected static String formName(Object kmlSource, KMLRoot kmlRoot)
{
KMLAbstractFeature rootFeature = kmlRoot.getFeature();
if (rootFeature != null && !WWUtil.isEmpty(rootFeature.getName()))
return rootFeature.getName();
if (kmlSource instanceof File)
return ((File) kmlSource).getName();
if (kmlSource instanceof URL)
return ((URL) kmlSource).getPath();
if (kmlSource instanceof String && WWIO.makeURL((String) kmlSource) != null)
return WWIO.makeURL((String) kmlSource).getPath();
return "KML Layer";
}
示例3: appendProperties
import gov.nasa.worldwind.util.WWUtil; //导入方法依赖的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: createLayerInfo
import gov.nasa.worldwind.util.WWUtil; //导入方法依赖的package包/类
private LayerInfo createLayerInfo(WMSCapabilities caps, WMSLayerCapabilities layerCaps, WMSLayerStyle style) {
// Create the layer info specified by the layer's capabilities entry and the selected style.
LayerInfo linfo = new LayerInfo();
linfo.caps = caps;
linfo.params = new AVListImpl();
linfo.params.setValue(AVKey.LAYER_NAMES, layerCaps.getName());
if (style != null)
linfo.params.setValue(AVKey.STYLE_NAMES, style.getName());
String abs = layerCaps.getLayerAbstract();
if (!WWUtil.isEmpty(abs))
linfo.params.setValue(AVKey.LAYER_ABSTRACT, abs);
linfo.params.setValue(AVKey.DISPLAY_NAME, makeTitle(caps, linfo));
return linfo;
}
示例5: drawLabel
import gov.nasa.worldwind.util.WWUtil; //导入方法依赖的package包/类
private void drawLabel( final DrawContext dc,
final LabelAttributes attr,
double x,
double y,
final String halign,
final String valign) {
final String text = attr.getText();
if (WWUtil.isEmpty(text)) {
return;
}
Font font = attr.getFont();
if (font == null) {
font = DEFAULT_FONT;
}
Color color = DEFAULT_COLOR;
if (attr.getColor() != null) {
color = attr.getColor();
}
final Point location = this.getScreenLocation(dc);
if (location != null) {
x += location.getX() - _legendImage.getImageWidth(dc) / 2;
y += location.getY() - _legendImage.getImageHeight(dc) / 2;
}
final Point2D offset = attr.getOffset();
if (offset != null) {
x += offset.getX();
y += offset.getY();
}
final TextRenderer tr = OGLTextRenderer.getOrCreateTextRenderer(dc.getTextRendererCache(), font);
if (tr == null) {
return;
}
final Rectangle2D bounds = tr.getBounds(text);
if (bounds != null) {
if (AVKey.CENTER.equals(halign)) {
x += -(bounds.getWidth() / 2d);
}
if (AVKey.RIGHT.equals(halign)) {
x += -bounds.getWidth();
}
if (AVKey.CENTER.equals(valign)) {
y += (bounds.getHeight() + bounds.getY());
}
if (AVKey.TOP.equals(valign)) {
y += bounds.getHeight();
}
}
final Rectangle viewport = dc.getView().getViewport();
tr.beginRendering(viewport.width, viewport.height);
try {
final double yInGLCoords = viewport.height - y - 1;
// Draw the text outline, in a contrasting color.
tr.setColor(WWUtil.computeContrastingColor(color));
tr.draw(text, (int) x + 1, (int) yInGLCoords - 1);
// Draw the text over its outline, in the specified color.
tr.setColor(color);
tr.draw(text, (int) x, (int) yInGLCoords);
} finally {
tr.endRendering();
}
}
示例6: validateDataSource
import gov.nasa.worldwind.util.WWUtil; //导入方法依赖的package包/类
protected String validateDataSource(Object source, AVList params) {
// TiledImageProducer does not accept null data sources.
if (source == null) return Logging.getMessage("nullValue.SourceIsNull");
// TiledRasterProducer accepts BufferedImageRaster as a data source. If the data source is a DataRaster, then
// check that it's a BufferedImageRaster.
// TODO garakl DataSource as a source? What about GDALDataRaster
if (source instanceof DataRaster) {
DataRaster raster = (DataRaster) source;
if (!(raster instanceof BufferedImageRaster)) return Logging.getMessage("TiledRasterProducer.UnrecognizedDataSource", raster);
String s = this.validateDataSourceParams(raster, String.valueOf(raster));
if (s != null) return s;
}
// For any other data source, attempt to find a reader for the data source. If the reader knows the data
// source's raster type, then check that it's a color image or a monochromatic image.
else {
params = (params == null) ? new AVListImpl() : params;
DataRasterReader reader = this.getReaderFactory().findReaderFor(source, params, this.getDataRasterReaders());
if (reader == null) {
return Logging.getMessage("TiledRasterProducer.UnrecognizedDataSource", source);
} else if (reader instanceof RPFRasterReader) {
// RPF rasters are geo-referenced, so we may skip the validation
return null;
}
String errMsg = this.validateDataSourceParams(params, String.valueOf(source));
if (!WWUtil.isEmpty(errMsg)) {
try {
reader.readMetadata(source, params);
errMsg = this.validateDataSourceParams(params, String.valueOf(source));
} catch (IOException e) {
return Logging.getMessage("TiledRasterProducer.ExceptionWhileReading", source, e.getMessage());
}
}
if (!WWUtil.isEmpty(errMsg)) return errMsg;
}
return null;
}