diff --git a/vtm/src/org/oscim/layers/tile/TileLoader.java b/vtm/src/org/oscim/layers/tile/TileLoader.java index d44305a6..3461d98f 100644 --- a/vtm/src/org/oscim/layers/tile/TileLoader.java +++ b/vtm/src/org/oscim/layers/tile/TileLoader.java @@ -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; diff --git a/vtm/src/org/oscim/layers/tile/TileManager.java b/vtm/src/org/oscim/layers/tile/TileManager.java index 0a088d78..c5e833b0 100644 --- a/vtm/src/org/oscim/layers/tile/TileManager.java +++ b/vtm/src/org/oscim/layers/tile/TileManager.java @@ -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; } diff --git a/vtm/src/org/oscim/layers/tile/bitmap/BitmapTileLoader.java b/vtm/src/org/oscim/layers/tile/bitmap/BitmapTileLoader.java index 8454c68d..ad4c2905 100644 --- a/vtm/src/org/oscim/layers/tile/bitmap/BitmapTileLoader.java +++ b/vtm/src/org/oscim/layers/tile/bitmap/BitmapTileLoader.java @@ -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); diff --git a/vtm/src/org/oscim/layers/tile/vector/VectorTileLoader.java b/vtm/src/org/oscim/layers/tile/vector/VectorTileLoader.java index 1b7ffa99..f02f691e 100644 --- a/vtm/src/org/oscim/layers/tile/vector/VectorTileLoader.java +++ b/vtm/src/org/oscim/layers/tile/vector/VectorTileLoader.java @@ -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))