Changeset 4580 in josm for trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
- Timestamp:
- 2011-11-06T15:00:56+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r4574 r4580 77 77 return isValidLat(lat()) && isValidLon(lon()); 78 78 } 79 80 public static double toIntervalLat(double value) { 81 if (value < -90) 82 return -90; 83 if (value > 90) 84 return 90; 85 return value; 86 } 87 88 /** 89 * Returns a valid OSM longitude [-180,+180] for the given extended longitude value. 90 * For example, a value of -181 will return +179, a value of +181 will return -179. 91 * @param lon A longitude value not restricted to the [-180,+180] range. 92 */ 93 public static double toIntervalLon(double value) { 94 if (isValidLon(value)) { 95 return value; 96 } else { 97 int n = (int) (value + Math.signum(value)*180.0) / 360; 98 return value - n*360.0; 99 } 100 } 79 101 80 102 /** … … 165 187 */ 166 188 public boolean isWithin(Bounds b) { 167 return lat() >= b.getMin().lat() && lat() <= b.getMax().lat() && lon() > b.getMin().lon() && lon() < b.getMax().lon();189 return b.contains(this); 168 190 } 169 191
Note:
See TracChangeset
for help on using the changeset viewer.