mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Tidied CacheController code
This commit is contained in:
parent
33ec4e50f3
commit
1efc6e38ed
1 changed files with 2 additions and 8 deletions
|
|
@ -10,9 +10,7 @@ import fr.free.nrw.commons.upload.MwVolleyApi;
|
||||||
|
|
||||||
public class CacheController {
|
public class CacheController {
|
||||||
|
|
||||||
private Context context;
|
private double x, y;
|
||||||
private double x;
|
|
||||||
private double y;
|
|
||||||
private QuadTree quadTree;
|
private QuadTree quadTree;
|
||||||
private Point[] pointsFound;
|
private Point[] pointsFound;
|
||||||
private double xMinus, xPlus, yMinus, yPlus;
|
private double xMinus, xPlus, yMinus, yPlus;
|
||||||
|
|
@ -21,7 +19,6 @@ public class CacheController {
|
||||||
quadTree = new QuadTree(-180, -90, +180, +90);
|
quadTree = new QuadTree(-180, -90, +180, +90);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setQtPoint(double decLongitude, double decLatitude) {
|
public void setQtPoint(double decLongitude, double decLatitude) {
|
||||||
x = decLongitude;
|
x = decLongitude;
|
||||||
y = decLatitude;
|
y = decLatitude;
|
||||||
|
|
@ -29,7 +26,6 @@ public class CacheController {
|
||||||
Log.d("Cache", "X (longitude) value: " + x + ", Y (latitude) value: " + y);
|
Log.d("Cache", "X (longitude) value: " + x + ", Y (latitude) value: " + y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void cacheCategory() {
|
public void cacheCategory() {
|
||||||
|
|
||||||
List<String> pointCatList = new ArrayList<String>();
|
List<String> pointCatList = new ArrayList<String>();
|
||||||
|
|
@ -44,7 +40,7 @@ public class CacheController {
|
||||||
|
|
||||||
public List findCategory() {
|
public List findCategory() {
|
||||||
|
|
||||||
//Convert decLatitude and decLongitude to a coordinate offset range
|
//Convert decLatitude and decLongitude to a coordinate offset range
|
||||||
convertCoordRange();
|
convertCoordRange();
|
||||||
pointsFound = quadTree.searchWithin(xMinus, yMinus, xPlus, yPlus);
|
pointsFound = quadTree.searchWithin(xMinus, yMinus, xPlus, yPlus);
|
||||||
List displayCatList = new ArrayList();
|
List displayCatList = new ArrayList();
|
||||||
|
|
@ -76,11 +72,9 @@ public class CacheController {
|
||||||
|
|
||||||
//Earth’s radius, sphere
|
//Earth’s radius, sphere
|
||||||
double radius=6378137;
|
double radius=6378137;
|
||||||
|
|
||||||
//offsets in meters
|
//offsets in meters
|
||||||
double offset = 100;
|
double offset = 100;
|
||||||
|
|
||||||
|
|
||||||
//Coordinate offsets in radians
|
//Coordinate offsets in radians
|
||||||
double dLat = offset/radius;
|
double dLat = offset/radius;
|
||||||
double dLon = offset/(radius*Math.cos(Math.PI*lat/180));
|
double dLon = offset/(radius*Math.cos(Math.PI*lat/180));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue