Last change
on this file since 1724 was 1724, checked in by stoecker, 15 years ago |
some more changes and bug fixes related to new projection stuff - GPX should now work also
|
File size:
1.1 KB
|
Line | |
---|
1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.data.coor;
|
---|
3 |
|
---|
4 | import org.openstreetmap.josm.Main;
|
---|
5 | import org.openstreetmap.josm.data.projection.Projection;
|
---|
6 |
|
---|
7 | public class CachedLatLon extends LatLon {
|
---|
8 | private EastNorth eastNorth;
|
---|
9 | private Projection proj;
|
---|
10 |
|
---|
11 | public CachedLatLon(double lat, double lon) {
|
---|
12 | super(lat, lon);
|
---|
13 | }
|
---|
14 |
|
---|
15 | public CachedLatLon(LatLon coor) {
|
---|
16 | super(coor.lat(), coor.lon());
|
---|
17 | proj = null;
|
---|
18 | }
|
---|
19 |
|
---|
20 | public final void setCoor(LatLon coor) {
|
---|
21 | setLocation(coor.lon(), coor.lat());
|
---|
22 | proj = null;
|
---|
23 | }
|
---|
24 |
|
---|
25 | public final void setEastNorth(EastNorth eastNorth) {
|
---|
26 | proj = Main.proj;
|
---|
27 | eastNorth = eastNorth;
|
---|
28 | LatLon l = proj.eastNorth2latlon(eastNorth);
|
---|
29 | setLocation(l.lat(), l.lon());
|
---|
30 | }
|
---|
31 |
|
---|
32 | public final EastNorth getEastNorth() {
|
---|
33 | if(proj != Main.proj)
|
---|
34 | {
|
---|
35 | proj = Main.proj;
|
---|
36 | eastNorth = proj.latlon2eastNorth(this);
|
---|
37 | }
|
---|
38 | return eastNorth;
|
---|
39 | }
|
---|
40 | @Override public String toString() {
|
---|
41 | return "CachedLatLon[lat="+lat()+",lon="+lon()+"]";
|
---|
42 | }
|
---|
43 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.