/[projects]/android/TrainInfo/src/dk/thoerup/traininfo/provider/XmlStationProvider.java
ViewVC logotype

Diff of /android/TrainInfo/src/dk/thoerup/traininfo/provider/XmlStationProvider.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1030 by torben, Mon Aug 2 23:18:53 2010 UTC revision 1031 by torben, Wed Sep 8 08:45:18 2010 UTC
# Line 24  public class XmlStationProvider implemen Line 24  public class XmlStationProvider implemen
24          AndroidTimeoutCache<String, List<StationBean>> stationCache = new AndroidTimeoutCache<String, List<StationBean>>(CACHE_TIMEOUT);          AndroidTimeoutCache<String, List<StationBean>> stationCache = new AndroidTimeoutCache<String, List<StationBean>>(CACHE_TIMEOUT);
25                    
26    
27            double roundToPlaces(double value, int places) {
28                    double pow = Math.pow(10, places);
29                    double temp = Math.round( value*pow );
30                    
31                    return temp / pow;
32            }
33    
34          @Override          @Override
35          public List<StationBean> lookupStations(Location location) {          public List<StationBean> lookupStations(Location location) {
36                  String url = XmlUtil.SERVICE_BASE + "/LocateStations?latitude=" + (float)location.getLatitude() + "&longitude=" + (float)location.getLongitude();                  double lat = roundToPlaces(location.getLatitude(), 4);
37                    double lng = roundToPlaces(location.getLongitude(), 4);
38                    
39                    String url = XmlUtil.SERVICE_BASE + "/LocateStations?latitude=" + lat + "&longitude=" + lng;
40                  Log.i("url", url);                  Log.i("url", url);
41                  return lookupStationsWorker(url);                  return lookupStationsWorker(url);
42          }          }

Legend:
Removed from v.1030  
changed lines
  Added in v.1031

  ViewVC Help
Powered by ViewVC 1.1.20