- Timestamp:
- 2015-12-13T22:48:40+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/projection/proj
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/proj/AbstractProj.java
r9116 r9117 25 25 26 26 /** 27 * Relative iteration precision used in the <code>mlfn< code> method27 * Relative iteration precision used in the <code>mlfn</code> method 28 28 */ 29 29 private static final double MLFN_TOL = 1E-11; … … 33 33 * {@link #en2}, {@link #en3}, {@link #en4}. 34 34 */ 35 private static final double C00 = 1.0,36 C02 = 0.25,37 C04 = 0.046875,38 C06 = 0.01953125,39 C08 = 0.01068115234375,40 C22 = 0.75,41 C44 = 0.46875,42 C46 = 0.01302083333333333333,43 C48 = 0.00712076822916666666,44 C66 = 0.36458333333333333333,45 C68 = 0.00569661458333333333,46 C88 = 0.3076171875;35 private static final double C00 = 1.0, 36 C02 = 0.25, 37 C04 = 0.046875, 38 C06 = 0.01953125, 39 C08 = 0.01068115234375, 40 C22 = 0.75, 41 C44 = 0.46875, 42 C46 = 0.01302083333333333333, 43 C48 = 0.00712076822916666666, 44 C66 = 0.36458333333333333333, 45 C68 = 0.00569661458333333333, 46 C88 = 0.3076171875; 47 47 48 48 /** 49 * Constant needed for the <code>mlfn< code> method.49 * Constant needed for the <code>mlfn</code> method. 50 50 * Setup at construction time. 51 51 */ 52 protected double en0, en1,en2,en3,en4;52 protected double en0, en1, en2, en3, en4; 53 53 54 54 /** 55 55 * The square of excentricity: e² = (a²-b²)/a² where 56 * <var>e</var> is the {@linkplain #excentricity excentricity},57 * <var>a</var> is the {@linkplain #semiMajor semi major}axis length and58 * <var>b</var> is the {@linkplain #semiMinor semi minor}axis length.56 * <var>e</var> is the excentricity, 57 * <var>a</var> is the semi major axis length and 58 * <var>b</var> is the semi minor axis length. 59 59 */ 60 60 protected double e2; … … 107 107 int i; 108 108 phi = arg; 109 for (i =MAXIMUM_ITERATIONS; true;) { // rarely goes over 5 iterations109 for (i = MAXIMUM_ITERATIONS; true;) { // rarely goes over 5 iterations 110 110 if (--i < 0) { 111 111 throw new RuntimeException("Too many iterations"); … … 122 122 123 123 public static double normalizeLon(double lon) { 124 if (lon >= - 124 if (lon >= -Math.PI && lon <= Math.PI) 125 125 return lon; 126 126 else { -
trunk/src/org/openstreetmap/josm/data/projection/proj/TransverseMercator.java
r9116 r9117 56 56 * </ul> 57 57 * 58 * @see <A HREF="http://mathworld.wolfram.com/MercatorProjection.html">Transverse Mercator projection on MathWorld</A>59 * @see <A HREF="http://www.remotesensing.org/geotiff/proj_list/transverse_mercator.html">"Transverse_Mercator" on RemoteSensing.org</A>60 *61 58 * @author André Gosselin 62 59 * @author Martin Desruisseaux (PMO, IRD) 63 60 * @author Rueben Schulz 61 * 62 * @see <A HREF="http://mathworld.wolfram.com/MercatorProjection.html">Transverse Mercator projection on MathWorld</A> 63 * @see <A HREF="http://www.remotesensing.org/geotiff/proj_list/transverse_mercator.html">"Transverse_Mercator" on RemoteSensing.org</A> 64 64 */ 65 65 public class TransverseMercator extends AbstractProj { … … 69 69 * case of the Transverse Mercator. 70 70 */ 71 private static final double FC1 = 1.00000000000000000000000, // 1/172 FC2 = 0.50000000000000000000000, // 1/273 FC3 = 0.16666666666666666666666, // 1/674 FC4 = 0.08333333333333333333333, // 1/1275 FC5 = 0.05000000000000000000000, // 1/2076 FC6 = 0.03333333333333333333333, // 1/3077 FC7 = 0.02380952380952380952380, // 1/4278 FC8 = 0.01785714285714285714285; // 1/5671 private static final double FC1 = 1.00000000000000000000000, // 1/1 72 FC2 = 0.50000000000000000000000, // 1/2 73 FC3 = 0.16666666666666666666666, // 1/6 74 FC4 = 0.08333333333333333333333, // 1/12 75 FC5 = 0.05000000000000000000000, // 1/20 76 FC6 = 0.03333333333333333333333, // 1/30 77 FC7 = 0.02380952380952380952380, // 1/42 78 FC8 = 0.01785714285714285714285; // 1/56 79 79 80 80 /** … … 139 139 y = (mlfn(y, sinphi, cosphi) - ml0 + 140 140 sinphi * al * x * 141 FC2 * ( 141 FC2 * (1.0 + 142 142 FC4 * als * (5.0 - t + n*(9.0 + 4.0*n) + 143 143 FC6 * als * (61.0 + t * (t - 58.0) + n*(270.0 - 330.0*t) + 144 FC8 * als * (1385.0 + t * ( 144 FC8 * als * (1385.0 + t * (t*(543.0 - t) - 3111.0)))))); 145 145 146 146 x = al*(FC1 + FC3 * als*(1.0 - t + n + 147 147 FC5 * als * (5.0 + t*(t - 18.0) + n*(14.0 - 58.0*t) + 148 FC7 * als * (61.0+ t*(t*(179.0 - t) - 479.0 148 FC7 * als * (61.0+ t*(t*(179.0 - t) - 479.0))))); 149 149 150 return new double[] { x, y};150 return new double[] {x, y}; 151 151 } 152 152 … … 156 156 157 157 if (Math.abs(phi) >= Math.PI/2) { 158 y = y <0.0 ? -(Math.PI/2) : (Math.PI/2);158 y = y < 0.0 ? -(Math.PI/2) : (Math.PI/2); 159 159 x = 0.0; 160 160 } else { … … 179 179 ds*FC7*(61.0 + t*(662.0 + t*(1320.0 + 720.0*t))))))/cosphi; 180 180 } 181 return new double[] { y, x};181 return new double[] {y, x}; 182 182 } 183 183 }
Note:
See TracChangeset
for help on using the changeset viewer.