- Timestamp:
- 2018-04-14T16:56:19+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r13598 r13628 454 454 */ 455 455 public Datum parseDatum(Map<String, String> parameters, Ellipsoid ellps) throws ProjectionConfigurationException { 456 Datum result = null; 456 457 String datumId = parameters.get(Param.datum.key); 457 458 if (datumId != null) { 458 re turnOptional.ofNullable(Projections.getDatum(datumId)).orElseThrow(459 result = Optional.ofNullable(Projections.getDatum(datumId)).orElseThrow( 459 460 () -> new ProjectionConfigurationException(tr("Unknown datum identifier: ''{0}''", datumId))); 460 461 } 461 462 if (ellps == null) { 462 if ( parameters.containsKey(Param.no_defs.key))463 if (result == null && parameters.containsKey(Param.no_defs.key)) 463 464 throw new ProjectionConfigurationException(tr("Ellipsoid required (+ellps=* or +a=*, +b=*)")); 464 465 // nothing specified, use WGS84 as default 465 ellps = Ellipsoid.WGS84;466 ellps = result != null ? result.getEllipsoid() : Ellipsoid.WGS84; 466 467 } 467 468 … … 479 480 480 481 String towgs84 = parameters.get(Param.towgs84.key); 481 if (towgs84 != null) 482 return parseToWGS84(towgs84, ellps); 483 484 return new NullDatum(null, ellps); 482 if (towgs84 != null) { 483 Datum towgs84Datum = parseToWGS84(towgs84, ellps); 484 if (result == null || towgs84Datum instanceof ThreeParameterDatum || towgs84Datum instanceof SevenParameterDatum) { 485 // +datum has priority over +towgs84=0,0,0[,0,0,0,0] 486 return towgs84Datum; 487 } 488 } 489 490 return result != null ? result : new NullDatum(null, ellps); 485 491 } 486 492 … … 513 519 } 514 520 if (isCentric) 515 return new CentricDatum(null, null, ellps);521 return Ellipsoid.WGS84.equals(ellps) ? WGS84Datum.INSTANCE : new CentricDatum(null, null, ellps); 516 522 boolean is3Param = true; 517 523 for (int i = 3; i < towgs84Param.size(); i++) {
Note:
See TracChangeset
for help on using the changeset viewer.