mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 13:23:58 +01:00
Converted Floats and Doubles to double where possible
This commit is contained in:
parent
5a4251fe55
commit
3ffcb8fd57
1 changed files with 13 additions and 14 deletions
|
|
@ -80,7 +80,7 @@ public class ImageProcessing {
|
||||||
//Converts format of coords into decimal coords as required by API for next step
|
//Converts format of coords into decimal coords as required by API for next step
|
||||||
private String getDecimalCoords(String latitude, String latitude_ref, String longitude, String longitude_ref) {
|
private String getDecimalCoords(String latitude, String latitude_ref, String longitude, String longitude_ref) {
|
||||||
|
|
||||||
Float decLatitude, decLongitude;
|
double decLatitude, decLongitude;
|
||||||
|
|
||||||
if(latitude_ref.equals("N")){
|
if(latitude_ref.equals("N")){
|
||||||
decLatitude = convertToDegree(latitude);
|
decLatitude = convertToDegree(latitude);
|
||||||
|
|
@ -99,27 +99,26 @@ public class ImageProcessing {
|
||||||
return (String.valueOf(decLatitude) + ", " + String.valueOf(decLongitude));
|
return (String.valueOf(decLatitude) + ", " + String.valueOf(decLongitude));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Float convertToDegree(String stringDMS){
|
private double convertToDegree(String stringDMS){
|
||||||
Float result;
|
double result;
|
||||||
String[] DMS = stringDMS.split(",", 3);
|
String[] DMS = stringDMS.split(",", 3);
|
||||||
|
|
||||||
String[] stringD = DMS[0].split("/", 2);
|
String[] stringD = DMS[0].split("/", 2);
|
||||||
Double D0 = new Double(stringD[0]);
|
double d0 = new Double(stringD[0]);
|
||||||
Double D1 = new Double(stringD[1]);
|
double d1 = new Double(stringD[1]);
|
||||||
Double FloatD = D0/D1;
|
double degrees = d0/d1;
|
||||||
|
|
||||||
String[] stringM = DMS[1].split("/", 2);
|
String[] stringM = DMS[1].split("/", 2);
|
||||||
Double M0 = new Double(stringM[0]);
|
double m0 = new Double(stringM[0]);
|
||||||
Double M1 = new Double(stringM[1]);
|
double m1 = new Double(stringM[1]);
|
||||||
Double FloatM = M0/M1;
|
double minutes = m0/m1;
|
||||||
|
|
||||||
String[] stringS = DMS[2].split("/", 2);
|
String[] stringS = DMS[2].split("/", 2);
|
||||||
Double S0 = new Double(stringS[0]);
|
double s0 = new Double(stringS[0]);
|
||||||
Double S1 = new Double(stringS[1]);
|
double s1 = new Double(stringS[1]);
|
||||||
Double FloatS = S0/S1;
|
double seconds = s0/s1;
|
||||||
|
|
||||||
result = new Float(FloatD + (FloatM/60) + (FloatS/3600));
|
|
||||||
|
|
||||||
|
result = degrees + (minutes/60) + (seconds/3600);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue