remove tile load CancellationException
does not work with GWT async loading
This commit is contained in:
parent
b0217767b8
commit
a46940a6b1
@ -85,7 +85,13 @@ public abstract class TileLoader extends PausableThread implements ITileDataSink
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void completed(QueryResult result) {
|
public void completed(QueryResult result) {
|
||||||
boolean success = (result == SUCCESS) && !isInterrupted();
|
boolean success = result == SUCCESS;
|
||||||
|
|
||||||
|
if (isCanceled())
|
||||||
|
success = false;
|
||||||
|
|
||||||
|
if (isInterrupted())
|
||||||
|
success = false;
|
||||||
|
|
||||||
mTileManager.jobCompleted(mTile, success);
|
mTileManager.jobCompleted(mTile, success);
|
||||||
mTile = null;
|
mTile = null;
|
||||||
|
|||||||
@ -502,7 +502,7 @@ public class TileManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called from MapWorker Thread when tile is loaded by MapTileLoader
|
* called by TileLoader thread when tile is loaded.
|
||||||
*
|
*
|
||||||
* @param tile
|
* @param tile
|
||||||
* Tile ready for upload in TileRenderLayer
|
* Tile ready for upload in TileRenderLayer
|
||||||
@ -513,7 +513,10 @@ public class TileManager {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!success || tile.state == CANCEL) {
|
if (!success || tile.state == CANCEL) {
|
||||||
log.debug("failed loading: {}", tile);
|
|
||||||
|
log.debug("loading {}: {}",
|
||||||
|
(!success ? "failed" : "canceled"),
|
||||||
|
tile);
|
||||||
tile.clear();
|
tile.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,8 +18,6 @@ package org.oscim.layers.tile.bitmap;
|
|||||||
|
|
||||||
import static org.oscim.layers.tile.MapTile.State.CANCEL;
|
import static org.oscim.layers.tile.MapTile.State.CANCEL;
|
||||||
|
|
||||||
import java.util.concurrent.CancellationException;
|
|
||||||
|
|
||||||
import org.oscim.backend.canvas.Bitmap;
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
import org.oscim.core.Tile;
|
import org.oscim.core.Tile;
|
||||||
import org.oscim.layers.tile.MapTile;
|
import org.oscim.layers.tile.MapTile;
|
||||||
@ -47,9 +45,6 @@ public class BitmapTileLoader extends TileLoader {
|
|||||||
protected boolean loadTile(MapTile tile) {
|
protected boolean loadTile(MapTile tile) {
|
||||||
try {
|
try {
|
||||||
mTileDataSource.query(tile, this);
|
mTileDataSource.query(tile, this);
|
||||||
} catch (CancellationException e) {
|
|
||||||
log.debug("{} was canceled", tile);
|
|
||||||
return false;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.debug("{} {}", tile, e.getMessage());
|
log.debug("{} {}", tile, e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
@ -60,7 +55,7 @@ public class BitmapTileLoader extends TileLoader {
|
|||||||
@Override
|
@Override
|
||||||
public void setTileImage(Bitmap bitmap) {
|
public void setTileImage(Bitmap bitmap) {
|
||||||
if (isCanceled() || mTile.state(CANCEL))
|
if (isCanceled() || mTile.state(CANCEL))
|
||||||
throw new CancellationException();
|
return;
|
||||||
|
|
||||||
BitmapLayer l = new BitmapLayer(false);
|
BitmapLayer l = new BitmapLayer(false);
|
||||||
l.setBitmap(bitmap, Tile.SIZE, Tile.SIZE, BitmapTileLayer.pool);
|
l.setBitmap(bitmap, Tile.SIZE, Tile.SIZE, BitmapTileLayer.pool);
|
||||||
|
|||||||
@ -18,8 +18,6 @@ package org.oscim.layers.tile.vector;
|
|||||||
|
|
||||||
import static org.oscim.layers.tile.MapTile.State.CANCEL;
|
import static org.oscim.layers.tile.MapTile.State.CANCEL;
|
||||||
|
|
||||||
import java.util.concurrent.CancellationException;
|
|
||||||
|
|
||||||
import org.oscim.core.GeometryBuffer.GeometryType;
|
import org.oscim.core.GeometryBuffer.GeometryType;
|
||||||
import org.oscim.core.MapElement;
|
import org.oscim.core.MapElement;
|
||||||
import org.oscim.core.MercatorProjection;
|
import org.oscim.core.MercatorProjection;
|
||||||
@ -118,9 +116,6 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
|||||||
try {
|
try {
|
||||||
/* query data source, which calls process() callback */
|
/* query data source, which calls process() callback */
|
||||||
mTileDataSource.query(tile, this);
|
mTileDataSource.query(tile, this);
|
||||||
} catch (CancellationException e) {
|
|
||||||
log.debug("{} was canceled", tile);
|
|
||||||
return false;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.debug("{} {}", tile, e.getMessage());
|
log.debug("{} {}", tile, e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
@ -172,9 +167,8 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(MapElement element) {
|
public void process(MapElement element) {
|
||||||
|
|
||||||
if (isCanceled() || mTile.state(CANCEL))
|
if (isCanceled() || mTile.state(CANCEL))
|
||||||
throw new CancellationException();
|
return;
|
||||||
|
|
||||||
for (TileLoaderProcessHook h : mTileLayer.loaderProcessHooks())
|
for (TileLoaderProcessHook h : mTileLayer.loaderProcessHooks())
|
||||||
if (h.process(mTile, mLayers, element))
|
if (h.process(mTile, mLayers, element))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user