Compare commits
8
Commits
dfffc2c9f1
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59d17304ad | ||
|
|
906df05c6c | ||
|
|
a685f972bf | ||
|
|
53528a82e9 | ||
|
|
ba9e3d5aa7 | ||
|
|
9f1f243f50 | ||
|
|
2c9c2ef7c4 | ||
|
|
3ba534c285 |
No files matched your search
@@ -43,5 +43,6 @@ dependencies {
|
|||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||||
|
|
||||||
implementation("com.google.guava:guava:30.1.1-jre")
|
implementation("com.google.guava:guava:30.1.1-jre")
|
||||||
|
implementation ('com.lemmingapex.trilateration:trilateration:1.0.2')
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,6 +142,9 @@ 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());
|
Log.i(TAGEPIZENTRUM, "Enstehungszeitpunkt: " + epizentrum.getEntstehungsZeitpunkt());
|
||||||
}
|
}
|
||||||
@@ -169,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
|
||||||
@@ -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));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ 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 = 0.075f; // für Emulator auf 1.5 setzen
|
||||||
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;
|
||||||
@@ -101,15 +101,17 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
{
|
{
|
||||||
//TextView txtEarthquake = (TextView) findViewById(R.id.txtEarthquake);
|
//TextView txtEarthquake = (TextView) findViewById(R.id.txtEarthquake);
|
||||||
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
|
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
|
||||||
Objects.requireNonNull(mSensorManager).registerListener(mSensorListener, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL);
|
Objects.requireNonNull(mSensorManager).registerListener(mSensorListener, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_FASTEST);
|
||||||
mAccel = 1f;
|
mAccel = 0.05f;
|
||||||
mAccelCurrent = SensorManager.GRAVITY_EARTH;
|
mAccelCurrent = SensorManager.GRAVITY_EARTH;
|
||||||
mAccelLast = SensorManager.GRAVITY_EARTH;
|
mAccelLast = SensorManager.GRAVITY_EARTH;
|
||||||
mShakeDetectionIsActive = false;
|
mShakeDetectionIsActive = false;
|
||||||
mShakeDetected = false;
|
mShakeDetected = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final SensorEventListener mSensorListener = new SensorEventListener() {
|
private final SensorEventListener mSensorListener = new SensorEventListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSensorChanged(SensorEvent event) {
|
public void onSensorChanged(SensorEvent event) {
|
||||||
float x = event.values[0];
|
float x = event.values[0];
|
||||||
@@ -119,11 +121,11 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
mAccelCurrent = (float) Math.sqrt((double) (x * x + y * y + z * z));
|
mAccelCurrent = (float) Math.sqrt((double) (x * x + y * y + z * z));
|
||||||
float delta = mAccelCurrent - mAccelLast;
|
float delta = mAccelCurrent - mAccelLast;
|
||||||
mAccel = mAccel * 0.9f + delta;
|
mAccel = mAccel * 0.9f + delta;
|
||||||
// Log.d(TAG,"mAccel: "+ mAccel);
|
Log.d(TAG,"mAccel: "+ mAccel);
|
||||||
if (mShakeDetectionIsActive && !mShakeDetected) {
|
if (mShakeDetectionIsActive && !mShakeDetected) {
|
||||||
if(Math.abs(mAccel) > mUpperThreshold) {
|
if(Math.abs(mAccel) > mUpperThreshold) {
|
||||||
|
|
||||||
new CountDownTimer(1000, 10) {
|
new CountDownTimer(500, 10) {
|
||||||
|
|
||||||
public void onTick(long millisUntilFinished) {
|
public void onTick(long millisUntilFinished) {
|
||||||
mShakeDetectionIsActive = false;
|
mShakeDetectionIsActive = false;
|
||||||
@@ -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,49 +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 ()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class Detektionssignal {
|
|||||||
this.koordinaten = koordinaten;
|
this.koordinaten = koordinaten;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getGeschwErdbeben() {
|
public double getGeschwErdbeben() {
|
||||||
return geschwErdbeben;
|
return geschwErdbeben;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +44,6 @@ public class Detektionssignal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Koordinaten koordinaten;
|
public Koordinaten koordinaten;
|
||||||
public int geschwErdbeben;
|
public double geschwErdbeben;
|
||||||
public LocalDateTime ankunftsZeit;
|
public LocalDateTime ankunftsZeit;
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ import android.os.Build;
|
|||||||
import android.util.Log;
|
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;
|
||||||
import de.edotzlaff.detection.detektion.berechnung.EpizentrumRechnung;
|
import de.edotzlaff.detection.detektion.berechnung.EpizentrumRechnung;
|
||||||
@@ -17,7 +18,7 @@ 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 = 8000;
|
public static final Integer SCHLEIFENDURCHLAUFTE = 200;
|
||||||
private static final String TAG = "ERDBEBEN";
|
private static final String TAG = "ERDBEBEN";
|
||||||
|
|
||||||
private Epizentrum epizentrum;
|
private Epizentrum epizentrum;
|
||||||
@@ -37,11 +38,9 @@ public class Erdbeben {
|
|||||||
return nutzerDaten.size();
|
return nutzerDaten.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDetektionssignalList(ArrayList<Detektionssignal> detektionssignale)
|
public void addDetektionssignalList(ArrayList<Detektionssignal> detektionssignale) {
|
||||||
{
|
for (int i = 0; i < detektionssignale.size(); i++) {
|
||||||
for (int i = 0; i< detektionssignale.size(); i++)
|
nutzerDaten.put(detektionssignale.get(i).getDeviceId() + "i", detektionssignale.get(i));
|
||||||
{
|
|
||||||
nutzerDaten.put(detektionssignale.get(i).getDeviceId()+"i",detektionssignale.get(i));
|
|
||||||
}
|
}
|
||||||
Log.i(TAG, "addDetektionssignalList: " + nutzerDaten.size());
|
Log.i(TAG, "addDetektionssignalList: " + nutzerDaten.size());
|
||||||
}
|
}
|
||||||
@@ -69,6 +68,16 @@ public class Erdbeben {
|
|||||||
}
|
}
|
||||||
epizentrumRechnung.erhoheRadius(berechnungsEndpunkte);
|
epizentrumRechnung.erhoheRadius(berechnungsEndpunkte);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!Objects.isNull(epizentrumRechnung.trilateration(berechnungsEndpunkte)))
|
||||||
|
{
|
||||||
|
epizentrum = epizentrumRechnung.trilateration(berechnungsEndpunkte);
|
||||||
|
Log.i(TAG, "Koordinaten: " +epizentrum.getKoordinaten().getX() + " " + epizentrum.getKoordinaten().getY());
|
||||||
|
epizentrum.setEntstehungsZeitpunkt(epizentrumRechnung.berechneEntstehungsZeitpunktLongLatt(erstesDetektionssignal, epizentrum.getKoordinaten()));
|
||||||
|
return epizentrum;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+46
-10
@@ -2,18 +2,25 @@ 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 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 com.lemmingapex.trilateration.NonLinearLeastSquaresSolver;
|
||||||
|
import com.lemmingapex.trilateration.TrilaterationFunction;
|
||||||
|
|
||||||
|
import org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer;
|
||||||
|
import org.apache.commons.math3.fitting.leastsquares.LevenbergMarquardtOptimizer;
|
||||||
|
|
||||||
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;
|
||||||
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.Kreis;
|
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.Kreis;
|
||||||
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.Schnittpunkt;
|
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.Schnittpunkt;
|
||||||
|
import de.edotzlaff.detection.detektion.berechnung.mathObjekte.UTM2Deg;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
@@ -25,9 +32,9 @@ 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.000050;
|
private static final double SCHRITTWEITE = 5;
|
||||||
private static final double MAX_ABSTAND = 0.000058;
|
private static final double MAX_ABSTAND = 5;
|
||||||
private static final int DOUBLESTELLEN = 24;
|
private static final int DOUBLESTELLEN = 15;
|
||||||
private static final int SCHLEIFENDURCHLAUFTE = 5000;
|
private static final int SCHLEIFENDURCHLAUFTE = 5000;
|
||||||
|
|
||||||
private static final String TAG = "EPIZENTRUMRECHNUNG";
|
private static final String TAG = "EPIZENTRUMRECHNUNG";
|
||||||
@@ -40,7 +47,7 @@ public class EpizentrumRechnung {
|
|||||||
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()
|
||||||
- ersteMessung.getAnkunftsZeit().getHour() * 3600 - ersteMessung.getAnkunftsZeit().getMinute() * 60 - ersteMessung.getAnkunftsZeit().getSecond();
|
- ersteMessung.getAnkunftsZeit().getHour() * 3600 - ersteMessung.getAnkunftsZeit().getMinute() * 60 - ersteMessung.getAnkunftsZeit().getSecond();
|
||||||
|
|
||||||
double startradius = zeitunterschied * aufzeichnung.getGeschwErdbeben()*0.0000114130224932113000000;
|
double startradius = zeitunterschied * aufzeichnung.getGeschwErdbeben();
|
||||||
|
|
||||||
Log.i(TAG, "Init Daten: " + aufzeichnung.getDeviceId() + "Startradius: " + startradius);
|
Log.i(TAG, "Init Daten: " + aufzeichnung.getDeviceId() + "Startradius: " + startradius);
|
||||||
Endpunkt tempEndpunkt = new Endpunkt(aufzeichnung.getDeviceId());
|
Endpunkt tempEndpunkt = new Endpunkt(aufzeichnung.getDeviceId());
|
||||||
@@ -62,6 +69,7 @@ public class EpizentrumRechnung {
|
|||||||
erstesDetektionssignal = detektionssignale.get(i);
|
erstesDetektionssignal = detektionssignale.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Log.i(TAG, "Test");
|
||||||
return erstesDetektionssignal;
|
return erstesDetektionssignal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,11 +160,12 @@ public class EpizentrumRechnung {
|
|||||||
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();
|
||||||
}
|
}
|
||||||
x = new BigDecimal(x/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue()*0.999308681;
|
x = new BigDecimal(x/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue();
|
||||||
y = new BigDecimal(y/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue()*1.000831381;
|
y = new BigDecimal(y/schnittpunkte.size()).setScale(DOUBLESTELLEN, RoundingMode.HALF_UP).doubleValue();
|
||||||
return new Koordinaten(x,y);
|
return new Koordinaten(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,21 +187,21 @@ public class EpizentrumRechnung {
|
|||||||
double abstand = Math.sqrt(
|
double abstand = Math.sqrt(
|
||||||
Math.pow(detektionssignal.getKoordinaten().getX() - koordEpi.getX(), 2) +
|
Math.pow(detektionssignal.getKoordinaten().getX() - koordEpi.getX(), 2) +
|
||||||
Math.pow(detektionssignal.getKoordinaten().getY() - koordEpi.getY(), 2));
|
Math.pow(detektionssignal.getKoordinaten().getY() - koordEpi.getY(), 2));
|
||||||
int sec = (int) abstand/ detektionssignal.geschwErdbeben;
|
int sec = (int) (abstand / detektionssignal.geschwErdbeben);
|
||||||
|
|
||||||
return detektionssignal.getAnkunftsZeit().minusSeconds(sec);
|
return detektionssignal.getAnkunftsZeit().minusSeconds(sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||||
public LocalDateTime berechneEntstehungsZeitpunktLongLatt(Detektionssignal detektionssignal, Koordinaten koordEpi)
|
public LocalDateTime berechneEntstehungsZeitpunktLongLatt(Detektionssignal detektionssignal, Koordinaten koordEpi) {
|
||||||
{
|
|
||||||
float[] results = new float[1];
|
float[] results = new float[1];
|
||||||
Location.distanceBetween(detektionssignal.getKoordinaten().getX(), detektionssignal.getKoordinaten().getY(), koordEpi.getX(), koordEpi.getY(), results);
|
Location.distanceBetween(detektionssignal.getKoordinaten().getX(), detektionssignal.getKoordinaten().getY(), koordEpi.getX(), koordEpi.getY(), results);
|
||||||
float distanceInMeters = results[0];
|
float distanceInMeters = results[0];
|
||||||
int sec = (int) distanceInMeters/ detektionssignal.geschwErdbeben;
|
int sec = (int) (distanceInMeters / detektionssignal.geschwErdbeben);
|
||||||
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) {
|
||||||
@@ -200,5 +209,32 @@ public class EpizentrumRechnung {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Epizentrum trilateration(ArrayList<Endpunkt> tempEndpunktListe) {
|
||||||
|
double[][] positions = new double[tempEndpunktListe.size()][2];
|
||||||
|
double[] distances = new double[tempEndpunktListe.size()];
|
||||||
|
|
||||||
|
for (int i = 0; i < tempEndpunktListe.size(); i++) {
|
||||||
|
positions[i][0] = tempEndpunktListe.get(i).getKreis().getMittelPunkt().getX();
|
||||||
|
positions[i][1] = tempEndpunktListe.get(i).getKreis().getMittelPunkt().getY();
|
||||||
|
distances[i] = tempEndpunktListe.get(i).getKreis().getRadius();
|
||||||
|
}
|
||||||
|
NonLinearLeastSquaresSolver solver = new NonLinearLeastSquaresSolver(new TrilaterationFunction(positions, distances), new LevenbergMarquardtOptimizer());
|
||||||
|
LeastSquaresOptimizer.Optimum optimum = solver.solve();
|
||||||
|
|
||||||
|
double[] centroid = optimum.getPoint().toArray();
|
||||||
|
if (centroid.length == 2) {
|
||||||
|
UTM2Deg utm2Deg = new UTM2Deg();
|
||||||
|
utm2Deg.convertToDeg(32, 'U', centroid[0], centroid[1]);
|
||||||
|
|
||||||
|
Log.i(TAG, "Center: " + utm2Deg.getLatitude() + " " + utm2Deg.getLongitude());
|
||||||
|
Epizentrum epizentrum = new Epizentrum();
|
||||||
|
Koordinaten koordinaten = new Koordinaten(centroid[0], centroid[1]);
|
||||||
|
epizentrum.setKoordinaten(koordinaten);
|
||||||
|
return epizentrum;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user