diff --git a/vtm/src/org/oscim/layers/marker/ItemizedLayer.java b/vtm/src/org/oscim/layers/marker/ItemizedLayer.java index 659f8229..154eef61 100644 --- a/vtm/src/org/oscim/layers/marker/ItemizedLayer.java +++ b/vtm/src/org/oscim/layers/marker/ItemizedLayer.java @@ -102,14 +102,7 @@ public abstract class ItemizedLayer 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; diff --git a/vtm/src/org/oscim/map/Viewport.java b/vtm/src/org/oscim/map/Viewport.java index 01b22c91..5ae64d59 100644 --- a/vtm/src/org/oscim/map/Viewport.java +++ b/vtm/src/org/oscim/map/Viewport.java @@ -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]; diff --git a/vtm/src/org/oscim/renderer/MapRenderer.java b/vtm/src/org/oscim/renderer/MapRenderer.java index a5c54836..ea4e8dd6 100644 --- a/vtm/src/org/oscim/renderer/MapRenderer.java +++ b/vtm/src/org/oscim/renderer/MapRenderer.java @@ -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); diff --git a/vtm/src/org/oscim/tiling/TileManager.java b/vtm/src/org/oscim/tiling/TileManager.java index 6b7fe28c..fe586d10 100644 --- a/vtm/src/org/oscim/tiling/TileManager.java +++ b/vtm/src/org/oscim/tiling/TileManager.java @@ -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; diff --git a/vtm/src/org/oscim/tiling/TileRenderer.java b/vtm/src/org/oscim/tiling/TileRenderer.java index 96ba5a59..4ae727da 100644 --- a/vtm/src/org/oscim/tiling/TileRenderer.java +++ b/vtm/src/org/oscim/tiling/TileRenderer.java @@ -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;