1 |
package dk.thoerup.traininfo.stationmap;
|
2 |
|
3 |
import java.io.Serializable;
|
4 |
|
5 |
import android.location.Location;
|
6 |
|
7 |
import com.google.android.maps.GeoPoint;
|
8 |
|
9 |
|
10 |
public class GeoPair implements Serializable{
|
11 |
|
12 |
private static final long serialVersionUID = 1L;
|
13 |
|
14 |
private double latitude;
|
15 |
private double longitude;
|
16 |
|
17 |
public GeoPair() {
|
18 |
latitude = 0.0;
|
19 |
longitude = 0.0;
|
20 |
}
|
21 |
|
22 |
public GeoPair(double lat, double lng) {
|
23 |
latitude = lat;
|
24 |
longitude = lng;
|
25 |
}
|
26 |
|
27 |
// conversion functions
|
28 |
public GeoPoint toGeopoint() {
|
29 |
return new GeoPoint((int)(latitude*1000000), (int)(longitude*1000000));
|
30 |
}
|
31 |
|
32 |
public static GeoPair fromLocation(Location loc) {
|
33 |
return new GeoPair(loc.getLatitude(), loc.getLongitude());
|
34 |
}
|
35 |
|
36 |
public double getLatitude() {
|
37 |
return latitude;
|
38 |
}
|
39 |
|
40 |
// setters and getters
|
41 |
public void setLatitude(double latitude) {
|
42 |
this.latitude = latitude;
|
43 |
}
|
44 |
|
45 |
public double getLongitude() {
|
46 |
return longitude;
|
47 |
}
|
48 |
|
49 |
public void setLongitude(double longitude) {
|
50 |
this.longitude = longitude;
|
51 |
}
|
52 |
|
53 |
|
54 |
|
55 |
}
|