private Polygon drawLine(Event event1, Event event2, int width, int color) { // Log.e(tag, "calling drawline with events "+event1.toString()+" and "+event2.toString()); return mMap.addPolygon( new PolygonOptions() .add( new LatLng(event1.getLat(), event1.getLng()), new LatLng(event2.getLat(), event2.getLng())) .strokeWidth(width) .strokeColor(color)); }
private void setUpMap() { mMap.setOnMarkerClickListener( new GoogleMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { // Log.e(tag, "clicked on marker"); String eventId = marker.getSnippet(); setEvent(eventId); refreshIfNeeded(); return false; } }); mMap.setMapType(Settings.getMapType()); computeMarkerColors(); showEvents(); selEventId = ((MapActivityInterface) getActivity()).getEventId(); if (selEventId != null) { Log.e(tag, "Setting up initial event"); setEvent(selEventId); Event e = MainModel.getEvent(selEventId); mMap.animateCamera( CameraUpdateFactory.newLatLngZoom(new LatLng(e.getLat(), e.getLng()), 12.0f)); } // mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitude, // longitude), 12.0f)); }
private void showEvent(String eventId) { Event e = MainModel.getEvent(eventId); LatLng pos = new LatLng( e.getLat() + Math.random() / MARKER_FUDGE_DENOM, e.getLng() + Math.random() / MARKER_FUDGE_DENOM); String description = e.getDescription(); float event_color = (description_hues.containsKey(description)) ? description_hues.get(description) : DEFAULT_MARKER_COLOR; mMap.addMarker( new MarkerOptions() .position(pos) .snippet(eventId) .icon(BitmapDescriptorFactory.defaultMarker(event_color))); }