diff options
| author | rsudev <rsudev@googlemail.com> | 2013-07-10 16:39:47 +0200 |
|---|---|---|
| committer | rsudev <rsudev@googlemail.com> | 2013-07-10 16:39:47 +0200 |
| commit | 190343a9809863574642498c9d3d746c86f97d1b (patch) | |
| tree | 9133ec6f60999fec4039a3b7ecfbf3bb4c19e90e /main/src/cgeo/geocaching | |
| parent | 3dfb1b3c5aea16e7a5d730f2ec7327e381f0236d (diff) | |
| download | cgeo-190343a9809863574642498c9d3d746c86f97d1b.zip cgeo-190343a9809863574642498c9d3d746c86f97d1b.tar.gz cgeo-190343a9809863574642498c9d3d746c86f97d1b.tar.bz2 | |
Fix #2962, Live map empty after loading has finished
Did not take zoomlevel into account when checking, thereby removing caches from cached tiles
Diffstat (limited to 'main/src/cgeo/geocaching')
| -rw-r--r-- | main/src/cgeo/geocaching/Geocache.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgData.java | 20 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/connector/gc/GCMap.java | 2 |
3 files changed, 16 insertions, 10 deletions
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index 1f1bd3b..dd292f9 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -1490,6 +1490,10 @@ public class Geocache implements ICache, IWaypoint { storeCache(this, null, newListId, false, handler); } + public int getZoomLevel() { + return this.zoomlevel; + } + public void setZoomlevel(int zoomlevel) { this.zoomlevel = zoomlevel; } diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index 33e0f46..2af2f82 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -3001,7 +3001,7 @@ public class cgData { return false; } - public static Set<String> getCachedMissingFromSearch(SearchResult searchResult, Set<Tile> tiles, IConnector connector) { + public static Set<String> getCachedMissingFromSearch(final SearchResult searchResult, final Set<Tile> tiles, final IConnector connector, final int maxZoom) { // get cached cgeocaches final Set<String> cachedGeocodes = new HashSet<String>(); @@ -3016,15 +3016,17 @@ public class cgData { for (String geocode : cachedGeocodes) { if (connector.canHandle(geocode)) { Geocache geocache = cacheCache.getCacheFromCache(geocode); - boolean bFound = false; - for (Tile tile : tiles) { - if (tile.containsPoint(geocache)) { - bFound = true; - break; + if (geocache.getZoomLevel() <= maxZoom) { + boolean bFound = false; + for (Tile tile : tiles) { + if (tile.containsPoint(geocache)) { + bFound = true; + break; + } + } + if (bFound) { + missingFromSearch.add(geocode); } - } - if (bFound) { - missingFromSearch.add(geocode); } } } diff --git a/main/src/cgeo/geocaching/connector/gc/GCMap.java b/main/src/cgeo/geocaching/connector/gc/GCMap.java index dbe8ced..9268479 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCMap.java +++ b/main/src/cgeo/geocaching/connector/gc/GCMap.java @@ -352,7 +352,7 @@ public class GCMap { // Check for vanished found caches if (tiles.iterator().next().getZoomlevel() >= Tile.ZOOMLEVEL_MIN_PERSONALIZED) { - searchResult.addFilteredGeocodes(cgData.getCachedMissingFromSearch(searchResult, tiles, GCConnector.getInstance())); + searchResult.addFilteredGeocodes(cgData.getCachedMissingFromSearch(searchResult, tiles, GCConnector.getInstance(), Tile.ZOOMLEVEL_MIN_PERSONALIZED - 1)); } } |
