rename Viewport.getMapViewProjection to getMapExtents
- add parameter to increase extents
This commit is contained in:
parent
dd954e3416
commit
ebaffdb123
@ -102,14 +102,7 @@ public abstract class ItemizedLayer<Item extends MarkerItem> extends MarkerLayer
|
||||
int changedVisible = 0;
|
||||
int numVisible = 0;
|
||||
|
||||
mMap.getViewport().getMapViewProjection(mBox);
|
||||
for (int i = 0; i < 8; i += 2) {
|
||||
float x = mBox[i];
|
||||
float y = mBox[i + 1];
|
||||
float len = (float) Math.sqrt(x * x + y * y);
|
||||
mBox[i + 0] += x / len * mExtents;
|
||||
mBox[i + 1] += y / len * mExtents;
|
||||
}
|
||||
mMap.getViewport().getMapExtents(mBox, mExtents);
|
||||
|
||||
long flip = (long) (Tile.SIZE * pos.scale) >> 1;
|
||||
|
||||
|
||||
@ -149,8 +149,9 @@ public class Viewport {
|
||||
* to screen corners by current view-projection-matrix.
|
||||
*
|
||||
* @param box float[8] will be set.
|
||||
* @param add increase extents of box
|
||||
*/
|
||||
public synchronized void getMapViewProjection(float[] box) {
|
||||
public synchronized void getMapExtents(float[] box, float add) {
|
||||
float t = getDepth(1);
|
||||
float t2 = getDepth(-1);
|
||||
|
||||
@ -162,6 +163,17 @@ public class Viewport {
|
||||
unproject(-1, 1, t2, box, 4);
|
||||
// bottom-right
|
||||
unproject(1, 1, t2, box, 6);
|
||||
|
||||
if (add == 0)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < 8; i += 2) {
|
||||
float x = box[i];
|
||||
float y = box[i + 1];
|
||||
float len = (float) Math.sqrt(x * x + y * y);
|
||||
box[i + 0] += x / len * add;
|
||||
box[i + 1] += y / len * add;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -237,7 +249,7 @@ public class Viewport {
|
||||
*/
|
||||
public synchronized void getViewBox(Box box) {
|
||||
float[] coords = mViewCoords;
|
||||
getMapViewProjection(coords);
|
||||
getMapExtents(coords, 0);
|
||||
|
||||
box.minX = coords[0];
|
||||
box.maxX = coords[0];
|
||||
|
||||
@ -56,7 +56,7 @@ public class MapRenderer {
|
||||
/** Do not modify! */
|
||||
public final GLMatrix view = new GLMatrix();
|
||||
/** Do not modify! */
|
||||
public final float[] mapPlane = new float[8];
|
||||
public final float[] plane = new float[8];
|
||||
|
||||
/** For temporary use, to setup MVP-Matrix */
|
||||
public final GLMatrix mvp = new GLMatrix();
|
||||
@ -247,7 +247,7 @@ public class MapRenderer {
|
||||
changed = viewport.getMapPosition(pos);
|
||||
|
||||
if (changed)
|
||||
viewport.getMapViewProjection(mMatrices.mapPlane);
|
||||
viewport.getMapExtents(mMatrices.plane, 0);
|
||||
|
||||
viewport.getMatrix(mMatrices.view, mMatrices.proj, mMatrices.viewproj);
|
||||
|
||||
|
||||
@ -189,7 +189,7 @@ public class TileManager {
|
||||
jobQueue.clear();
|
||||
|
||||
// load some tiles more than currently visible (* 0.75)
|
||||
double scale = pos.scale * 0.9f;
|
||||
//double scale = pos.scale * 0.9f;
|
||||
|
||||
int tileZoom = FastMath.clamp(pos.zoomLevel, mMinZoom, mMaxZoom);
|
||||
|
||||
@ -205,12 +205,12 @@ public class TileManager {
|
||||
tileZoom = match;
|
||||
}
|
||||
|
||||
mViewport.getMapViewProjection(mMapPlane);
|
||||
mViewport.getMapExtents(mMapPlane, Tile.SIZE / 2);
|
||||
|
||||
// scan visible tiles. callback function calls 'addTile'
|
||||
// which updates mNewTiles
|
||||
mNewTiles.cnt = 0;
|
||||
mScanBox.scan(pos.x, pos.y, scale, tileZoom, mMapPlane);
|
||||
mScanBox.scan(pos.x, pos.y, pos.scale, tileZoom, mMapPlane);
|
||||
|
||||
MapTile[] newTiles = mNewTiles.tiles;
|
||||
int newCnt = mNewTiles.cnt;
|
||||
|
||||
@ -124,7 +124,7 @@ public class TileRenderer extends LayerRenderer {
|
||||
MapTile[] tiles = mDrawTiles.tiles;
|
||||
|
||||
if (tilesChanged || changed) {
|
||||
updateTileVisibility(pos, m.mapPlane);
|
||||
updateTileVisibility(pos, m.plane);
|
||||
}
|
||||
|
||||
tileCnt += mNumTileHolder;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user