source: josm/trunk/src/org/openstreetmap/josm/data/projection/ProjectionInfo.java@ 5298

Last change on this file since 5298 was 5236, checked in by bastiK, 12 years ago
  • removed offset option from UTM which is probably rarely used. (custom projection can be used for this now, e.g. +proj=tmerc +lon_0=-3 +k_0=0.9996 +x_0=3500000 or +init=epsg:32630 +x_0=3500000)
  • fixed tests
File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.projection;
3
4import java.util.Collection;
5import java.util.HashMap;
6import java.util.Map;
7
8import org.openstreetmap.josm.gui.preferences.projection.ProjectionChoice;
9import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
10
11public class ProjectionInfo {
12 private static Map<String, ProjectionChoice> allCodesPC = new HashMap<String, ProjectionChoice>();
13 private static Map<String, Projection> allCodes = new HashMap<String, Projection>();
14
15 static {
16 for (ProjectionChoice pc : ProjectionPreference.getProjectionChoices()) {
17 for (String code : pc.allCodes()) {
18 allCodesPC.put(code, pc);
19 }
20 }
21 }
22
23 public static Projection getProjectionByCode(String code) {
24 Projection p = allCodes.get(code);
25 if (p != null) return p;
26 ProjectionChoice pc = allCodesPC.get(code);
27 if (pc == null) return null;
28 Collection<String> pref = pc.getPreferencesFromCode(code);
29 pc.setPreferences(pref);
30 p = pc.getProjection();
31 allCodes.put(code, p);
32 return p;
33 }
34}
Note: See TracBrowser for help on using the repository browser.