Changeset 12161 in josm for trunk/src/org/openstreetmap/josm/data/coor
- Timestamp:
- 2017-05-15T15:43:30+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/coor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/CachedLatLon.java
r10334 r12161 5 5 6 6 import org.openstreetmap.josm.Main; 7 import org.openstreetmap.josm.data.projection.Projecting; 7 8 import org.openstreetmap.josm.data.projection.Projection; 8 9 … … 20 21 21 22 private EastNorth eastNorth; 22 private transient Projection proj;23 private transient Object cacheKey; 23 24 24 25 /** … … 37 38 public CachedLatLon(LatLon coor) { 38 39 super(coor.lat(), coor.lon()); 39 proj= null;40 cacheKey = null; 40 41 } 41 42 … … 45 46 */ 46 47 public CachedLatLon(EastNorth eastNorth) { 47 super(Main.getProjection().eastNorth2latlon(eastNorth)); 48 proj = Main.getProjection(); 48 this(eastNorth, Main.getProjection()); 49 } 50 51 private CachedLatLon(EastNorth eastNorth, Projection projection) { 52 super(projection.eastNorth2latlon(eastNorth)); 53 cacheKey = projection.getCacheKey(); 49 54 this.eastNorth = eastNorth; 50 55 } … … 55 60 * @return the internally cached east/north coordinates. null, if the globally defined projection is null 56 61 */ 57 public final EastNorth getEastNorth() { 58 if (!Objects.equals(proj, Main.getProjection())) { 59 proj = Main.getProjection(); 60 eastNorth = proj.latlon2eastNorth(this); 62 @Override 63 public final EastNorth getEastNorth(Projecting projecting) { 64 if (!Objects.equals(cacheKey, projecting.getCacheKey())) { 65 cacheKey = projecting.getCacheKey(); 66 eastNorth = projecting.latlon2eastNorth(this); 61 67 } 62 68 return eastNorth; -
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r12131 r12161 43 43 * @author Imi 44 44 */ 45 public class LatLon extends Coordinate { 45 public class LatLon extends Coordinate implements ILatLon { 46 46 47 47 private static final long serialVersionUID = 1L; … … 251 251 } 252 252 253 protected LatLon(LatLon coor) { 253 /** 254 * Creates a new LatLon object for the given coordinate 255 * @param coor The coordinates to copy from. 256 */ 257 public LatLon(ILatLon coor) { 254 258 super(coor.lon(), coor.lat()); 255 259 } … … 263 267 } 264 268 265 /** 266 * Returns the latitude, i.e., the north-south position in degrees. 267 * @return the latitude 268 */ 269 @Override 269 270 public double lat() { 270 271 return y; … … 286 287 } 287 288 288 /** 289 * Returns the longitude, i.e., the east-west position in degrees. 290 * @return the longitude 291 */ 289 @Override 292 290 public double lon() { 293 291 return x;
Note:
See TracChangeset
for help on using the changeset viewer.