private void toggleHeatMapVisibility() { if (heatMapVisible) { heatMapVisible = false; mapView.getOverlays().remove(heatMapOverlay); mapView.invalidate(); } else { heatMapVisible = true; mapView.getOverlays().add(heatMapOverlay); mapView.invalidate(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); noteOverlay.setContext(this); setContentView(R.layout.heat_map); mapView.getOverlays().add(routeOverlay); mapView.getOverlays().add(traceOverlay); if (!sessionManager.isSessionSaved()) { mapView.getOverlays().add(locationOverlay); } }
private void initializeMap() { mapView.setSatellite(settingsHelper.isSatelliteView()); if (settingsHelper.isFirstLaunch()) { mapView.getController().setZoom(16); Location location = locationHelper.getLastLocation(); if (location != null) { GeoPoint geoPoint = geoPoint(location); mapView.getController().setCenter(geoPoint); } settingsHelper.setFirstLaunch(false); } }
protected void centerMap() { if (locationHelper.getLastLocation() != null) { GeoPoint geoPoint = geoPoint(locationHelper.getLastLocation()); MapController controller = mapView.getController(); controller.animateTo(geoPoint); } }
@Override @Subscribe public void onEvent(SessionChangeEvent event) { super.onEvent(event); refreshNotes(); mapView.invalidate(); }
public void noteClicked(OverlayItem item, int index) { suppressNextTap(); mapView.getController().animateTo(item.getPoint()); noteClicked(index); }
private void showSession() { if (sessionManager.isSessionSaved() && zoomToSession) { LocationConversionHelper.BoundingBox boundingBox = boundingBox(sessionManager.getSession()); mapView.getController().zoomToSpan(boundingBox.getLatSpan(), boundingBox.getLonSpan()); mapView.getController().animateTo(boundingBox.getCenter()); } }
private void refresh() { boolean complete = (requestsOutstanding == 0) && soundTraceComplete; if (complete) { stopSpinner(); } else { startSpinner(); } if (!complete) mapView.invalidate(); }
private void initialize() { if (!initialized) { showSession(); mapView.getOverlays().add(noteOverlay); initialized = true; } }
@Override public void onClick(View view) { switch (view.getId()) { case R.id.toggle_heat_map_button: toggleHeatMapVisibility(); updateButtons(); break; case R.id.zoom_in: mapView.getController().zoomIn(); break; case R.id.zoom_out: mapView.getController().zoomOut(); break; case R.id.locate: centerMap(); break; case R.id.view_photo: Intents.viewPhoto(this, photoUri()); break; default: super.onClick(view); } }
@Subscribe public void onEvent(LocationEvent event) { updateRoute(); mapView.invalidate(); }
@Subscribe public void onEvent(MotionEvent event) { mapView.dispatchTouchEvent(event); }
@Subscribe public void onEvent(DoubleTapEvent event) { mapView.getController().zoomIn(); }