Projektteil 2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

EarthquakeLocation.java 4.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package de.edotzlaff.detection;
  2. import androidx.fragment.app.FragmentActivity;
  3. import android.os.Bundle;
  4. import com.google.android.gms.maps.CameraUpdateFactory;
  5. import com.google.android.gms.maps.GoogleMap;
  6. import com.google.android.gms.maps.OnMapReadyCallback;
  7. import com.google.android.gms.maps.SupportMapFragment;
  8. import com.google.android.gms.maps.model.BitmapDescriptorFactory;
  9. import com.google.android.gms.maps.model.LatLng;
  10. import com.google.android.gms.maps.model.MarkerOptions;
  11. public class EarthquakeLocation extends FragmentActivity implements OnMapReadyCallback {
  12. private GoogleMap mMap;
  13. @Override
  14. protected void onCreate(Bundle savedInstanceState) {
  15. super.onCreate(savedInstanceState);
  16. setContentView(R.layout.activity_earthquake_location);
  17. // Obtain the SupportMapFragment and get notified when the map is ready to be used.
  18. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
  19. .findFragmentById(R.id.map);
  20. mapFragment.getMapAsync(this);
  21. }
  22. //##########################################################################################################################################################################
  23. //################################################################## vvv DB Code vvv #####################################################################################
  24. //TODO Aron
  25. //################################################################## ^^^^ DB Code ^^^^ ###################################################################################
  26. //##########################################################################################################################################################################
  27. //##########################################################################################################################################################################
  28. //################################################################## vvv Calculate Epicenter vvv #########################################################################
  29. //TODO Jan
  30. //################################################################## ^^^^ Calculate Epicenter ^^^^ #######################################################################
  31. //##########################################################################################################################################################################
  32. //##########################################################################################################################################################################
  33. //################################################################## vvv Maps Code vvv ###################################################################################
  34. @Override
  35. public void onMapReady(GoogleMap googleMap) {
  36. mMap = googleMap;
  37. //TODO Aron: Daten aus DB in die jeweiligen Devices einsetzten
  38. //aus DB für Device 1 long lat
  39. LatLng divice1 = new LatLng(-34, 152);
  40. mMap.addMarker(new MarkerOptions().position(divice1).title("Device 1").icon(BitmapDescriptorFactory
  41. .defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));
  42. //aus DB für Device 2 long lat
  43. LatLng divice2 = new LatLng(-33, 152);
  44. mMap.addMarker(new MarkerOptions().position(divice2).title("Device 2").icon(BitmapDescriptorFactory
  45. .defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));
  46. //aus DB für Device 3 long lat
  47. LatLng divice3 = new LatLng(-34, 150);
  48. mMap.addMarker(new MarkerOptions().position(divice3).title("Device 3").icon(BitmapDescriptorFactory
  49. .defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));
  50. //man könnten noch eine IF Abfrage einbauen falls es 4 Devices gibt
  51. // Add a marker in Epicenter
  52. LatLng epicenter = new LatLng(-34, 151);
  53. mMap.addMarker(new MarkerOptions().position(epicenter).title("Epicenter"));
  54. mMap.moveCamera(CameraUpdateFactory.newLatLng(epicenter));
  55. }
  56. //################################################################## ^^^^ Maps Code ^^^^ #################################################################################
  57. //##########################################################################################################################################################################
  58. }