简体   繁体   English

如何在 WorldWind 的图层面板中隐藏(或删除)预先配置的图层

[英]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:其他可能对您有用的图层名称:

  • Stars星星
  • Atmosphere大气层
  • NASA Blue Marble Image美国宇航局蓝色大理石图像
  • Blue Marble May 2004蓝色大理石 2004 年 5 月
  • i-cubed Landsat立方体陆地卫星

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.

相关问题 如何在Android中连接到预配置的Wifi? - How to connect to pre-configured Wifi in Android? 如何使用XStream制作预配置的模板 - How can I make pre-configured templates using XStream 分发预先配置的Eclipse的好解决方案? - Good solutions to distribute a pre-configured Eclipse? 预先配置的Java Web应用程序项目 - Pre-Configured Java Web Application Project 如何从美国宇航局世界风中移除指南针 - How to remove the compass from nasa worldwind 如何以超级用户身份访问HBase Shell? (带有CDH 5.7.2,HBase 1.2的预配置VM) - How to Access HBase Shell As Superuser? (Pre-Configured VM with CDH 5.7.2, HBase 1.2) 我可以使用哪种设计模式来提供几种创建“预配置” UI组件的方法 - Which design pattern can I use to supply several methods that create “pre-configured” UI components 配置WSO2 IS服务器以预配置格式发送令牌,而不是SAML响应? - configure WSO2 IS server to send token in pre-configured format instead of SAML response? 当单元测试覆盖率低于多模块项目中的预配置限制时,maven将失败构建 - maven fail build when unit test coverage fails below a pre-configured limit in a multimodule project 在 NASA Worldwind 中实现 XYZ 平铺层 - Implement XYZ tile layer in NASA Worldwind
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM