- Timestamp:
- 2012-03-11T21:19:59+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/projection
- Files:
-
- 1 added
- 3 edited
- 4 moved
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); -
trunk/src/org/openstreetmap/josm/data/projection/GaussKrueger.java
r5066 r5073 17 17 import org.openstreetmap.josm.data.Bounds; 18 18 import org.openstreetmap.josm.data.coor.LatLon; 19 import org.openstreetmap.josm.data.projection.datum.NTV2Datum; 20 import org.openstreetmap.josm.data.projection.datum.NTV2GridShiftFile; 19 21 import org.openstreetmap.josm.data.projection.proj.ProjParameters; 20 22 import org.openstreetmap.josm.data.projection.proj.TransverseMercator; … … 60 62 this.zone = zone; 61 63 ellps = Ellipsoid.Bessel1841; 62 nadgrids = BETA2007;64 datum = new NTV2Datum("BETA2007", null, ellps, BETA2007); 63 65 ////less acurrate datum (errors up to 3m): 64 66 //datum = new SevenParameterDatum( -
trunk/src/org/openstreetmap/josm/data/projection/Lambert.java
r5067 r5073 17 17 import org.openstreetmap.josm.data.Bounds; 18 18 import org.openstreetmap.josm.data.coor.LatLon; 19 import org.openstreetmap.josm.data.projection.datum.NTV2Datum; 20 import org.openstreetmap.josm.data.projection.datum.NTV2GridShiftFile; 19 21 import org.openstreetmap.josm.data.projection.proj.LambertConformalConic; 20 22 import org.openstreetmap.josm.data.projection.proj.ProjParameters; … … 101 103 this.layoutZone = layoutZone; 102 104 ellps = Ellipsoid.clarkeIGN; 103 datum = null; // no datum needed, we have a shift file 104 nadgrids = ntf_rgf93Grid; 105 datum = new NTV2Datum("ntf_rgf93Grid", null, ellps, ntf_rgf93Grid); 105 106 x_0 = x_0s[layoutZone]; 106 107 lon_0 = 2.0 + 20.0 / 60 + 14.025 / 3600; // 0 grade Paris -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShift.java
r5067 r5073 18 18 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 19 */ 20 package org.openstreetmap.josm.data.projection ;20 package org.openstreetmap.josm.data.projection.datum; 21 21 22 22 import java.io.Serializable; -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java
r5067 r5073 18 18 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 19 */ 20 package org.openstreetmap.josm.data.projection ;20 package org.openstreetmap.josm.data.projection.datum; 21 21 22 22 import java.io.IOException; -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2SubGrid.java
r5067 r5073 18 18 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 19 */ 20 package org.openstreetmap.josm.data.projection ;20 package org.openstreetmap.josm.data.projection.datum; 21 21 22 22 import java.io.IOException; -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2Util.java
r5067 r5073 18 18 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 19 19 */ 20 package org.openstreetmap.josm.data.projection ;20 package org.openstreetmap.josm.data.projection.datum; 21 21 22 22 /**
Note:
See TracChangeset
for help on using the changeset viewer.