Changeset 10001 in josm for trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
- Timestamp:
- 2016-03-17T01:50:12+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.
