Changeset 10334 in josm for trunk/src/org
- Timestamp:
- 2016-06-07T21:26:44+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/coor
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/CachedLatLon.java
r8846 r10334 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.coor; 3 4 import java.util.Objects; 3 5 4 6 import org.openstreetmap.josm.Main; … … 54 56 */ 55 57 public final EastNorth getEastNorth() { 56 if ( proj != Main.getProjection()) {58 if (!Objects.equals(proj, Main.getProjection())) { 57 59 proj = Main.getProjection(); 58 60 eastNorth = proj.latlon2eastNorth(this); … … 62 64 63 65 @Override 66 public int hashCode() { 67 return Objects.hash(x, y, eastNorth); 68 } 69 70 @Override 71 public boolean equals(Object obj) { 72 if (!super.equals(obj)) 73 return false; 74 CachedLatLon other = (CachedLatLon) obj; 75 return Objects.equals(eastNorth, other.eastNorth); 76 } 77 78 @Override 64 79 public String toString() { 65 80 return "CachedLatLon[lat="+lat()+",lon="+lon()+']'; -
trunk/src/org/openstreetmap/josm/data/coor/EastNorth.java
r9243 r10334 13 13 private static final long serialVersionUID = 1L; 14 14 15 /** 16 * Constructs a new {@code EastNorth}. 17 * @param east easting 18 * @param north northing 19 */ 15 20 public EastNorth(double east, double north) { 16 21 super(east, north); 17 22 } 18 23 24 /** 25 * Returns easting. 26 * @return easting 27 */ 19 28 public double east() { 20 29 return x; 21 30 } 22 31 32 /** 33 * Returns northing. 34 * @return northing 35 */ 23 36 public double north() { 24 37 return y; … … 53 66 } 54 67 68 /** 69 * Scales this {@link EastNorth} instance to a given factor and returns the result. 70 * @param s factor 71 * @return The result. 72 */ 55 73 public EastNorth scale(double s) { 56 74 return new EastNorth(s * x, s * y); -
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r10181 r10334 56 56 public static final LatLon ZERO = new LatLon(0, 0); 57 57 58 /** 59 * North and south pole. 60 */ 58 /** North pole. */ 61 59 public static final LatLon NORTH_POLE = new LatLon(90, 0); 60 /** South pole. */ 62 61 public static final LatLon SOUTH_POLE = new LatLon(-90, 0); 63 62 … … 227 226 } 228 227 229 230 228 /** 231 229 * Returns the latitude, i.e., the north-south position in degrees. … … 487 485 public boolean equals(Object obj) { 488 486 if (this == obj) return true; 489 if ( !(obj instanceof LatLon)) return false;487 if (obj == null || getClass() != obj.getClass()) return false; 490 488 LatLon that = (LatLon) obj; 491 489 return Double.compare(that.x, x) == 0 && 492 490 Double.compare(that.y, y) == 0; 493 491 } 494 492
Note:
See TracChangeset
for help on using the changeset viewer.