remove tile load CancellationException

does not work with GWT async loading
This commit is contained in:
Hannes Janetzek 2014-03-17 01:17:42 +01:00
parent b0217767b8
commit a46940a6b1
4 changed files with 14 additions and 16 deletions

View File

@ -85,7 +85,13 @@ public abstract class TileLoader extends PausableThread implements ITileDataSink
*/
@Override
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);
mTile = null;

View File

@ -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
* Tile ready for upload in TileRenderLayer
@ -513,7 +513,10 @@ public class TileManager {
@Override
public void run() {
if (!success || tile.state == CANCEL) {
log.debug("failed loading: {}", tile);
log.debug("loading {}: {}",
(!success ? "failed" : "canceled"),
tile);
tile.clear();
return;
}

View File

@ -18,8 +18,6 @@ package org.oscim.layers.tile.bitmap;
import static org.oscim.layers.tile.MapTile.State.CANCEL;
import java.util.concurrent.CancellationException;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.core.Tile;
import org.oscim.layers.tile.MapTile;
@ -47,9 +45,6 @@ public class BitmapTileLoader extends TileLoader {
protected boolean loadTile(MapTile tile) {
try {
mTileDataSource.query(tile, this);
} catch (CancellationException e) {
log.debug("{} was canceled", tile);
return false;
} catch (Exception e) {
log.debug("{} {}", tile, e.getMessage());
return false;
@ -60,7 +55,7 @@ public class BitmapTileLoader extends TileLoader {
@Override
public void setTileImage(Bitmap bitmap) {
if (isCanceled() || mTile.state(CANCEL))
throw new CancellationException();
return;
BitmapLayer l = new BitmapLayer(false);
l.setBitmap(bitmap, Tile.SIZE, Tile.SIZE, BitmapTileLayer.pool);

View File

@ -18,8 +18,6 @@ package org.oscim.layers.tile.vector;
import static org.oscim.layers.tile.MapTile.State.CANCEL;
import java.util.concurrent.CancellationException;
import org.oscim.core.GeometryBuffer.GeometryType;
import org.oscim.core.MapElement;
import org.oscim.core.MercatorProjection;
@ -118,9 +116,6 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
try {
/* query data source, which calls process() callback */
mTileDataSource.query(tile, this);
} catch (CancellationException e) {
log.debug("{} was canceled", tile);
return false;
} catch (Exception e) {
log.debug("{} {}", tile, e.getMessage());
return false;
@ -172,9 +167,8 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
@Override
public void process(MapElement element) {
if (isCanceled() || mTile.state(CANCEL))
throw new CancellationException();
return;
for (TileLoaderProcessHook h : mTileLayer.loaderProcessHooks())
if (h.process(mTile, mLayers, element))