keep tile loading state in JobTile.state
This commit is contained in:
@@ -41,7 +41,8 @@ public class JobQueue {
|
||||
|
||||
for (int i = 0, n = tiles.size(); i < n; i++) {
|
||||
JobTile tile = tiles.get(i);
|
||||
tile.isLoading = true;
|
||||
//tile.isLoading = true;
|
||||
tile.state = JobTile.STATE_LOADING;
|
||||
mPriorityQueue.offer(tile);
|
||||
}
|
||||
}
|
||||
@@ -50,10 +51,10 @@ public class JobQueue {
|
||||
* Removes all jobs from this queue.
|
||||
*/
|
||||
public synchronized void clear() {
|
||||
|
||||
JobTile t;
|
||||
while ((t = mPriorityQueue.poll()) != null)
|
||||
t.isLoading = false;
|
||||
t.state = JobTile.STATE_NONE;
|
||||
//t.isLoading = false;
|
||||
|
||||
mPriorityQueue.clear();
|
||||
}
|
||||
|
||||
@@ -16,10 +16,13 @@ package org.oscim.generator;
|
||||
|
||||
import org.oscim.core.Tile;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class JobTile extends Tile implements Comparable<JobTile> {
|
||||
private final static String TAG = JobTile.class.getName();
|
||||
// public final static int LOADING = 1;
|
||||
// public final static int NEWDATA = 1 << 1;
|
||||
// public final static int READY = 1 << 2;
|
||||
@@ -27,10 +30,27 @@ public class JobTile extends Tile implements Comparable<JobTile> {
|
||||
// public final static int CANCELED = 1 << 3;
|
||||
// public int state;
|
||||
|
||||
public final static int STATE_NONE = 0;
|
||||
public final static int STATE_LOADING = 1 << 0;
|
||||
public final static int STATE_NEW_DATA = 1 << 1;
|
||||
public final static int STATE_READY = 1 << 2;
|
||||
|
||||
public void clearState() {
|
||||
state = STATE_NONE;
|
||||
}
|
||||
|
||||
public void setLoading() {
|
||||
if (state != STATE_NONE)
|
||||
Log.d(TAG, "wrong state: " + state);
|
||||
|
||||
state = STATE_LOADING;
|
||||
}
|
||||
|
||||
/**
|
||||
* tile is in JobQueue
|
||||
*/
|
||||
public boolean isLoading;
|
||||
//public boolean isLoading;
|
||||
public byte state;
|
||||
|
||||
/**
|
||||
* distance from map center.
|
||||
|
||||
Reference in New Issue
Block a user