Ignore:
Timestamp:
2015-07-21T22:58:33+02:00 (9 years ago)
Author:
bastiK
Message:

get rid of redundant ellipsoid info in epsg file

File:
1 edited

Legend:

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

    r8609 r8610  
    188188            ellps = parseEllipsoid(parameters);
    189189            datum = parseDatum(parameters, ellps);
     190            if (ellps == null) {
     191                ellps = datum.getEllipsoid();
     192            }
    190193            proj = parseProjection(parameters, ellps);
    191194            // "utm" is a shortcut for a set of parameters
     
    338341                parameters.containsKey(Param.b.key))
    339342            throw new ProjectionConfigurationException(tr("Combination of ellipsoid parameters is not supported."));
    340         if (parameters.containsKey(Param.no_defs.key))
    341             throw new ProjectionConfigurationException(tr("Ellipsoid required (+ellps=* or +a=*, +b=*)"));
    342         // nothing specified, use WGS84 as default
    343         return Ellipsoid.WGS84;
     343        return null;
    344344    }
    345345
    346346    public Datum parseDatum(Map<String, String> parameters, Ellipsoid ellps) throws ProjectionConfigurationException {
     347        String datumId = parameters.get(Param.datum.key);
     348        if (datumId != null) {
     349            Datum datum = Projections.getDatum(datumId);
     350            if (datum == null) throw new ProjectionConfigurationException(tr("Unknown datum identifier: ''{0}''", datumId));
     351            return datum;
     352        }
     353        if (ellps == null) {
     354            if (parameters.containsKey(Param.no_defs.key))
     355                throw new ProjectionConfigurationException(tr("Ellipsoid required (+ellps=* or +a=*, +b=*)"));
     356            // nothing specified, use WGS84 as default
     357            ellps = Ellipsoid.WGS84;
     358        }
     359       
    347360        String nadgridsId = parameters.get(Param.nadgrids.key);
    348361        if (nadgridsId != null) {
     
    362375            return parseToWGS84(towgs84, ellps);
    363376
    364         String datumId = parameters.get(Param.datum.key);
    365         if (datumId != null) {
    366             Datum datum = Projections.getDatum(datumId);
    367             if (datum == null) throw new ProjectionConfigurationException(tr("Unknown datum identifier: ''{0}''", datumId));
    368             return datum;
    369         }
    370377        if (parameters.containsKey(Param.no_defs.key))
    371378            throw new ProjectionConfigurationException(tr("Datum required (+datum=*, +towgs84=* or +nadgrids=*)"));
Note: See TracChangeset for help on using the changeset viewer.