diff --git a/src/org/oscim/core/MercatorProjection.java b/src/org/oscim/core/MercatorProjection.java index 6ea825fc..60142b1f 100644 --- a/src/org/oscim/core/MercatorProjection.java +++ b/src/org/oscim/core/MercatorProjection.java @@ -57,7 +57,7 @@ public final class MercatorProjection { */ public static double calculateGroundResolution(double latitude, int zoomLevel) { return Math.cos(latitude * (Math.PI / 180)) * EARTH_CIRCUMFERENCE - / ((long) Tile.TILE_SIZE << zoomLevel); + / ((long) Tile.SIZE << zoomLevel); } /** @@ -130,7 +130,7 @@ public final class MercatorProjection { * @return the longitude value of the pixel X coordinate. */ public static double pixelXToLongitude(double pixelX, int zoomLevel) { - return 360 * ((pixelX / ((long) Tile.TILE_SIZE << zoomLevel)) - 0.5); + return 360 * ((pixelX / ((long) Tile.SIZE << zoomLevel)) - 0.5); } /** @@ -144,7 +144,7 @@ public final class MercatorProjection { * @return the pixel X coordinate of the longitude value. */ public static double longitudeToPixelX(double longitude, int zoomLevel) { - return (longitude + 180) / 360 * ((long) Tile.TILE_SIZE << zoomLevel); + return (longitude + 180) / 360 * ((long) Tile.SIZE << zoomLevel); } /** @@ -158,7 +158,7 @@ public final class MercatorProjection { * @return the latitude value of the pixel Y coordinate. */ public static double pixelYToLatitude(double pixelY, int zoomLevel) { - double y = 0.5 - (pixelY / ((long) Tile.TILE_SIZE << zoomLevel)); + double y = 0.5 - (pixelY / ((long) Tile.SIZE << zoomLevel)); return 90 - 360 * Math.atan(Math.exp(-y * (2 * Math.PI))) / Math.PI; } @@ -175,7 +175,7 @@ public final class MercatorProjection { public static double latitudeToPixelY(double latitude, int zoomLevel) { double sinLatitude = Math.sin(latitude * (Math.PI / 180)); return (0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI)) - * ((long) Tile.TILE_SIZE << zoomLevel); + * ((long) Tile.SIZE << zoomLevel); } private MercatorProjection() { diff --git a/src/org/oscim/core/Tile.java b/src/org/oscim/core/Tile.java index d79ffe7f..14bfc448 100644 --- a/src/org/oscim/core/Tile.java +++ b/src/org/oscim/core/Tile.java @@ -24,7 +24,7 @@ public class Tile { /** * Width and height of a map tile in pixel. */ - public static int TILE_SIZE = 256; + public static int SIZE = 256; /** * The X number of this tile. diff --git a/src/org/oscim/core/WebMercator.java b/src/org/oscim/core/WebMercator.java index f9ce7922..bce11915 100644 --- a/src/org/oscim/core/WebMercator.java +++ b/src/org/oscim/core/WebMercator.java @@ -63,7 +63,7 @@ public class WebMercator { * @return ... */ public static double PixelYtoSphericalMercator(long pixelY, byte z) { - long half = (Tile.TILE_SIZE << z) >> 1; + long half = (Tile.SIZE << z) >> 1; return ((half - pixelY) / (double) half) * f900913; } @@ -75,7 +75,7 @@ public class WebMercator { * @return ... */ public static double PixelXtoSphericalMercator(long pixelX, byte z) { - long half = (Tile.TILE_SIZE << z) >> 1; + long half = (Tile.SIZE << z) >> 1; return ((pixelX - half) / (double) half) * f900913; } diff --git a/src/org/oscim/database/mapfile/MapDatabase.java b/src/org/oscim/database/mapfile/MapDatabase.java index c10888a9..60f1cfb0 100644 --- a/src/org/oscim/database/mapfile/MapDatabase.java +++ b/src/org/oscim/database/mapfile/MapDatabase.java @@ -591,9 +591,9 @@ public class MapDatabase implements IMapDatabase { Tag[] tags = null; Tag[] curTags; - long x = mTile.tileX * Tile.TILE_SIZE; - long y = mTile.tileY * Tile.TILE_SIZE + Tile.TILE_SIZE; - long z = Tile.TILE_SIZE << mTile.zoomLevel; + long x = mTile.tileX * Tile.SIZE; + long y = mTile.tileY * Tile.SIZE + Tile.SIZE; + long z = Tile.SIZE << mTile.zoomLevel; long dx = (x - (z >> 1)); long dy = (y - (z >> 1)); @@ -1055,9 +1055,9 @@ public class MapDatabase implements IMapDatabase { private boolean projectToTile(float[] coords, short[] indices) { - long x = mTile.tileX * Tile.TILE_SIZE; - long y = mTile.tileY * Tile.TILE_SIZE + Tile.TILE_SIZE; - long z = Tile.TILE_SIZE << mTile.zoomLevel; + long x = mTile.tileX * Tile.SIZE; + long y = mTile.tileY * Tile.SIZE + Tile.SIZE; + long z = Tile.SIZE << mTile.zoomLevel; double divx, divy = 0; long dx = (x - (z >> 1)); @@ -1081,7 +1081,7 @@ public class MapDatabase implements IMapDatabase { lon = (float) ((coords[pos]) / divx - dx); double sinLat = Math.sin(coords[pos + 1] * PI180); - lat = (float) (Tile.TILE_SIZE - (Math.log((1.0 + sinLat) / (1.0 - sinLat)) * divy + dy)); + lat = (float) (Tile.SIZE - (Math.log((1.0 + sinLat) / (1.0 - sinLat)) * divy + dy)); if (cnt != 0) { // drop small distance intermediate nodes diff --git a/src/org/oscim/database/mapfile/Projection.java b/src/org/oscim/database/mapfile/Projection.java index 553f66d3..991c4faa 100644 --- a/src/org/oscim/database/mapfile/Projection.java +++ b/src/org/oscim/database/mapfile/Projection.java @@ -31,7 +31,7 @@ public class Projection { * @return the longitude value of the tile X number. */ public static double tileXToLongitude(long tileX, int zoomLevel) { - return MercatorProjection.pixelXToLongitude(tileX * Tile.TILE_SIZE, zoomLevel); + return MercatorProjection.pixelXToLongitude(tileX * Tile.SIZE, zoomLevel); } /** @@ -45,7 +45,7 @@ public class Projection { * @return the latitude value of the tile Y number. */ public static double tileYToLatitude(long tileY, int zoomLevel) { - return MercatorProjection.pixelYToLatitude(tileY * Tile.TILE_SIZE, zoomLevel); + return MercatorProjection.pixelYToLatitude(tileY * Tile.SIZE, zoomLevel); } /** @@ -86,7 +86,7 @@ public class Projection { * @return the tile X number. */ public static int pixelXToTileX(double pixelX, int zoomLevel) { - return (int) Math.min(Math.max(pixelX / Tile.TILE_SIZE, 0), + return (int) Math.min(Math.max(pixelX / Tile.SIZE, 0), Math.pow(2, zoomLevel) - 1); } /** @@ -99,7 +99,7 @@ public class Projection { * @return the tile Y number. */ public static int pixelYToTileY(double pixelY, int zoomLevel) { - return (int) Math.min(Math.max(pixelY / Tile.TILE_SIZE, 0), + return (int) Math.min(Math.max(pixelY / Tile.SIZE, 0), Math.pow(2, zoomLevel) - 1); } private Projection(){ diff --git a/src/org/oscim/database/mapfile/header/RequiredFields.java b/src/org/oscim/database/mapfile/header/RequiredFields.java index 446ae55f..97097bfb 100644 --- a/src/org/oscim/database/mapfile/header/RequiredFields.java +++ b/src/org/oscim/database/mapfile/header/RequiredFields.java @@ -205,7 +205,7 @@ final class RequiredFields { static OpenResult readTilePixelSize(ReadBuffer readBuffer, MapFileInfoBuilder mapFileInfoBuilder) { // get and check the tile pixel size (2 bytes) int tilePixelSize = readBuffer.readShort(); - // if (tilePixelSize != Tile.TILE_SIZE) { + // if (tilePixelSize != Tile.SIZE) { // return new FileOpenResult("unsupported tile pixel size: " + tilePixelSize); // } mapFileInfoBuilder.tilePixelSize = tilePixelSize; diff --git a/src/org/oscim/database/oscimap/MapDatabase.java b/src/org/oscim/database/oscimap/MapDatabase.java index 6ab02ab5..c48d5937 100644 --- a/src/org/oscim/database/oscimap/MapDatabase.java +++ b/src/org/oscim/database/oscimap/MapDatabase.java @@ -86,7 +86,7 @@ public class MapDatabase implements IMapDatabase { mMapGenerator = mapDatabaseCallback; // scale coordinates to tile size - mScaleFactor = REF_TILE_SIZE / Tile.TILE_SIZE; + mScaleFactor = REF_TILE_SIZE / Tile.SIZE; File f = null; diff --git a/src/org/oscim/database/pbmap/MapDatabase.java b/src/org/oscim/database/pbmap/MapDatabase.java index b90dac34..69cd928c 100644 --- a/src/org/oscim/database/pbmap/MapDatabase.java +++ b/src/org/oscim/database/pbmap/MapDatabase.java @@ -130,7 +130,7 @@ public class MapDatabase implements IMapDatabase { mCurTagCnt = 0; // scale coordinates to tile size - mScaleFactor = REF_TILE_SIZE / Tile.TILE_SIZE; + mScaleFactor = REF_TILE_SIZE / Tile.SIZE; File f = null; @@ -532,7 +532,7 @@ public class MapDatabase implements IMapDatabase { lastX = lon + lastX; lastY = lat + lastY; coords[cnt++] = lastX / scale; - coords[cnt++] = Tile.TILE_SIZE - lastY / scale; + coords[cnt++] = Tile.SIZE - lastY / scale; } mGeom.index[0] = (short)numNodes; @@ -722,7 +722,7 @@ public class MapDatabase implements IMapDatabase { } else { y = ((result >>> 1) ^ -(result & 1)); lastY = lastY + y; - coords[cnt++] = Tile.TILE_SIZE - lastY / scale; + coords[cnt++] = Tile.SIZE - lastY / scale; even = true; } } diff --git a/src/org/oscim/database/test/MapDatabase.java b/src/org/oscim/database/test/MapDatabase.java index 3dfab610..898e4f69 100644 --- a/src/org/oscim/database/test/MapDatabase.java +++ b/src/org/oscim/database/test/MapDatabase.java @@ -57,7 +57,7 @@ public class MapDatabase implements IMapDatabase { @Override public QueryResult executeQuery(JobTile tile, IMapDatabaseCallback mapDatabaseCallback) { - int size = Tile.TILE_SIZE; + int size = Tile.SIZE; float[] points = mGeom.points; short[] index = mGeom.index; diff --git a/src/org/oscim/generator/TileGenerator.java b/src/org/oscim/generator/TileGenerator.java index c44b81b2..f8b08d8d 100644 --- a/src/org/oscim/generator/TileGenerator.java +++ b/src/org/oscim/generator/TileGenerator.java @@ -71,14 +71,14 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback { private static final Tag[] debugTagArea = { new Tag("debug", "area") }; private final GeometryBuffer mDebugPoint = new GeometryBuffer( - new float[] { Tile.TILE_SIZE >> 1, 10 }, + new float[] { Tile.SIZE >> 1, 10 }, new short[] { 2 }); private final WayData mDebugWay = new WayData( new GeometryBuffer( - new float[] { 0, 0, 0, Tile.TILE_SIZE, - Tile.TILE_SIZE, Tile.TILE_SIZE, - Tile.TILE_SIZE, 0, 0, 0 }, + new float[] { 0, 0, 0, Tile.SIZE, + Tile.SIZE, Tile.SIZE, + Tile.SIZE, 0, 0, 0 }, new short[] {10}), new Tag[] { new Tag("debug", "box") } ); @@ -127,7 +127,7 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback { /** */ public TileGenerator() { - mClipper = new LineClipper(0, 0, Tile.TILE_SIZE, Tile.TILE_SIZE, true); + mClipper = new LineClipper(0, 0, Tile.SIZE, Tile.SIZE, true); } public void cleanup() { @@ -156,7 +156,7 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback { mGroundResolution = (float) (Math.cos(latitude * (Math.PI / 180)) * MercatorProjection.EARTH_CIRCUMFERENCE - / ((long) Tile.TILE_SIZE << mTile.zoomLevel)); + / ((long) Tile.SIZE << mTile.zoomLevel)); mTile.layers = new Layers(); diff --git a/src/org/oscim/generator/WayDecorator.java b/src/org/oscim/generator/WayDecorator.java index 073130db..84f3067f 100644 --- a/src/org/oscim/generator/WayDecorator.java +++ b/src/org/oscim/generator/WayDecorator.java @@ -31,10 +31,10 @@ public final class WayDecorator { // calculate the way name length plus some margin of safety float wayNameWidth = -1; - float minWidth = Tile.TILE_SIZE / 10; + float minWidth = Tile.SIZE / 10; final int min = 0; - final int max = Tile.TILE_SIZE; + final int max = Tile.SIZE; // find way segments long enough to draw the way name on them for (int i = pos; i < pos + len - 2; i += 2) { diff --git a/src/org/oscim/overlay/ItemizedOverlay.java b/src/org/oscim/overlay/ItemizedOverlay.java index 7679d913..d378dbe9 100644 --- a/src/org/oscim/overlay/ItemizedOverlay.java +++ b/src/org/oscim/overlay/ItemizedOverlay.java @@ -105,8 +105,8 @@ public abstract class ItemizedOverlay extends Overlay int z = FastMath.log2((int) curPos.scale); int diff = MAX_ZOOM - z; - int mx = (int) (curPos.x * (Tile.TILE_SIZE << z)); - int my = (int) (curPos.y * (Tile.TILE_SIZE << z)); + int mx = (int) (curPos.x * (Tile.SIZE << z)); + int my = (int) (curPos.y * (Tile.SIZE << z)); // limit could be 1 if we update on every position change float limit = 1.5f; diff --git a/src/org/oscim/overlay/PathOverlay.java b/src/org/oscim/overlay/PathOverlay.java index b6d5f73c..bb9874ca 100644 --- a/src/org/oscim/overlay/PathOverlay.java +++ b/src/org/oscim/overlay/PathOverlay.java @@ -124,8 +124,8 @@ public class PathOverlay extends Overlay { //int z = curPos.zoomLevel; int z = FastMath.log2((int) curPos.scale); int diff = MAX_ZOOM - z; - int mx = (int) (curPos.x * (Tile.TILE_SIZE << z)); - int my = (int) (curPos.y * (Tile.TILE_SIZE << z)); + int mx = (int) (curPos.x * (Tile.SIZE << z)); + int my = (int) (curPos.y * (Tile.SIZE << z)); for (int j = 0; j < size; j += 2) { // TODO translate mapPosition and do this after clipping diff --git a/src/org/oscim/renderer/GLRenderer.java b/src/org/oscim/renderer/GLRenderer.java index c5c3320e..5279ddbe 100644 --- a/src/org/oscim/renderer/GLRenderer.java +++ b/src/org/oscim/renderer/GLRenderer.java @@ -190,7 +190,7 @@ public class GLRenderer implements GLSurfaceView.Renderer { // tile fill coords short min = 0; - short max = (short) ((Tile.TILE_SIZE * COORD_SCALE)); + short max = (short) ((Tile.SIZE * COORD_SCALE)); mFillCoords = new short[8]; mFillCoords[0] = min; mFillCoords[1] = max; @@ -318,8 +318,8 @@ public class GLRenderer implements GLSurfaceView.Renderer { int z = tiles[0].zoomLevel; - double curScale = Tile.TILE_SIZE * pos.scale; - double tileScale = Tile.TILE_SIZE * (pos.scale / (1 << z)); + double curScale = Tile.SIZE * pos.scale; + double tileScale = Tile.SIZE * (pos.scale / (1 << z)); for (int i = 0; i < 8; i += 2) { coords[i + 0] = (float) ((pos.x * curScale + coords[i + 0]) / tileScale); @@ -622,8 +622,8 @@ public class GLRenderer implements GLSurfaceView.Renderer { mBufferMemoryUsage = 0; mDrawTiles = null; - int numTiles = (screenWidth / (Tile.TILE_SIZE / 2) + 2) - * (screenHeight / (Tile.TILE_SIZE / 2) + 2); + int numTiles = (screenWidth / (Tile.SIZE / 2) + 2) + * (screenHeight / (Tile.SIZE / 2) + 2); // Set up vertex buffer objects int numVBO = (CACHE_TILES + (numTiles * 2)); diff --git a/src/org/oscim/renderer/TileManager.java b/src/org/oscim/renderer/TileManager.java index 11123eff..51b79a3e 100644 --- a/src/org/oscim/renderer/TileManager.java +++ b/src/org/oscim/renderer/TileManager.java @@ -135,7 +135,7 @@ public class TileManager { // set up TileSet large enough to hold current tiles int num = Math.max(width, height); - int size = Tile.TILE_SIZE >> 1; + int size = Tile.SIZE >> 1; int numTiles = (num * num) / (size * size) * 4; mNewTiles = new TileSet(numTiles); mCurrentTiles = new TileSet(numTiles); @@ -166,7 +166,7 @@ public class TileManager { // scale and translate projection to tile coordinates // load some tiles more than currently visible (* 0.75) // float scale = mapPosition.scale * 0.75f; - // float tileScale = scale * Tile.TILE_SIZE; + // float tileScale = scale * Tile.SIZE; // double px = mapPosition.x * scale; // double py = mapPosition.y * scale; // @@ -180,10 +180,10 @@ public class TileManager { // scale and translate projection to tile coordinates // load some tiles more than currently visible (* 0.75) double scale = pos.scale * 0.75f; - double curScale = Tile.TILE_SIZE * scale; + double curScale = Tile.SIZE * scale; int zoomLevel = FastMath.clamp(pos.zoomLevel, MIN_ZOOMLEVEL, MAX_ZOOMLEVEL); - double tileScale = Tile.TILE_SIZE * (scale / (1 << zoomLevel)); + double tileScale = Tile.SIZE * (scale / (1 << zoomLevel)); float[] coords = mTileCoords; mMapViewPosition.getMapViewProjection(coords); diff --git a/src/org/oscim/renderer/TileRenderer.java b/src/org/oscim/renderer/TileRenderer.java index 338be13d..fcd0944a 100644 --- a/src/org/oscim/renderer/TileRenderer.java +++ b/src/org/oscim/renderer/TileRenderer.java @@ -125,7 +125,7 @@ public class TileRenderer { float div = FastMath.pow(z - pos.zoomLevel); - double curScale = Tile.TILE_SIZE * pos.scale; + double curScale = Tile.SIZE * pos.scale; double scale = (pos.scale / (1 << z)); float x = (float) ((tile.x - pos.x) * curScale); diff --git a/src/org/oscim/renderer/layer/ExtrusionLayer.java b/src/org/oscim/renderer/layer/ExtrusionLayer.java index e1670d7c..ef094081 100644 --- a/src/org/oscim/renderer/layer/ExtrusionLayer.java +++ b/src/org/oscim/renderer/layer/ExtrusionLayer.java @@ -72,7 +72,7 @@ public class ExtrusionLayer extends Layer { for (int i = 0; i < 4; i++) mIndices[i] = mCurIndices[i] = VertexPool.get(); - mClipper = new LineClipper(0, 0, Tile.TILE_SIZE, Tile.TILE_SIZE); + mClipper = new LineClipper(0, 0, Tile.SIZE, Tile.SIZE); } public void addBuildings(WayData way) { diff --git a/src/org/oscim/renderer/layer/LineLayer.java b/src/org/oscim/renderer/layer/LineLayer.java index 7fd34903..2de34ff8 100644 --- a/src/org/oscim/renderer/layer/LineLayer.java +++ b/src/org/oscim/renderer/layer/LineLayer.java @@ -74,7 +74,7 @@ public final class LineLayer extends Layer { float x, y, nextX, nextY; float a, ux, uy, vx, vy, wx, wy; - int tmax = Tile.TILE_SIZE + 4; + int tmax = Tile.SIZE + 4; int tmin = -4; boolean rounded = false; diff --git a/src/org/oscim/renderer/layer/PolygonLayer.java b/src/org/oscim/renderer/layer/PolygonLayer.java index 65b77d2d..cb26448d 100644 --- a/src/org/oscim/renderer/layer/PolygonLayer.java +++ b/src/org/oscim/renderer/layer/PolygonLayer.java @@ -33,7 +33,7 @@ public final class PolygonLayer extends Layer { } public void addPolygon(float[] points, short[] index) { - short center = (short) ((Tile.TILE_SIZE >> 1) * S); + short center = (short) ((Tile.SIZE >> 1) * S); VertexPoolItem si = curItem; short[] v = si.vertices; diff --git a/src/org/oscim/renderer/overlays/ExtrusionOverlay.java b/src/org/oscim/renderer/overlays/ExtrusionOverlay.java index db73fda0..8ef4688d 100644 --- a/src/org/oscim/renderer/overlays/ExtrusionOverlay.java +++ b/src/org/oscim/renderer/overlays/ExtrusionOverlay.java @@ -326,7 +326,7 @@ public class ExtrusionOverlay extends RenderOverlay { MapTile tile, int delta) { int z = tile.zoomLevel; - double curScale = Tile.TILE_SIZE * pos.scale; + double curScale = Tile.SIZE * pos.scale; float scale = (float)(pos.scale / (1 << z)); float x = (float) ((tile.x - pos.x) * curScale); diff --git a/src/org/oscim/renderer/overlays/GridOverlay.java b/src/org/oscim/renderer/overlays/GridOverlay.java index fad9e882..36b87f92 100644 --- a/src/org/oscim/renderer/overlays/GridOverlay.java +++ b/src/org/oscim/renderer/overlays/GridOverlay.java @@ -37,7 +37,7 @@ public class GridOverlay extends BasicOverlay { public GridOverlay(MapView mapView) { super(mapView); - int size = Tile.TILE_SIZE; + int size = Tile.SIZE; float[] points = new float[64]; short[] index = new short[16]; @@ -71,7 +71,7 @@ public class GridOverlay extends BasicOverlay { } private void addLabels(int x, int y, int z) { - int size = Tile.TILE_SIZE; + int size = Tile.SIZE; TextLayer tl = new TextLayer(); diff --git a/src/org/oscim/renderer/overlays/RenderOverlay.java b/src/org/oscim/renderer/overlays/RenderOverlay.java index ed07f28a..0e712e9b 100644 --- a/src/org/oscim/renderer/overlays/RenderOverlay.java +++ b/src/org/oscim/renderer/overlays/RenderOverlay.java @@ -84,7 +84,7 @@ public abstract class RenderOverlay { protected void setMatrix(MapPosition curPos, Matrices m, boolean project) { MapPosition oPos = mMapPosition; - double tileScale = Tile.TILE_SIZE * curPos.scale; + double tileScale = Tile.SIZE * curPos.scale; double x = oPos.x - curPos.x; double y = oPos.y - curPos.y; diff --git a/src/org/oscim/renderer/overlays/TestOverlay.java b/src/org/oscim/renderer/overlays/TestOverlay.java index 68f71478..9a34326f 100644 --- a/src/org/oscim/renderer/overlays/TestOverlay.java +++ b/src/org/oscim/renderer/overlays/TestOverlay.java @@ -113,8 +113,8 @@ public class TestOverlay extends BasicOverlay { // TextItem ti = new TextItem(0, 0, "check one, check two", t); // ti.x1 = 0; // ti.y1 = 0; - // ti.x2 = (short) Tile.TILE_SIZE; - // ti.y2 = (short) Tile.TILE_SIZE; + // ti.x2 = (short) Tile.SIZE; + // ti.y2 = (short) Tile.SIZE; // // tl.addText(ti); // diff --git a/src/org/oscim/renderer/overlays/TextOverlay.java b/src/org/oscim/renderer/overlays/TextOverlay.java index a4f6ff26..64ed57c1 100644 --- a/src/org/oscim/renderer/overlays/TextOverlay.java +++ b/src/org/oscim/renderer/overlays/TextOverlay.java @@ -306,8 +306,8 @@ public class TextOverlay extends BasicOverlay { mMapViewPosition.getMapViewProjection(coords); //mMapViewPosition.getMatrix(null, null, mMVP); } - int mw = (mMapView.getWidth() + Tile.TILE_SIZE) / 2; - int mh = (mMapView.getHeight() + Tile.TILE_SIZE) / 2; + int mw = (mMapView.getWidth() + Tile.SIZE) / 2; + int mh = (mMapView.getHeight() + Tile.SIZE) / 2; mSquareRadius = mw * mw + mh * mh; // mTiles might be from another zoomlevel than the current: @@ -328,7 +328,7 @@ public class TextOverlay extends BasicOverlay { float cos = (float) Math.cos(angle); float sin = (float) Math.sin(angle); - int maxx = Tile.TILE_SIZE << (pos.zoomLevel - 1); + int maxx = Tile.SIZE << (pos.zoomLevel - 1); Label l = null; @@ -337,8 +337,8 @@ public class TextOverlay extends BasicOverlay { mRelabelCnt++; - double tileX = (pos.x * (Tile.TILE_SIZE << pos.zoomLevel)); - double tileY = (pos.y * (Tile.TILE_SIZE << pos.zoomLevel)); + double tileX = (pos.x * (Tile.SIZE << pos.zoomLevel)); + double tileY = (pos.y * (Tile.SIZE << pos.zoomLevel)); for (l = mPrevLabels; l != null;) { @@ -355,8 +355,8 @@ public class TextOverlay extends BasicOverlay { continue; } - float dx = (float) (l.tile.tileX * Tile.TILE_SIZE - tileX * s); - float dy = (float) (l.tile.tileY * Tile.TILE_SIZE - tileY * s); + float dx = (float) (l.tile.tileX * Tile.SIZE - tileX * s); + float dy = (float) (l.tile.tileY * Tile.SIZE - tileY * s); // flip around date-line if (dx > maxx) @@ -412,8 +412,8 @@ public class TextOverlay extends BasicOverlay { if (t.state != JobTile.STATE_READY) continue; - float dx = (float) (t.tileX * Tile.TILE_SIZE - tileX); - float dy = (float) (t.tileY * Tile.TILE_SIZE - tileY); + float dx = (float) (t.tileX * Tile.SIZE - tileX); + float dy = (float) (t.tileY * Tile.SIZE - tileY); // flip around date-line if (dx > maxx) @@ -479,8 +479,8 @@ public class TextOverlay extends BasicOverlay { if (t.state != JobTile.STATE_READY) continue; - float dx = (float) (t.tileX * Tile.TILE_SIZE - tileX); - float dy = (float) (t.tileY * Tile.TILE_SIZE - tileY); + float dx = (float) (t.tileX * Tile.SIZE - tileX); + float dy = (float) (t.tileY * Tile.SIZE - tileY); // flip around date-line if (dx > maxx) @@ -726,7 +726,7 @@ public class TextOverlay extends BasicOverlay { protected void setMatrix(MapPosition curPos, Matrices m) { MapPosition oPos = mMapPosition; - double tileScale = Tile.TILE_SIZE * curPos.scale; + double tileScale = Tile.SIZE * curPos.scale; double scale = (curPos.scale / oPos.scale); float x = (float) ((oPos.x - curPos.x) * tileScale); diff --git a/src/org/oscim/view/MapView.java b/src/org/oscim/view/MapView.java index 900c29fc..ddc47222 100644 --- a/src/org/oscim/view/MapView.java +++ b/src/org/oscim/view/MapView.java @@ -143,7 +143,7 @@ public class MapView extends RelativeLayout { dpi = Math.max(metrics.xdpi, metrics.ydpi); // TODO make this dpi dependent - Tile.TILE_SIZE = 400; + Tile.SIZE = 400; MapActivity mapActivity = (MapActivity) context; diff --git a/src/org/oscim/view/MapViewPosition.java b/src/org/oscim/view/MapViewPosition.java index 1cffaabb..63da0c7d 100644 --- a/src/org/oscim/view/MapViewPosition.java +++ b/src/org/oscim/view/MapViewPosition.java @@ -37,7 +37,7 @@ import android.view.animation.AccelerateDecelerateInterpolator; public class MapViewPosition { private static final String TAG = MapViewPosition.class.getName(); - // needs to fit for int: 2 * 20 * Tile.TILE_SIZE + // needs to fit for int: 2 * 20 * Tile.SIZE public final static int MAX_ZOOMLEVEL = 20; public final static int MIN_ZOOMLEVEL = 2; @@ -54,7 +54,7 @@ public class MapViewPosition { private double mAbsX; private double mAbsY; - // mAbsScale * Tile.TILE_SIZE + // mAbsScale * Tile.SIZE // i.e. size of tile 0/0/0 at current scale in pixel private double mCurScale; @@ -107,7 +107,7 @@ public class MapViewPosition { } private void updatePosition() { - mCurScale = mAbsScale * Tile.TILE_SIZE; + mCurScale = mAbsScale * Tile.SIZE; mCurX = mAbsX * mCurScale; mCurY = mAbsY * mCurScale; } @@ -341,8 +341,8 @@ public class MapViewPosition { double dx = mCurX + mu[0]; double dy = mCurY + mu[1]; - dx /= mAbsScale * Tile.TILE_SIZE; - dy /= mAbsScale * Tile.TILE_SIZE; + dx /= mAbsScale * Tile.SIZE; + dy /= mAbsScale * Tile.SIZE; if (dx > 1) { while (dx > 1) @@ -458,7 +458,7 @@ public class MapViewPosition { } private synchronized void moveAbs(double x, double y) { - double f = Tile.TILE_SIZE << ABS_ZOOMLEVEL; + double f = Tile.SIZE << ABS_ZOOMLEVEL; mAbsX = x / f; mAbsY = y / f; @@ -625,7 +625,7 @@ public class MapViewPosition { double dy = Math.abs(MercatorProjection.latitudeToY(bbox.getMinLatitude()) - MercatorProjection.latitudeToY(bbox.getMaxLatitude())); - double aspect = (Math.min(mWidth, mHeight) / Tile.TILE_SIZE); + double aspect = (Math.min(mWidth, mHeight) / Tile.SIZE); double z = Math.min( -LOG4 * Math.log(dx) + aspect, -LOG4 * Math.log(dy) + aspect); @@ -647,7 +647,7 @@ public class MapViewPosition { //mTilt = 0; //mRotation = 0; //updateMatrix(); - double f = Tile.TILE_SIZE << ABS_ZOOMLEVEL; + double f = Tile.SIZE << ABS_ZOOMLEVEL; mStartX = mAbsX * f; mStartY = mAbsY * f; @@ -666,7 +666,7 @@ public class MapViewPosition { } public synchronized void animateTo(GeoPoint geoPoint) { - double f = Tile.TILE_SIZE << ABS_ZOOMLEVEL; + double f = Tile.SIZE << ABS_ZOOMLEVEL; mStartX = mAbsX * f; mStartY = mAbsY * f; diff --git a/src/org/oscim/view/TouchHandler.java b/src/org/oscim/view/TouchHandler.java index 0ad79bd9..f3aaa582 100644 --- a/src/org/oscim/view/TouchHandler.java +++ b/src/org/oscim/view/TouchHandler.java @@ -382,8 +382,8 @@ final class TouchHandler implements OnGestureListener, OnDoubleTapListener { if (mWasMulti) return true; - int w = Tile.TILE_SIZE * 3; - int h = Tile.TILE_SIZE * 3; + int w = Tile.SIZE * 3; + int h = Tile.SIZE * 3; //if (mMapView.enablePagedFling) { // double a = Math.sqrt(velocityX * velocityX + velocityY * velocityY);