Ticket #2020: smc_mapstyle.patch

File smc_mapstyle.patch, 2.2 KB (added by detlef.reichl@…, 3 years ago)
  • plugins/slippy_map_chooser/src/SlippyMapChooser.java

    diff -urb --exclude='*.svn*' josm-dev/plugins/slippy_map_chooser/src/SlippyMapChooser.java josm-smc/plugins/slippy_map_chooser/src/SlippyMapChooser.java
    old new  
    2828import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker; 
    2929import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader; 
    3030import org.openstreetmap.gui.jmapviewer.interfaces.TileSource; 
     31import org.openstreetmap.josm.Main; 
    3132import org.openstreetmap.josm.gui.download.DownloadDialog; 
    3233import org.openstreetmap.josm.gui.download.DownloadSelection; 
    3334 
     
    7374        setFileCacheEnabled(SlippyMapChooserPlugin.ENABLE_FILE_CACHE); 
    7475        setMaxTilesInmemory(SlippyMapChooserPlugin.MAX_TILES_IN_MEMORY); 
    7576        addComponentListener(this); 
     77 
     78        String mapStyle = Main.pref.get("slippy_map_chooser.mapstyle", "mapnik"); 
     79        if(mapStyle == "osmarender") { 
     80            iSourceButton.setIsMapStyleMapnik(false); 
     81            this.setTileSource(sources[1]); 
     82        } 
     83        else { 
     84            if(mapStyle != "mapnik") 
     85                Main.pref.put("slippy_map_chooser.mapstyle", "mapnik"); 
     86        } 
    7687    } 
    7788 
    7889    public void setMaxTilesInmemory(int tiles) { 
     
    248259        this.tileCache = new MemoryTileCache(); 
    249260        if (mapSource == SourceButton.MAPNIK) { 
    250261            this.setTileSource(sources[0]); 
     262            Main.pref.put("slippy_map_chooser.mapstyle", "mapnik"); 
    251263        } else { 
    252264            this.setTileSource(sources[1]); 
     265            Main.pref.put("slippy_map_chooser.mapstyle", "osmarender"); 
    253266        } 
    254267    } 
    255268 
  • plugins/slippy_map_chooser/src/SourceButton.java

    diff -urb --exclude='*.svn*' josm-dev/plugins/slippy_map_chooser/src/SourceButton.java josm-smc/plugins/slippy_map_chooser/src/SourceButton.java
    old new  
    8585 
    8686        return 0; 
    8787    } 
     88     
     89    public void setIsMapStyleMapnik (boolean style) { 
     90        isMapnik = style; 
     91    } 
    8892}