Ignore:
Timestamp:
2012-05-12T23:27:39+02:00 (14 years ago)
Author:
bastiK
Message:
  • 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:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java

    r4277 r5236  
    1212import java.util.LinkedHashMap;
    1313import java.util.List;
     14import java.util.Map;
    1415import java.util.Map.Entry;
    1516
     
    1718import org.openstreetmap.josm.data.coor.EastNorth;
    1819import org.openstreetmap.josm.data.coor.LatLon;
     20import org.openstreetmap.josm.gui.preferences.projection.ProjectionChoice;
     21import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
    1922import org.openstreetmap.josm.tools.Utils;
    2023
     
    2932
    3033    /**
    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
    3235     * @param args
    3336     */
    3437    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);
    4745            }
    4846        }
     
    5149        }
    5250    }
    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 
    6352    @Test
    6453    public void test() throws IOException, FileNotFoundException {
Note: See TracChangeset for help on using the changeset viewer.