Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65cabe66e9 | ||
|
|
f875ab6415 | ||
|
|
ba9e3d5aa7 | ||
|
|
9f1f243f50 | ||
|
|
2c9c2ef7c4 | ||
|
|
3ba534c285 | ||
|
|
dfffc2c9f1 | ||
|
|
0d8e04f9e0 | ||
|
|
2e0da83888 | ||
|
|
d3a1380658 | ||
|
|
48d53ca1d9 | ||
|
|
8c780e9462 | ||
|
|
8f2eb9b012 | ||
|
|
71b53e42e6 | ||
|
|
e9c0ddb711 | ||
|
|
00dbbc810d | ||
|
|
b88f45b728 | ||
|
|
59880392f6 | ||
|
|
022ecd94a6 | ||
|
|
ab02421307 | ||
|
|
77900b3088 |
No files matched your search
Generated
+1
@@ -0,0 +1 @@
|
||||
Detection
|
||||
@@ -1,5 +1,7 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'com.google.gms.google-services'
|
||||
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -34,10 +36,12 @@ dependencies {
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'com.google.android.gms:play-services-maps:17.0.1'
|
||||
implementation 'com.google.firebase:firebase-database:20.0.0'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
implementation "com.google.android.gms:play-services-location:15.0.1" //Important to find the location from the device
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
|
||||
implementation("com.google.guava:guava:30.1.1-jre")
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "957720376634",
|
||||
"firebase_url": "https://schockwelle-mdt5-g1-default-rtdb.europe-west1.firebasedatabase.app",
|
||||
"project_id": "schockwelle-mdt5-g1",
|
||||
"storage_bucket": "schockwelle-mdt5-g1.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:957720376634:android:7e4e3f644d052e6f70cc03",
|
||||
"android_client_info": {
|
||||
"package_name": "de.edotzlaff.detection"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "957720376634-gvj86hvfrnt5npvqfbsb8lnu77fgaumh.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyDNnG6F_VIzKbu4r7QBqsUZ3z6ELFbgyuc"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "957720376634-gvj86hvfrnt5npvqfbsb8lnu77fgaumh.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:957720376634:android:fdc03f689ff71b2f70cc03",
|
||||
"android_client_info": {
|
||||
"package_name": "de.edotzlaff.schockwelle"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "957720376634-gvj86hvfrnt5npvqfbsb8lnu77fgaumh.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyDNnG6F_VIzKbu4r7QBqsUZ3z6ELFbgyuc"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": [
|
||||
{
|
||||
"client_id": "957720376634-gvj86hvfrnt5npvqfbsb8lnu77fgaumh.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
@@ -10,12 +10,13 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:icon="@mipmap/ic_trianglesign"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:roundIcon="@mipmap/ic_trianglesign"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Detection">
|
||||
|
||||
|
||||
@@ -6,7 +6,10 @@ import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.os.Build;
|
||||
import android.os.CountDownTimer;
|
||||
import android.provider.ContactsContract;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
@@ -20,10 +23,21 @@ import com.google.android.gms.maps.SupportMapFragment;
|
||||
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
|
||||
import de.edotzlaff.detection.detektion.Detektionssignal;
|
||||
import de.edotzlaff.detection.detektion.Epizentrum;
|
||||
import de.edotzlaff.detection.detektion.Erdbeben;
|
||||
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.Deg2UTM;
|
||||
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.Koordinaten;
|
||||
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.UTM2Deg;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -31,21 +45,81 @@ public class EarthquakeLocation extends FragmentActivity implements OnMapReadyCa
|
||||
|
||||
private GoogleMap mMap;
|
||||
private static final String TAGEPIZENTRUM = "Epizentrum";
|
||||
private DatabaseReference mDatenbank;
|
||||
private double latitudeD1, latitudeD2, latitudeD3, latitudeD4, latitudeEPI;
|
||||
private double longitudeD1, longitudeD2, longitudeD3, longitudeD4, lonitudeEPI;
|
||||
private String dev1, dev2, dev3, dev4;
|
||||
Epizentrum epizentrum;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_earthquake_location);
|
||||
getLocationInfo();
|
||||
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
|
||||
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
|
||||
.findFragmentById(R.id.map);
|
||||
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
|
||||
mapFragment.getMapAsync(this);
|
||||
}
|
||||
|
||||
//##########################################################################################################################################################################
|
||||
//################################################################## vvv DB Code vvv #####################################################################################
|
||||
|
||||
//TODO Aron
|
||||
|
||||
public void getLocationInfo()
|
||||
{
|
||||
mDatenbank = FirebaseDatabase.getInstance().getReference().child("overviewdetection");
|
||||
mDatenbank.get().addOnCompleteListener(new OnCompleteListener<DataSnapshot>() {
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<DataSnapshot> task) {
|
||||
if (!task.isSuccessful()) {
|
||||
System.out.println("Datenbank Fehler in getDataBaseValuesNoListener");
|
||||
}
|
||||
else{
|
||||
defineGPSforMapping(task.getResult());
|
||||
epizentrum = ermittleEpizentrum(task.getResult());
|
||||
//ermittleEpizentrum(task.getResult());
|
||||
//mapToDetektionssignale(task.getResult());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void defineGPSforMapping(DataSnapshot data)
|
||||
{
|
||||
String breitengradString;
|
||||
String laengengradString;
|
||||
String androidID;
|
||||
for(int i =1; i<=3; i++)
|
||||
{
|
||||
breitengradString = data.child("IDG" + i).child("d_breitengrad").getValue().toString();
|
||||
laengengradString = data.child("IDG" + i).child("e_laengengrad").getValue().toString();
|
||||
androidID = data.child("IDG" + i).child("a_androidid").getValue().toString();
|
||||
double breitengrad = Double.parseDouble(breitengradString);
|
||||
double laengengrad = Double.parseDouble(laengengradString);
|
||||
|
||||
switch (i){
|
||||
case 1:
|
||||
latitudeD1 = breitengrad;
|
||||
longitudeD1 = laengengrad;
|
||||
dev1 = androidID;
|
||||
break;
|
||||
case 2:
|
||||
latitudeD2 = breitengrad;
|
||||
longitudeD2 = laengengrad;
|
||||
dev2 = androidID;
|
||||
break;
|
||||
case 3:
|
||||
latitudeD3 = breitengrad;
|
||||
longitudeD3 = laengengrad;
|
||||
dev3 = androidID;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//################################################################## ^^^^ DB Code ^^^^ ###################################################################################
|
||||
//##########################################################################################################################################################################
|
||||
@@ -53,81 +127,118 @@ public class EarthquakeLocation extends FragmentActivity implements OnMapReadyCa
|
||||
//##########################################################################################################################################################################
|
||||
//################################################################## vvv Calculate Epicenter vvv #########################################################################
|
||||
|
||||
//TODO Jan
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
/* public Epizentrum ermittleEpizentrum(DataSnapshot data)
|
||||
public Epizentrum ermittleEpizentrum(DataSnapshot data)
|
||||
{
|
||||
Log.i(TAGEPIZENTRUM, "Start Ermittle Epizentrum");
|
||||
Erdbeben erdbeben = new Erdbeben();
|
||||
erdbeben.addDetektionssignalList(mapToDetektionssignale(data));
|
||||
|
||||
Epizentrum epizentrum = new Epizentrum();
|
||||
epizentrum = erdbeben.ermittleEpizentrum();
|
||||
|
||||
Epizentrum epizentrum = erdbeben.ermittleEpizentrum();
|
||||
if(Objects.isNull(epizentrum))
|
||||
{
|
||||
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!Kein Epizentrum vorhanden!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
Log.i(TAGEPIZENTRUM, "Kein Epizentrum vorhanden");
|
||||
}
|
||||
else
|
||||
{
|
||||
UTM2Deg utm2Deg = new UTM2Deg();
|
||||
utm2Deg.convertToDeg(32,'U',epizentrum.getKoordinaten().getX(),epizentrum.getKoordinaten().getY());
|
||||
epizentrum.getKoordinaten().setLocation(utm2Deg.getLatitude(), utm2Deg.getLongitude());
|
||||
Log.i(TAGEPIZENTRUM, "Epizentrum konnte ermittelt werden, Koordinaten: " + epizentrum.getKoordinaten().getX() + " " + epizentrum.getKoordinaten().getY());
|
||||
Log.i(TAGEPIZENTRUM, "Enstehungszeitpunkt: " + epizentrum.getEntstehungsZeitpunkt());
|
||||
}
|
||||
return epizentrum;
|
||||
|
||||
return epizentrum;
|
||||
}
|
||||
*/
|
||||
/* public ArrayList<Detektionssignal> mapToDetektionssignale(DataSnapshot data)
|
||||
|
||||
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public ArrayList<Detektionssignal> mapToDetektionssignale(DataSnapshot data)
|
||||
{
|
||||
ArrayList<Detektionssignal> detektionssignale = new ArrayList<>();
|
||||
for(data.child("overviewnodes").getChildernKey)
|
||||
for(int i=1; i<=3; i++)
|
||||
{
|
||||
Detektionssignal detektionssignal = new Detektionssignal();
|
||||
detektionssignal.setAnkunftsZeit();
|
||||
detektionssignal.setDeviceId();
|
||||
detektionssignal.setKoordinaten(data.child("overviewnodes").child("IDG" + f).child("d_breitengrad").getValue().toString(),
|
||||
data.child("overviewnodes").child("IDG" + f).child("e_laengengrad").getValue().toString());
|
||||
detektionssignal.setGeschwErdbeben();
|
||||
|
||||
//LocalDateTime als LocalDateTime
|
||||
String localdatetimeString = data.child("IDG" + i).child("b_localdatetime").getValue().toString();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;
|
||||
LocalDateTime localdatetime = LocalDateTime.parse(localdatetimeString, formatter);
|
||||
detektionssignal.setAnkunftsZeit(localdatetime);
|
||||
|
||||
//ID als String
|
||||
detektionssignal.setDeviceId(data.child("IDG" + i).child("a_androidid").getValue().toString());
|
||||
|
||||
//Koordinaten
|
||||
String breitengradString = data.child("IDG" + i).child("d_breitengrad").getValue().toString();
|
||||
String laengengradString = data.child("IDG" + i).child("e_laengengrad").getValue().toString();
|
||||
double breitengrad = Double.parseDouble(breitengradString);
|
||||
double laengengrad = Double.parseDouble(laengengradString);
|
||||
|
||||
Deg2UTM deg2UTM = new Deg2UTM(breitengrad, laengengrad);
|
||||
|
||||
Koordinaten koordinaten = new Koordinaten(deg2UTM.getEasting(), deg2UTM.getNorthing());
|
||||
detektionssignal.setKoordinaten(koordinaten);
|
||||
|
||||
//Welle in m/s
|
||||
String welle = data.child("IDG" + i).child("w_wellengeschwindigkeit").getValue().toString();
|
||||
int wellengeschwindigkeit = Integer.parseInt(welle);
|
||||
detektionssignal.setGeschwErdbeben(wellengeschwindigkeit);
|
||||
|
||||
detektionssignale.add(detektionssignal);
|
||||
}
|
||||
|
||||
return detektionssignale;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//################################################################## ^^^^ Calculate Epicenter ^^^^ #######################################################################
|
||||
//##########################################################################################################################################################################
|
||||
|
||||
|
||||
|
||||
//##########################################################################################################################################################################
|
||||
//################################################################## vvv Maps Code vvv ###################################################################################
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
@Override
|
||||
public void onMapReady(GoogleMap googleMap) {
|
||||
mMap = googleMap;
|
||||
|
||||
//TODO Aron: Daten aus DB in die jeweiligen Devices einsetzten
|
||||
if(Objects.isNull(epizentrum))
|
||||
{
|
||||
System.out.println("--------Keine Epizentrum Koordinaten verfügbar");
|
||||
}else
|
||||
{
|
||||
System.out.println(">>>>>>>>Epizentrum Koordinaten");
|
||||
latitudeEPI = epizentrum.getKoordinaten().getX();
|
||||
lonitudeEPI = epizentrum.getKoordinaten().getY();
|
||||
System.out.println("Breitengrad/Latitude: " + latitudeEPI);
|
||||
System.out.println("Längengrad/Longitude: " + lonitudeEPI);
|
||||
}
|
||||
|
||||
//aus DB für Device 1 long lat
|
||||
LatLng divice1 = new LatLng(-34, 152);
|
||||
mMap.addMarker(new MarkerOptions().position(divice1).title("Device 1").icon(BitmapDescriptorFactory
|
||||
LatLng device1 = new LatLng(latitudeD1, longitudeD1);
|
||||
mMap.addMarker(new MarkerOptions().position(device1).title("Device 1").icon(BitmapDescriptorFactory
|
||||
.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));
|
||||
|
||||
//aus DB für Device 2 long lat
|
||||
LatLng divice2 = new LatLng(-33, 152);
|
||||
mMap.addMarker(new MarkerOptions().position(divice2).title("Device 2").icon(BitmapDescriptorFactory
|
||||
LatLng device2 = new LatLng(latitudeD2, longitudeD2);
|
||||
mMap.addMarker(new MarkerOptions().position(device2).title("Device 2").icon(BitmapDescriptorFactory
|
||||
.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));
|
||||
|
||||
//aus DB für Device 3 long lat
|
||||
LatLng divice3 = new LatLng(-34, 150);
|
||||
mMap.addMarker(new MarkerOptions().position(divice3).title("Device 3").icon(BitmapDescriptorFactory
|
||||
LatLng device3 = new LatLng(latitudeD3, longitudeD3);
|
||||
mMap.addMarker(new MarkerOptions().position(device3).title("Device 3").icon(BitmapDescriptorFactory
|
||||
.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)));
|
||||
|
||||
//man könnten noch eine IF Abfrage einbauen falls es 4 Devices gibt
|
||||
|
||||
|
||||
|
||||
// Add a marker in Epicenter
|
||||
LatLng epicenter = new LatLng(-34, 151);
|
||||
LatLng epicenter = new LatLng(latitudeEPI, lonitudeEPI);
|
||||
mMap.addMarker(new MarkerOptions().position(epicenter).title("Epicenter"));
|
||||
mMap.moveCamera(CameraUpdateFactory.newLatLng(epicenter));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package de.edotzlaff.detection;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
@@ -15,8 +16,11 @@ import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.location.Location;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.provider.ContactsContract;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
@@ -28,14 +32,16 @@ import com.google.android.gms.common.GoogleApiAvailability;
|
||||
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||
import com.google.android.gms.location.LocationServices;
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.android.gms.maps.OnMapReadyCallback;
|
||||
import com.google.android.gms.maps.SupportMapFragment;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseError;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
import com.google.firebase.database.FirebaseDatabase;
|
||||
import com.google.firebase.database.ValueEventListener;
|
||||
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.Calendar;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -53,17 +59,21 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
Long currentTime;
|
||||
Location currentLocation;
|
||||
// private DatabaseReference mDatenbank;
|
||||
private DatabaseReference mDatenbank;
|
||||
private double breitengrad;
|
||||
private double laengengrad;
|
||||
private boolean useOwnGPS = true;
|
||||
private int indexID = 1;
|
||||
private int writtenDevices = 1;
|
||||
private boolean allowCalculation = true;
|
||||
private boolean enableDisplayReset = true;
|
||||
//##########################################################################################################################################################################
|
||||
//################################################################## vvv SensorParameter vvv ##############################################################################
|
||||
private SensorManager mSensorManager;
|
||||
private static final float mUpperThreshold = 1.0f; // für Emulator auf 1.5 setzen
|
||||
private static final float mUpperThreshold = 1.0f; // für Emulator auf 1.5 setzen //Für passende Empfindlichkeit auf 0.025f setzen ohne Smartphonehülle
|
||||
//private static final float mUpperThreshold = 1.0f; // für Emulator auf 1.5 setzen //Für passende Empfindlichkeit auf 0.025f setzen ohne Smartphonehülle
|
||||
private static final float mLowerThreshold = 0.5f; // für Emulator auf 0.5 setzen
|
||||
private static final long mShakeDetectionLockTimeMicroSeconds = 1000;
|
||||
private static final long mShakeDetectionLockTimeMicroSeconds = 3500;
|
||||
private float mAccel;
|
||||
private float mAccelCurrent;
|
||||
private float mAccelLast;
|
||||
@@ -78,18 +88,13 @@ public class MainActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
if (isServiceOK()){
|
||||
init();
|
||||
}
|
||||
|
||||
//Detection funktion here
|
||||
sensorManagementInit();
|
||||
initDataBase();
|
||||
getLocationPermission();
|
||||
|
||||
//DB function here
|
||||
|
||||
|
||||
getDataBaseValuesWithListener();
|
||||
}
|
||||
|
||||
//################################################################## vvv Detection Code vvv ###################################################################################
|
||||
@@ -102,9 +107,10 @@ public class MainActivity extends AppCompatActivity {
|
||||
mAccel = 1f;
|
||||
mAccelCurrent = SensorManager.GRAVITY_EARTH;
|
||||
mAccelLast = SensorManager.GRAVITY_EARTH;
|
||||
mShakeDetectionIsActive = true;
|
||||
mShakeDetectionIsActive = false;
|
||||
mShakeDetected = false;
|
||||
}
|
||||
|
||||
private final SensorEventListener mSensorListener = new SensorEventListener() {
|
||||
@Override
|
||||
public void onSensorChanged(SensorEvent event) {
|
||||
@@ -115,10 +121,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
mAccelCurrent = (float) Math.sqrt((double) (x * x + y * y + z * z));
|
||||
float delta = mAccelCurrent - mAccelLast;
|
||||
mAccel = mAccel * 0.9f + delta;
|
||||
Log.d(TAG,"mAccel: "+ mAccel);
|
||||
// Log.d(TAG,"mAccel: "+ mAccel);
|
||||
if (mShakeDetectionIsActive && !mShakeDetected) {
|
||||
if(Math.abs(mAccel) > mUpperThreshold) {
|
||||
new CountDownTimer(500, 10) {
|
||||
|
||||
new CountDownTimer(1000, 10) {
|
||||
|
||||
public void onTick(long millisUntilFinished) {
|
||||
mShakeDetectionIsActive = false;
|
||||
@@ -131,14 +138,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
public void onFinish() {
|
||||
if (Math.abs(mAccel) > mUpperThreshold) {
|
||||
mShakeDetectionIsActive = false;
|
||||
mShakeDetected = true;
|
||||
|
||||
earthquakeDetected();
|
||||
|
||||
} else {
|
||||
mShakeDetectionIsActive = true;
|
||||
mShakeDetected = false;
|
||||
@@ -155,26 +159,12 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private void earthquakeDetected()
|
||||
{
|
||||
Toast.makeText(getApplicationContext(), "!Earthquake detected!", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getApplicationContext(), "Earthquake detected", Toast.LENGTH_SHORT).show();
|
||||
Log.d(TAG,"!Earthquake detected!");
|
||||
//setDataBaseValues();
|
||||
new CountDownTimer(mShakeDetectionLockTimeMicroSeconds, 100) {
|
||||
|
||||
public void onTick(long millisUntilFinished) {
|
||||
Log.d(TAG,"Earthquake: "+ millisUntilFinished + " ms");
|
||||
}
|
||||
|
||||
|
||||
public void onFinish() {
|
||||
Log.d(TAG,"Earthquake Detection is Unlocked: ");
|
||||
mShakeDetectionIsActive = true;
|
||||
mShakeDetected = false;
|
||||
|
||||
}
|
||||
}.start();
|
||||
|
||||
|
||||
|
||||
//Hier wird bei Vibration in DB geschrieben
|
||||
getDataBaseValuesNoListenerForVibration();
|
||||
Button buttonReadyToDetect = (Button) findViewById(R.id.buttonReadyToDetect);
|
||||
buttonReadyToDetect.setEnabled(true);
|
||||
}
|
||||
|
||||
//################################################################## ^^^^ Detection Code ^^^^ ###################################################################################
|
||||
@@ -213,7 +203,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
currentLocation.setLatitude(breitengrad);
|
||||
currentLocation.setLongitude(laengengrad);
|
||||
setText();
|
||||
//setText();
|
||||
}
|
||||
else{
|
||||
Toast.makeText(MainActivity.this, "Current Location unavailable", Toast.LENGTH_SHORT).show();
|
||||
@@ -232,38 +222,293 @@ public class MainActivity extends AppCompatActivity {
|
||||
//##########################################################################################################################################################################
|
||||
//################################################################## vvv DB Code vvv #####################################################################################
|
||||
|
||||
//TODO Aron
|
||||
//###### Für Start der APP ####
|
||||
public void initDataBase()
|
||||
{
|
||||
getDataBaseValuesNoListener();
|
||||
}
|
||||
public void getDataBaseValuesNoListener()
|
||||
{
|
||||
mDatenbank = FirebaseDatabase.getInstance().getReference().child("overviewdetection");
|
||||
mDatenbank.get().addOnCompleteListener(new OnCompleteListener<DataSnapshot>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<DataSnapshot> task) {
|
||||
if (!task.isSuccessful()) {
|
||||
System.out.println("Datenbank Fehler in getDataBaseValuesNoListener");
|
||||
}
|
||||
else {
|
||||
analyzeForEmptyDB(task.getResult());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//Methode bestimmt, ob DB mit leer IDGn Felder überhaupt vorhanden ist
|
||||
public void analyzeForEmptyDB(DataSnapshot data)
|
||||
{
|
||||
String androidid;
|
||||
String localedatetime;
|
||||
String breitengrad;
|
||||
String laengengrad;
|
||||
String timestamp;
|
||||
String ampltiude;
|
||||
String welle;
|
||||
int emptyIDG =0;
|
||||
|
||||
for (int i=1; i<=data.getChildrenCount(); i++)
|
||||
{
|
||||
androidid = data.child("IDG" + i).child("a_androidid").getValue().toString();
|
||||
localedatetime = data.child("IDG" + i).child("b_localdatetime").getValue().toString();
|
||||
breitengrad = data.child("IDG" + i).child("d_breitengrad").getValue().toString();
|
||||
laengengrad = data.child("IDG" + i).child("e_laengengrad").getValue().toString();
|
||||
timestamp = data.child("IDG" + i).child("h_timestamp").getValue().toString();
|
||||
ampltiude = data.child("IDG" + i).child("i_amplitude").getValue().toString();
|
||||
welle = data.child("IDG" + i).child("w_wellengeschwindigkeit").getValue().toString();
|
||||
|
||||
if(androidid.isEmpty() && localedatetime.isEmpty() && breitengrad.isEmpty() && laengengrad.isEmpty() && timestamp.isEmpty() && ampltiude.isEmpty() && welle.isEmpty())
|
||||
{
|
||||
emptyIDG++;
|
||||
}else{
|
||||
emptyIDG--;
|
||||
}
|
||||
}
|
||||
//Wenn DB nicht vorhanden ODER leer ist, erstelle diese DB mit IDG 1-5
|
||||
if(emptyIDG == data.getChildrenCount())
|
||||
{
|
||||
for (int i=1; i<=5; i++)
|
||||
{
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
writeEmptyToSecondDataBase(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public void writeEmptyToSecondDataBase(int k)
|
||||
{
|
||||
mDatenbank = FirebaseDatabase.getInstance().getReference().child("overviewdetection");
|
||||
mDatenbank.child("IDG" + k).child("a_androidid").setValue("");
|
||||
mDatenbank.child("IDG" + k).child("b_localdatetime").setValue("");
|
||||
mDatenbank.child("IDG" + k).child("d_breitengrad").setValue("");
|
||||
mDatenbank.child("IDG" + k).child("e_laengengrad").setValue("");
|
||||
mDatenbank.child("IDG" + k).child("h_timestamp").setValue("");
|
||||
mDatenbank.child("IDG" + k).child("i_amplitude").setValue("");
|
||||
mDatenbank.child("IDG" + k).child("w_wellengeschwindigkeit").setValue("");
|
||||
}
|
||||
|
||||
//###### Bei Vibration der APP ####
|
||||
public void getDataBaseValuesNoListenerForVibration()
|
||||
{
|
||||
mDatenbank = FirebaseDatabase.getInstance().getReference().child("overviewdetection");
|
||||
mDatenbank.get().addOnCompleteListener(new OnCompleteListener<DataSnapshot>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<DataSnapshot> task) {
|
||||
if (!task.isSuccessful()) {
|
||||
System.out.println("Datenbank Fehler in getDataBaseValuesNoListener");
|
||||
}
|
||||
else {
|
||||
checkForEmptyIDG(task.getResult());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
public void checkForEmptyIDG(DataSnapshot data)
|
||||
{
|
||||
for (int i=1; i<=data.getChildrenCount(); i++)
|
||||
{
|
||||
if(analyzeForEmptyIDG(data,i))
|
||||
{
|
||||
writeDeviceToDB(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public boolean analyzeForEmptyIDG(DataSnapshot data, int i)
|
||||
{
|
||||
String androidid;
|
||||
String localedatetime;
|
||||
String breitengrad;
|
||||
String laengengrad;
|
||||
String timestamp;
|
||||
String ampltiude;
|
||||
String welle;
|
||||
androidid = data.child("IDG" + i).child("a_androidid").getValue().toString();
|
||||
localedatetime = data.child("IDG" + i).child("b_localdatetime").getValue().toString();
|
||||
breitengrad = data.child("IDG" + i).child("d_breitengrad").getValue().toString();
|
||||
laengengrad = data.child("IDG" + i).child("e_laengengrad").getValue().toString();
|
||||
timestamp = data.child("IDG" + i).child("h_timestamp").getValue().toString();
|
||||
ampltiude = data.child("IDG" + i).child("i_amplitude").getValue().toString();
|
||||
welle = data.child("IDG" + i).child("w_wellengeschwindigkeit").getValue().toString();
|
||||
|
||||
if(androidid.isEmpty() && localedatetime.isEmpty() && breitengrad.isEmpty() && laengengrad.isEmpty() && timestamp.isEmpty() && ampltiude.isEmpty() && welle.isEmpty())
|
||||
{
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public void writeDeviceToDB (int k)
|
||||
{
|
||||
mDatenbank = FirebaseDatabase.getInstance().getReference().child("overviewdetection");
|
||||
|
||||
mDatenbank.child("IDG" + k).child("a_androidid").setValue(getandroidid());
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG" + k).child("b_localdatetime").setValue(LocalDateTime.now(ZoneOffset.UTC).toString());
|
||||
}
|
||||
mDatenbank.child("IDG" + k).child("d_breitengrad").setValue(currentLocation.getLatitude());
|
||||
mDatenbank.child("IDG" + k).child("e_laengengrad").setValue(currentLocation.getLongitude());
|
||||
mDatenbank.child("IDG" + k).child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG" + k).child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG" + k).child("w_wellengeschwindigkeit").setValue(10);
|
||||
}
|
||||
|
||||
//###### Bei Eintragungen in der DB ####
|
||||
public void getDataBaseValuesWithListener()
|
||||
{
|
||||
mDatenbank = FirebaseDatabase.getInstance().getReference().child("overviewdetection");
|
||||
mDatenbank.addValueEventListener(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(@NonNull DataSnapshot snapshot) {
|
||||
analyzeDBchanges(snapshot);
|
||||
}
|
||||
@Override
|
||||
public void onCancelled(@NonNull DatabaseError error) {
|
||||
getDataBaseFailure(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void analyzeDBchanges(DataSnapshot data)
|
||||
{
|
||||
for (int i=1; i<=data.getChildrenCount(); i++)
|
||||
{
|
||||
if(analyzeForFullIDG(data,i) || analyzeForEmptyIDG(data,i))
|
||||
{
|
||||
TextView txtDevice1 = (TextView) findViewById(R.id.txtdevice1);
|
||||
TextView txtDevice2 = (TextView) findViewById(R.id.txtdevice2);
|
||||
TextView txtDevice3 = (TextView) findViewById(R.id.txtdevice3);
|
||||
TextView txtDevice4 = (TextView) findViewById(R.id.txtdevice4);
|
||||
String dbSlotStringContent = getSlotString(data,i);
|
||||
String displayContent;
|
||||
switch (i){
|
||||
case 1:
|
||||
displayContent = txtDevice1.getText().toString();
|
||||
if(!displayContent.equals(dbSlotStringContent))
|
||||
{
|
||||
if(analyzeForEmptyIDG(data,i))
|
||||
{
|
||||
txtDevice1.setText("");
|
||||
}else
|
||||
{
|
||||
txtDevice1.setText(dbSlotStringContent);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
displayContent = txtDevice2.getText().toString();
|
||||
if(!displayContent.equals(dbSlotStringContent))
|
||||
{
|
||||
if(analyzeForEmptyIDG(data,i))
|
||||
{
|
||||
txtDevice2.setText("");
|
||||
}else
|
||||
{
|
||||
txtDevice2.setText(dbSlotStringContent);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
displayContent = txtDevice3.getText().toString();
|
||||
if(!displayContent.equals(dbSlotStringContent))
|
||||
{
|
||||
if(analyzeForEmptyIDG(data,i))
|
||||
{
|
||||
txtDevice3.setText("");
|
||||
}else
|
||||
{
|
||||
txtDevice3.setText(dbSlotStringContent);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
displayContent = txtDevice4.getText().toString();
|
||||
if(!displayContent.equals(dbSlotStringContent))
|
||||
{
|
||||
if(analyzeForEmptyIDG(data,i))
|
||||
{
|
||||
txtDevice4.setText("");
|
||||
}else
|
||||
{
|
||||
txtDevice4.setText(dbSlotStringContent);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int takenIDG = 0;
|
||||
for (int i=1; i<=data.getChildrenCount(); i++)
|
||||
{
|
||||
if(analyzeForFullIDG(data,i))
|
||||
{
|
||||
takenIDG++;
|
||||
}
|
||||
}
|
||||
if(takenIDG >= 3 && allowCalculation)
|
||||
{
|
||||
Toast.makeText(MainActivity.this, "3 Geräte regisrtiert - Berechnung möglich!", Toast.LENGTH_SHORT).show();
|
||||
allowCalculation = false;
|
||||
Button btnEarthquake = (Button) findViewById(R.id.btnEarthquakeLocation);
|
||||
btnEarthquake.setEnabled(true);
|
||||
}
|
||||
}
|
||||
public String getSlotString(DataSnapshot data,int i)
|
||||
{
|
||||
String androidid = data.child("IDG" + i).child("a_androidid").getValue().toString();
|
||||
String localedatetime = data.child("IDG" + i).child("b_localdatetime").getValue().toString();
|
||||
String breitengrad = data.child("IDG" + i).child("d_breitengrad").getValue().toString();
|
||||
String laengengrad = data.child("IDG" + i).child("e_laengengrad").getValue().toString();
|
||||
String timestamp = data.child("IDG" + i).child("h_timestamp").getValue().toString();
|
||||
String ampltiude = data.child("IDG" + i).child("i_amplitude").getValue().toString();
|
||||
String databaseSlotString = "Device ID " + i + ": "+ androidid + "\n" + "Latitude: "+breitengrad+"\n"+ "Longitude: "+ laengengrad +"\n" + "Time Stamp: "+ timestamp + "\n" + "LocalDateTime: " + localedatetime +"\n"+ "Amplitude: "+ ampltiude+"\n";
|
||||
return databaseSlotString;
|
||||
}
|
||||
public boolean analyzeForFullIDG(DataSnapshot data, int i)
|
||||
{
|
||||
String androidid = data.child("IDG" + i).child("a_androidid").getValue().toString();
|
||||
String localedatetime = data.child("IDG" + i).child("b_localdatetime").getValue().toString();
|
||||
String breitengrad = data.child("IDG" + i).child("d_breitengrad").getValue().toString();
|
||||
String laengengrad = data.child("IDG" + i).child("e_laengengrad").getValue().toString();
|
||||
String timestamp = data.child("IDG" + i).child("h_timestamp").getValue().toString();
|
||||
String ampltiude = data.child("IDG" + i).child("i_amplitude").getValue().toString();
|
||||
String welle = data.child("IDG" + i).child("w_wellengeschwindigkeit").getValue().toString();
|
||||
|
||||
if(!androidid.isEmpty() && !localedatetime.isEmpty() && !breitengrad.isEmpty() && !laengengrad.isEmpty() && !timestamp.isEmpty() && !ampltiude.isEmpty() && !welle.isEmpty())
|
||||
{
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getandroidid ()
|
||||
{
|
||||
return Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||
}
|
||||
|
||||
public void getDataBaseFailure (DatabaseError error)
|
||||
{
|
||||
System.out.println("Fehler");
|
||||
Log.w("Datenbankfehler", error.toException());
|
||||
}
|
||||
|
||||
//################################################################## ^^^^ DB Code ^^^^ ###################################################################################
|
||||
//##########################################################################################################################################################################
|
||||
|
||||
|
||||
|
||||
//##########################################################################################################################################################################
|
||||
//################################################################## vvv Set Text of Device 1/2/3 on MainActivity vvv ####################################################
|
||||
|
||||
private void setText(){
|
||||
TextView txtDevice1 = (TextView) findViewById(R.id.txtdevice1);
|
||||
TextView txtDevice2 = (TextView) findViewById(R.id.txtdevice2);
|
||||
TextView txtDevice3 = (TextView) findViewById(R.id.txtdevice3);
|
||||
TextView txtDevice4 = (TextView) findViewById(R.id.txtdevice4);
|
||||
|
||||
|
||||
txtDevice1.setText("Device 1"+"\n"+"Time Stamp: "+ Calendar.getInstance().getTimeInMillis()+"\n"+"Latitude: "+breitengrad+"\n"+ "Longitude: "+ laengengrad+"\n");
|
||||
|
||||
txtDevice2.setText("Device 2"+"\n"+"Time Stamp: "+ Calendar.getInstance().getTimeInMillis()+"\n"+"Latitude: "+breitengrad+"\n"+ "Longitude: "+ laengengrad+"\n");
|
||||
|
||||
txtDevice3.setText("Device 3"+"\n"+"Time Stamp: "+ Calendar.getInstance().getTimeInMillis()+"\n"+"Latitude: "+breitengrad+"\n"+ "Longitude: "+ laengengrad+"\n");
|
||||
|
||||
txtDevice4.setText("Device 4"+"\n"+"Time Stamp: "+ Calendar.getInstance().getTimeInMillis()+"\n"+"Latitude: "+breitengrad+"\n"+ "Longitude: "+ laengengrad+"\n");
|
||||
|
||||
}
|
||||
|
||||
//################################################################## ^^^^ Set Text of Device 1/2/3 on MainActivity ^^^^ ##################################################
|
||||
//##########################################################################################################################################################################
|
||||
|
||||
|
||||
|
||||
//##########################################################################################################################################################################
|
||||
//################################################################## vvv Maps Code vvv ###################################################################################
|
||||
|
||||
@@ -290,6 +535,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
private void init() {
|
||||
|
||||
Button btnEarthquake = (Button) findViewById(R.id.btnEarthquakeLocation);
|
||||
btnEarthquake.setEnabled(false);
|
||||
btnEarthquake.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -298,6 +544,225 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
Button btnResetDB = (Button) findViewById(R.id.btnResetDB);
|
||||
btnResetDB.setOnClickListener(new View.OnClickListener() {
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
for (int i=1; i<=5; i++)
|
||||
{
|
||||
writeEmptyToSecondDataBase(i);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Button btnReadyToDetect = (Button) findViewById(R.id.buttonReadyToDetect);
|
||||
btnReadyToDetect.setOnClickListener(new View.OnClickListener() {
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mShakeDetectionIsActive = true;
|
||||
mShakeDetected = false;
|
||||
btnReadyToDetect.setEnabled(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//TODO Benötigt für Testzwecke (Epizentrum) für Jan
|
||||
|
||||
Button btnGerichtet = (Button) findViewById(R.id.btnGerichtet1);
|
||||
btnGerichtet.setOnClickListener(new View.OnClickListener() {
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getDataBaseValuesWithListener();
|
||||
mDatenbank = FirebaseDatabase.getInstance().getReference().child("overviewdetection");
|
||||
mDatenbank.child("IDG1").child("a_androidid").setValue("ID1");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG1").child("b_localdatetime").setValue("2021-06-25T19:00:00.000");
|
||||
}
|
||||
mDatenbank.child("IDG1").child("d_breitengrad").setValue(49.448290362613854);
|
||||
mDatenbank.child("IDG1").child("e_laengengrad").setValue(11.097272994499544);
|
||||
mDatenbank.child("IDG1").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG1").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG1").child("w_wellengeschwindigkeit").setValue(10);
|
||||
|
||||
mDatenbank.child("IDG2").child("a_androidid").setValue("ID2");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG2").child("b_localdatetime").setValue("2021-06-25T19:01:40.000");
|
||||
}
|
||||
mDatenbank.child("IDG2").child("d_breitengrad").setValue(49.44466671859845);
|
||||
mDatenbank.child("IDG2").child("e_laengengrad").setValue(11.11073498515257);
|
||||
mDatenbank.child("IDG2").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG2").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG2").child("w_wellengeschwindigkeit").setValue(10);
|
||||
|
||||
mDatenbank.child("IDG3").child("a_androidid").setValue("ID3");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG3").child("b_localdatetime").setValue("2021-06-25T19:03:20.000");
|
||||
}
|
||||
mDatenbank.child("IDG3").child("d_breitengrad").setValue(49.44263735292373);
|
||||
mDatenbank.child("IDG3").child("e_laengengrad").setValue(11.124199910730779);
|
||||
mDatenbank.child("IDG3").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG3").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG3").child("w_wellengeschwindigkeit").setValue(10);
|
||||
}
|
||||
});
|
||||
|
||||
Button btnDreiGoogle = (Button) findViewById(R.id.btnDreieckGoogle);
|
||||
btnDreiGoogle.setOnClickListener(new View.OnClickListener() {
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mDatenbank = FirebaseDatabase.getInstance().getReference().child("overviewdetection");
|
||||
mDatenbank.child("IDG1").child("a_androidid").setValue("ID1");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG1").child("b_localdatetime").setValue("2021-06-25T19:00:00.000");
|
||||
}
|
||||
mDatenbank.child("IDG1").child("d_breitengrad").setValue(49.449588027612);
|
||||
mDatenbank.child("IDG1").child("e_laengengrad").setValue(11.069961699379434);
|
||||
mDatenbank.child("IDG1").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG1").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG1").child("w_wellengeschwindigkeit").setValue(10);
|
||||
|
||||
mDatenbank.child("IDG2").child("a_androidid").setValue("ID2");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG2").child("b_localdatetime").setValue("2021-06-25T19:01:40.000");
|
||||
}
|
||||
mDatenbank.child("IDG2").child("d_breitengrad").setValue(49.45813339772139);
|
||||
mDatenbank.child("IDG2").child("e_laengengrad").setValue(11.105891230575331);
|
||||
mDatenbank.child("IDG2").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG2").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG2").child("w_wellengeschwindigkeit").setValue(10);
|
||||
|
||||
mDatenbank.child("IDG3").child("a_androidid").setValue("ID3");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG3").child("b_localdatetime").setValue("2021-06-25T19:03:20.000");
|
||||
}
|
||||
mDatenbank.child("IDG3").child("d_breitengrad").setValue(49.42208575064953);
|
||||
mDatenbank.child("IDG3").child("e_laengengrad").setValue(11.096983614292839);
|
||||
mDatenbank.child("IDG3").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG3").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG3").child("w_wellengeschwindigkeit").setValue(10);
|
||||
}
|
||||
});
|
||||
|
||||
Button btnDreiEigen = (Button) findViewById(R.id.btnDreieckEigen);
|
||||
btnDreiEigen.setOnClickListener(new View.OnClickListener() {
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mDatenbank = FirebaseDatabase.getInstance().getReference().child("overviewdetection");
|
||||
mDatenbank.child("IDG1").child("a_androidid").setValue("ID1");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG1").child("b_localdatetime").setValue("2021-06-25T19:00:00.000");
|
||||
}
|
||||
mDatenbank.child("IDG1").child("d_breitengrad").setValue(49.44796056728842);
|
||||
mDatenbank.child("IDG1").child("e_laengengrad").setValue(11.069682589518582);
|
||||
mDatenbank.child("IDG1").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG1").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG1").child("w_wellengeschwindigkeit").setValue(10);
|
||||
|
||||
mDatenbank.child("IDG2").child("a_androidid").setValue("ID2");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG2").child("b_localdatetime").setValue("2021-06-25T19:01:40.000");
|
||||
}
|
||||
mDatenbank.child("IDG2").child("d_breitengrad").setValue(49.445169649958295);
|
||||
mDatenbank.child("IDG2").child("e_laengengrad").setValue(11.110874403601176);
|
||||
mDatenbank.child("IDG2").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG2").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG2").child("w_wellengeschwindigkeit").setValue(10);
|
||||
|
||||
mDatenbank.child("IDG3").child("a_androidid").setValue("ID3");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG3").child("b_localdatetime").setValue("2021-06-25T19:03:20.000");
|
||||
}
|
||||
mDatenbank.child("IDG3").child("d_breitengrad").setValue(49.42197662865119);
|
||||
mDatenbank.child("IDG3").child("e_laengengrad").setValue(11.07097763125116);
|
||||
mDatenbank.child("IDG3").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG3").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG3").child("w_wellengeschwindigkeit").setValue(10);
|
||||
}
|
||||
});
|
||||
|
||||
Button btnLinieGoogle= (Button) findViewById(R.id.btnLinieGoogle);
|
||||
btnLinieGoogle.setOnClickListener(new View.OnClickListener() {
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mDatenbank = FirebaseDatabase.getInstance().getReference().child("overviewdetection");
|
||||
mDatenbank.child("IDG1").child("a_androidid").setValue("ID1");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG1").child("b_localdatetime").setValue("2021-06-25T19:00:00.000");
|
||||
}
|
||||
mDatenbank.child("IDG1").child("d_breitengrad").setValue(49.439093816961254);
|
||||
mDatenbank.child("IDG1").child("e_laengengrad").setValue(11.087992224141008);
|
||||
mDatenbank.child("IDG1").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG1").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG1").child("w_wellengeschwindigkeit").setValue(10);
|
||||
|
||||
mDatenbank.child("IDG2").child("a_androidid").setValue("ID2");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG2").child("b_localdatetime").setValue("2021-06-25T19:01:40.000");
|
||||
}
|
||||
mDatenbank.child("IDG2").child("d_breitengrad").setValue(49.43058961031174);
|
||||
mDatenbank.child("IDG2").child("e_laengengrad").setValue(11.092487606432716);
|
||||
mDatenbank.child("IDG2").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG2").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG2").child("w_wellengeschwindigkeit").setValue(10);
|
||||
|
||||
mDatenbank.child("IDG3").child("a_androidid").setValue("ID3");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG3").child("b_localdatetime").setValue("2021-06-25T19:03:20.000");
|
||||
}
|
||||
mDatenbank.child("IDG3").child("d_breitengrad").setValue(49.42208989434345);
|
||||
mDatenbank.child("IDG3").child("e_laengengrad").setValue(11.096991470517569);
|
||||
mDatenbank.child("IDG3").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG3").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG3").child("w_wellengeschwindigkeit").setValue(10);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Button btnLinieEigen = (Button) findViewById(R.id.btnLinieEigen);
|
||||
btnLinieEigen.setOnClickListener(new View.OnClickListener() {
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mDatenbank = FirebaseDatabase.getInstance().getReference().child("overviewdetection");
|
||||
mDatenbank.child("IDG1").child("a_androidid").setValue("ID1");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG1").child("b_localdatetime").setValue("2021-06-25T19:00:00.000");
|
||||
}
|
||||
mDatenbank.child("IDG1").child("d_breitengrad").setValue(49.44709382725857);
|
||||
mDatenbank.child("IDG1").child("e_laengengrad").setValue(11.069646529622538);
|
||||
mDatenbank.child("IDG1").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG1").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG1").child("w_wellengeschwindigkeit").setValue(10);
|
||||
|
||||
mDatenbank.child("IDG2").child("a_androidid").setValue("ID2");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG2").child("b_localdatetime").setValue("2021-06-25T19:01:40.000");
|
||||
}
|
||||
mDatenbank.child("IDG2").child("d_breitengrad").setValue(49.446938212388574);
|
||||
mDatenbank.child("IDG2").child("e_laengengrad").setValue(11.055889659014166);
|
||||
mDatenbank.child("IDG2").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG2").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG2").child("w_wellengeschwindigkeit").setValue(10);
|
||||
|
||||
mDatenbank.child("IDG3").child("a_androidid").setValue("ID3");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mDatenbank.child("IDG3").child("b_localdatetime").setValue("2021-06-25T19:03:20.000");
|
||||
}
|
||||
mDatenbank.child("IDG3").child("d_breitengrad").setValue(49.447447927483005);
|
||||
mDatenbank.child("IDG3").child("e_laengengrad").setValue(11.042050722727316);
|
||||
mDatenbank.child("IDG3").child("h_timestamp").setValue(Calendar.getInstance().getTimeInMillis());
|
||||
mDatenbank.child("IDG3").child("i_amplitude").setValue(1000);
|
||||
mDatenbank.child("IDG3").child("w_wellengeschwindigkeit").setValue(10);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -305,4 +770,54 @@ public class MainActivity extends AppCompatActivity {
|
||||
//###########################################################################################################################################################
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public void setDisplayText(DataSnapshot data, int i)
|
||||
{
|
||||
String androidid = data.child("IDG" + i).child("a_androidid").getValue().toString();
|
||||
String localedatetime = data.child("IDG" + i).child("b_localdatetime").getValue().toString();
|
||||
String breitengrad = data.child("IDG" + i).child("d_breitengrad").getValue().toString();
|
||||
String laengengrad = data.child("IDG" + i).child("e_laengengrad").getValue().toString();
|
||||
String timestamp = data.child("IDG" + i).child("h_timestamp").getValue().toString();
|
||||
String ampltiude = data.child("IDG" + i).child("i_amplitude").getValue().toString();
|
||||
TextView txtDevice1 = (TextView) findViewById(R.id.txtdevice1);
|
||||
TextView txtDevice2 = (TextView) findViewById(R.id.txtdevice2);
|
||||
TextView txtDevice3 = (TextView) findViewById(R.id.txtdevice3);
|
||||
TextView txtDevice4 = (TextView) findViewById(R.id.txtdevice4);
|
||||
switch (i){
|
||||
case 1:
|
||||
txtDevice1.setText("Device ID 1: "+ androidid + "\n" + "Latitude: "+breitengrad+"\n"+ "Longitude: "+ laengengrad +"\n" + "Time Stamp: "+ timestamp + "\n" + "LocalDateTime: " + localedatetime +"\n"+ "Amplitude: "+ ampltiude+"\n");
|
||||
break;
|
||||
case 2:
|
||||
txtDevice2.setText("Device ID 2: "+ androidid + "\n" + "Latitude: "+breitengrad+"\n"+ "Longitude: "+ laengengrad +"\n" + "Time Stamp: "+ timestamp + "\n" + "LocalDateTime: " + localedatetime +"\n"+ "Amplitude: "+ ampltiude+"\n");
|
||||
break;
|
||||
case 3:
|
||||
txtDevice3.setText("Device ID 3: "+ androidid + "\n" + "Latitude: "+breitengrad+"\n"+ "Longitude: "+ laengengrad +"\n" + "Time Stamp: "+ timestamp + "\n" + "LocalDateTime: " + localedatetime +"\n"+ "Amplitude: "+ ampltiude+"\n");
|
||||
break;
|
||||
case 4:
|
||||
txtDevice4.setText("Device ID 4: "+ androidid + "\n" + "Latitude: "+breitengrad+"\n"+ "Longitude: "+ laengengrad +"\n" + "Time Stamp: "+ timestamp + "\n" + "LocalDateTime: " + localedatetime +"\n"+ "Amplitude: "+ ampltiude+"\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
public void resetDisplayText()
|
||||
{
|
||||
Button btnEarthquake = (Button) findViewById(R.id.btnEarthquakeLocation);
|
||||
btnEarthquake.setEnabled(false);
|
||||
TextView txtDevice1 = (TextView) findViewById(R.id.txtdevice1);
|
||||
TextView txtDevice2 = (TextView) findViewById(R.id.txtdevice2);
|
||||
TextView txtDevice3 = (TextView) findViewById(R.id.txtdevice3);
|
||||
TextView txtDevice4 = (TextView) findViewById(R.id.txtdevice4);
|
||||
txtDevice1.setText("");
|
||||
txtDevice2.setText("");
|
||||
txtDevice3.setText("");
|
||||
txtDevice4.setText("");
|
||||
allowCalculation=true;
|
||||
}
|
||||
*/
|
||||
@@ -2,6 +2,8 @@ package de.edotzlaff.detection.detektion;
|
||||
|
||||
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import de.edotzlaff.detection.detektion.berechnung.Endpunkt;
|
||||
import de.edotzlaff.detection.detektion.berechnung.EndpunktVerbindung;
|
||||
@@ -15,12 +17,13 @@ import java.util.Objects;
|
||||
public class Erdbeben {
|
||||
|
||||
//ToDO anpassen an Szenario umso mehr umso wahrscheinlich ein Ergebnis, oder Abbruchbedingung mit do while
|
||||
public static final Integer SCHLEIFENDURCHLAUFTE = 400;
|
||||
|
||||
public static final Integer SCHLEIFENDURCHLAUFTE = 2000;
|
||||
private static final String TAG = "ERDBEBEN";
|
||||
|
||||
private Epizentrum epizentrum;
|
||||
private EpizentrumRechnung epizentrumRechnung;
|
||||
private HashMap<String, Detektionssignal> nutzerDaten;
|
||||
private Detektionssignal erstesDetektionssignal;
|
||||
|
||||
public Erdbeben() {
|
||||
|
||||
@@ -38,8 +41,9 @@ public class Erdbeben {
|
||||
{
|
||||
for (int i = 0; i< detektionssignale.size(); i++)
|
||||
{
|
||||
nutzerDaten.put(detektionssignale.get(i).getDeviceId(),detektionssignale.get(i));
|
||||
nutzerDaten.put(detektionssignale.get(i).getDeviceId()+"i",detektionssignale.get(i));
|
||||
}
|
||||
Log.i(TAG, "addDetektionssignalList: " + nutzerDaten.size());
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@@ -48,7 +52,9 @@ public class Erdbeben {
|
||||
ArrayList<Detektionssignal> rechenListe = new ArrayList<>();
|
||||
nutzerDaten.forEach((key, value) -> rechenListe.add(value));
|
||||
//Initialisierung der Rechung - First Element mit delta r + alle möglichen EndpunktKombinationen (einfach)
|
||||
ArrayList<Endpunkt> berechnungsEndpunkte = epizentrumRechnung.initEndpunkte(rechenListe);
|
||||
erstesDetektionssignal = epizentrumRechnung.ermittleErstesDetektionssignal(rechenListe);
|
||||
ArrayList<Endpunkt> berechnungsEndpunkte = epizentrumRechnung.initEndpunkte(rechenListe, erstesDetektionssignal);
|
||||
|
||||
ArrayList<EndpunktVerbindung> endpunktKonbinationen = epizentrumRechnung.ermittleEndpunktKonbinationen(berechnungsEndpunkte);
|
||||
|
||||
//ToDo Vernünftiger Endpunkt überlegen bzw. bis wann abgebrochen wird -> Umzug in Berechnungs
|
||||
@@ -57,10 +63,7 @@ public class Erdbeben {
|
||||
epizentrum = epizentrumRechnung.ueberpruefeObEpizentrum(endpunktKonbinationen);
|
||||
//ToDo set EnstehungsZeitpunkt -> (Bezugszeit, Koord, Koord, v;)
|
||||
if (!Objects.isNull(epizentrum)) {
|
||||
System.out.println("Epizentrum ermittelt");
|
||||
epizentrum.setEntstehungsZeitpunkt(
|
||||
epizentrumRechnung.berechneEntstehungsZeitpunkt(
|
||||
nutzerDaten.get(berechnungsEndpunkte.get(0).getNutzer()), epizentrum.getKoordinaten()));
|
||||
epizentrum.setEntstehungsZeitpunkt(epizentrumRechnung.berechneEntstehungsZeitpunktLongLatt(erstesDetektionssignal, epizentrum.getKoordinaten()));
|
||||
return epizentrum;
|
||||
}
|
||||
}
|
||||
|
||||
+55
-16
@@ -1,10 +1,15 @@
|
||||
package de.edotzlaff.detection.detektion.berechnung;
|
||||
|
||||
|
||||
import android.location.Location;
|
||||
import android.nfc.Tag;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import de.edotzlaff.detection.detektion.Detektionssignal;
|
||||
import de.edotzlaff.detection.detektion.Epizentrum;
|
||||
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.Koordinaten;
|
||||
@@ -21,32 +26,47 @@ import java.util.Set;
|
||||
public class EpizentrumRechnung {
|
||||
|
||||
//ToDo Schrittweite und Abstand auf Szenario anpassen
|
||||
private static final double SCHRITTWEITE = 0.02;
|
||||
private static final double MAX_ABSTAND = 0.009;
|
||||
private static final int DOUBLESTELLEN = 8;
|
||||
private static final double SCHRITTWEITE = 2;
|
||||
private static final double MAX_ABSTAND = 0.5;
|
||||
private static final int DOUBLESTELLEN = 15;
|
||||
private static final int SCHLEIFENDURCHLAUFTE = 8000;
|
||||
|
||||
private static final String TAG = "EPIZENTRUMRECHNUNG";
|
||||
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public ArrayList<Endpunkt> initEndpunkte(ArrayList<Detektionssignal> detektionssignal) {
|
||||
Detektionssignal nahegelegensteMessung = detektionssignal.get(0);
|
||||
public ArrayList<Endpunkt> initEndpunkte(ArrayList<Detektionssignal> detektionssignal, Detektionssignal ersteMessung) {
|
||||
ArrayList<Endpunkt> arrBerechnungsObjekte = new ArrayList<>();
|
||||
for (int i = 1; i < detektionssignal.size(); i++) {
|
||||
if (detektionssignal.get(i).getAnkunftsZeit().isBefore(nahegelegensteMessung.getAnkunftsZeit())) {
|
||||
nahegelegensteMessung = detektionssignal.get(i);
|
||||
}
|
||||
}
|
||||
for (Detektionssignal aufzeichnung : detektionssignal) {
|
||||
int zeitunterschied = aufzeichnung.getAnkunftsZeit().getHour() * 3600 + aufzeichnung.getAnkunftsZeit().getMinute() * 60 + aufzeichnung.getAnkunftsZeit().getSecond()
|
||||
- nahegelegensteMessung.getAnkunftsZeit().getHour() * 3600 - nahegelegensteMessung.getAnkunftsZeit().getMinute() * 60 - nahegelegensteMessung.getAnkunftsZeit().getSecond();
|
||||
- ersteMessung.getAnkunftsZeit().getHour() * 3600 - ersteMessung.getAnkunftsZeit().getMinute() * 60 - ersteMessung.getAnkunftsZeit().getSecond();
|
||||
|
||||
double startradius = zeitunterschied * aufzeichnung.getGeschwErdbeben();
|
||||
|
||||
Log.i(TAG, "Init Daten: " + aufzeichnung.getDeviceId() + "Startradius: " + startradius);
|
||||
Endpunkt tempEndpunkt = new Endpunkt(aufzeichnung.getDeviceId());
|
||||
Kreis k = new Kreis(aufzeichnung.getKoordinaten().getX(), aufzeichnung.getKoordinaten().getY(), startradius);
|
||||
tempEndpunkt.setKreis(k);
|
||||
arrBerechnungsObjekte.add(tempEndpunkt);
|
||||
}
|
||||
|
||||
Log.i(TAG, "Daten Erfolgreich initialisiert");
|
||||
return arrBerechnungsObjekte;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public Detektionssignal ermittleErstesDetektionssignal(ArrayList<Detektionssignal> detektionssignale)
|
||||
{
|
||||
Detektionssignal erstesDetektionssignal = detektionssignale.get(0);
|
||||
for (int i = 1; i < detektionssignale.size(); i++) {
|
||||
if (detektionssignale.get(i).getAnkunftsZeit().isBefore(erstesDetektionssignal.getAnkunftsZeit())) {
|
||||
erstesDetektionssignal = detektionssignale.get(i);
|
||||
}
|
||||
}
|
||||
Log.i(TAG, "Test");
|
||||
return erstesDetektionssignal;
|
||||
}
|
||||
|
||||
public ArrayList<Schnittpunkt> berechneKreisSchnittpunkte(Kreis kreis1, Kreis kreis2) {
|
||||
|
||||
ArrayList<Schnittpunkt> schnittpunkte = new ArrayList<>();
|
||||
@@ -85,7 +105,8 @@ public class EpizentrumRechnung {
|
||||
}
|
||||
|
||||
public boolean genuegendSchnittpunktevorhanden(ArrayList<EndpunktVerbindung> endpunktVerbindungen) {
|
||||
|
||||
//Log.i(TAG,"Überprüfe ob genügend Schnittpunkte vorhanden sind");
|
||||
//Log.i(TAG,"Radius: "+ Double.toString(endpunktVerbindungen.get(0).getEndpunkt1().getKreis().getRadius()));
|
||||
for (EndpunktVerbindung endpunktVerbindung : endpunktVerbindungen) {
|
||||
ArrayList<Schnittpunkt> templist;
|
||||
templist = berechneKreisSchnittpunkte(endpunktVerbindung.getEndpunkt1().getKreis(), endpunktVerbindung.getEndpunkt2().getKreis());
|
||||
@@ -98,7 +119,6 @@ public class EpizentrumRechnung {
|
||||
}
|
||||
|
||||
public Epizentrum ueberpruefeObEpizentrum(ArrayList<EndpunktVerbindung> endpunktVerbindungen) {
|
||||
|
||||
int counter;
|
||||
ArrayList<Schnittpunkt> schnittpunkte = new ArrayList<>();
|
||||
|
||||
@@ -118,7 +138,9 @@ public class EpizentrumRechnung {
|
||||
if (counter == endpunktVerbindungen.size() - 1) {
|
||||
schnittpunkte.add(s1);
|
||||
Epizentrum tempEpizentrum = new Epizentrum();
|
||||
tempEpizentrum.setKoordinaten(berechneEpizentrumKoordinaten(schnittpunkte));
|
||||
Koordinaten koordinaten = (berechneEpizentrumKoordinaten(schnittpunkte));
|
||||
tempEpizentrum.setKoordinaten(koordinaten);
|
||||
Log.i(TAG, "Epizentrumkoord: " + tempEpizentrum.getKoordinaten().getX() + " " + tempEpizentrum.getKoordinaten().getY());
|
||||
return tempEpizentrum;
|
||||
}
|
||||
}
|
||||
@@ -128,17 +150,21 @@ public class EpizentrumRechnung {
|
||||
}
|
||||
|
||||
public Koordinaten berechneEpizentrumKoordinaten(ArrayList<Schnittpunkt> schnittpunkte) {
|
||||
Log.i(TAG, "Berechne Epizentrum Koordinaten");
|
||||
double x = 0;
|
||||
double y = 0;
|
||||
for (Schnittpunkt s : schnittpunkte) {
|
||||
Log.i(TAG, "Koordinaten der Schnittpunkte: "+ s.getKoordinaten().getX() + " " + s.getKoordinaten().getY());
|
||||
x+= s.getKoordinaten().getX();
|
||||
y+= s.getKoordinaten().getY();
|
||||
}
|
||||
return new Koordinaten(new BigDecimal(x/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue(),
|
||||
new BigDecimal(y/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue());
|
||||
x = new BigDecimal(x/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue();
|
||||
y = new BigDecimal(y/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue();
|
||||
return new Koordinaten(x,y);
|
||||
}
|
||||
|
||||
public ArrayList<EndpunktVerbindung> ermittleEndpunktKonbinationen(ArrayList<Endpunkt> tempBerechungsObjekte) {
|
||||
|
||||
ArrayList<EndpunktVerbindung> verbindungen = new ArrayList<>();
|
||||
Set<Set<Endpunkt>> combinations = Sets.combinations(ImmutableSet.copyOf(tempBerechungsObjekte), 2);
|
||||
for (Set<Endpunkt> tempEndpunkt : combinations) {
|
||||
@@ -146,6 +172,7 @@ public class EpizentrumRechnung {
|
||||
EndpunktVerbindung endpunktVerbindung = new EndpunktVerbindung(helpArrayToGetValues.get(0), helpArrayToGetValues.get(1));
|
||||
verbindungen.add(endpunktVerbindung);
|
||||
}
|
||||
Log.i(TAG, "Endpunkteverbindungen Erfolgreich festgelegt, Anzahl: " + verbindungen.size());
|
||||
return verbindungen;
|
||||
}
|
||||
|
||||
@@ -159,10 +186,22 @@ public class EpizentrumRechnung {
|
||||
return detektionssignal.getAnkunftsZeit().minusSeconds(sec);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public LocalDateTime berechneEntstehungsZeitpunktLongLatt(Detektionssignal detektionssignal, Koordinaten koordEpi)
|
||||
{
|
||||
float[] results = new float[1];
|
||||
Location.distanceBetween(detektionssignal.getKoordinaten().getX(), detektionssignal.getKoordinaten().getY(), koordEpi.getX(), koordEpi.getY(), results);
|
||||
float distanceInMeters = results[0];
|
||||
int sec = (int) distanceInMeters/ detektionssignal.geschwErdbeben;
|
||||
return detektionssignal.getAnkunftsZeit().minusSeconds(sec);
|
||||
|
||||
}
|
||||
public void erhoheRadius(ArrayList<Endpunkt> tempEndpunktListe) {
|
||||
|
||||
for (Endpunkt b : tempEndpunktListe) {
|
||||
b.erhoeheRadius(SCHRITTWEITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package de.edotzlaff.detection.detektion.berechnung.mathObjekte;
|
||||
|
||||
public class Deg2UTM {
|
||||
|
||||
double Easting;
|
||||
double Northing;
|
||||
int Zone;
|
||||
char Letter;
|
||||
|
||||
public Deg2UTM(double Lat, double Lon) {
|
||||
Zone = (int) Math.floor(Lon / 6 + 31);
|
||||
if (Lat < -72)
|
||||
Letter = 'C';
|
||||
else if (Lat < -64)
|
||||
Letter = 'D';
|
||||
else if (Lat < -56)
|
||||
Letter = 'E';
|
||||
else if (Lat < -48)
|
||||
Letter = 'F';
|
||||
else if (Lat < -40)
|
||||
Letter = 'G';
|
||||
else if (Lat < -32)
|
||||
Letter = 'H';
|
||||
else if (Lat < -24)
|
||||
Letter = 'J';
|
||||
else if (Lat < -16)
|
||||
Letter = 'K';
|
||||
else if (Lat < -8)
|
||||
Letter = 'L';
|
||||
else if (Lat < 0)
|
||||
Letter = 'M';
|
||||
else if (Lat < 8)
|
||||
Letter = 'N';
|
||||
else if (Lat < 16)
|
||||
Letter = 'P';
|
||||
else if (Lat < 24)
|
||||
Letter = 'Q';
|
||||
else if (Lat < 32)
|
||||
Letter = 'R';
|
||||
else if (Lat < 40)
|
||||
Letter = 'S';
|
||||
else if (Lat < 48)
|
||||
Letter = 'T';
|
||||
else if (Lat < 56)
|
||||
Letter = 'U';
|
||||
else if (Lat < 64)
|
||||
Letter = 'V';
|
||||
else if (Lat < 72)
|
||||
Letter = 'W';
|
||||
else
|
||||
Letter = 'X';
|
||||
Easting = 0.5 * Math.log((1 + Math.cos(Lat * Math.PI / 180) * Math.sin(Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180)) / (1 - Math.cos(Lat * Math.PI / 180) * Math.sin(Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180))) * 0.9996 * 6399593.62 / Math.pow((1 + Math.pow(0.0820944379, 2) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)), 0.5) * (1 + Math.pow(0.0820944379, 2) / 2 * Math.pow((0.5 * Math.log((1 + Math.cos(Lat * Math.PI / 180) * Math.sin(Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180)) / (1 - Math.cos(Lat * Math.PI / 180) * Math.sin(Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180)))), 2) * Math.pow(Math.cos(Lat * Math.PI / 180), 2) / 3) + 500000;
|
||||
Easting = Math.round(Easting * 100) * 0.01;
|
||||
Northing = (Math.atan(Math.tan(Lat * Math.PI / 180) / Math.cos((Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180))) - Lat * Math.PI / 180) * 0.9996 * 6399593.625 / Math.sqrt(1 + 0.006739496742 * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) * (1 + 0.006739496742 / 2 * Math.pow(0.5 * Math.log((1 + Math.cos(Lat * Math.PI / 180) * Math.sin((Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180))) / (1 - Math.cos(Lat * Math.PI / 180) * Math.sin((Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180)))), 2) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) + 0.9996 * 6399593.625 * (Lat * Math.PI / 180 - 0.005054622556 * (Lat * Math.PI / 180 + Math.sin(2 * Lat * Math.PI / 180) / 2) + 4.258201531e-05 * (3 * (Lat * Math.PI / 180 + Math.sin(2 * Lat * Math.PI / 180) / 2) + Math.sin(2 * Lat * Math.PI / 180) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) / 4 - 1.674057895e-07 * (5 * (3 * (Lat * Math.PI / 180 + Math.sin(2 * Lat * Math.PI / 180) / 2) + Math.sin(2 * Lat * Math.PI / 180) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) / 4 + Math.sin(2 * Lat * Math.PI / 180) * Math.pow(Math.cos(Lat * Math.PI / 180), 2) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) / 3);
|
||||
if (Letter < 'M')
|
||||
Northing = Northing + 10000000;
|
||||
Northing = Math.round(Northing * 100) * 0.01;
|
||||
}
|
||||
|
||||
public double getEasting() {
|
||||
return Easting;
|
||||
}
|
||||
|
||||
public void setEasting(double easting) {
|
||||
Easting = easting;
|
||||
}
|
||||
|
||||
public double getNorthing() {
|
||||
return Northing;
|
||||
}
|
||||
|
||||
public void setNorthing(double northing) {
|
||||
Northing = northing;
|
||||
}
|
||||
}
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package de.edotzlaff.detection.detektion.berechnung.mathObjekte;
|
||||
|
||||
public class UTM2Deg {
|
||||
|
||||
double latitude;
|
||||
double longitude;
|
||||
|
||||
|
||||
public void convertToDeg(int zone, char letter, double easting, double northing)
|
||||
{
|
||||
int Zone=zone;
|
||||
char Letter=letter;
|
||||
double Easting=easting;
|
||||
double Northing=northing;
|
||||
double Hem;
|
||||
if (Letter>'M')
|
||||
Hem='N';
|
||||
else
|
||||
Hem='S';
|
||||
double north;
|
||||
if (Hem == 'S')
|
||||
north = Northing - 10000000;
|
||||
else
|
||||
north = Northing;
|
||||
latitude = (north/6366197.724/0.9996+(1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)-0.006739496742*Math.sin(north/6366197.724/0.9996)*Math.cos(north/6366197.724/0.9996)*(Math.atan(Math.cos(Math.atan(( Math.exp((Easting - 500000) / (0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting - 500000) / (0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2)/3))-Math.exp(-(Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*( 1 - 0.006739496742*Math.pow((Easting - 500000) / (0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2)/3)))/2/Math.cos((north-0.9996*6399593.625*(north/6366197.724/0.9996-0.006739496742*3/4*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.pow(0.006739496742*3/4,2)*5/3*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996 )/2)+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4-Math.pow(0.006739496742*3/4,3)*35/27*(5*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/3))/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2))+north/6366197.724/0.9996)))*Math.tan((north-0.9996*6399593.625*(north/6366197.724/0.9996 - 0.006739496742*3/4*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.pow(0.006739496742*3/4,2)*5/3*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2*north/6366197.724/0.9996 )*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4-Math.pow(0.006739496742*3/4,3)*35/27*(5*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/3))/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2))+north/6366197.724/0.9996))-north/6366197.724/0.9996)*3/2)*(Math.atan(Math.cos(Math.atan((Math.exp((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2)/3))-Math.exp(-(Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2)/3)))/2/Math.cos((north-0.9996*6399593.625*(north/6366197.724/0.9996-0.006739496742*3/4*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.pow(0.006739496742*3/4,2)*5/3*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4-Math.pow(0.006739496742*3/4,3)*35/27*(5*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/3))/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2))+north/6366197.724/0.9996)))*Math.tan((north-0.9996*6399593.625*(north/6366197.724/0.9996-0.006739496742*3/4*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.pow(0.006739496742*3/4,2)*5/3*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4-Math.pow(0.006739496742*3/4,3)*35/27*(5*(3*(north/6366197.724/0.9996+Math.sin(2*north/63Line truncated
|
||||
latitude=Math.round(latitude*10000000);
|
||||
latitude=latitude/10000000;
|
||||
longitude =Math.atan((Math.exp((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2)/3))-Math.exp(-(Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2)/3)))/2/Math.cos((north-0.9996*6399593.625*( north/6366197.724/0.9996-0.006739496742*3/4*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.pow(0.006739496742*3/4,2)*5/3*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2* north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4-Math.pow(0.006739496742*3/4,3)*35/27*(5*(3*(north/6366197.724/0.9996+Math.sin(2*north/6366197.724/0.9996)/2)+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/4+Math.sin(2*north/6366197.724/0.9996)*Math.pow(Math.cos(north/6366197.724/0.9996),2)*Math.pow(Math.cos(north/6366197.724/0.9996),2))/3)) / (0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2))))*(1-0.006739496742*Math.pow((Easting-500000)/(0.9996*6399593.625/Math.sqrt((1+0.006739496742*Math.pow(Math.cos(north/6366197.724/0.9996),2)))),2)/2*Math.pow(Math.cos(north/6366197.724/0.9996),2))+north/6366197.724/0.9996))*180/Math.PI+Zone*6-183;
|
||||
longitude=Math.round(longitude*10000000);
|
||||
longitude=longitude/10000000;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(double latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(double longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Device 1"
|
||||
android:text="@string/device_1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
@@ -20,7 +20,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Device 2"
|
||||
android:text="@string/device_2"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
@@ -32,7 +32,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Device 3"
|
||||
android:text="@string/device_3"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
@@ -44,7 +44,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Device 4"
|
||||
android:text="@string/device_4"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
@@ -60,6 +60,85 @@
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="0dp"
|
||||
android:text="Show Earthquake Location" />
|
||||
android:text="@string/show_earthquake_location" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/buttonReadyToDetect"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/btnEarthquakeLocation"
|
||||
android:layout_alignParentStart="false"
|
||||
android:layout_alignParentEnd="false"
|
||||
android:layout_alignParentBottom="false"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="@string/sensor_ready_to_detect" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnResetDB"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_above="@id/buttonReadyToDetect"
|
||||
android:layout_alignParentStart="false"
|
||||
android:layout_alignParentEnd="false"
|
||||
android:layout_alignParentBottom="false"
|
||||
android:layout_centerInParent="true"
|
||||
android:textColor="@color/black"
|
||||
android:text="@string/db_zur_cksetzen" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnGerichtet1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/btnResetDB"
|
||||
android:backgroundTint="@color/design_default_color_secondary_variant"
|
||||
android:layout_alignParentStart="false"
|
||||
android:layout_alignParentEnd="false"
|
||||
android:layout_alignParentBottom="false"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:text="@string/gerichtett"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnLinieGoogle"
|
||||
android:backgroundTint="@color/design_default_color_secondary_variant"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/btnGerichtet1"
|
||||
android:layout_toStartOf="@id/btnGerichtet1"
|
||||
android:text="@string/linie_g" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDreieckGoogle"
|
||||
android:backgroundTint="@color/design_default_color_secondary_variant"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/btnGerichtet1"
|
||||
android:layout_toEndOf="@id/btnGerichtet1"
|
||||
android:text="@string/gerichtet_g"
|
||||
tools:text="Dreieck_G" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDreieckEigen"
|
||||
android:backgroundTint="@color/design_default_color_secondary_variant"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/btnGerichtet1"
|
||||
android:layout_toEndOf="@id/btnGerichtet1"
|
||||
android:text="@string/dreieck_e"
|
||||
tools:text="Dreieck_E" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnLinieEigen"
|
||||
android:backgroundTint="@color/design_default_color_secondary_variant"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/btnGerichtet1"
|
||||
android:layout_toStartOf="@id/btnGerichtet1"
|
||||
android:text="@string/linie_e" />
|
||||
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -1,4 +1,17 @@
|
||||
<resources>
|
||||
<string name="app_name">Detection</string>
|
||||
<string name="title_activity_earthquake_location">Map</string>
|
||||
<string name="testbutton">Testbutton</string>
|
||||
<string name="sensor_ready_to_detect">Sensor Ready To Detect</string>
|
||||
<string name="show_earthquake_location">Show Earthquake Location</string>
|
||||
<string name="device_4">Device 4</string>
|
||||
<string name="device_3">Device 3</string>
|
||||
<string name="device_2">Device 2</string>
|
||||
<string name="device_1">Device 1</string>
|
||||
<string name="db_zur_cksetzen">DB zurücksetzen</string>
|
||||
<string name="gerichtet_g">Gerichtet_G</string>
|
||||
<string name="dreieck_e">Dreieck_E</string>
|
||||
<string name="linie_e">Linie_E</string>
|
||||
<string name="linie_g">Linie_G</string>
|
||||
<string name="gerichtett">Gerichtett</string>
|
||||
</resources>
|
||||
@@ -6,6 +6,8 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.2.1'
|
||||
classpath 'com.google.gms:google-services:4.3.8'
|
||||
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
Reference in new issue
Block a user