Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. public class MapFragment extends Fragment {
  2.  
  3.  
  4. public View onCreateView(LayoutInflater inflater, ViewGroup container,
  5. Bundle savedInstanceState) {
  6.  
  7. mResourceProxy = new DefaultResourceProxyImpl(inflater.getContext().getApplicationContext());
  8. mMapView = new MapView(inflater.getContext(), 256, mResourceProxy);
  9.  
  10.  
  11. readfromFile2();
  12.  
  13. MapPoint mapPoint = new MapPoint();
  14. mapPoint.matchStringtogeoPoint(arrayList1);
  15.  
  16.  
  17. try {
  18. countLines();
  19. int Anzahlzeilen = counter;
  20.  
  21. } catch (IOException e) {
  22. // TODO Auto-generated catch block
  23. e.printStackTrace();
  24. }
  25.  
  26.  
  27. mapPoint.convertpoint();
  28.  
  29.  
  30.  
  31. View v = inflater.inflate(R.layout.meetfragment, null);
  32. mMapView = (MapView) v.findViewById(R.id.mapview);
  33. mMapView.setTileSource(TileSourceFactory.MAPNIK);
  34. mMapView.setBuiltInZoomControls(true);
  35. mMapView.setMultiTouchControls(true);
  36. mMapController = mMapView.getController();
  37. mMapController.setZoom(13);
  38.  
  39.  
  40. // show pathOverlay
  41. PathOverlay pathOverlay = new PathOverlay(Color.BLUE, this);
  42. pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat, mapPoint.var_lon));
  43. pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat1,mapPoint.var_lon1));
  44. pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat2, mapPoint.var_lon2));
  45. pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat3, mapPoint.var_lon3));
  46. pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat4, mapPoint.var_lon4));
  47.  
  48. pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat5, mapPoint.var_lon5));
  49. pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat6, mapPoint.var_lon6));
  50. pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat7, mapPoint.var_lon7));
  51. pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat8, mapPoint.var_lon8));
  52. pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat9, mapPoint.var_lon9));
  53. pathOverlay.getPaint().setStrokeWidth(10.0f);
  54. mMapView.getOverlays().add(pathOverlay);
  55.  
  56.  
  57. GeoPoint point2 = new GeoPoint(mapPoint.var_lat, mapPoint.var_lon);
  58. GeoPoint point1 = new GeoPoint(mapPoint.var_lat1, mapPoint.var_lon1);
  59. GeoPoint point3 = new GeoPoint(mapPoint.var_lat2, mapPoint.var_lon2);
  60. GeoPoint point4 = new GeoPoint(mapPoint.var_lat3, mapPoint.var_lon3);
  61. GeoPoint point5 = new GeoPoint(mapPoint.var_lat4, mapPoint.var_lon4);
  62. mMapController.setCenter(point2);
  63.  
  64.  
  65. ArrayList<OverlayItem> items = new ArrayList<OverlayItem>();
  66.  
  67. this.myLocationOverlay = new ItemizedIconOverlay<OverlayItem>(items,
  68. new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
  69. @Override
  70. public boolean onItemSingleTapUp(final int index,
  71. final OverlayItem item) {
  72.  
  73. return true;
  74. }
  75. @Override
  76. public boolean onItemLongPress(final int index,
  77. final OverlayItem item) {
  78.  
  79. return false;
  80. }
  81. }, mResourceProxy);
  82. this.mMapView.getOverlays().add(this.myLocationOverlay);
  83. mMapView.invalidate();
  84. return v;
  85.  
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement