Changeset 5236 in josm for trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
- Timestamp:
- 2012-05-12T23:27:39+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
r4277 r5236 12 12 import java.util.LinkedHashMap; 13 13 import java.util.List; 14 import java.util.Map; 14 15 import java.util.Map.Entry; 15 16 … … 17 18 import org.openstreetmap.josm.data.coor.EastNorth; 18 19 import org.openstreetmap.josm.data.coor.LatLon; 20 import org.openstreetmap.josm.gui.preferences.projection.ProjectionChoice; 21 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference; 19 22 import org.openstreetmap.josm.tools.Utils; 20 23 … … 29 32 30 33 /** 31 * create a list of epsg codes and bounds to be used by 34 * create a list of epsg codes and bounds to be used by the perl script 32 35 * @param args 33 36 */ 34 37 public static void main(String[] args) { 35 HashMap<String, Projection> allCodes = new LinkedHashMap<String, Projection>(); 36 List<Projection> projs = Projections.getProjections(); 37 for (Projection p: projs) { 38 if (p instanceof ProjectionSubPrefs) { 39 for (String code : ((ProjectionSubPrefs)p).allCodes()) { 40 ProjectionSubPrefs projSub = recreateProj((ProjectionSubPrefs)p); 41 Collection<String> prefs = projSub.getPreferencesFromCode(code); 42 projSub.setPreferences(prefs); 43 allCodes.put(code, projSub); 44 } 45 } else { 46 allCodes.put(p.toCode(), p); 38 Map<String, Projection> allCodes = new HashMap<String, Projection>(); 39 for (ProjectionChoice pc : ProjectionPreference.getProjectionChoices()) { 40 for (String code : pc.allCodes()) { 41 Collection<String> pref = pc.getPreferencesFromCode(code); 42 pc.setPreferences(pref); 43 Projection p = pc.getProjection(); 44 allCodes.put(code, p); 47 45 } 48 46 } … … 51 49 } 52 50 } 53 54 private static ProjectionSubPrefs recreateProj(ProjectionSubPrefs proj) { 55 try { 56 return proj.getClass().newInstance(); 57 } catch (Exception e) { 58 throw new IllegalStateException( 59 tr("Cannot instantiate projection ''{0}''", proj.getClass().toString()), e); 60 } 61 } 62 51 63 52 @Test 64 53 public void test() throws IOException, FileNotFoundException {
Note:
See TracChangeset
for help on using the changeset viewer.
