[英]How to remove the compass from nasa worldwind
只需從您的 Javascript 文件中刪除以下代碼:
wwd.addLayer(new WorldWind.CompassLayer());
祝你好運 !
由於您已使用swing
和java
標簽標記了問題,因此我假設您指的是 WorldWindJava,並且與 WebWorldWind 相關的其他答案中的解決方案將不起作用。 要從 WorldWind 中刪除羅盤圖層,您可以通過編程方式或通過worldwind.layers.xml
文件來完成。
對於編程方法,您可以查看以下問題:
如何在 World wind java 中隱藏(或移除)標准層(如星星、大氣、地球)
然后在那里調用該方法: removeLayerWithName("Compass")
。
XML 配置文件方法是最簡單的方法,您可以在此處查看worldwind.layers.xml
文件的完整示例。 所以,基本上你復制那個文件,刪除:
<Layer className="gov.nasa.worldwind.layers.CompassLayer"/>
在底部進入那里。 然后,您需要將此文件放在位於應用程序當前工作目錄中的文件夾中。 我建議你給它一個唯一的名字,以區別於默認的worldwind.layers.xml
文件,例如worldwind.custom.layers.xml
。 然后,您需要通過修改worldwind.xml
文件來指定 WorldWind 應使用此自定義文件。 您可以在此處獲取此文件的模板。 將此文件復制到應用程序當前工作目錄中的同一文件夾中。 也給它一個不同的名字,比如worldwind.custom.xml
。 然后您需要修改此條目:
<LayerList href="config/worldwind.layers.xml"/>
在worldwind.custom.xml
中指向您的文件,如下所示:
<LayerList href="some-folder/worldwind.custom.layers.xml"/>
最后,您需要通過gov.nasa.worldwind.app.config.document
系統屬性指定 WorldWind 應使用您的自定義配置文件。 因此,如果您有啟動應用程序的腳本,請在run.sh
文件中添加以下run.sh
:
java -cp "...classpath-stuff" -Dgov.nasa.worldwind.app.config.document="some-folder/worldwind.custom.xml" com.example.MainClass
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.