source:
osm/applications/editors/josm/plugins/proj4j/patches/01proj4j-transverse-mercator-fix.patch@
26606
Last change on this file since 26606 was 26410, checked in by , 14 years ago | |
---|---|
File size: 2.0 KB |
-
src/org/osgeo/proj4j/proj/TransverseMercatorProjection.java
Taken from the jmapprojlib project, fixes Gauß-Krüger projection, wich was completly broken.
old new 16 16 17 17 /* 18 18 * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 * 20 * Bernhard Jenny, February 2 2010: Corrected code for spherical case in 21 * projectInverse, added isConformal. 22 * 27 September 2010: added missing tests to forward spherical, removed 23 * initialization code in constructor. 19 24 */ 20 25 package org.osgeo.proj4j.proj; 21 26 … … 154 159 155 160 public ProjCoordinate projectInverse(double x, double y, ProjCoordinate out) { 156 161 if (spherical) { 157 double h = Math.exp(x / scaleFactor); 158 double g = .5 * (h - 1. / h); 159 h = Math.cos(projectionLatitude + y / scaleFactor); 160 out.y = ProjectionMath.asin(Math.sqrt((1. - h*h) / (1. + g*g))); 161 if (y < 0) 162 out.y = -out.y; 163 out.x = Math.atan2(g, h); 162 /* 163 Original code 164 x = Math.exp(x / scaleFactor); 165 y = .5 * (x - 1. / x); 166 x = Math.cos(projectionLatitude + y / scaleFactor); 167 out.y = MapMath.asin(Math.sqrt((1. - x * x) / (1. + y * y))); 168 if (y < 0) { 169 out.y = -out.y; 170 } 171 out.x = Math.atan2(y, x); 172 */ 173 174 // new code by Bernhard Jenny, February 2 2010 175 double D = y / scaleFactor + projectionLatitude; 176 double xp = x / scaleFactor; 177 178 out.y = Math.asin(Math.sin(D) / Math.cosh(xp)); 179 out.x = Math.atan2(Math.sinh(xp), Math.cos(D)); 164 180 } else { 165 181 double n, con, cosphi, d, ds, sinphi, t; 166 182 … … 196 212 public boolean hasInverse() { 197 213 return true; 198 214 } 215 216 public boolean isConformal() { 217 return true; 218 } 199 219 200 220 public String toString() { 201 221 if (utmZone >= 0)
Note:
See TracBrowser
for help on using the repository browser.