Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MapFragment extends Fragment {
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- mResourceProxy = new DefaultResourceProxyImpl(inflater.getContext().getApplicationContext());
- mMapView = new MapView(inflater.getContext(), 256, mResourceProxy);
- readfromFile2();
- MapPoint mapPoint = new MapPoint();
- mapPoint.matchStringtogeoPoint(arrayList1);
- try {
- countLines();
- int Anzahlzeilen = counter;
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- mapPoint.convertpoint();
- View v = inflater.inflate(R.layout.meetfragment, null);
- mMapView = (MapView) v.findViewById(R.id.mapview);
- mMapView.setTileSource(TileSourceFactory.MAPNIK);
- mMapView.setBuiltInZoomControls(true);
- mMapView.setMultiTouchControls(true);
- mMapController = mMapView.getController();
- mMapController.setZoom(13);
- // show pathOverlay
- PathOverlay pathOverlay = new PathOverlay(Color.BLUE, this);
- pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat, mapPoint.var_lon));
- pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat1,mapPoint.var_lon1));
- pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat2, mapPoint.var_lon2));
- pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat3, mapPoint.var_lon3));
- pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat4, mapPoint.var_lon4));
- pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat5, mapPoint.var_lon5));
- pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat6, mapPoint.var_lon6));
- pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat7, mapPoint.var_lon7));
- pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat8, mapPoint.var_lon8));
- pathOverlay.addPoint(new GeoPoint(mapPoint.var_lat9, mapPoint.var_lon9));
- pathOverlay.getPaint().setStrokeWidth(10.0f);
- mMapView.getOverlays().add(pathOverlay);
- GeoPoint point2 = new GeoPoint(mapPoint.var_lat, mapPoint.var_lon);
- GeoPoint point1 = new GeoPoint(mapPoint.var_lat1, mapPoint.var_lon1);
- GeoPoint point3 = new GeoPoint(mapPoint.var_lat2, mapPoint.var_lon2);
- GeoPoint point4 = new GeoPoint(mapPoint.var_lat3, mapPoint.var_lon3);
- GeoPoint point5 = new GeoPoint(mapPoint.var_lat4, mapPoint.var_lon4);
- mMapController.setCenter(point2);
- ArrayList<OverlayItem> items = new ArrayList<OverlayItem>();
- this.myLocationOverlay = new ItemizedIconOverlay<OverlayItem>(items,
- new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
- @Override
- public boolean onItemSingleTapUp(final int index,
- final OverlayItem item) {
- return true;
- }
- @Override
- public boolean onItemLongPress(final int index,
- final OverlayItem item) {
- return false;
- }
- }, mResourceProxy);
- this.mMapView.getOverlays().add(this.myLocationOverlay);
- mMapView.invalidate();
- return v;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement