/[projects]/android/TrainInfo/src/dk/thoerup/traininfo/stationmap/GeoPair.java
ViewVC logotype

Annotation of /android/TrainInfo/src/dk/thoerup/traininfo/stationmap/GeoPair.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 369 - (hide annotations) (download)
Wed Sep 30 16:40:48 2009 UTC (14 years, 8 months ago) by torben
File size: 1407 byte(s)
Draw user location on stationmap,
When a station icon is pressed, show the station name in a toaster box
1 torben 368 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 torben 369 private String description;
17 torben 368
18     public GeoPair() {
19     latitude = 0.0;
20     longitude = 0.0;
21 torben 369 description = "";
22 torben 368 }
23    
24     public GeoPair(double lat, double lng) {
25     latitude = lat;
26     longitude = lng;
27 torben 369 description = "";
28 torben 368 }
29 torben 369
30     public GeoPair(double lat, double lng, String desc) {
31     latitude = lat;
32     longitude = lng;
33     description = desc;
34     }
35 torben 368
36     // conversion functions
37     public GeoPoint toGeopoint() {
38     return new GeoPoint((int)(latitude*1000000), (int)(longitude*1000000));
39     }
40    
41     public static GeoPair fromLocation(Location loc) {
42     return new GeoPair(loc.getLatitude(), loc.getLongitude());
43     }
44    
45     public double getLatitude() {
46     return latitude;
47     }
48    
49     // setters and getters
50     public void setLatitude(double latitude) {
51     this.latitude = latitude;
52     }
53    
54     public double getLongitude() {
55     return longitude;
56     }
57    
58     public void setLongitude(double longitude) {
59     this.longitude = longitude;
60     }
61 torben 369
62     public String getDescription() {
63     return description;
64     }
65    
66     public void setDescription(String description) {
67     this.description = description;
68     }
69    
70 torben 368
71     }

  ViewVC Help
Powered by ViewVC 1.1.20