[英]How to hide (or remove) a pre-configured layer from the layers-panel in WorldWind
I would like to hide one of the "standard" layers (such as Stars, atmosphere, nasa blue marble and so on) in the layer panel, and to visualize and to make enabled/disabled by ticks only layers added by me.我想在图层面板中隐藏“标准”图层之一(例如星星、大气、美国航空航天局蓝色大理石等),并仅通过我添加的图层进行可视化和启用/禁用。 Naturally, the hidden layers have to be always active.
当然,隐藏层必须始终处于活动状态。 Is it possible?
是否可以?
You can add this method.您可以添加此方法。
private void removeLayerWithName(String str) {
wwd.getModel().getLayers().forEach(layer -> {
if (layer.getName().equals(str)) {
wwd.getModel().getLayers().remove(layer);
return;
}
});
}
and in your code you call it as removeLayerWithName("Stars");
在您的代码中,您将其称为
removeLayerWithName("Stars");
. .
Other layer-names that may be useful for you:其他可能对您有用的图层名称:
If you want to remove layers programmatically use @sayyedbagher solution.如果要以编程方式删除图层,请使用 @sayyedbagher 解决方案。 Another solution is changing the initial settings of WorldWind by providing an xml file containing initial settings (including initial layers).
另一种解决方案是通过提供包含初始设置(包括初始层)的 xml 文件来更改 WorldWind 的初始设置。 Base on documents of
gov.nasa.worldwind.Configuration
class here https://worldwind.arc.nasa.gov/java/latest/javadoc/index.html?gov/nasa/worldwind/Configuration.html and comments in the file worldwind.xml
here https://github.com/nasa/World-Wind-Java/blob/master/WorldWind/src/config/worldwind.xml you could determine yourself initial layers as permanent initial settings of WorldWind in your app.基于
gov.nasa.worldwind.Configuration
类的文档https://worldwind.arc.nasa.gov/java/latest/javadoc/index.html?gov/nasa/worldwind/Configuration.html以及文件worldwind.xml
中的worldwind.xml
此处https://github.com/nasa/World-Wind-Java/blob/master/WorldWind/src/config/worldwind.xml您可以将自己的初始层确定为应用程序中 WorldWind 的永久初始设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.