source: josm/trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2Datum.java@ 6268

Last change on this file since 6268 was 5226, checked in by bastiK, 12 years ago

improvements for custom projection

  • Property svn:eol-style set to native
File size: 1.1 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 based of NTV2 grid shift file.
9 */
10public class NTV2Datum extends AbstractDatum {
11
12 protected NTV2GridShiftFileWrapper nadgrids;
13
14 public NTV2Datum(String name, String proj4Id, Ellipsoid ellps, NTV2GridShiftFileWrapper nadgrids) {
15 super(name, proj4Id, ellps);
16 this.nadgrids = nadgrids;
17 }
18
19 @Override
20 public LatLon toWGS84(LatLon ll) {
21 NTV2GridShift gs = new NTV2GridShift(ll);
22 nadgrids.getShiftFile().gridShiftForward(gs);
23 return new LatLon(ll.lat() + gs.getLatShiftDegrees(), ll.lon() + gs.getLonShiftPositiveEastDegrees());
24 }
25
26 @Override
27 public LatLon fromWGS84(LatLon ll) {
28 NTV2GridShift gs = new NTV2GridShift(ll);
29 nadgrids.getShiftFile().gridShiftReverse(gs);
30 return new LatLon(ll.lat() + gs.getLatShiftDegrees(), ll.lon() + gs.getLonShiftPositiveEastDegrees());
31 }
32}
Note: See TracBrowser for help on using the repository browser.