From 0e4840d16bf3ebf4ac5f2934f500715186ad4513 Mon Sep 17 00:00:00 2001 From: Luis Veci Date: Mon, 13 Jun 2022 11:08:06 -0400 Subject: [PATCH] default to Bing Imagery as MSVirtualEarthLayers no longer work --- .../java/org/esa/snap/worldwind/LayerPanel.java | 3 ++- .../org/esa/snap/worldwind/LayerPanelLayer.java | 2 +- .../esa/snap/worldwind/WWAnalysisToolView.java | 16 ++-------------- .../esa/snap/worldwind/WWWorldViewToolView.java | 10 +++------- 4 files changed, 8 insertions(+), 23 deletions(-) diff --git a/snap-worldwind/src/main/java/org/esa/snap/worldwind/LayerPanel.java b/snap-worldwind/src/main/java/org/esa/snap/worldwind/LayerPanel.java index a3f664178..e5fa0405a 100644 --- a/snap-worldwind/src/main/java/org/esa/snap/worldwind/LayerPanel.java +++ b/snap-worldwind/src/main/java/org/esa/snap/worldwind/LayerPanel.java @@ -73,7 +73,8 @@ private void fill(WorldWindow wwd) { for (Layer layer : wwd.getModel().getLayers()) { if (layer.getName().equalsIgnoreCase("Atmosphere") || layer.getName().equalsIgnoreCase("World Map") || - layer.getName().equalsIgnoreCase("Scale bar") || layer.getName().equalsIgnoreCase("Compass")) + layer.getName().equalsIgnoreCase("Scale bar") || layer.getName().equalsIgnoreCase("Compass") || + layer.getName().equalsIgnoreCase("Stars")) continue; final LayerAction action = new LayerAction(layer, wwd, layer.isEnabled()); diff --git a/snap-worldwind/src/main/java/org/esa/snap/worldwind/LayerPanelLayer.java b/snap-worldwind/src/main/java/org/esa/snap/worldwind/LayerPanelLayer.java index 184173f2b..d2286d070 100644 --- a/snap-worldwind/src/main/java/org/esa/snap/worldwind/LayerPanelLayer.java +++ b/snap-worldwind/src/main/java/org/esa/snap/worldwind/LayerPanelLayer.java @@ -44,7 +44,7 @@ private LayerList getValidLayers() { for (Layer l : allLayers) { if (l.getName().equalsIgnoreCase("Atmosphere") || l.getName().equalsIgnoreCase("World Map") || l.getName().equalsIgnoreCase("Scale bar") || l.getName().equalsIgnoreCase("Compass") || - l.getName().equalsIgnoreCase("NASA Blue Marble Image")) + l.getName().equalsIgnoreCase("Stars") || l.getName().equalsIgnoreCase("NASA Blue Marble Image")) continue; if (l.getName().equalsIgnoreCase("MS Bing Aerial")) virtualEarthAerialLayer = l; diff --git a/snap-worldwind/src/main/java/org/esa/snap/worldwind/WWAnalysisToolView.java b/snap-worldwind/src/main/java/org/esa/snap/worldwind/WWAnalysisToolView.java index 66ee9359d..1ec3b9a9d 100644 --- a/snap-worldwind/src/main/java/org/esa/snap/worldwind/WWAnalysisToolView.java +++ b/snap-worldwind/src/main/java/org/esa/snap/worldwind/WWAnalysisToolView.java @@ -163,20 +163,6 @@ protected Object doInBackground() throws Exception { wwjPanel.addLayerPanelLayer(); wwjPanel.addElevation(); - final MSVirtualEarthLayer virtualEarthLayerA = new MSVirtualEarthLayer(MSVirtualEarthLayer.LAYER_AERIAL); - virtualEarthLayerA.setName("MS Bing Aerial"); - insertTiledLayer(getWwd(), virtualEarthLayerA); - - final MSVirtualEarthLayer virtualEarthLayerR = new MSVirtualEarthLayer(MSVirtualEarthLayer.LAYER_ROADS); - virtualEarthLayerR.setName("MS Bing Roads"); - virtualEarthLayerR.setEnabled(false); - insertTiledLayer(getWwd(), virtualEarthLayerR); - - final MSVirtualEarthLayer virtualEarthLayerH = new MSVirtualEarthLayer(MSVirtualEarthLayer.LAYER_HYBRID); - virtualEarthLayerH.setName("MS Bing Hybrid"); - virtualEarthLayerH.setEnabled(false); - insertTiledLayer(getWwd(), virtualEarthLayerH); - final OSMMapnikLayer streetLayer = new OSMMapnikLayer(); streetLayer.setOpacity(0.7); streetLayer.setEnabled(false); @@ -208,6 +194,8 @@ protected Object doInBackground() throws Exception { layerList.add(fixingPlaceNameLayer); fixingPlaceNameLayer.setEnabled(true); + final Layer bingLayer = layerList.getLayerByName("Bing Imagery"); + bingLayer.setEnabled(true); // Put the pieces together. mainPane.add(wwjPanel, BorderLayout.CENTER); diff --git a/snap-worldwind/src/main/java/org/esa/snap/worldwind/WWWorldViewToolView.java b/snap-worldwind/src/main/java/org/esa/snap/worldwind/WWWorldViewToolView.java index 9e5927195..dd4bd65c8 100644 --- a/snap-worldwind/src/main/java/org/esa/snap/worldwind/WWWorldViewToolView.java +++ b/snap-worldwind/src/main/java/org/esa/snap/worldwind/WWWorldViewToolView.java @@ -15,7 +15,6 @@ */ package org.esa.snap.worldwind; -import gov.nasa.worldwind.layers.Earth.MSVirtualEarthLayer; import gov.nasa.worldwind.layers.Layer; import gov.nasa.worldwind.layers.LayerList; import org.esa.snap.core.datamodel.ProductNode; @@ -37,9 +36,7 @@ import javax.swing.SwingUtilities; import javax.swing.SwingWorker; import javax.swing.border.EmptyBorder; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Window; +import java.awt.*; import static org.esa.snap.rcp.SnapApp.SelectionSourceHint.VIEW; @@ -119,9 +116,8 @@ protected Object doInBackground() { final LayerList layerList = getWwd().getModel().getLayers(); - final MSVirtualEarthLayer virtualEarthLayerA = new MSVirtualEarthLayer(MSVirtualEarthLayer.LAYER_AERIAL); - virtualEarthLayerA.setName("MS Bing Aerial"); - layerList.add(virtualEarthLayerA); + final Layer bingLayer = layerList.getLayerByName("Bing Imagery"); + bingLayer.setEnabled(true); final WWLayerDescriptor[] wwLayerDescriptors = WWLayerRegistry.getInstance().getWWLayerDescriptors(); for (WWLayerDescriptor layerDescriptor : wwLayerDescriptors) {