time checks removed

This commit is contained in:
simon 2020-09-10 17:12:46 +03:00
parent 65e8328a0c
commit b708f8e6ff
2 changed files with 7 additions and 9 deletions

View file

@ -6,7 +6,6 @@ import net.osmand.PlatformUtil;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import java.io.File; import java.io.File;
@ -18,7 +17,7 @@ public class MetaTileFileSystemCache {
private static final String TILES_FOLDER = "webtiles"; private static final String TILES_FOLDER = "webtiles";
static final int TILE_SIZE_PX = 256; static final int TILE_SIZE_PX = 256;
static final int TILE_DENSITY = 2; static final int TILE_DENSITY = 2;
static final int METATILE_SIZE = 4; static final int METATILE_SIZE = 2;
private static final int MAX_IN_MEMORY_CACHE_SIZE = 16 / METATILE_SIZE; private static final int MAX_IN_MEMORY_CACHE_SIZE = 16 / METATILE_SIZE;
private static final int MAX_CACHE_SIZE = 128; private static final int MAX_CACHE_SIZE = 128;

View file

@ -1,13 +1,13 @@
package net.osmand.plus.server.endpoints; package net.osmand.plus.server.endpoints;
import android.graphics.*; import android.graphics.*;
import androidx.annotation.GuardedBy;
import fi.iki.elonen.NanoHTTPD; import fi.iki.elonen.NanoHTTPD;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.resources.AsyncLoadingThread; import net.osmand.plus.resources.AsyncLoadingThread;
import net.osmand.plus.server.OsmAndHttpServer; import net.osmand.plus.server.OsmAndHttpServer;
import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
@ -16,16 +16,16 @@ import java.io.ByteArrayOutputStream;
import static fi.iki.elonen.NanoHTTPD.newFixedLengthResponse; import static fi.iki.elonen.NanoHTTPD.newFixedLengthResponse;
public class TileEndpoint implements OsmAndHttpServer.ApiEndpoint { public class TileEndpoint implements OsmAndHttpServer.ApiEndpoint {
private static final int TIMEOUT_STEP = 150; private static final int TIMEOUT_STEP = 150;
private static final int TIMEOUT = 15000; private static final int TIMEOUT = 15000;
private static final Log LOG = PlatformUtil.getLog(TileEndpoint.class); private static final Log LOG = PlatformUtil.getLog(TileEndpoint.class);
private final MapActivity mapActivity; @GuardedBy("this")
private final MetaTileFileSystemCache cache; //todo cancel on zoom
private static int lastZoom = -999;
//TODO restore mapState on Exit //TODO restore mapState on Exit
private final RotatedTileBox mapTileBoxCopy; private final RotatedTileBox mapTileBoxCopy;
private final MapActivity mapActivity;
private final MetaTileFileSystemCache cache;
public TileEndpoint(MapActivity mapActivity) { public TileEndpoint(MapActivity mapActivity) {
this.mapActivity = mapActivity; this.mapActivity = mapActivity;
@ -82,7 +82,6 @@ public class TileEndpoint implements OsmAndHttpServer.ApiEndpoint {
if (cacheTile != null) { if (cacheTile != null) {
return cacheTile; return cacheTile;
} }
MetaTileFileSystemCache.MetaTileCache res = cache.createMetaTile(zoom, x, y); MetaTileFileSystemCache.MetaTileCache res = cache.createMetaTile(zoom, x, y);
mapActivity.getMapView().setCurrentViewport(res.bbox); mapActivity.getMapView().setCurrentViewport(res.bbox);
int timeout = 0; int timeout = 0;