set MapTile.STATE_CANCEL when tile is cleared
in TileManager.jobCompleted clear tile when tile state is CANCEL
This commit is contained in:
parent
e76b0a3740
commit
25c95da80c
@ -61,6 +61,8 @@ public class MapTile extends Tile {
|
|||||||
*/
|
*/
|
||||||
public final static byte STATE_ERROR = 1 << 3;
|
public final static byte STATE_ERROR = 1 << 3;
|
||||||
|
|
||||||
|
public final static byte STATE_CANCEL = 1 << 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* absolute tile coordinates: tileX,Y / Math.pow(2, zoomLevel)
|
* absolute tile coordinates: tileX,Y / Math.pow(2, zoomLevel)
|
||||||
*/
|
*/
|
||||||
@ -89,7 +91,7 @@ public class MapTile extends Tile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tile is in view region. Set by GLRenderer.
|
* Tile is in view region. Set by TileRenderer.
|
||||||
*/
|
*/
|
||||||
public boolean isVisible;
|
public boolean isVisible;
|
||||||
|
|
||||||
@ -100,7 +102,6 @@ public class MapTile extends Tile {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* to avoid drawing a tile twice per frame
|
* to avoid drawing a tile twice per frame
|
||||||
* FIXME what if multiple layers use the same tile?
|
|
||||||
*/
|
*/
|
||||||
int lastDraw = 0;
|
int lastDraw = 0;
|
||||||
|
|
||||||
|
|||||||
@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
package org.oscim.tiling;
|
package org.oscim.tiling;
|
||||||
|
|
||||||
|
import static org.oscim.tiling.MapTile.STATE_CANCEL;
|
||||||
import static org.oscim.tiling.MapTile.STATE_LOADING;
|
import static org.oscim.tiling.MapTile.STATE_LOADING;
|
||||||
import static org.oscim.tiling.MapTile.STATE_NEW_DATA;
|
import static org.oscim.tiling.MapTile.STATE_NEW_DATA;
|
||||||
import static org.oscim.tiling.MapTile.STATE_NONE;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -29,7 +29,6 @@ import org.oscim.core.Tile;
|
|||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.oscim.map.Viewport;
|
import org.oscim.map.Viewport;
|
||||||
import org.oscim.renderer.BufferObject;
|
import org.oscim.renderer.BufferObject;
|
||||||
import org.oscim.renderer.MapRenderer;
|
|
||||||
import org.oscim.utils.FastMath;
|
import org.oscim.utils.FastMath;
|
||||||
import org.oscim.utils.ScanBox;
|
import org.oscim.utils.ScanBox;
|
||||||
import org.oscim.utils.quadtree.QuadTree;
|
import org.oscim.utils.quadtree.QuadTree;
|
||||||
@ -383,13 +382,14 @@ public class TileManager {
|
|||||||
if (t == null)
|
if (t == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
t.clear();
|
synchronized (t) {
|
||||||
|
// still belongs to TileLoader thread
|
||||||
mIndex.remove(t);
|
if (t.state != STATE_LOADING)
|
||||||
|
t.clear();
|
||||||
// QuadTree.remove(t);
|
|
||||||
t.state = STATE_NONE;
|
|
||||||
|
|
||||||
|
t.state = STATE_CANCEL;
|
||||||
|
mIndex.remove(t);
|
||||||
|
}
|
||||||
mTilesCount--;
|
mTilesCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,8 +527,7 @@ public class TileManager {
|
|||||||
* @return caller does not care
|
* @return caller does not care
|
||||||
*/
|
*/
|
||||||
public void jobCompleted(MapTile tile, boolean success) {
|
public void jobCompleted(MapTile tile, boolean success) {
|
||||||
|
if (!success || tile.state == STATE_CANCEL) {
|
||||||
if (!success) {
|
|
||||||
tile.clear();
|
tile.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user