Tidied CacheController code

This commit is contained in:
misaochan 2016-01-06 19:07:21 +13:00
parent 33ec4e50f3
commit 1efc6e38ed

View file

@ -10,9 +10,7 @@ import fr.free.nrw.commons.upload.MwVolleyApi;
public class CacheController {
private Context context;
private double x;
private double y;
private double x, y;
private QuadTree quadTree;
private Point[] pointsFound;
private double xMinus, xPlus, yMinus, yPlus;
@ -21,7 +19,6 @@ public class CacheController {
quadTree = new QuadTree(-180, -90, +180, +90);
}
public void setQtPoint(double decLongitude, double decLatitude) {
x = decLongitude;
y = decLatitude;
@ -29,7 +26,6 @@ public class CacheController {
Log.d("Cache", "X (longitude) value: " + x + ", Y (latitude) value: " + y);
}
public void cacheCategory() {
List<String> pointCatList = new ArrayList<String>();
@ -44,7 +40,7 @@ public class CacheController {
public List findCategory() {
//Convert decLatitude and decLongitude to a coordinate offset range
//Convert decLatitude and decLongitude to a coordinate offset range
convertCoordRange();
pointsFound = quadTree.searchWithin(xMinus, yMinus, xPlus, yPlus);
List displayCatList = new ArrayList();
@ -76,11 +72,9 @@ public class CacheController {
//Earths radius, sphere
double radius=6378137;
//offsets in meters
double offset = 100;
//Coordinate offsets in radians
double dLat = offset/radius;
double dLon = offset/(radius*Math.cos(Math.PI*lat/180));