[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

jmapviewer: Resolution for missing Bing logo



hello all,

the good news is I have received a mail from a Microsoft employee
(unfortunately late on Friday) inviting me on a call regarding
use of the Bing logo in jmapviewer.

I will make that call on Monday morning and maybe we will be able to
agree on a free license that I can put in debian/copyright and thus I
can re-include bing_maps.png

But if MS decides the logo must not be included in jmapviewer
then I'm afraid I *must* remove BingAerialTileSource.java from
jmapviewer and apply the attached patch [1] to 0.0.svn7480+dfsg1-2,
removing Bing support from JOSM. Otherwise jmapviewer may be moved to
non-free because it contains Bing support but not the logo [2].

--> can we agree on this?

[1] "dquilt import josm2.diff" should be enough before running
"gbp buildpackage".

[2] https://lists.debian.org/debian-gis/2014/10/msg00115.html

Cheers and Best Regards,
-- 
Felix Natter
diff --git a/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java b/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
index 318257f..c597d08 100644
--- a/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
+++ b/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
@@ -150,7 +150,7 @@ public class AddImageryLayerAction extends JosmAction implements AdaptableAction
         // never enable blacklisted entries. Do not add same imagery layer twice (fix #2519)
         if (info.isBlacklisted() /*|| isLayerAlreadyPresent()*/) { // FIXME check disabled to allow several instances with different settings (see #7981)
             setEnabled(false);
-        } else if (info.getImageryType() == ImageryType.TMS || info.getImageryType() == ImageryType.BING || info.getImageryType() == ImageryType.SCANEX) {
+        } else if (info.getImageryType() == ImageryType.TMS /*|| info.getImageryType() == ImageryType.BING*/ || info.getImageryType() == ImageryType.SCANEX) {
             setEnabled(true);
         } else if (Main.isDisplayingMapView() && !Main.map.mapView.getAllLayers().isEmpty()) {
             setEnabled(true);
diff --git a/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java b/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
index fce96df..82daf15 100644
--- a/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
+++ b/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
@@ -45,8 +45,6 @@ public class ImageryInfo implements Comparable<ImageryInfo>, Attributed {
         TMS("tms"),
         /** An HTML proxy (previously used for Yahoo imagery) entry. **/
         HTML("html"),
-        /** TMS entry for Microsoft Bing. */
-        BING("bing"),
         /** TMS entry for Russian company <a href="https://wiki.openstreetmap.org/wiki/WikiProject_Russia/kosmosnimki";>ScanEx</a>. **/
         SCANEX("scanex"),
         /** A WMS endpoint entry only stores the WMS server info, without layer, which are chosen later by the user. **/
diff --git a/src/org/openstreetmap/josm/gui/MapView.java b/src/org/openstreetmap/josm/gui/MapView.java
index 91d5b6b..d1185a9 100644
--- a/src/org/openstreetmap/josm/gui/MapView.java
+++ b/src/org/openstreetmap/josm/gui/MapView.java
@@ -978,7 +978,7 @@ public class MapView extends NavigatableComponent implements PropertyChangeListe
             layerInfo.add(i.getName());
         }
         for (final ImageryLayer i : getLayersOfType(ImageryLayer.class)) {
-            layerInfo.add(ImageryInfo.ImageryType.BING.equals(i.getInfo().getImageryType()) ? "Bing" : i.getName());
+            layerInfo.add(/*ImageryInfo.ImageryType.BING.equals(i.getInfo().getImageryType()) ? "Bing" :*/ i.getName());
         }
         return Utils.join("; ", layerInfo);
     }
diff --git a/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java b/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
index 6176e0a..737b848 100644
--- a/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
+++ b/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
@@ -152,7 +152,7 @@ public abstract class ImageryLayer extends Layer {
     public static ImageryLayer create(ImageryInfo info) {
         if (info.getImageryType() == ImageryType.WMS || info.getImageryType() == ImageryType.HTML)
             return new WMSLayer(info);
-        else if (info.getImageryType() == ImageryType.TMS || info.getImageryType() == ImageryType.BING || info.getImageryType() == ImageryType.SCANEX)
+        else if (info.getImageryType() == ImageryType.TMS /*|| info.getImageryType() == ImageryType.BING*/ || info.getImageryType() == ImageryType.SCANEX)
             return new TMSLayer(info);
         else throw new AssertionError();
     }
diff --git a/src/org/openstreetmap/josm/gui/layer/TMSLayer.java b/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
index b940251..5a64dab 100644
--- a/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
+++ b/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
@@ -51,7 +51,6 @@ import org.openstreetmap.gui.jmapviewer.interfaces.TileCache;
 import org.openstreetmap.gui.jmapviewer.interfaces.TileClearController;
 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener;
 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource;
-import org.openstreetmap.gui.jmapviewer.tilesources.BingAerialTileSource;
 import org.openstreetmap.gui.jmapviewer.tilesources.ScanexTileSource;
 import org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource;
 import org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource;
@@ -316,47 +315,6 @@ public class TMSLayer extends ImageryLayer implements ImageObserver, TileLoaderL
         PROP_MIN_ZOOM_LVL.put(minZoomLvl);
     }
 
-    private static class CachedAttributionBingAerialTileSource extends BingAerialTileSource {
-
-        class BingAttributionData extends CacheCustomContent<IOException> {
-
-            public BingAttributionData() {
-                super("bing.attribution.xml", CacheCustomContent.INTERVAL_HOURLY);
-            }
-
-            @Override
-            protected byte[] updateData() throws IOException {
-                URL u = getAttributionUrl();
-                try (Scanner scanner = new Scanner(UTFInputStreamReader.create(Utils.openURL(u)))) {
-                    String r = scanner.useDelimiter("\\A").next();
-                    Main.info("Successfully loaded Bing attribution data.");
-                    return r.getBytes("UTF-8");
-                }
-            }
-        }
-
-        @Override
-        protected Callable<List<Attribution>> getAttributionLoaderCallable() {
-            return new Callable<List<Attribution>>() {
-
-                @Override
-                public List<Attribution> call() throws Exception {
-                    BingAttributionData attributionLoader = new BingAttributionData();
-                    int waitTimeSec = 1;
-                    while (true) {
-                        try {
-                            String xml = attributionLoader.updateIfRequiredString();
-                            return parseAttributionText(new InputSource(new StringReader((xml))));
-                        } catch (IOException ex) {
-                            Main.warn("Could not connect to Bing API. Will retry in " + waitTimeSec + " seconds.");
-                            Thread.sleep(waitTimeSec * 1000L);
-                            waitTimeSec *= 2;
-                        }
-                    }
-                }
-            };
-        }
-    }
 
     /**
      * Creates and returns a new TileSource instance depending on the {@link ImageryType}
@@ -364,7 +322,7 @@ public class TMSLayer extends ImageryLayer implements ImageObserver, TileLoaderL
      *
      * If no appropriate TileSource is found, null is returned.
      * Currently supported ImageryType are {@link ImageryType#TMS},
-     * {@link ImageryType#BING}, {@link ImageryType#SCANEX}.
+     * {@link ImageryType#SCANEX}.
      *
      * @param info
      * @return a new TileSource instance or null if no TileSource for the ImageryInfo/ImageryType could be found.
@@ -376,8 +334,7 @@ public class TMSLayer extends ImageryLayer implements ImageObserver, TileLoaderL
             TMSTileSource t = new TemplatedTMSTileSource(info.getName(), info.getUrl(), info.getMinZoom(), info.getMaxZoom());
             info.setAttribution(t);
             return t;
-        } else if (info.getImageryType() == ImageryType.BING)
-            return new CachedAttributionBingAerialTileSource();
+        }
         else if (info.getImageryType() == ImageryType.SCANEX) {
             return new ScanexTileSource(info.getName(), info.getUrl(), info.getMaxZoom());
         }

Reply to: