Changeset 5554 in josm for trunk/src/org
- Timestamp:
- 2012-11-03T09:58:37+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/projection
- Files:
-
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/Projections.java
r5548 r5554 6 6 import java.io.InputStream; 7 7 import java.io.InputStreamReader; 8 import java.util.Collection; 8 9 import java.util.HashMap; 9 10 import java.util.Map; … … 24 25 import org.openstreetmap.josm.data.projection.proj.SwissObliqueMercator; 25 26 import org.openstreetmap.josm.data.projection.proj.TransverseMercator; 27 import org.openstreetmap.josm.gui.preferences.projection.ProjectionChoice; 28 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference; 26 29 import org.openstreetmap.josm.io.MirroredInputStream; 27 30 import org.openstreetmap.josm.tools.Pair; … … 140 143 } 141 144 } 145 146 private final static Map<String, ProjectionChoice> allCodesPC = new HashMap<String, ProjectionChoice>(); 147 private final static Map<String, Projection> allCodes = new HashMap<String, Projection>(); 148 149 static { 150 // FIXME: use {@link #inits}, because it may contain more codes in future 151 // than exposed by the ProjectionChoices 152 for (ProjectionChoice pc : ProjectionPreference.getProjectionChoices()) { 153 for (String code : pc.allCodes()) { 154 allCodesPC.put(code, pc); 155 } 156 } 157 } 158 159 public static Projection getProjectionByCode(String code) { 160 Projection p = allCodes.get(code); 161 if (p != null) return p; 162 ProjectionChoice pc = allCodesPC.get(code); 163 if (pc == null) return null; 164 Collection<String> pref = pc.getPreferencesFromCode(code); 165 pc.setPreferences(pref); 166 p = pc.getProjection(); 167 allCodes.put(code, p); 168 return p; 169 } 170 142 171 }
Note:
See TracChangeset
for help on using the changeset viewer.