Changeset 5073 in josm for trunk/src/org/openstreetmap/josm/data/projection/AbstractProjection.java
- Timestamp:
- 2012-03-11T21:19:59+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/AbstractProjection.java
r5040 r5073 20 20 * Subclasses of AbstractProjection must set ellps and proj to a non-null value. 21 21 * In addition, either datum or nadgrid has to be initialized to some value. 22 *23 * FIXME: nadgrids should probably be implemented as a Datum24 22 */ 25 23 abstract public class AbstractProjection implements Projection { … … 32 30 protected double lon_0 = 0.0; /* central meridian */ 33 31 protected double k_0 = 1.0; /* general scale factor */ 34 protected NTV2GridShiftFile nadgrids = null; 35 32 36 33 public final Ellipsoid getEllipsoid() { 37 34 return ellps; … … 64 61 @Override 65 62 public EastNorth latlon2eastNorth(LatLon ll) { 66 if (nadgrids != null) { 67 NTV2GridShift gs = new NTV2GridShift(ll); 68 nadgrids.gridShiftReverse(gs); 69 ll = new LatLon(ll.lat()+gs.getLatShiftDegrees(), ll.lon()+gs.getLonShiftPositiveEastDegrees()); 70 } else { 71 ll = datum.fromWGS84(ll); 72 } 63 ll = datum.fromWGS84(ll); 73 64 double[] en = proj.project(Math.toRadians(ll.lat()), Math.toRadians(ll.lon() - lon_0)); 74 65 return new EastNorth(ellps.a * k_0 * en[0] + x_0, ellps.a * k_0 * en[1] + y_0); … … 79 70 double[] latlon_rad = proj.invproject((en.east() - x_0) / ellps.a / k_0, (en.north() - y_0) / ellps.a / k_0); 80 71 LatLon ll = new LatLon(Math.toDegrees(latlon_rad[0]), Math.toDegrees(latlon_rad[1]) + lon_0); 81 if (nadgrids != null) { 82 NTV2GridShift gs = new NTV2GridShift(ll); 83 nadgrids.gridShiftForward(gs); 84 ll = new LatLon(ll.lat()+gs.getLatShiftDegrees(), ll.lon()+gs.getLonShiftPositiveEastDegrees()); 85 } else { 86 ll = datum.toWGS84(ll); 87 } 88 return ll; 72 return datum.toWGS84(ll); 89 73 } 90 74 … … 94 78 return 10; 95 79 } 96 80 97 81 /** 98 82 * @return The EPSG Code of this CRS, null if it doesn't have one. … … 108 92 return "EPSG:" + getEpsgCode(); 109 93 } 110 94 111 95 protected static final double convertMinuteSecond(double minute, double second) { 112 96 return (minute/60.0) + (second/3600.0); 113 97 } 114 98 115 99 protected static final double convertDegreeMinuteSecond(double degree, double minute, double second) { 116 100 return degree + convertMinuteSecond(minute, second);
Note:
See TracChangeset
for help on using the changeset viewer.