aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkeith.paterson <keith.paterson@saxsys.de>2012-04-11 22:02:50 +0200
committerkeith.paterson <keith.paterson@saxsys.de>2012-04-11 22:02:50 +0200
commit315c56f52ff7977cc31e34226ebd5782b9031d5b (patch)
tree303ac4eff9d514aa7b01e7432138841a71acd502
parent60d4f531a0d47dcf9231329e218974d267103fbc (diff)
downloadcgeo-315c56f52ff7977cc31e34226ebd5782b9031d5b.zip
cgeo-315c56f52ff7977cc31e34226ebd5782b9031d5b.tar.gz
cgeo-315c56f52ff7977cc31e34226ebd5782b9031d5b.tar.bz2
Small fix for Pull #1391
-rw-r--r--main/src/cgeo/geocaching/cgData.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java
index 3bc9d00..98443e2 100644
--- a/main/src/cgeo/geocaching/cgData.java
+++ b/main/src/cgeo/geocaching/cgData.java
@@ -1884,12 +1884,16 @@ public class cgData {
Cursor cursor = null;
try {
- StringBuilder where = cgData.whereGeocodeIn(geocodes);
+ StringBuilder where = new StringBuilder();
// viewport limitation
if (centerLat != null && centerLon != null && spanLat != null && spanLon != null) {
where.append(buildCoordinateWhere(centerLat, centerLon, spanLat, spanLon));
}
+ else
+ {
+ cgData.whereGeocodeIn(geocodes);
+ }
cursor = databaseRO.query(
dbTableCaches,
CACHE_COLUMNS,
@@ -1983,7 +1987,7 @@ public class cgData {
* @return
*/
- private String buildCoordinateWhere(final Long centerLat, final Long centerLon, final Long spanLat, final Long spanLon) {
+ private static String buildCoordinateWhere(final Long centerLat, final Long centerLon, final Long spanLat, final Long spanLon) {
StringBuilder where = new StringBuilder();
double latMin = (centerLat / 1e6) - ((spanLat / 1e6) / 2) - ((spanLat / 1e6) / 4);
double latMax = (centerLat / 1e6) + ((spanLat / 1e6) / 2) + ((spanLat / 1e6) / 4);
@@ -2002,9 +2006,6 @@ public class cgData {
lonMin = llCache;
}
- if (where.length() > 0) {
- where.append(" and ");
- }
where.append("(latitude >= ");
where.append(String.format((Locale) null, "%.6f", latMin));
where.append(" and latitude <= ");