1 |
torben |
368 |
package dk.thoerup.traininfo.stationmap;
|
2 |
|
|
|
3 |
|
|
import java.util.List;
|
4 |
|
|
|
5 |
|
|
import android.content.Intent;
|
6 |
|
|
import android.os.Bundle;
|
7 |
|
|
import android.util.Log;
|
8 |
|
|
|
9 |
|
|
import com.google.android.maps.MapActivity;
|
10 |
|
|
import com.google.android.maps.MapController;
|
11 |
|
|
import com.google.android.maps.MapView;
|
12 |
|
|
|
13 |
|
|
import dk.thoerup.traininfo.R;
|
14 |
|
|
|
15 |
|
|
public class StationMapView extends MapActivity {
|
16 |
|
|
|
17 |
|
|
MapView mapView;
|
18 |
|
|
|
19 |
|
|
MapController mapController;
|
20 |
|
|
|
21 |
|
|
@Override
|
22 |
|
|
protected void onCreate(Bundle icicle) {
|
23 |
|
|
super.onCreate(icicle);
|
24 |
|
|
setContentView(R.layout.stationmap);
|
25 |
|
|
|
26 |
|
|
mapView = (MapView) findViewById(R.id.mapview);
|
27 |
|
|
mapView.setBuiltInZoomControls(true);
|
28 |
|
|
mapView.setSatellite(false);
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
mapController = mapView.getController();
|
32 |
|
|
mapController.setZoom(12);
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
Intent launchedBy = getIntent();
|
37 |
|
|
|
38 |
|
|
GeoPair userLocation = (GeoPair) launchedBy.getSerializableExtra("userlocation");
|
39 |
|
|
Log.i("MapView", "" + userLocation.getLatitude() + "," + userLocation.getLongitude());
|
40 |
|
|
mapController.setCenter( userLocation.toGeopoint() );
|
41 |
|
|
|
42 |
|
|
StationOverlay stationOverlay = new StationOverlay(getResources().getDrawable(R.drawable.train_24));
|
43 |
|
|
|
44 |
|
|
stationOverlay.addUserLocation( userLocation );
|
45 |
|
|
|
46 |
|
|
List<GeoPair> stations = (List<GeoPair>) launchedBy.getSerializableExtra("stations");
|
47 |
|
|
stationOverlay.addStations( stations );
|
48 |
|
|
|
49 |
|
|
mapView.getOverlays().add( stationOverlay );
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
@Override
|
54 |
|
|
protected boolean isRouteDisplayed() {
|
55 |
|
|
return false;
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
}
|