Changeset 24510 in osm for applications/editors/josm/plugins/imagery
- Timestamp:
- 2010-12-02T10:34:11+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryLayerInfo.java
r24509 r24510 12 12 import java.util.Collections; 13 13 import java.util.LinkedList; 14 import java.util.Map;15 import java.util.TreeSet;16 14 17 15 import org.openstreetmap.josm.Main; … … 33 31 } 34 32 35 { /* REMOVE following old block in spring 2011 */36 defaults = new LinkedList<String>(defaults);37 Map<String,String> prefs = Main.pref.getAllPrefix("imagery.layers.default.");38 for(String s : prefs.keySet()) {39 Main.pref.put(s, null);40 defaults.add(s.substring(18));41 }42 prefs = Main.pref.getAllPrefix("imagery.layers.url.");43 for(String s : prefs.keySet()) {44 Main.pref.put(s, null);45 }46 TreeSet<String> keys = new TreeSet<String>(prefs.keySet());47 48 // And then the names+urls of imagery layers49 int prefid = 0;50 String name = null;51 String url = null;52 String cookies = null;53 double pixelPerDegree = 0.0;54 int lastid = -1;55 for (String key : keys) {56 String[] elements = key.split("\\.");57 if (elements.length != 4) continue;58 try {59 prefid = Integer.parseInt(elements[2]);60 } catch(NumberFormatException e) {61 continue;62 }63 if (prefid != lastid) {64 name = url = cookies = null; pixelPerDegree = 0.0; lastid = prefid;65 }66 if (elements[3].equals("name")) {67 name = prefs.get(key);68 int codeIndex = name.indexOf("#PPD=");69 if (codeIndex != -1) {70 pixelPerDegree = Double.valueOf(name.substring(codeIndex+5));71 name = name.substring(0, codeIndex);72 }73 }74 else if (elements[3].equals("url"))75 {76 url = prefs.get(key);77 }78 else if (elements[3].equals("cookies"))79 cookies = prefs.get(key);80 if (name != null && url != null)81 layers.add(new ImageryInfo(name, url, cookies, pixelPerDegree));82 }83 }84 33 ArrayList<String> defaultsSave = new ArrayList<String>(); 85 34 for(String source : Main.pref.getCollection("imagery.layers.sites", Arrays.asList(DEFAULT_LAYER_SITES)))
Note:
See TracChangeset
for help on using the changeset viewer.