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

Last change on this file since 10680 was 6069, checked in by stoecker, 11 years ago

see #8853 remove tabs, trailing spaces, windows line ends, strange characters

  • Property svn:eol-style set to native
File size: 1.0 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 */
10public class ThreeParameterDatum extends AbstractDatum {
11
12 protected double dx, dy, dz;
13
14 public ThreeParameterDatum(String name, String proj4Id, Ellipsoid ellps, double dx, double dy, double dz) {
15 super(name, proj4Id, ellps);
16 this.dx = dx;
17 this.dy = dy;
18 this.dz = dz;
19 }
20
21 @Override
22 public LatLon toWGS84(LatLon ll) {
23 double[] xyz = ellps.latLon2Cart(ll);
24 xyz[0] += dx;
25 xyz[1] += dy;
26 xyz[2] += dz;
27 return Ellipsoid.WGS84.cart2LatLon(xyz);
28 }
29
30 @Override
31 public LatLon fromWGS84(LatLon ll) {
32 double[] xyz = Ellipsoid.WGS84.latLon2Cart(ll);
33 xyz[0] -= dx;
34 xyz[1] -= dy;
35 xyz[2] -= dz;
36 return this.ellps.cart2LatLon(xyz);
37 }
38
39}
Note: See TracBrowser for help on using the repository browser.