cleanups
This commit is contained in:
parent
6466a65545
commit
f5532059ec
@ -25,7 +25,6 @@ import org.oscim.utils.GlUtils;
|
|||||||
|
|
||||||
import android.opengl.GLES20;
|
import android.opengl.GLES20;
|
||||||
import android.opengl.Matrix;
|
import android.opengl.Matrix;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hannes Janetzek
|
* @author Hannes Janetzek
|
||||||
@ -104,7 +103,7 @@ public class BaseMap {
|
|||||||
t = t.holder;
|
t = t.holder;
|
||||||
|
|
||||||
if (t.layers == null || t.vbo == null) {
|
if (t.layers == null || t.vbo == null) {
|
||||||
Log.d(TAG, "missing data " + (t.layers == null) + " " + (t.vbo == null));
|
//Log.d(TAG, "missing data " + (t.layers == null) + " " + (t.vbo == null));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,14 +362,14 @@ public class TileManager {
|
|||||||
|
|
||||||
if (mTilesSize == mTiles.length) {
|
if (mTilesSize == mTiles.length) {
|
||||||
if (mTilesSize > mTilesCount) {
|
if (mTilesSize > mTilesCount) {
|
||||||
Log.d(TAG, "repack: " + mTiles.length + " / " + mTilesCount);
|
//Log.d(TAG, "repack: " + mTiles.length + " / " + mTilesCount);
|
||||||
TileDistanceSort.sort(mTiles, 0, mTilesSize);
|
TileDistanceSort.sort(mTiles, 0, mTilesSize);
|
||||||
mTilesSize = mTilesCount;
|
mTilesSize = mTilesCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mTilesSize > mTiles.length - 10) {
|
if (mTilesSize == mTiles.length) {
|
||||||
Log.d(TAG, "realloc tiles");
|
Log.d(TAG, "realloc tiles " + mTilesSize);
|
||||||
MapTile[] tmp = new MapTile[mTiles.length + 10];
|
MapTile[] tmp = new MapTile[mTiles.length + 20];
|
||||||
System.arraycopy(mTiles, 0, tmp, 0, mTilesCount);
|
System.arraycopy(mTiles, 0, tmp, 0, mTilesCount);
|
||||||
mTiles = tmp;
|
mTiles = tmp;
|
||||||
}
|
}
|
||||||
@ -416,35 +416,30 @@ public class TileManager {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
diff = (t.zoomLevel - zoom);
|
diff = (t.zoomLevel - zoom);
|
||||||
|
float scale;
|
||||||
if (diff == 0) {
|
if (diff == 0) {
|
||||||
dx = (t.pixelX + h) - x;
|
dx = (t.pixelX + h) - x;
|
||||||
dy = (t.pixelY + h) - y;
|
dy = (t.pixelY + h) - y;
|
||||||
dx %= center;
|
scale = 0.5f;
|
||||||
dy %= center;
|
|
||||||
t.distance = (dx * dx + dy * dy) * 0.5f;
|
|
||||||
} else if (diff > 0) {
|
} else if (diff > 0) {
|
||||||
// tile zoom level is child of current
|
// tile zoom level is child of current
|
||||||
if (diff < 3) {
|
if (diff < 3) {
|
||||||
dx = ((t.pixelX + h) >> diff) - x;
|
dx = ((t.pixelX + h) >> diff) - x;
|
||||||
dy = ((t.pixelY + h) >> diff) - y;
|
dy = ((t.pixelY + h) >> diff) - y;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
dx = ((t.pixelX + h) >> (diff >> 1)) - x;
|
dx = ((t.pixelX + h) >> (diff >> 1)) - x;
|
||||||
dy = ((t.pixelY + h) >> (diff >> 1)) - y;
|
dy = ((t.pixelY + h) >> (diff >> 1)) - y;
|
||||||
}
|
}
|
||||||
dx %= center;
|
scale = 1;
|
||||||
dy %= center;
|
|
||||||
t.distance = (dx * dx + dy * dy);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// tile zoom level is parent of current
|
// tile zoom level is parent of current
|
||||||
dx = ((t.pixelX + h) << -diff) - x;
|
dx = ((t.pixelX + h) << -diff) - x;
|
||||||
dy = ((t.pixelY + h) << -diff) - y;
|
dy = ((t.pixelY + h) << -diff) - y;
|
||||||
dx %= center;
|
scale = -diff * 0.7f;
|
||||||
dy %= center;
|
|
||||||
t.distance = (dx * dx + dy * dy) * (-diff * 0.7f);
|
|
||||||
}
|
}
|
||||||
|
dx %= center;
|
||||||
|
dy %= center;
|
||||||
|
t.distance = (dx * dx + dy * dy) * scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,13 +483,13 @@ public class TileManager {
|
|||||||
if (t.isLocked()) {
|
if (t.isLocked()) {
|
||||||
// dont remove tile used by GLRenderer, or somewhere else
|
// dont remove tile used by GLRenderer, or somewhere else
|
||||||
Log.d(TAG, "limitCache: tile still locked " + t + " " + t.distance);
|
Log.d(TAG, "limitCache: tile still locked " + t + " " + t.distance);
|
||||||
//mTiles.add(t);
|
// try again in next run.
|
||||||
|
break;
|
||||||
} else if (t.state == STATE_LOADING) {
|
} else if (t.state == STATE_LOADING) {
|
||||||
// NOTE: when set loading to false the tile could be
|
// NOTE: when set loading to false the tile could be
|
||||||
// added to load queue again while still processed in
|
// added to load queue again while still processed in
|
||||||
// TileGenerator => need tile.cancel flag.
|
// TileGenerator => need tile.cancel flag.
|
||||||
// t.isLoading = false;
|
// t.isLoading = false;
|
||||||
//mTiles.add(t);
|
|
||||||
Log.d(TAG, "limitCache: cancel loading " + t + " " + t.distance);
|
Log.d(TAG, "limitCache: cancel loading " + t + " " + t.distance);
|
||||||
} else {
|
} else {
|
||||||
if (t.state == STATE_NEW_DATA)
|
if (t.state == STATE_NEW_DATA)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user