From 74dcd9df8f64e90182f568da3f34649692f240c7 Mon Sep 17 00:00:00 2001 From: misaochan Date: Tue, 5 Jan 2016 19:13:15 +1300 Subject: [PATCH] Cleaned up unnecessary code --- .../free/nrw/commons/upload/GPSExtractor.java | 45 +++---------------- .../nrw/commons/upload/ShareActivity.java | 2 +- 2 files changed, 8 insertions(+), 39 deletions(-) diff --git a/commons/src/main/java/fr/free/nrw/commons/upload/GPSExtractor.java b/commons/src/main/java/fr/free/nrw/commons/upload/GPSExtractor.java index 28685353d..4de87d42a 100644 --- a/commons/src/main/java/fr/free/nrw/commons/upload/GPSExtractor.java +++ b/commons/src/main/java/fr/free/nrw/commons/upload/GPSExtractor.java @@ -16,7 +16,7 @@ public class GPSExtractor { } //Extract GPS coords of image - public String getCoords(boolean xyCoordsReq) { + public String getCoords() { ExifInterface exif; String latitude = ""; @@ -24,7 +24,6 @@ public class GPSExtractor { String latitude_ref = ""; String longitude_ref = ""; String decimalCoords = ""; - String xyCoords = ""; try { exif = new ExifInterface(filePath); @@ -43,17 +42,12 @@ public class GPSExtractor { longitude = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE); longitude_ref = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF); - if (xyCoordsReq == true) { - Log.d("Image", "Latitude: " + latitude + " " + latitude_ref); - Log.d("Image", "Longitude: " + longitude + " " + longitude_ref); - xyCoords = getXyCoords(latitude, latitude_ref, longitude, longitude_ref); - return xyCoords; - } else { - Log.d("Image", "Latitude: " + latitude + " " + latitude_ref); - Log.d("Image", "Longitude: " + longitude + " " + longitude_ref); - decimalCoords = getDecimalCoords(latitude, latitude_ref, longitude, longitude_ref); - return decimalCoords; - } + + Log.d("Image", "Latitude: " + latitude + " " + latitude_ref); + Log.d("Image", "Longitude: " + longitude + " " + longitude_ref); + decimalCoords = getDecimalCoords(latitude, latitude_ref, longitude, longitude_ref); + return decimalCoords; + } } @@ -89,31 +83,6 @@ public class GPSExtractor { return decimalCoords; } - //Converts format of coords into XY values as required by Quadtree for caching - private String getXyCoords(String latitude, String latitude_ref, String longitude, String longitude_ref) { - - double decLatitude, decLongitude; - - if(latitude_ref.equals("N")){ - decLatitude = convertToDegree(latitude); - } - else{ - decLatitude = 0 - convertToDegree(latitude); - } - - if(longitude_ref.equals("E")){ - decLongitude = convertToDegree(longitude); - } - else{ - decLongitude = 0 - convertToDegree(longitude); - } - - //Have to return Longitude before Latitude for X/Y conversion. Long = X; Lat = Y - String xyCoords = String.valueOf(decLongitude) + "|" + String.valueOf(decLatitude); - Log.d("Coords", "X and Y are " + xyCoords); - return xyCoords; - } - private double convertToDegree(String stringDMS){ double result; diff --git a/commons/src/main/java/fr/free/nrw/commons/upload/ShareActivity.java b/commons/src/main/java/fr/free/nrw/commons/upload/ShareActivity.java index 8e6b6ae75..e06a70e28 100644 --- a/commons/src/main/java/fr/free/nrw/commons/upload/ShareActivity.java +++ b/commons/src/main/java/fr/free/nrw/commons/upload/ShareActivity.java @@ -184,7 +184,7 @@ public class ShareActivity Log.d("Image", "Calling GPSExtractor"); GPSExtractor imageObj = new GPSExtractor(filePath); //decimalCoords for MediaWiki API, xyCoords for Quadtree - String decimalCoords = imageObj.getCoords(false); + String decimalCoords = imageObj.getCoords(); double decLongitude = imageObj.getDecLongitude(); double decLatitude = imageObj.getDecLatitude();