- Timestamp:
- 2012-11-03T09:58:37+01:00 (12 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 3 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 } -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
r5236 r5554 65 65 double east = Double.parseDouble(f[3]); 66 66 double north = Double.parseDouble(f[4]); 67 Projection p = Projection Info.getProjectionByCode(code);67 Projection p = Projections.getProjectionByCode(code); 68 68 { 69 69 EastNorth en = p.latlon2eastNorth(new LatLon(lat, lon)); -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
r5236 r5554 171 171 172 172 for (TestData data : allData) { 173 Projection proj = Projection Info.getProjectionByCode(data.code);173 Projection proj = Projections.getProjectionByCode(data.code); 174 174 if (proj == null) { 175 175 fail.append("Projection "+data.code+" from test data was not found!\n");
Note:
See TracChangeset
for help on using the changeset viewer.