Ignore:
Timestamp:
2012-11-01T16:52:19+01:00 (11 years ago)
Author:
bastiK
Message:

remove Projection classes (replaced by data/epsg file)

concludes the projection rework from ealier this year

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/projection/Projections.java

    r5237 r5548  
    2525import org.openstreetmap.josm.data.projection.proj.TransverseMercator;
    2626import org.openstreetmap.josm.io.MirroredInputStream;
     27import org.openstreetmap.josm.tools.Pair;
    2728
    2829/**
     
    4748     * should be compatible to PROJ.4
    4849     */
    49     public static Map<String, ProjFactory> projs = new HashMap<String, ProjFactory>();
    50     public static Map<String, Ellipsoid> ellipsoids = new HashMap<String, Ellipsoid>();
    51     public static Map<String, Datum> datums = new HashMap<String, Datum>();
    52     public static Map<String, NTV2GridShiftFileWrapper> nadgrids = new HashMap<String, NTV2GridShiftFileWrapper>();
    53     public static Map<String, String> inits = new HashMap<String, String>();
     50    final public static Map<String, ProjFactory> projs = new HashMap<String, ProjFactory>();
     51    final public static Map<String, Ellipsoid> ellipsoids = new HashMap<String, Ellipsoid>();
     52    final public static Map<String, Datum> datums = new HashMap<String, Datum>();
     53    final public static Map<String, NTV2GridShiftFileWrapper> nadgrids = new HashMap<String, NTV2GridShiftFileWrapper>();
     54    final public static Map<String, Pair<String, String>> inits = new HashMap<String, Pair<String, String>>();
    5455
    5556    static {
     
    109110
    110111    public static String getInit(String id) {
    111         return inits.get(id);
     112        return inits.get(id.toLowerCase()).b;
    112113    }
    113114
     
    116117     */
    117118    private static void loadInits() {
    118         Pattern epsgPattern = Pattern.compile("\\A<(\\d+)>(.*)<>\\Z");
     119        Pattern epsgPattern = Pattern.compile("<(\\d+)>(.*)<>");
    119120        try {
    120121            InputStream in = new MirroredInputStream("resource://data/epsg");
    121122            BufferedReader r = new BufferedReader(new InputStreamReader(in));
    122             String line;
     123            String line, lastline = "";
    123124            while ((line = r.readLine()) != null) {
    124125                line = line.trim();
    125126                if (!line.startsWith("#") && !line.isEmpty()) {
     127                    if (!lastline.startsWith("#")) throw new AssertionError();
     128                    String name = lastline.substring(1).trim();
    126129                    Matcher m = epsgPattern.matcher(line);
    127130                    if (m.matches()) {
    128                         inits.put("epsg:" + m.group(1), m.group(2).trim());
     131                        inits.put("epsg:" + m.group(1), Pair.create(name, m.group(2).trim()));
    129132                    } else {
    130133                        System.err.println("Warning: failed to parse line from the epsg projection definition: "+line);
    131134                    }
    132135                }
     136                lastline = line;
    133137            }
    134138        } catch (IOException ex) {
Note: See TracChangeset for help on using the changeset viewer.