本文整理汇总了Java中gov.nasa.worldwind.util.WWUtil类的典型用法代码示例。如果您正苦于以下问题:Java WWUtil类的具体用法?Java WWUtil怎么用?Java WWUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WWUtil类属于gov.nasa.worldwind.util包,在下文中一共展示了WWUtil类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: computeColumnSum
import gov.nasa.worldwind.util.WWUtil; //导入依赖的package包/类
private long computeColumnSum(int columnIndex)
{
long size = 0;
for (int row = 0; row < this.datasets.size(); row++)
{
String s = this.getValueAt(row, columnIndex).toString();
Double cs = WWUtil.makeDoubleForLocale(s);
size += cs != null ? cs * 1e6 : 0;
}
return size;
}
示例6: GuiFrame
import gov.nasa.worldwind.util.WWUtil; //导入依赖的package包/类
GuiFrame() throws GeometryException, TriangulationException {
navMeshModel = new NavigationMeshModel();
final List<Layer> layers = new ArrayList<Layer>();
final RenderableLayer navMeshLayer = new RenderableLayer();
navMeshLayer.setPickEnabled(false);
final RenderableLayer constrainedEdgeLayer = new RenderableLayer();
constrainedEdgeLayer.setPickEnabled(false);
final RenderableLayer obstacleEditorLayer = new RenderableLayer();
final RenderableLayer obstaclesLayer = new RenderableLayer();
layers.add(navMeshLayer);
layers.add(constrainedEdgeLayer);
layers.add(obstacleEditorLayer);
layers.add(obstaclesLayer);
// Create the WorldWindow.
final WorldWindPanel wwp = new WorldWindPanel(layers);
getContentPane().add(wwp, BorderLayout.CENTER);
final WorldWindow wwd = wwp.getWwd();
final ObstaclesModel obstaclesModel = new ObstaclesModel();
final ObstacleEditor editor = new ObstacleEditor(obstaclesModel, wwd);
final ObstacleEditorListener oel = new ObstacleEditorView(obstacleEditorLayer);
final ObstaclesModelListener ol = new ObstaclesView(obstaclesLayer);
final NavigationMeshModelListener nl = new NavigationMeshView(navMeshLayer, constrainedEdgeLayer);
final WorldWindowController controller = new WorldWindowController(wwd, editor, navMeshModel);
wwd.getInputHandler().addMouseListener(controller);
wwd.addSelectListener(controller);
pack();
// Center the application on the screen.
WWUtil.alignComponent(null, this, AVKey.CENTER);
setResizable(true);
navMeshModel.addListener(nl);
editor.addListener(oel);
obstaclesModel.addListener(ol);
}
示例7: 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();
}
}
示例8: 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;
}