Changeset 10001 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2016-03-17T01:50:12+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/QuadTiling.java
r8510 r10001 23 23 public static LatLon tile2LatLon(long quad) { 24 24 // The world is divided up into X_PARTS,Y_PARTS. 25 // The question is how far we move for each bit 26 // being set. In the case of the top level, we 27 // move half of the world. 28 double x_unit = X_PARTS/2; 29 double y_unit = Y_PARTS/2; 25 // The question is how far we move for each bit being set. 26 // In the case of the top level, we move half of the world. 27 double xUnit = X_PARTS/2; 28 double yUnit = Y_PARTS/2; 30 29 long shift = (NR_LEVELS*2)-2; 31 30 … … 36 35 // remember x is the MSB 37 36 if ((bits & 0x2) != 0) { 38 x += x _unit;37 x += xUnit; 39 38 } 40 39 if ((bits & 0x1) != 0) { 41 y += y _unit;40 y += yUnit; 42 41 } 43 x _unit /= 2;44 y _unit /= 2;42 xUnit /= 2; 43 yUnit /= 2; 45 44 shift -= 2; 46 45 } … … 61 60 } 62 61 return tile; 63 }64 65 static long coorToTile(LatLon coor) {66 return quadTile(coor);67 62 } 68 63 … … 89 84 public static int index(int level, long quad) { 90 85 long mask = 0x00000003; 91 int total _shift = TILES_PER_LEVEL_SHIFT*(NR_LEVELS-level-1);92 return (int) (mask & (quad >> total _shift));86 int totalShift = TILES_PER_LEVEL_SHIFT*(NR_LEVELS-level-1); 87 return (int) (mask & (quad >> totalShift)); 93 88 } 94 89 -
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r9854 r10001 240 240 241 241 /** 242 * Makes a WayPoint at the projection of point Ponto the track providingPis less than242 * Makes a WayPoint at the projection of point p onto the track providing p is less than 243 243 * tolerance away from the track 244 244 * 245 * @param P: the point to determine the projection for245 * @param p : the point to determine the projection for 246 246 * @param tolerance : must be no further than this from the track 247 * @return the closest point on the track to P, which may be the first or last point if off the247 * @return the closest point on the track to p, which may be the first or last point if off the 248 248 * end of a segment, or may be null if nothing close enough 249 249 */ 250 public WayPoint nearestPointOnTrack(EastNorth P, double tolerance) {250 public WayPoint nearestPointOnTrack(EastNorth p, double tolerance) { 251 251 /* 252 252 * assume the coordinates of P are xp,yp, and those of a section of track between two … … 272 272 */ 273 273 274 double PNminsq = tolerance * tolerance;274 double pnminsq = tolerance * tolerance; 275 275 EastNorth bestEN = null; 276 276 double bestTime = 0.0; 277 double px = P.east();278 double py = P.north();277 double px = p.east(); 278 double py = p.north(); 279 279 double rx = 0.0, ry = 0.0, sx, sy, x, y; 280 280 if (tracks == null) … … 282 282 for (GpxTrack track : tracks) { 283 283 for (GpxTrackSegment seg : track.getSegments()) { 284 WayPoint R= null;284 WayPoint r = null; 285 285 for (WayPoint S : seg.getWayPoints()) { 286 EastNorth c= S.getEastNorth();287 if ( R== null) {288 R= S;289 rx = c.east();290 ry = c.north();286 EastNorth en = S.getEastNorth(); 287 if (r == null) { 288 r = S; 289 rx = en.east(); 290 ry = en.north(); 291 291 x = px - rx; 292 292 y = py - ry; 293 double PRsq = x * x + y * y;294 if ( PRsq < PNminsq) {295 PNminsq =PRsq;296 bestEN = c;297 bestTime = R.time;293 double pRsq = x * x + y * y; 294 if (pRsq < pnminsq) { 295 pnminsq = pRsq; 296 bestEN = en; 297 bestTime = r.time; 298 298 } 299 299 } else { 300 sx = c.east();301 sy = c.north();302 double A= sy - ry;303 double B= rx - sx;304 double C = -A* rx -B* ry;305 double RSsq = A * A + B * B;306 if ( RSsq == 0) {300 sx = en.east(); 301 sy = en.north(); 302 double a = sy - ry; 303 double b = rx - sx; 304 double c = -a * rx - b * ry; 305 double rssq = a * a + b * b; 306 if (rssq == 0) { 307 307 continue; 308 308 } 309 double PNsq = A* px +B* py +C;310 PNsq = PNsq * PNsq / RSsq;311 if ( PNsq < PNminsq) {309 double pnsq = a * px + b * py + c; 310 pnsq = pnsq * pnsq / rssq; 311 if (pnsq < pnminsq) { 312 312 x = px - rx; 313 313 y = py - ry; 314 double PRsq = x * x + y * y;314 double prsq = x * x + y * y; 315 315 x = px - sx; 316 316 y = py - sy; 317 double PSsq = x * x + y * y;318 if ( PRsq - PNsq <= RSsq && PSsq - PNsq <= RSsq) {319 double RNoverRS = Math.sqrt((PRsq - PNsq) / RSsq);320 double nx = rx - RNoverRS *B;321 double ny = ry + RNoverRS *A;317 double pssq = x * x + y * y; 318 if (prsq - pnsq <= rssq && pssq - pnsq <= rssq) { 319 double rnoverRS = Math.sqrt((prsq - pnsq) / rssq); 320 double nx = rx - rnoverRS * b; 321 double ny = ry + rnoverRS * a; 322 322 bestEN = new EastNorth(nx, ny); 323 bestTime = R.time +RNoverRS * (S.time -R.time);324 PNminsq =PNsq;323 bestTime = r.time + rnoverRS * (S.time - r.time); 324 pnminsq = pnsq; 325 325 } 326 326 } 327 R= S;327 r = S; 328 328 rx = sx; 329 329 ry = sy; 330 330 } 331 331 } 332 if ( R!= null) {333 EastNorth c = R.getEastNorth();332 if (r != null) { 333 EastNorth c = r.getEastNorth(); 334 334 /* if there is only one point in the seg, it will do this twice, but no matter */ 335 335 rx = c.east(); … … 337 337 x = px - rx; 338 338 y = py - ry; 339 double PRsq = x * x + y * y;340 if ( PRsq < PNminsq) {341 PNminsq =PRsq;339 double prsq = x * x + y * y; 340 if (prsq < pnminsq) { 341 pnminsq = prsq; 342 342 bestEN = c; 343 bestTime = R.time;343 bestTime = r.time; 344 344 } 345 345 } -
trunk/src/org/openstreetmap/josm/data/osm/BBox.java
r9976 r10001 52 52 } 53 53 54 public BBox(double a _x, double a_y, double b_x, double b_y) {55 56 if (a _x > b_x) {57 xmax = a _x;58 xmin = b _x;54 public BBox(double ax, double ay, double bx, double by) { 55 56 if (ax > bx) { 57 xmax = ax; 58 xmin = bx; 59 59 } else { 60 xmax = b _x;61 xmin = a _x;62 } 63 64 if (a _y > b_y) {65 ymax = a _y;66 ymin = b _y;60 xmax = bx; 61 xmin = ax; 62 } 63 64 if (ay > by) { 65 ymax = ay; 66 ymin = by; 67 67 } else { 68 ymax = b _y;69 ymin = a _y;68 ymax = by; 69 ymin = ay; 70 70 } 71 71 -
trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java
r9854 r10001 98 98 } 99 99 100 QBLevel(QBLevel<T> parent, int parent _index, final QuadBuckets<T> buckets) {100 QBLevel(QBLevel<T> parent, int parentIndex, final QuadBuckets<T> buckets) { 101 101 this.parent = parent; 102 102 this.level = parent.level + 1; 103 this.index = parent _index;103 this.index = parentIndex; 104 104 this.buckets = buckets; 105 105 … … 111 111 mult = 1 << 30; 112 112 } 113 long this_quadpart = mult * (parent_index << shift);114 this.quad = parent.quad | this_quadpart;113 long quadpart = mult * (parentIndex << shift); 114 this.quad = parent.quad | quadpart; 115 115 this.bbox = calculateBBox(); // calculateBBox reference quad 116 116 } 117 117 118 118 private BBox calculateBBox() { 119 LatLon bottom _left = this.coor();120 double lat = bottom _left.lat() + parent.height() / 2;121 double lon = bottom _left.lon() + parent.width() / 2;122 return new BBox(bottom _left.lon(), bottom_left.lat(), lon, lat);119 LatLon bottomLeft = this.coor(); 120 double lat = bottomLeft.lat() + parent.height() / 2; 121 double lon = bottomLeft.lon() + parent.width() / 2; 122 return new BBox(bottomLeft.lon(), bottomLeft.lat(), lon, lat); 123 123 } 124 124 … … 181 181 } 182 182 183 boolean matches(final T o, final BBox search _bbox) {183 boolean matches(final T o, final BBox searchBbox) { 184 184 if (o instanceof Node) { 185 185 final LatLon latLon = ((Node) o).getCoor(); 186 186 // node without coords -> bbox[0,0,0,0] 187 return search _bbox.bounds(latLon != null ? latLon : LatLon.ZERO);188 } 189 return o.getBBox().intersects(search _bbox);190 } 191 192 private void search_contents(BBox search _bbox, List<T> result) {187 return searchBbox.bounds(latLon != null ? latLon : LatLon.ZERO); 188 } 189 return o.getBBox().intersects(searchBbox); 190 } 191 192 private void search_contents(BBox searchBbox, List<T> result) { 193 193 /* 194 194 * It is possible that this was created in a split … … 199 199 200 200 for (T o : content) { 201 if (matches(o, search _bbox)) {201 if (matches(o, searchBbox)) { 202 202 result.add(o); 203 203 } … … 299 299 } 300 300 301 private void search(BBox search _bbox, List<T> result) {302 if (!this.bbox().intersects(search _bbox))301 private void search(BBox searchBbox, List<T> result) { 302 if (!this.bbox().intersects(searchBbox)) 303 303 return; 304 else if (bbox().bounds(search _bbox)) {304 else if (bbox().bounds(searchBbox)) { 305 305 buckets.searchCache = this; 306 306 } 307 307 308 308 if (this.hasContent()) { 309 search_contents(search _bbox, result);309 search_contents(searchBbox, result); 310 310 } 311 311 … … 313 313 314 314 if (nw != null) { 315 nw.search(search _bbox, result);315 nw.search(searchBbox, result); 316 316 } 317 317 if (ne != null) { 318 ne.search(search _bbox, result);318 ne.search(searchBbox, result); 319 319 } 320 320 if (se != null) { 321 se.search(search _bbox, result);321 se.search(searchBbox, result); 322 322 } 323 323 if (sw != null) { 324 sw.search(search _bbox, result);324 sw.search(searchBbox, result); 325 325 } 326 326 } … … 330 330 } 331 331 332 int index_of(QBLevel<T> find _this) {332 int index_of(QBLevel<T> findThis) { 333 333 QBLevel<T>[] children = getChildren(); 334 334 for (int i = 0; i < QuadTiling.TILES_PER_LEVEL; i++) { 335 if (children[i] == find _this)335 if (children[i] == findThis) 336 336 return i; 337 337 } -
trunk/src/org/openstreetmap/josm/data/projection/AbstractProjection.java
r9790 r10001 96 96 @Override 97 97 public LatLon eastNorth2latlon(EastNorth en) { 98 double[] latlon _rad = proj.invproject((en.east() * toMeter - x0) / ellps.a / k0, (en.north() * toMeter - y0) / ellps.a / k0);99 LatLon ll = new LatLon(Math.toDegrees(latlon _rad[0]), LatLon.normalizeLon(Math.toDegrees(latlon_rad[1]) + lon0 + pm));98 double[] latlonRad = proj.invproject((en.east() * toMeter - x0) / ellps.a / k0, (en.north() * toMeter - y0) / ellps.a / k0); 99 LatLon ll = new LatLon(Math.toDegrees(latlonRad[0]), LatLon.normalizeLon(Math.toDegrees(latlonRad[1]) + lon0 + pm)); 100 100 return datum.toWGS84(ll); 101 101 } -
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r10000 r10001 615 615 s = s.substring(m.end()); 616 616 } 617 final String FLOAT= "(\\d+(\\.\\d*)?)";617 final String floatPattern = "(\\d+(\\.\\d*)?)"; 618 618 boolean dms = false; 619 619 double deg = 0.0, min = 0.0, sec = 0.0; 620 620 // degrees 621 m = Pattern.compile("^"+ FLOAT+"d").matcher(s);621 m = Pattern.compile("^"+floatPattern+"d").matcher(s); 622 622 if (m.find()) { 623 623 s = s.substring(m.end()); … … 626 626 } 627 627 // minutes 628 m = Pattern.compile("^"+ FLOAT+"'").matcher(s);628 m = Pattern.compile("^"+floatPattern+"'").matcher(s); 629 629 if (m.find()) { 630 630 s = s.substring(m.end()); … … 633 633 } 634 634 // seconds 635 m = Pattern.compile("^"+ FLOAT+"\"").matcher(s);635 m = Pattern.compile("^"+floatPattern+"\"").matcher(s); 636 636 if (m.find()) { 637 637 s = s.substring(m.end()); … … 643 643 value = deg + (min/60.0) + (sec/3600.0); 644 644 } else { 645 m = Pattern.compile("^"+ FLOAT).matcher(s);645 m = Pattern.compile("^"+floatPattern).matcher(s); 646 646 if (m.find()) { 647 647 s = s.substring(m.end()); … … 780 780 } 781 781 782 private static EastNorth getPointAlong(int i, int N, ProjectionBounds r) {783 double dEast = (r.maxEast - r.minEast) / N;784 double dNorth = (r.maxNorth - r.minNorth) / N;785 if (i < N) {782 private static EastNorth getPointAlong(int i, int n, ProjectionBounds r) { 783 double dEast = (r.maxEast - r.minEast) / n; 784 double dNorth = (r.maxNorth - r.minNorth) / n; 785 if (i < n) { 786 786 return new EastNorth(r.minEast + i * dEast, r.minNorth); 787 } else if (i < 2* N) {788 i -= N;787 } else if (i < 2*n) { 788 i -= n; 789 789 return new EastNorth(r.maxEast, r.minNorth + i * dNorth); 790 } else if (i < 3* N) {791 i -= 2* N;790 } else if (i < 3*n) { 791 i -= 2*n; 792 792 return new EastNorth(r.maxEast - i * dEast, r.maxNorth); 793 } else if (i < 4* N) {794 i -= 3* N;793 } else if (i < 4*n) { 794 i -= 3*n; 795 795 return new EastNorth(r.minEast, r.maxNorth - i * dNorth); 796 796 } else { … … 824 824 @Override 825 825 public Bounds getLatLonBoundsBox(ProjectionBounds r) { 826 final int N= 10;826 final int n = 10; 827 827 Bounds result = new Bounds(eastNorth2latlon(r.getMin())); 828 828 result.extend(eastNorth2latlon(r.getMax())); 829 829 LatLon llPrev = null; 830 for (int i = 0; i < 4* N; i++) {831 LatLon llNow = eastNorth2latlon(getPointAlong(i, N, r));830 for (int i = 0; i < 4*n; i++) { 831 LatLon llNow = eastNorth2latlon(getPointAlong(i, n, r)); 832 832 result.extend(llNow); 833 833 // check if segment crosses 180th meridian and if so, make sure -
trunk/src/org/openstreetmap/josm/data/projection/Ellipsoid.java
r9565 r10001 353 353 double lambda = Math.toRadians(coord.lon()); 354 354 355 double Rn = a / Math.sqrt(1 - e2 * Math.pow(Math.sin(phi), 2));355 double rn = a / Math.sqrt(1 - e2 * Math.pow(Math.sin(phi), 2)); 356 356 double[] xyz = new double[3]; 357 xyz[0] = Rn * Math.cos(phi) * Math.cos(lambda);358 xyz[1] = Rn * Math.cos(phi) * Math.sin(lambda);359 xyz[2] = Rn * (1 - e2) * Math.sin(phi);357 xyz[0] = rn * Math.cos(phi) * Math.cos(lambda); 358 xyz[1] = rn * Math.cos(phi) * Math.sin(lambda); 359 xyz[2] = rn * (1 - e2) * Math.sin(phi); 360 360 361 361 return xyz; -
trunk/src/org/openstreetmap/josm/data/projection/proj/AlbersEqualArea.java
r9998 r10001 167 167 */ 168 168 public double phi1(final double qs) { 169 final double tone _es = 1 - e2;169 final double toneEs = 1 - e2; 170 170 double phi = Math.asin(0.5 * qs); 171 171 if (e < EPSILON) { … … 178 178 final double com = 1.0 - con*con; 179 179 final double dphi = 0.5 * com*com / cospi * 180 (qs/tone _es - sinpi / com + 0.5/e * Math.log((1. - con) / (1. + con)));180 (qs/toneEs - sinpi / com + 0.5/e * Math.log((1. - con) / (1. + con))); 181 181 phi += dphi; 182 182 if (Math.abs(dphi) <= ITERATION_TOLERANCE) { … … 194 194 */ 195 195 private double qsfn(final double sinphi) { 196 final double one _es = 1 - e2;196 final double oneEs = 1 - e2; 197 197 if (e >= EPSILON) { 198 198 final double con = e * sinphi; 199 return one _es * (sinphi / (1. - con*con) -199 return oneEs * (sinphi / (1. - con*con) - 200 200 (0.5/e) * Math.log((1.-con) / (1.+con))); 201 201 } else { -
trunk/src/org/openstreetmap/josm/data/projection/proj/DoubleStereographic.java
r9974 r10001 58 58 } 59 59 60 private void initialize(double lat _0) {61 double phi0 = toRadians(lat _0);60 private void initialize(double lat0) { 61 double phi0 = toRadians(lat0); 62 62 double e2 = ellps.e2; 63 63 r = sqrt(1-e2) / (1 - e2*pow(sin(phi0), 2)); 64 64 n = sqrt(1 + ellps.eb2 * pow(cos(phi0), 4)); 65 double S1 = (1 + sin(phi0)) / (1 - sin(phi0));66 double S2 = (1 - e * sin(phi0)) / (1 + e * sin(phi0));67 double w1 = pow( S1 * pow(S2, e), n);65 double s1 = (1 + sin(phi0)) / (1 - sin(phi0)); 66 double s2 = (1 - e * sin(phi0)) / (1 + e * sin(phi0)); 67 double w1 = pow(s1 * pow(s2, e), n); 68 68 double sinchi00 = (w1 - 1) / (w1 + 1); 69 69 c = (n + sin(phi0)) * (1 - sinchi00) / ((n - sin(phi0)) * (1 + sinchi00)); … … 74 74 @Override 75 75 public double[] project(double phi, double lambda) { 76 double Lambda = n * lambda; 77 double Sa = (1 + sin(phi)) / (1 - sin(phi));78 double Sb = (1 - e * sin(phi)) / (1 + e * sin(phi));79 double w = c * pow( Sa * pow(Sb, e), n);76 double nLambda = n * lambda; 77 double sa = (1 + sin(phi)) / (1 - sin(phi)); 78 double sb = (1 - e * sin(phi)) / (1 + e * sin(phi)); 79 double w = c * pow(sa * pow(sb, e), n); 80 80 double chi = asin((w - 1) / (w + 1)); 81 double B= 1 + sin(chi) * sin(chi0) + cos(chi) * cos(chi0) * cos(Lambda);82 double x = 2 * r * cos(chi) * sin(Lambda) / B;83 double y = 2 * r * (sin(chi) * cos(chi0) - cos(chi) * sin(chi0) * cos(Lambda)) / B;81 double b = 1 + sin(chi) * sin(chi0) + cos(chi) * cos(chi0) * cos(nLambda); 82 double x = 2 * r * cos(chi) * sin(nLambda) / b; 83 double y = 2 * r * (sin(chi) * cos(chi0) - cos(chi) * sin(chi0) * cos(nLambda)) / b; 84 84 return new double[] {x, y}; 85 85 } … … 93 93 double j = atan(x/(g - y)) - i; 94 94 double chi = chi0 + 2 * atan((y - x * tan(j/2)) / (2 * r)); 95 double Lambda = j + 2*i; 96 double lambda = Lambda / n; 95 double lambda = (j + 2*i) / n; 97 96 double psi = 0.5 * log((1 + sin(chi)) / (c*(1 - sin(chi)))) / n; 98 97 double phiprev = -1000; -
trunk/src/org/openstreetmap/josm/data/projection/proj/LambertConformalConic.java
r9600 r10001 91 91 * Initialize for LCC with 2 standard parallels. 92 92 * 93 * @param lat _0 latitude of false origin (in degrees)94 * @param lat _1 latitude of first standard parallel (in degrees)95 * @param lat _2 latitude of second standard parallel (in degrees)93 * @param lat0 latitude of false origin (in degrees) 94 * @param lat1 latitude of first standard parallel (in degrees) 95 * @param lat2 latitude of second standard parallel (in degrees) 96 96 */ 97 private void initialize2SP(double lat _0, double lat_1, double lat_2) {98 this.params = new Parameters2SP(lat _0, lat_1, lat_2);97 private void initialize2SP(double lat0, double lat1, double lat2) { 98 this.params = new Parameters2SP(lat0, lat1, lat2); 99 99 100 final double m1 = m(toRadians(lat _1));101 final double m2 = m(toRadians(lat _2));100 final double m1 = m(toRadians(lat1)); 101 final double m2 = m(toRadians(lat2)); 102 102 103 final double t1 = t(toRadians(lat _1));104 final double t2 = t(toRadians(lat _2));105 final double tf = t(toRadians(lat _0));103 final double t1 = t(toRadians(lat1)); 104 final double t2 = t(toRadians(lat2)); 105 final double tf = t(toRadians(lat0)); 106 106 107 107 n = (log(m1) - log(m2)) / (log(t1) - log(t2)); … … 113 113 * Initialize for LCC with 1 standard parallel. 114 114 * 115 * @param lat _0 latitude of natural origin (in degrees)115 * @param lat0 latitude of natural origin (in degrees) 116 116 */ 117 private void initialize1SP(double lat _0) {118 this.params = new Parameters1SP(lat _0);119 final double lat _0_rad = toRadians(lat_0);117 private void initialize1SP(double lat0) { 118 this.params = new Parameters1SP(lat0); 119 final double lat0rad = toRadians(lat0); 120 120 121 final double m0 = m(lat _0_rad);122 final double t0 = t(lat _0_rad);121 final double m0 = m(lat0rad); 122 final double t0 = t(lat0rad); 123 123 124 n = sin(lat _0_rad);124 n = sin(lat0rad); 125 125 f = m0 / (n * pow(t0, n)); 126 126 r0 = f * pow(t0, n); … … 129 129 /** 130 130 * auxiliary function t 131 * @param lat _rad latitude in radians131 * @param latRad latitude in radians 132 132 * @return result 133 133 */ 134 protected double t(double lat _rad) {135 return tan(PI/4 - lat _rad / 2.0)136 / pow((1.0 - e * sin(lat _rad)) / (1.0 + e * sin(lat_rad)), e/2);134 protected double t(double latRad) { 135 return tan(PI/4 - latRad / 2.0) 136 / pow((1.0 - e * sin(latRad)) / (1.0 + e * sin(latRad)), e/2); 137 137 } 138 138 139 139 /** 140 140 * auxiliary function m 141 * @param lat _rad latitude in radians141 * @param latRad latitude in radians 142 142 * @return result 143 143 */ 144 protected double m(double lat _rad) {145 return cos(lat _rad) / (sqrt(1 - e * e * pow(sin(lat_rad), 2)));144 protected double m(double latRad) { 145 return cos(latRad) / (sqrt(1 - e * e * pow(sin(latRad), 2))); 146 146 } 147 147 -
trunk/src/org/openstreetmap/josm/data/projection/proj/LonLat.java
r9628 r10001 30 30 31 31 @Override 32 public double[] project(double lat _rad, double lon_rad) {33 return new double[] {Math.toDegrees(lon _rad) / a, Math.toDegrees(lat_rad) / a};32 public double[] project(double latRad, double lonRad) { 33 return new double[] {Math.toDegrees(lonRad) / a, Math.toDegrees(latRad) / a}; 34 34 } 35 35 -
trunk/src/org/openstreetmap/josm/data/projection/proj/ObliqueMercator.java
r10000 r10001 379 379 double temp = 1.0 / q; 380 380 double s = 0.5 * (q - temp); 381 double V= Math.sin(b * x);382 double U= (s * singamma0 -V* cosgamma0) / (0.5 * (q + temp));383 if (Math.abs(Math.abs( U) - 1.0) < EPSILON) {381 double v2 = Math.sin(b * x); 382 double u2 = (s * singamma0 - v2 * cosgamma0) / (0.5 * (q + temp)); 383 if (Math.abs(Math.abs(u2) - 1.0) < EPSILON) { 384 384 v = 0; // this is actually an error and should be reported to the caller somehow 385 385 } else { 386 v = 0.5 * arb * Math.log((1.0 - U) / (1.0 +U));386 v = 0.5 * arb * Math.log((1.0 - u2) / (1.0 + u2)); 387 387 } 388 388 temp = Math.cos(b * x); … … 390 390 u = ab * x; 391 391 } else { 392 u = arb * Math.atan2(s * cosgamma0 + V* singamma0, temp);392 u = arb * Math.atan2(s * cosgamma0 + v2 * singamma0, temp); 393 393 } 394 394 } else { -
trunk/src/org/openstreetmap/josm/data/projection/proj/PolarStereographic.java
r9998 r10001 171 171 @Override 172 172 public Bounds getAlgorithmBounds() { 173 final double CUT= 60;173 final double cut = 60; 174 174 if (southPole) { 175 return new Bounds(-90, -180, CUT, 180, false);175 return new Bounds(-90, -180, cut, 180, false); 176 176 } else { 177 return new Bounds(- CUT, -180, 90, 180, false);177 return new Bounds(-cut, -180, 90, 180, false); 178 178 } 179 179 } -
trunk/src/org/openstreetmap/josm/data/projection/proj/Proj.java
r9628 r10001 50 50 * Convert lat/lon to east/north. 51 51 * 52 * @param lat _rad the latitude in radians53 * @param lon _rad the longitude in radians52 * @param latRad the latitude in radians 53 * @param lonRad the longitude in radians 54 54 * @return array of length 2, containing east and north value in meters, 55 55 * divided by the semi major axis of the ellipsoid. 56 56 */ 57 double[] project(double lat _rad, double lon_rad);57 double[] project(double latRad, double lonRad); 58 58 59 59 /** -
trunk/src/org/openstreetmap/josm/data/projection/proj/SwissObliqueMercator.java
r9628 r10001 56 56 } 57 57 58 private void initialize(double lat _0) {59 phi0 = toRadians(lat _0);58 private void initialize(double lat0) { 59 phi0 = toRadians(lat0); 60 60 kR = sqrt(1 - ellps.e2) / (1 - (ellps.e2 * pow(sin(phi0), 2))); 61 61 alpha = sqrt(1 + (ellps.eb2 * pow(cos(phi0), 4))); … … 78 78 @Override 79 79 public double[] project(double phi, double lambda) { 80 double S= alpha * log(tan(PI / 4 + phi / 2)) - alpha * ellps.e / 280 double s = alpha * log(tan(PI / 4 + phi / 2)) - alpha * ellps.e / 2 81 81 * log((1 + ellps.e * sin(phi)) / (1 - ellps.e * sin(phi))) + k; 82 double b = 2 * (atan(exp( S)) - PI / 4);82 double b = 2 * (atan(exp(s)) - PI / 4); 83 83 double l = alpha * lambda; 84 84 -
trunk/src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java
r9070 r10001 119 119 int i; // iterates through s 120 120 int j; // iterates through t 121 char s _i; // ith character of s122 char t _j; // jth character of t121 char si; // ith character of s 122 char tj; // jth character of t 123 123 int cost; // cost 124 124 … … 143 143 for (i = 1; i <= n; i++) { 144 144 145 s _i = s.charAt(i - 1);145 si = s.charAt(i - 1); 146 146 147 147 // Step 4 148 148 for (j = 1; j <= m; j++) { 149 149 150 t _j = t.charAt(j - 1);150 tj = t.charAt(j - 1); 151 151 152 152 // Step 5 153 if (s _i == t_j) {153 if (si == tj) { 154 154 cost = 0; 155 155 } else { -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r8836 r10001 389 389 nearbyNodeCache = null; 390 390 List<LatLon> bounds = this.getBounds(dist); 391 List<Node> found _nodes = endnodesHighway.search(new BBox(bounds.get(0), bounds.get(1)));392 found _nodes.addAll(endnodes.search(new BBox(bounds.get(0), bounds.get(1))));393 394 for (Node n : found _nodes) {391 List<Node> foundNodes = endnodesHighway.search(new BBox(bounds.get(0), bounds.get(1))); 392 foundNodes.addAll(endnodes.search(new BBox(bounds.get(0), bounds.get(1)))); 393 394 for (Node n : foundNodes) { 395 395 if (!nearby(n, dist) || !n.getCoor().isIn(dsArea)) { 396 396 continue;
Note:
See TracChangeset
for help on using the changeset viewer.