Compare commits
8
Commits
2e0da83888
...
EpiTest
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65cabe66e9 | ||
|
|
f875ab6415 | ||
|
|
ba9e3d5aa7 | ||
|
|
9f1f243f50 | ||
|
|
2c9c2ef7c4 | ||
|
|
3ba534c285 | ||
|
|
dfffc2c9f1 | ||
|
|
0d8e04f9e0 |
No files matched your search
@@ -32,7 +32,9 @@ import com.google.firebase.database.FirebaseDatabase;
|
|||||||
import de.edotzlaff.detection.detektion.Detektionssignal;
|
import de.edotzlaff.detection.detektion.Detektionssignal;
|
||||||
import de.edotzlaff.detection.detektion.Epizentrum;
|
import de.edotzlaff.detection.detektion.Epizentrum;
|
||||||
import de.edotzlaff.detection.detektion.Erdbeben;
|
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.Koordinaten;
|
||||||
|
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.UTM2Deg;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
@@ -44,9 +46,10 @@ public class EarthquakeLocation extends FragmentActivity implements OnMapReadyCa
|
|||||||
private GoogleMap mMap;
|
private GoogleMap mMap;
|
||||||
private static final String TAGEPIZENTRUM = "Epizentrum";
|
private static final String TAGEPIZENTRUM = "Epizentrum";
|
||||||
private DatabaseReference mDatenbank;
|
private DatabaseReference mDatenbank;
|
||||||
private double latitudeD1, latitudeD2, latitudeD3, latitudeD4;
|
private double latitudeD1, latitudeD2, latitudeD3, latitudeD4, latitudeEPI;
|
||||||
private double longitudeD1, longitudeD2, longitudeD3, longitudeD4;
|
private double longitudeD1, longitudeD2, longitudeD3, longitudeD4, lonitudeEPI;
|
||||||
private String dev1, dev2, dev3, dev4;
|
private String dev1, dev2, dev3, dev4;
|
||||||
|
Epizentrum epizentrum;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -74,7 +77,8 @@ public class EarthquakeLocation extends FragmentActivity implements OnMapReadyCa
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
defineGPSforMapping(task.getResult());
|
defineGPSforMapping(task.getResult());
|
||||||
ermittleEpizentrum(task.getResult());
|
epizentrum = ermittleEpizentrum(task.getResult());
|
||||||
|
//ermittleEpizentrum(task.getResult());
|
||||||
//mapToDetektionssignale(task.getResult());
|
//mapToDetektionssignale(task.getResult());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,12 +130,11 @@ public class EarthquakeLocation extends FragmentActivity implements OnMapReadyCa
|
|||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
@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 erdbeben = new Erdbeben();
|
||||||
erdbeben.addDetektionssignalList(mapToDetektionssignale(data));
|
erdbeben.addDetektionssignalList(mapToDetektionssignale(data));
|
||||||
|
|
||||||
Epizentrum epizentrum = new Epizentrum();
|
Epizentrum epizentrum = erdbeben.ermittleEpizentrum();
|
||||||
epizentrum = erdbeben.ermittleEpizentrum();
|
|
||||||
|
|
||||||
if(Objects.isNull(epizentrum))
|
if(Objects.isNull(epizentrum))
|
||||||
{
|
{
|
||||||
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!Kein Epizentrum vorhanden!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!Kein Epizentrum vorhanden!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
@@ -139,13 +142,18 @@ public class EarthquakeLocation extends FragmentActivity implements OnMapReadyCa
|
|||||||
}
|
}
|
||||||
else
|
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, "Epizentrum konnte ermittelt werden, Koordinaten: " + epizentrum.getKoordinaten().getX() + " " + epizentrum.getKoordinaten().getY());
|
||||||
|
Log.i(TAGEPIZENTRUM, "Enstehungszeitpunkt: " + epizentrum.getEntstehungsZeitpunkt());
|
||||||
}
|
}
|
||||||
|
|
||||||
return epizentrum;
|
return epizentrum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||||
public ArrayList<Detektionssignal> mapToDetektionssignale(DataSnapshot data)
|
public ArrayList<Detektionssignal> mapToDetektionssignale(DataSnapshot data)
|
||||||
{
|
{
|
||||||
@@ -168,7 +176,10 @@ public class EarthquakeLocation extends FragmentActivity implements OnMapReadyCa
|
|||||||
String laengengradString = data.child("IDG" + i).child("e_laengengrad").getValue().toString();
|
String laengengradString = data.child("IDG" + i).child("e_laengengrad").getValue().toString();
|
||||||
double breitengrad = Double.parseDouble(breitengradString);
|
double breitengrad = Double.parseDouble(breitengradString);
|
||||||
double laengengrad = Double.parseDouble(laengengradString);
|
double laengengrad = Double.parseDouble(laengengradString);
|
||||||
Koordinaten koordinaten = new Koordinaten(breitengrad, laengengrad);
|
|
||||||
|
Deg2UTM deg2UTM = new Deg2UTM(breitengrad, laengengrad);
|
||||||
|
|
||||||
|
Koordinaten koordinaten = new Koordinaten(deg2UTM.getEasting(), deg2UTM.getNorthing());
|
||||||
detektionssignal.setKoordinaten(koordinaten);
|
detektionssignal.setKoordinaten(koordinaten);
|
||||||
|
|
||||||
//Welle in m/s
|
//Welle in m/s
|
||||||
@@ -178,7 +189,6 @@ public class EarthquakeLocation extends FragmentActivity implements OnMapReadyCa
|
|||||||
|
|
||||||
detektionssignale.add(detektionssignal);
|
detektionssignale.add(detektionssignal);
|
||||||
}
|
}
|
||||||
System.out.println("detektionsingale size: " + detektionssignale.size());
|
|
||||||
return detektionssignale;
|
return detektionssignale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,11 +201,23 @@ public class EarthquakeLocation extends FragmentActivity implements OnMapReadyCa
|
|||||||
//##########################################################################################################################################################################
|
//##########################################################################################################################################################################
|
||||||
//################################################################## vvv Maps Code vvv ###################################################################################
|
//################################################################## vvv Maps Code vvv ###################################################################################
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||||
@Override
|
@Override
|
||||||
public void onMapReady(GoogleMap googleMap) {
|
public void onMapReady(GoogleMap googleMap) {
|
||||||
mMap = 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
|
//aus DB für Device 1 long lat
|
||||||
LatLng device1 = new LatLng(latitudeD1, longitudeD1);
|
LatLng device1 = new LatLng(latitudeD1, longitudeD1);
|
||||||
mMap.addMarker(new MarkerOptions().position(device1).title("Device 1").icon(BitmapDescriptorFactory
|
mMap.addMarker(new MarkerOptions().position(device1).title("Device 1").icon(BitmapDescriptorFactory
|
||||||
@@ -213,8 +235,10 @@ public class EarthquakeLocation extends FragmentActivity implements OnMapReadyCa
|
|||||||
|
|
||||||
//man könnten noch eine IF Abfrage einbauen falls es 4 Devices gibt
|
//man könnten noch eine IF Abfrage einbauen falls es 4 Devices gibt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Add a marker in Epicenter
|
// 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.addMarker(new MarkerOptions().position(epicenter).title("Epicenter"));
|
||||||
mMap.moveCamera(CameraUpdateFactory.newLatLng(epicenter));
|
mMap.moveCamera(CameraUpdateFactory.newLatLng(epicenter));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import android.location.Location;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
|
import android.provider.ContactsContract;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -69,7 +70,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
//##########################################################################################################################################################################
|
//##########################################################################################################################################################################
|
||||||
//################################################################## vvv SensorParameter vvv ##############################################################################
|
//################################################################## vvv SensorParameter vvv ##############################################################################
|
||||||
private SensorManager mSensorManager;
|
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 float mLowerThreshold = 0.5f; // für Emulator auf 0.5 setzen
|
||||||
private static final long mShakeDetectionLockTimeMicroSeconds = 3500;
|
private static final long mShakeDetectionLockTimeMicroSeconds = 3500;
|
||||||
private float mAccel;
|
private float mAccel;
|
||||||
@@ -378,34 +380,83 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
public void analyzeDBchanges(DataSnapshot data)
|
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;
|
int takenIDG = 0;
|
||||||
for (int i=1; i<=data.getChildrenCount(); i++)
|
for (int i=1; i<=data.getChildrenCount(); i++)
|
||||||
{
|
{
|
||||||
if(analyzeForFullIDG(data,i))
|
if(analyzeForFullIDG(data,i))
|
||||||
{
|
{
|
||||||
//Ein voller IDG slot
|
|
||||||
takenIDG++;
|
takenIDG++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(takenIDG>=1 && takenIDG <=5)
|
|
||||||
{
|
|
||||||
//Kommt bei einer neuen vollen IDG ins Display
|
|
||||||
for(writtenDevices = writtenDevices; writtenDevices <= takenIDG; writtenDevices++)
|
|
||||||
{
|
|
||||||
setDisplayText(data,writtenDevices);
|
|
||||||
enableDisplayReset = true; //Für DB zurücksetzen
|
|
||||||
}
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
if(enableDisplayReset)
|
|
||||||
{
|
|
||||||
resetDisplayText();
|
|
||||||
enableDisplayReset = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Bei genau 3 Einträgen:
|
|
||||||
if(takenIDG >= 3 && allowCalculation)
|
if(takenIDG >= 3 && allowCalculation)
|
||||||
{
|
{
|
||||||
Toast.makeText(MainActivity.this, "3 Geräte regisrtiert - Berechnung möglich!", Toast.LENGTH_SHORT).show();
|
Toast.makeText(MainActivity.this, "3 Geräte regisrtiert - Berechnung möglich!", Toast.LENGTH_SHORT).show();
|
||||||
@@ -414,7 +465,17 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
btnEarthquake.setEnabled(true);
|
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)
|
public boolean analyzeForFullIDG(DataSnapshot data, int i)
|
||||||
{
|
{
|
||||||
String androidid = data.child("IDG" + i).child("a_androidid").getValue().toString();
|
String androidid = data.child("IDG" + i).child("a_androidid").getValue().toString();
|
||||||
@@ -434,50 +495,6 @@ 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("");
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getandroidid ()
|
public String getandroidid ()
|
||||||
{
|
{
|
||||||
return Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
|
return Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||||
@@ -549,6 +566,203 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
btnReadyToDetect.setEnabled(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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -556,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.os.Build;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import de.edotzlaff.detection.detektion.berechnung.Endpunkt;
|
import de.edotzlaff.detection.detektion.berechnung.Endpunkt;
|
||||||
import de.edotzlaff.detection.detektion.berechnung.EndpunktVerbindung;
|
import de.edotzlaff.detection.detektion.berechnung.EndpunktVerbindung;
|
||||||
@@ -15,12 +17,13 @@ import java.util.Objects;
|
|||||||
public class Erdbeben {
|
public class Erdbeben {
|
||||||
|
|
||||||
//ToDO anpassen an Szenario umso mehr umso wahrscheinlich ein Ergebnis, oder Abbruchbedingung mit do while
|
//ToDO anpassen an Szenario umso mehr umso wahrscheinlich ein Ergebnis, oder Abbruchbedingung mit do while
|
||||||
public static final Integer SCHLEIFENDURCHLAUFTE = 5000;
|
public static final Integer SCHLEIFENDURCHLAUFTE = 2000;
|
||||||
|
private static final String TAG = "ERDBEBEN";
|
||||||
|
|
||||||
private Epizentrum epizentrum;
|
private Epizentrum epizentrum;
|
||||||
private EpizentrumRechnung epizentrumRechnung;
|
private EpizentrumRechnung epizentrumRechnung;
|
||||||
private HashMap<String, Detektionssignal> nutzerDaten;
|
private HashMap<String, Detektionssignal> nutzerDaten;
|
||||||
|
private Detektionssignal erstesDetektionssignal;
|
||||||
|
|
||||||
public Erdbeben() {
|
public Erdbeben() {
|
||||||
|
|
||||||
@@ -38,8 +41,9 @@ public class Erdbeben {
|
|||||||
{
|
{
|
||||||
for (int i = 0; i< detektionssignale.size(); i++)
|
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)
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||||
@@ -48,7 +52,9 @@ public class Erdbeben {
|
|||||||
ArrayList<Detektionssignal> rechenListe = new ArrayList<>();
|
ArrayList<Detektionssignal> rechenListe = new ArrayList<>();
|
||||||
nutzerDaten.forEach((key, value) -> rechenListe.add(value));
|
nutzerDaten.forEach((key, value) -> rechenListe.add(value));
|
||||||
//Initialisierung der Rechung - First Element mit delta r + alle möglichen EndpunktKombinationen (einfach)
|
//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);
|
ArrayList<EndpunktVerbindung> endpunktKonbinationen = epizentrumRechnung.ermittleEndpunktKonbinationen(berechnungsEndpunkte);
|
||||||
|
|
||||||
//ToDo Vernünftiger Endpunkt überlegen bzw. bis wann abgebrochen wird -> Umzug in Berechnungs
|
//ToDo Vernünftiger Endpunkt überlegen bzw. bis wann abgebrochen wird -> Umzug in Berechnungs
|
||||||
@@ -57,10 +63,7 @@ public class Erdbeben {
|
|||||||
epizentrum = epizentrumRechnung.ueberpruefeObEpizentrum(endpunktKonbinationen);
|
epizentrum = epizentrumRechnung.ueberpruefeObEpizentrum(endpunktKonbinationen);
|
||||||
//ToDo set EnstehungsZeitpunkt -> (Bezugszeit, Koord, Koord, v;)
|
//ToDo set EnstehungsZeitpunkt -> (Bezugszeit, Koord, Koord, v;)
|
||||||
if (!Objects.isNull(epizentrum)) {
|
if (!Objects.isNull(epizentrum)) {
|
||||||
System.out.println("Epizentrum ermittelt");
|
epizentrum.setEntstehungsZeitpunkt(epizentrumRechnung.berechneEntstehungsZeitpunktLongLatt(erstesDetektionssignal, epizentrum.getKoordinaten()));
|
||||||
epizentrum.setEntstehungsZeitpunkt(
|
|
||||||
epizentrumRechnung.berechneEntstehungsZeitpunktLongLatt(
|
|
||||||
nutzerDaten.get(berechnungsEndpunkte.get(0).getNutzer()), epizentrum.getKoordinaten()));
|
|
||||||
return epizentrum;
|
return epizentrum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+44
-18
@@ -2,10 +2,14 @@ package de.edotzlaff.detection.detektion.berechnung;
|
|||||||
|
|
||||||
|
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
|
import android.nfc.Tag;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import de.edotzlaff.detection.detektion.Detektionssignal;
|
import de.edotzlaff.detection.detektion.Detektionssignal;
|
||||||
import de.edotzlaff.detection.detektion.Epizentrum;
|
import de.edotzlaff.detection.detektion.Epizentrum;
|
||||||
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.Koordinaten;
|
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.Koordinaten;
|
||||||
@@ -22,32 +26,47 @@ import java.util.Set;
|
|||||||
public class EpizentrumRechnung {
|
public class EpizentrumRechnung {
|
||||||
|
|
||||||
//ToDo Schrittweite und Abstand auf Szenario anpassen
|
//ToDo Schrittweite und Abstand auf Szenario anpassen
|
||||||
private static final double SCHRITTWEITE = 0.0001;
|
private static final double SCHRITTWEITE = 2;
|
||||||
private static final double MAX_ABSTAND = 0.001;
|
private static final double MAX_ABSTAND = 0.5;
|
||||||
private static final int DOUBLESTELLEN = 8;
|
private static final int DOUBLESTELLEN = 15;
|
||||||
|
private static final int SCHLEIFENDURCHLAUFTE = 8000;
|
||||||
|
|
||||||
|
private static final String TAG = "EPIZENTRUMRECHNUNG";
|
||||||
|
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||||
public ArrayList<Endpunkt> initEndpunkte(ArrayList<Detektionssignal> detektionssignal) {
|
public ArrayList<Endpunkt> initEndpunkte(ArrayList<Detektionssignal> detektionssignal, Detektionssignal ersteMessung) {
|
||||||
Detektionssignal nahegelegensteMessung = detektionssignal.get(0);
|
|
||||||
ArrayList<Endpunkt> arrBerechnungsObjekte = new ArrayList<>();
|
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) {
|
for (Detektionssignal aufzeichnung : detektionssignal) {
|
||||||
int zeitunterschied = aufzeichnung.getAnkunftsZeit().getHour() * 3600 + aufzeichnung.getAnkunftsZeit().getMinute() * 60 + aufzeichnung.getAnkunftsZeit().getSecond()
|
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();
|
double startradius = zeitunterschied * aufzeichnung.getGeschwErdbeben();
|
||||||
|
|
||||||
|
Log.i(TAG, "Init Daten: " + aufzeichnung.getDeviceId() + "Startradius: " + startradius);
|
||||||
Endpunkt tempEndpunkt = new Endpunkt(aufzeichnung.getDeviceId());
|
Endpunkt tempEndpunkt = new Endpunkt(aufzeichnung.getDeviceId());
|
||||||
Kreis k = new Kreis(aufzeichnung.getKoordinaten().getX(), aufzeichnung.getKoordinaten().getY(), startradius);
|
Kreis k = new Kreis(aufzeichnung.getKoordinaten().getX(), aufzeichnung.getKoordinaten().getY(), startradius);
|
||||||
tempEndpunkt.setKreis(k);
|
tempEndpunkt.setKreis(k);
|
||||||
arrBerechnungsObjekte.add(tempEndpunkt);
|
arrBerechnungsObjekte.add(tempEndpunkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.i(TAG, "Daten Erfolgreich initialisiert");
|
||||||
return arrBerechnungsObjekte;
|
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) {
|
public ArrayList<Schnittpunkt> berechneKreisSchnittpunkte(Kreis kreis1, Kreis kreis2) {
|
||||||
|
|
||||||
ArrayList<Schnittpunkt> schnittpunkte = new ArrayList<>();
|
ArrayList<Schnittpunkt> schnittpunkte = new ArrayList<>();
|
||||||
@@ -86,8 +105,8 @@ public class EpizentrumRechnung {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean genuegendSchnittpunktevorhanden(ArrayList<EndpunktVerbindung> endpunktVerbindungen) {
|
public boolean genuegendSchnittpunktevorhanden(ArrayList<EndpunktVerbindung> endpunktVerbindungen) {
|
||||||
System.out.println("<<<<<<<<<<<<<<<<<<<<<<genuegendSchnittpunktevorhanden");
|
//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) {
|
for (EndpunktVerbindung endpunktVerbindung : endpunktVerbindungen) {
|
||||||
ArrayList<Schnittpunkt> templist;
|
ArrayList<Schnittpunkt> templist;
|
||||||
templist = berechneKreisSchnittpunkte(endpunktVerbindung.getEndpunkt1().getKreis(), endpunktVerbindung.getEndpunkt2().getKreis());
|
templist = berechneKreisSchnittpunkte(endpunktVerbindung.getEndpunkt1().getKreis(), endpunktVerbindung.getEndpunkt2().getKreis());
|
||||||
@@ -100,7 +119,6 @@ public class EpizentrumRechnung {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Epizentrum ueberpruefeObEpizentrum(ArrayList<EndpunktVerbindung> endpunktVerbindungen) {
|
public Epizentrum ueberpruefeObEpizentrum(ArrayList<EndpunktVerbindung> endpunktVerbindungen) {
|
||||||
|
|
||||||
int counter;
|
int counter;
|
||||||
ArrayList<Schnittpunkt> schnittpunkte = new ArrayList<>();
|
ArrayList<Schnittpunkt> schnittpunkte = new ArrayList<>();
|
||||||
|
|
||||||
@@ -120,7 +138,9 @@ public class EpizentrumRechnung {
|
|||||||
if (counter == endpunktVerbindungen.size() - 1) {
|
if (counter == endpunktVerbindungen.size() - 1) {
|
||||||
schnittpunkte.add(s1);
|
schnittpunkte.add(s1);
|
||||||
Epizentrum tempEpizentrum = new Epizentrum();
|
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;
|
return tempEpizentrum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,17 +150,21 @@ public class EpizentrumRechnung {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Koordinaten berechneEpizentrumKoordinaten(ArrayList<Schnittpunkt> schnittpunkte) {
|
public Koordinaten berechneEpizentrumKoordinaten(ArrayList<Schnittpunkt> schnittpunkte) {
|
||||||
|
Log.i(TAG, "Berechne Epizentrum Koordinaten");
|
||||||
double x = 0;
|
double x = 0;
|
||||||
double y = 0;
|
double y = 0;
|
||||||
for (Schnittpunkt s : schnittpunkte) {
|
for (Schnittpunkt s : schnittpunkte) {
|
||||||
|
Log.i(TAG, "Koordinaten der Schnittpunkte: "+ s.getKoordinaten().getX() + " " + s.getKoordinaten().getY());
|
||||||
x+= s.getKoordinaten().getX();
|
x+= s.getKoordinaten().getX();
|
||||||
y+= s.getKoordinaten().getY();
|
y+= s.getKoordinaten().getY();
|
||||||
}
|
}
|
||||||
return new Koordinaten(new BigDecimal(x/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue(),
|
x = new BigDecimal(x/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue();
|
||||||
new BigDecimal(y/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) {
|
public ArrayList<EndpunktVerbindung> ermittleEndpunktKonbinationen(ArrayList<Endpunkt> tempBerechungsObjekte) {
|
||||||
|
|
||||||
ArrayList<EndpunktVerbindung> verbindungen = new ArrayList<>();
|
ArrayList<EndpunktVerbindung> verbindungen = new ArrayList<>();
|
||||||
Set<Set<Endpunkt>> combinations = Sets.combinations(ImmutableSet.copyOf(tempBerechungsObjekte), 2);
|
Set<Set<Endpunkt>> combinations = Sets.combinations(ImmutableSet.copyOf(tempBerechungsObjekte), 2);
|
||||||
for (Set<Endpunkt> tempEndpunkt : combinations) {
|
for (Set<Endpunkt> tempEndpunkt : combinations) {
|
||||||
@@ -148,6 +172,7 @@ public class EpizentrumRechnung {
|
|||||||
EndpunktVerbindung endpunktVerbindung = new EndpunktVerbindung(helpArrayToGetValues.get(0), helpArrayToGetValues.get(1));
|
EndpunktVerbindung endpunktVerbindung = new EndpunktVerbindung(helpArrayToGetValues.get(0), helpArrayToGetValues.get(1));
|
||||||
verbindungen.add(endpunktVerbindung);
|
verbindungen.add(endpunktVerbindung);
|
||||||
}
|
}
|
||||||
|
Log.i(TAG, "Endpunkteverbindungen Erfolgreich festgelegt, Anzahl: " + verbindungen.size());
|
||||||
return verbindungen;
|
return verbindungen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,11 +196,12 @@ public class EpizentrumRechnung {
|
|||||||
return detektionssignal.getAnkunftsZeit().minusSeconds(sec);
|
return detektionssignal.getAnkunftsZeit().minusSeconds(sec);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void erhoheRadius(ArrayList<Endpunkt> tempEndpunktListe) {
|
public void erhoheRadius(ArrayList<Endpunkt> tempEndpunktListe) {
|
||||||
|
|
||||||
for (Endpunkt b : tempEndpunktListe) {
|
for (Endpunkt b : tempEndpunktListe) {
|
||||||
b.erhoeheRadius(SCHRITTWEITE);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -86,6 +86,57 @@
|
|||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:text="@string/db_zur_cksetzen" />
|
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" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,4 +9,9 @@
|
|||||||
<string name="device_2">Device 2</string>
|
<string name="device_2">Device 2</string>
|
||||||
<string name="device_1">Device 1</string>
|
<string name="device_1">Device 1</string>
|
||||||
<string name="db_zur_cksetzen">DB zurücksetzen</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>
|
</resources>
|
||||||
Reference in new issue
Block a user