Ignore:
Timestamp:
2013-04-21T16:27:21+02:00 (12 years ago)
Author:
Don-vip
Message:

see #8606 - Set User-Agent for JMapViewer connections

Location:
trunk/src/org/openstreetmap/josm/gui/bbox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java

    r5779 r5898  
    1111import java.awt.Point;
    1212import java.awt.Rectangle;
    13 import java.io.File;
    1413import java.io.IOException;
    1514import java.util.ArrayList;
     
    2726import org.openstreetmap.gui.jmapviewer.MapMarkerDot;
    2827import org.openstreetmap.gui.jmapviewer.MemoryTileCache;
    29 import org.openstreetmap.gui.jmapviewer.OsmFileCacheTileLoader;
    3028import org.openstreetmap.gui.jmapviewer.OsmMercator;
    3129import org.openstreetmap.gui.jmapviewer.OsmTileLoader;
    3230import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker;
    33 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader;
    34 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener;
    3531import org.openstreetmap.gui.jmapviewer.interfaces.TileSource;
    3632import org.openstreetmap.gui.jmapviewer.tilesources.MapQuestOpenAerialTileSource;
     
    3935import org.openstreetmap.josm.Main;
    4036import org.openstreetmap.josm.data.Bounds;
     37import org.openstreetmap.josm.data.Version;
    4138import org.openstreetmap.josm.data.coor.LatLon;
    4239import org.openstreetmap.josm.data.imagery.ImageryInfo;
     
    171168    public static final String RESIZE_PROP = SlippyMapBBoxChooser.class.getName() + ".resize";
    172169
    173     private TileLoader cachedLoader;
    174     private TileLoader uncachedLoader;
     170    private OsmTileLoader cachedLoader;
     171    private OsmTileLoader uncachedLoader;
    175172
    176173    private final SizeButton iSizeButton = new SizeButton();
     
    189186
    190187        uncachedLoader = new OsmTileLoader(this);
     188        uncachedLoader.headers.put("User-Agent", Version.getInstance().getFullAgentString());
    191189        setZoomContolsVisible(Main.pref.getBoolean("slippy_map_chooser.zoomcontrols",false));
    192190        setMapMarkerVisible(false);
  • trunk/src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java

    r5886 r5898  
    4242import org.openstreetmap.gui.jmapviewer.MapMarkerDot;
    4343import org.openstreetmap.gui.jmapviewer.OsmMercator;
     44import org.openstreetmap.gui.jmapviewer.OsmTileLoader;
    4445import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker;
     46import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader;
    4547import org.openstreetmap.josm.data.Bounds;
     48import org.openstreetmap.josm.data.Version;
    4649import org.openstreetmap.josm.data.coor.LatLon;
    4750import org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator;
     
    120123    }
    121124
     125    /**
     126     * Constructs a new {@code TileSelectionBBoxChooser}.
     127     */
    122128    public TileSelectionBBoxChooser() {
    123129        build();
     
    655661        public TileBoundsMapView() {
    656662            setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));
     663            TileLoader loader = tileController.getTileLoader();
     664            if (loader instanceof OsmTileLoader) {
     665                ((OsmTileLoader)loader).headers.put("User-Agent", Version.getInstance().getFullAgentString());
     666            }
    657667        }
    658668
Note: See TracChangeset for help on using the changeset viewer.