diff --git a/src/org/oscim/database/oscimap/MapDatabase.java b/src/org/oscim/database/oscimap/MapDatabase.java index a50fe07b..17ce2c78 100644 --- a/src/org/oscim/database/oscimap/MapDatabase.java +++ b/src/org/oscim/database/oscimap/MapDatabase.java @@ -51,11 +51,9 @@ public class MapDatabase implements IMapDatabase { new Byte((byte) 4), new GeoPoint(53.11, 8.85), null, 0, 0, 0, "de", "comment", "author", null); - private static final String CACHE_DIRECTORY = "/Android/data/org.oscim.app/cache/"; private static final String CACHE_FILE = "%d-%d-%d.tile"; - private final static float REF_TILE_SIZE = 4096.0f; // 'open' state @@ -89,7 +87,7 @@ public class MapDatabase implements IMapDatabase { File f = null; if (USE_CACHE) { - f = new File(cacheDir, String.format(CACHE_FILE, + f = new File(cacheDir, String.format(CACHE_FILE, Integer.valueOf(tile.zoomLevel), Integer.valueOf(tile.tileX), Integer.valueOf(tile.tileY))); @@ -158,7 +156,7 @@ public class MapDatabase implements IMapDatabase { lwHttp = new LwHttp(); - if (!lwHttp.setServer(options.get("url"))){ + if (!lwHttp.setServer(options.get("url"))) { return new OpenResult("invalid url: " + options.get("url")); } @@ -211,20 +209,9 @@ public class MapDatabase implements IMapDatabase { // /////////////// hand sewed tile protocol buffers decoder /////////////// private final int MAX_WAY_COORDS = 16384; - //private final byte[] mReadBuffer = new byte[BUFFER_SIZE]; - - // position in buffer -// private int mBufferPos; - - // bytes available in buffer -// private int mBufferFill; - // overall bytes of content processed private int mBytesProcessed; - // overall bytes of content read -// private int mReadPos; - private static final int TAG_TILE_NUM_TAGS = 1; private static final int TAG_TILE_TAG_KEYS = 2; private static final int TAG_TILE_TAG_VALUES = 3; @@ -360,19 +347,16 @@ public class MapDatabase implements IMapDatabase { break; case TAG_ELEM_INDEX: - index = decodeShortArray(indexCnt, mIndices); - if (index != null) { - mIndices = index; + mIndices = index = decodeShortArray(indexCnt, mIndices); - for (int i = 0; i < indexCnt; i++) { - int len = index[i] * 2; - coordCnt += len; - index[i] = (short) len; - } - // set end marker - if (indexCnt < index.length) - index[indexCnt] = -1; + for (int i = 0; i < indexCnt; i++) { + int len = index[i] * 2; + coordCnt += len; + index[i] = (short) len; } + // set end marker + if (indexCnt < index.length) + index[indexCnt] = -1; break; case TAG_ELEM_COORDS: @@ -436,19 +420,17 @@ public class MapDatabase implements IMapDatabase { if (tagNum < 0) { Log.d(TAG, "NULL TAG: " + mTile + " invalid tag:" + tagNum + " " + cnt); + } else if (tagNum < Tags.MAX) { + tmp[cnt++] = Tags.tags[tagNum]; } else { - if (tagNum < Tags.MAX) - tmp[cnt++] = Tags.tags[tagNum]; - else { - tagNum -= Tags.LIMIT; + tagNum -= Tags.LIMIT; - if (tagNum >= 0 && tagNum < max) { - // Log.d(TAG, "variable tag: " + curTags[tagNum]); - tmp[cnt++] = curTags[tagNum]; - } else { - Log.d(TAG, "NULL TAG: " + mTile + " could find tag:" - + tagNum + " " + cnt); - } + if (tagNum >= 0 && tagNum < max) { + // Log.d(TAG, "variable tag: " + curTags[tagNum]); + tmp[cnt++] = curTags[tagNum]; + } else { + Log.d(TAG, "NULL TAG: " + mTile + " could not find tag:" + + tagNum + " " + cnt); } } } @@ -554,10 +536,8 @@ public class MapDatabase implements IMapDatabase { private short[] decodeShortArray(int num, short[] array) throws IOException { int bytes = decodeVarint32(); - short[] index = array; - if (index.length < num) { - index = new short[num]; - } + if (array.length < num) + array = new short[num]; lwHttp.readBuffer(bytes); @@ -605,13 +585,13 @@ public class MapDatabase implements IMapDatabase { } - index[cnt++] = (short) result; + array[cnt++] = (short) result; } lwHttp.bufferPos = pos; mBytesProcessed += bytes; - return index; + return array; } private int decodeVarint32() throws IOException { @@ -622,7 +602,7 @@ public class MapDatabase implements IMapDatabase { pos = lwHttp.bufferPos; } - byte[] buf =lwHttp.buffer; + byte[] buf = lwHttp.buffer; if (buf[pos] >= 0) { lwHttp.bufferPos += 1; diff --git a/src/org/oscim/renderer/layer/LineLayer.java b/src/org/oscim/renderer/layer/LineLayer.java index 7fbb55e8..7fd34903 100644 --- a/src/org/oscim/renderer/layer/LineLayer.java +++ b/src/org/oscim/renderer/layer/LineLayer.java @@ -162,12 +162,6 @@ public final class LineLayer extends Layer { ux = -vy; uy = vx; - if (opos == VertexPoolItem.SIZE) { - si = si.next = VertexPool.get(); - v = si.vertices; - opos = 0; - } - int ddx, ddy; // vertex point coordinate diff --git a/src/org/oscim/renderer/layer/TextLayer.java b/src/org/oscim/renderer/layer/TextLayer.java index ef12e3f1..9398f658 100644 --- a/src/org/oscim/renderer/layer/TextLayer.java +++ b/src/org/oscim/renderer/layer/TextLayer.java @@ -30,7 +30,7 @@ public final class TextLayer extends TextureLayer { private final static int LBIT_MASK = 0xfffffffe; private static int mFontPadX = 1; - private static int mFontPadY = 1; + //private static int mFontPadY = 1; public TextItem labels; private final Canvas mCanvas; diff --git a/src/org/oscim/renderer/overlays/TextOverlay.java b/src/org/oscim/renderer/overlays/TextOverlay.java index 0cb01b63..82be3cbe 100644 --- a/src/org/oscim/renderer/overlays/TextOverlay.java +++ b/src/org/oscim/renderer/overlays/TextOverlay.java @@ -55,7 +55,7 @@ import android.opengl.GLES20; import android.os.SystemClock; public class TextOverlay extends BasicOverlay { - private final static String TAG = TextOverlay.class.getName(); + //private final static String TAG = TextOverlay.class.getName(); private final MapViewPosition mMapViewPosition; private TileSet mTileSet; @@ -247,9 +247,8 @@ public class TextOverlay extends BasicOverlay { private final static float[] mDebugPoints = new float[4]; //private final Matrix4 mMVP = new Matrix4(); - void addTile(MapTile t) { - - } + //void addTile(MapTile t) { + //} private Label addToPool(Label l) { TextItem.release(l.item); diff --git a/src/org/oscim/theme/RenderTheme.java b/src/org/oscim/theme/RenderTheme.java index 14c96346..fa96b2c2 100644 --- a/src/org/oscim/theme/RenderTheme.java +++ b/src/org/oscim/theme/RenderTheme.java @@ -28,7 +28,7 @@ import android.graphics.Color; * A RenderTheme defines how ways and nodes are drawn. */ public class RenderTheme { - private final static String TAG = RenderTheme.class.getName(); + //private final static String TAG = RenderTheme.class.getName(); private static final int MATCHING_CACHE_SIZE = 512; private static final int RENDER_THEME_VERSION = 1; @@ -88,13 +88,13 @@ public class RenderTheme { private final LRUCache mWayCache; private final LRUCache mAreaCache; - private MatchingCacheKey mAreaCacheKey = new MatchingCacheKey(); - private MatchingCacheKey mWayCacheKey = new MatchingCacheKey(); - private MatchingCacheKey mNodeCacheKey = new MatchingCacheKey(); + private final MatchingCacheKey mAreaCacheKey = new MatchingCacheKey(); + private final MatchingCacheKey mWayCacheKey = new MatchingCacheKey(); + private final MatchingCacheKey mNodeCacheKey = new MatchingCacheKey(); - private ArrayList mWayInstructionList = new ArrayList(4); - private ArrayList mAreaInstructionList = new ArrayList(4); - private ArrayList mNodeInstructionList = new ArrayList(4); + private final ArrayList mWayInstructionList = new ArrayList(4); + private final ArrayList mAreaInstructionList = new ArrayList(4); + private final ArrayList mNodeInstructionList = new ArrayList(4); private RenderInstructionItem mPrevAreaItem; private RenderInstructionItem mPrevWayItem;