source: josm/trunk/src/org/openstreetmap/josm/data/projection/datum/ThreeParameterDatum.java@ 14159

Last change on this file since 14159 was 13627, checked in by Don-vip, 6 years ago

see #16129 - datum javadoc

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.projection.datum;
3
4import org.openstreetmap.josm.data.coor.LatLon;
5import org.openstreetmap.josm.data.projection.Ellipsoid;
6
7/**
8 * Datum provides 3 dimensional offset and ellipsoid conversion.
9 * @since 4285
10 */
11public class ThreeParameterDatum extends AbstractDatum {
12
13 protected double dx, dy, dz;
14
15 /**
16 * Constructs a new {@code ThreeParameterDatum}.
17 * @param name name of the datum
18 * @param proj4Id Proj.4 identifier for this datum (or null)
19 * @param ellps the ellipsoid used
20 * @param dx x offset in meters
21 * @param dy y offset in meters
22 * @param dz z offset in meters
23 */
24 public ThreeParameterDatum(String name, String proj4Id, Ellipsoid ellps, double dx, double dy, double dz) {
25 super(name, proj4Id, ellps);
26 this.dx = dx;
27 this.dy = dy;
28 this.dz = dz;
29 }
30
31 @Override
32 public LatLon toWGS84(LatLon ll) {
33 double[] xyz = ellps.latLon2Cart(ll);
34 xyz[0] += dx;
35 xyz[1] += dy;
36 xyz[2] += dz;
37 return Ellipsoid.WGS84.cart2LatLon(xyz);
38 }
39
40 @Override
41 public LatLon fromWGS84(LatLon ll) {
42 double[] xyz = Ellipsoid.WGS84.latLon2Cart(ll);
43 xyz[0] -= dx;
44 xyz[1] -= dy;
45 xyz[2] -= dz;
46 return this.ellps.cart2LatLon(xyz);
47 }
48
49}
Note: See TracBrowser for help on using the repository browser.