From 43ca55083298e2b718b526fba0a5aa4e9bf4e009 Mon Sep 17 00:00:00 2001 From: Emux Date: Tue, 12 Jul 2016 19:25:33 +0300 Subject: [PATCH] Improve code / xml formatting, #54 --- jni/src/JniBuilder.java | 164 +++--- jni/src/org/oscim/utils/TessJNI.java | 492 +++++++++--------- .../oscim/android/test/BaseMapActivity.java | 2 +- .../android/test/BitmapTileMapActivity.java | 4 +- .../android/test/JeoIndoorMapActivity.java | 18 +- .../android/test/MarkerOverlayActivity.java | 6 +- .../android/test/PathOverlayActivity.java | 2 +- .../oscim/android/test/S3DBMapActivity.java | 2 +- .../oscim/android/test/SimpleMapActivity.java | 4 +- .../android/test/VectorLayerMapActivity.java | 52 +- .../src/org/oscim/android/MapScaleBar.java | 4 +- .../src/org/oscim/android/MapView.java | 8 +- .../org/oscim/android/cache/TileCache.java | 2 +- .../oscim/android/input/GestureHandler.java | 4 +- .../tiling/source/oscimap/TileDecoder.java | 2 +- .../src/org/oscim/utils/Triangulator.java | 16 +- .../org/oscim/utils/osmpbf/OsmPbfParser.java | 142 ++--- .../org/oscim/theme/carto/RenderTheme.java | 2 +- .../src/org/oscim/layers/JtsPathLayer.java | 10 +- .../org/oscim/layers/vector/VectorLayer.java | 28 +- .../oscim/layers/vector/geometries/Style.java | 4 +- .../resources/assets/styles/mapzen.xml | 2 +- .../src/org/oscim/test/HairLineTest.java | 12 +- .../src/org/oscim/test/PathLayerTest.java | 10 +- .../src/org/oscim/test/TileRenderTest.java | 14 +- .../src/org/oscim/test/VectorLayerTest.java | 42 +- .../oscim/test/gdx/poi3d/GdxModelLayer.java | 208 ++++---- .../test/gdx/poi3d/GdxModelRenderer.java | 28 +- .../org/oscim/test/gdx/poi3d/SharedModel.java | 58 +-- .../oscim/test/renderer/CustomRenderer.java | 2 +- .../test/renderer/HexagonRenderTest.java | 16 +- .../oscim/tiling/source/OkHttpEngineTest.java | 32 +- .../test/org/oscim/utils/KeyMapTest.java | 2 +- vtm-tests/test/org/oscim/utils/RTreeTest.java | 62 +-- .../test/org/oscim/utils/pool/InlistTest.java | 10 +- .../src/org/oscim/web/client/GwtLauncher.java | 4 +- .../src/org/oscim/web/client/SearchBox.java | 28 +- .../src/org/oscim/web/client/WKTReader.java | 34 +- vtm-web-app/war/default.css | 110 ++-- vtm-web-app/war/index.html | 44 +- .../src/org/oscim/web/client/GwtLauncher.java | 4 +- .../src/org/oscim/web/client/GwtMap.java | 2 +- .../org/oscim/web/js/JsBitmapTileLayer.java | 8 +- .../org/oscim/web/js/JsBitmapTileSource.java | 8 +- vtm-web-js/src/org/oscim/web/js/JsMap.java | 2 +- .../src/org/oscim/web/js/JsOverlays.java | 6 +- vtm-web-js/war/default.css | 100 ++-- vtm-web-js/war/map.js | 58 +-- vtm-web/src/org/oscim/gdx/client/GdxGL.java | 6 +- .../src/org/oscim/gdx/client/MapConfig.java | 20 +- vtm-web/src/org/oscim/gdx/client/MapUrl.java | 8 +- .../gdx/backends/gwt/GwtApplication.java | 56 +- .../gdx/backends/gwt/GwtGraphics.java | 94 ++-- .../badlogic/gdx/backends/gwt/GwtInput.java | 196 +++---- .../gdx/emu/org/oscim/renderer/GLMatrix.java | 34 +- .../emu/org/oscim/tiling/source/LwHttp.java | 4 +- .../source/bitmap/BitmapTileSource.java | 8 +- .../gdx/emu/org/oscim/utils/Tessellator.java | 36 +- .../org/oscim/gdx/resources/js/tessellate.js | 168 +++--- .../oscim/tiling/source/geojson/Feature.java | 16 +- .../source/geojson/FeatureCollection.java | 2 +- .../tiling/source/geojson/GeoJsonObject.java | 4 +- .../source/geojson/GeoJsonTileDecoder.java | 4 +- .../oscim/tiling/source/geojson/Geometry.java | 4 +- .../source/geojson/JsArrayCollection.java | 12 +- .../oscim/tiling/source/geojson/LngLat.java | 4 +- .../source/geojson/MultiLineString.java | 4 +- .../tiling/source/geojson/MultiPolygon.java | 4 +- .../oscim/tiling/source/geojson/Polygon.java | 8 +- vtm/src/org/oscim/core/GeometryBuffer.java | 20 +- vtm/src/org/oscim/layers/MapEventLayer.java | 22 +- vtm/src/org/oscim/layers/PathLayer.java | 4 +- .../oscim/layers/marker/ItemizedLayer.java | 10 +- .../oscim/layers/marker/MarkerRenderer.java | 42 +- vtm/src/org/oscim/layers/tile/MapTile.java | 8 +- .../org/oscim/layers/tile/TileManager.java | 106 ++-- .../org/oscim/layers/tile/TileRenderer.java | 44 +- vtm/src/org/oscim/layers/tile/TileSet.java | 2 +- .../oscim/layers/tile/VectorTileRenderer.java | 40 +- .../layers/tile/bitmap/BitmapTileLayer.java | 34 +- .../layers/tile/buildings/BuildingLayer.java | 46 +- .../tile/buildings/BuildingRenderer.java | 18 +- .../layers/tile/buildings/S3DBTileLoader.java | 2 +- .../layers/tile/vector/VectorTileLayer.java | 10 +- .../layers/tile/vector/VectorTileLoader.java | 10 +- .../layers/tile/vector/labeling/Debug.java | 22 +- .../tile/vector/labeling/LabelLayer.java | 32 +- .../tile/vector/labeling/LabelPlacement.java | 42 +- .../tile/vector/labeling/WayDecorator.java | 78 +-- .../layers/vector/AbstractVectorLayer.java | 52 +- vtm/src/org/oscim/map/Animator.java | 8 +- vtm/src/org/oscim/map/ViewController.java | 40 +- vtm/src/org/oscim/map/Viewport.java | 6 +- vtm/src/org/oscim/renderer/BufferObject.java | 4 +- .../org/oscim/renderer/ExtrusionRenderer.java | 30 +- vtm/src/org/oscim/renderer/GLMatrix.java | 24 +- vtm/src/org/oscim/renderer/GridRenderer.java | 8 +- vtm/src/org/oscim/renderer/MapRenderer.java | 6 +- .../org/oscim/renderer/OffscreenRenderer.java | 2 +- .../oscim/renderer/atlas/TextureAtlas.java | 12 +- .../oscim/renderer/bucket/BitmapBucket.java | 4 +- .../renderer/bucket/ExtrusionBucket.java | 150 +++--- .../org/oscim/renderer/bucket/LineBucket.java | 124 ++--- .../oscim/renderer/bucket/LineTexBucket.java | 60 +-- .../oscim/renderer/bucket/PolygonBucket.java | 102 ++-- .../oscim/renderer/bucket/RenderBuckets.java | 10 +- .../oscim/renderer/bucket/SymbolBucket.java | 16 +- .../org/oscim/renderer/bucket/TextBucket.java | 24 +- .../oscim/renderer/bucket/TextureBucket.java | 6 +- .../oscim/renderer/bucket/TextureItem.java | 4 +- vtm/src/org/oscim/theme/MatchingCacheKey.java | 6 +- vtm/src/org/oscim/theme/RenderTheme.java | 28 +- vtm/src/org/oscim/theme/XmlThemeBuilder.java | 2 +- vtm/src/org/oscim/theme/rule/Rule.java | 30 +- vtm/src/org/oscim/tiling/TileSource.java | 2 +- vtm/src/org/oscim/tiling/source/LwHttp.java | 26 +- .../org/oscim/tiling/source/PbfDecoder.java | 2 +- .../tiling/source/mapfile/MapDatabase.java | 144 ++--- vtm/src/org/oscim/utils/KeyMap.java | 248 ++++----- vtm/src/org/oscim/utils/RTree.java | 404 +++++++------- vtm/src/org/oscim/utils/ScanBox.java | 4 +- vtm/src/org/oscim/utils/TessJNI.java | 180 +++---- vtm/src/org/oscim/utils/Tessellator.java | 376 ++++++------- vtm/src/org/oscim/utils/TimSort.java | 142 ++--- vtm/src/org/oscim/utils/async/AsyncTask.java | 2 +- vtm/src/org/oscim/utils/geom/LineClipper.java | 34 +- vtm/src/org/oscim/utils/geom/OBB2D.java | 34 +- vtm/src/org/oscim/utils/geom/SimplifyDP.java | 2 +- vtm/src/org/oscim/utils/geom/SimplifyVW.java | 10 +- vtm/src/org/oscim/utils/geom/TileClipper.java | 14 +- vtm/src/org/oscim/utils/pool/Inlist.java | 4 +- vtm/src/org/oscim/utils/quadtree/BoxTree.java | 44 +- .../org/oscim/utils/quadtree/TileIndex.java | 6 +- 133 files changed, 2803 insertions(+), 2791 deletions(-) diff --git a/jni/src/JniBuilder.java b/jni/src/JniBuilder.java index b3fe9d35..30beba9d 100644 --- a/jni/src/JniBuilder.java +++ b/jni/src/JniBuilder.java @@ -5,98 +5,98 @@ import com.badlogic.gdx.jnigen.BuildTarget.TargetOs; import com.badlogic.gdx.jnigen.NativeCodeGenerator; public class JniBuilder { - public static void main(String[] args) throws Exception { - String[] headers = { ".", "libtess2/Include" }; - String[] sources = { - "gl/utils.c", - "libtess2/Source/bucketalloc.c", - "libtess2/Source/dict.c", - "libtess2/Source/geom.c", - "libtess2/Source/mesh.c", - "libtess2/Source/priorityq.c", - "libtess2/Source/sweep.c", - "libtess2/Source/tess.c", - }; + public static void main(String[] args) throws Exception { + String[] headers = {".", "libtess2/Include"}; + String[] sources = { + "gl/utils.c", + "libtess2/Source/bucketalloc.c", + "libtess2/Source/dict.c", + "libtess2/Source/geom.c", + "libtess2/Source/mesh.c", + "libtess2/Source/priorityq.c", + "libtess2/Source/sweep.c", + "libtess2/Source/tess.c", + }; - String cflags = " -Wall -std=c99 -O2 -ffast-math"; - cflags += " -DNDEBUG"; /* disable debug in libtess2 */ + String cflags = " -Wall -std=c99 -O2 -ffast-math"; + cflags += " -DNDEBUG"; /* disable debug in libtess2 */ - //BuildTarget win32home = BuildTarget - // .newDefaultTarget(TargetOs.Windows, false); - //win32home.compilerPrefix = ""; - //win32home.buildFileName = "build-windows32home.xml"; - //win32home.excludeFromMasterBuildFile = true; - //win32home.headerDirs = headers; - //win32home.cIncludes = sources; - //win32home.cFlags += cflags; - //win32home.cppFlags += cflags; + //BuildTarget win32home = BuildTarget + // .newDefaultTarget(TargetOs.Windows, false); + //win32home.compilerPrefix = ""; + //win32home.buildFileName = "build-windows32home.xml"; + //win32home.excludeFromMasterBuildFile = true; + //win32home.headerDirs = headers; + //win32home.cIncludes = sources; + //win32home.cFlags += cflags; + //win32home.cppFlags += cflags; - BuildTarget win32 = BuildTarget - .newDefaultTarget(TargetOs.Windows, false); - win32.headerDirs = headers; - win32.cIncludes = sources; - win32.cFlags += cflags; - win32.cppFlags += cflags; + BuildTarget win32 = BuildTarget + .newDefaultTarget(TargetOs.Windows, false); + win32.headerDirs = headers; + win32.cIncludes = sources; + win32.cFlags += cflags; + win32.cppFlags += cflags; - BuildTarget win64 = BuildTarget - .newDefaultTarget(TargetOs.Windows, true); - win64.headerDirs = headers; - win64.cIncludes = sources; - win64.cFlags += cflags; - win64.cppFlags += cflags; + BuildTarget win64 = BuildTarget + .newDefaultTarget(TargetOs.Windows, true); + win64.headerDirs = headers; + win64.cIncludes = sources; + win64.cFlags += cflags; + win64.cppFlags += cflags; - BuildTarget lin32 = BuildTarget - .newDefaultTarget(TargetOs.Linux, false); - lin32.headerDirs = headers; - lin32.cIncludes = sources; - lin32.cFlags += cflags; - lin32.cppFlags += cflags; + BuildTarget lin32 = BuildTarget + .newDefaultTarget(TargetOs.Linux, false); + lin32.headerDirs = headers; + lin32.cIncludes = sources; + lin32.cFlags += cflags; + lin32.cppFlags += cflags; - BuildTarget lin64 = BuildTarget - .newDefaultTarget(TargetOs.Linux, true); - lin64.headerDirs = headers; - lin64.cIncludes = sources; - lin64.cFlags += cflags; - lin64.cppFlags += cflags; + BuildTarget lin64 = BuildTarget + .newDefaultTarget(TargetOs.Linux, true); + lin64.headerDirs = headers; + lin64.cIncludes = sources; + lin64.cFlags += cflags; + lin64.cppFlags += cflags; - BuildTarget mac = BuildTarget - .newDefaultTarget(TargetOs.MacOsX, false); - mac.headerDirs = headers; - mac.cIncludes = sources; - mac.cFlags += cflags; - mac.cppFlags += cflags; - mac.linkerFlags += " -framework CoreServices -framework Carbon"; + BuildTarget mac = BuildTarget + .newDefaultTarget(TargetOs.MacOsX, false); + mac.headerDirs = headers; + mac.cIncludes = sources; + mac.cFlags += cflags; + mac.cppFlags += cflags; + mac.linkerFlags += " -framework CoreServices -framework Carbon"; - BuildTarget android = BuildTarget - .newDefaultTarget(TargetOs.Android, false); - android.headerDirs = headers; - android.cIncludes = sources; - android.cFlags += cflags; - android.cppFlags += cflags; - android.linkerFlags += " -llog"; + BuildTarget android = BuildTarget + .newDefaultTarget(TargetOs.Android, false); + android.headerDirs = headers; + android.cIncludes = sources; + android.cFlags += cflags; + android.cppFlags += cflags; + android.linkerFlags += " -llog"; - BuildTarget ios = BuildTarget.newDefaultTarget(TargetOs.IOS, false); - ios.headerDirs = headers; - ios.cIncludes = sources; - ios.cFlags += cflags; - ios.cppFlags += cflags; + BuildTarget ios = BuildTarget.newDefaultTarget(TargetOs.IOS, false); + ios.headerDirs = headers; + ios.cIncludes = sources; + ios.cFlags += cflags; + ios.cppFlags += cflags; - new NativeCodeGenerator().generate(); + new NativeCodeGenerator().generate(); - new AntScriptGenerator() - .generate(new BuildConfig("vtm-jni"), - android, - lin64, - lin32, - mac, - ios, - //win32home, - win32, - win64 - ); + new AntScriptGenerator() + .generate(new BuildConfig("vtm-jni"), + android, + lin64, + lin32, + mac, + ios, + //win32home, + win32, + win64 + ); - // BuildExecutor.executeAnt("jni/build-windows32home.xml", "-v clean"); - // BuildExecutor.executeAnt("jni/build-linux64.xml", "-v"); - // BuildExecutor.executeAnt("jni/build.xml", "pack-natives -v"); - } + // BuildExecutor.executeAnt("jni/build-windows32home.xml", "-v clean"); + // BuildExecutor.executeAnt("jni/build-linux64.xml", "-v"); + // BuildExecutor.executeAnt("jni/build.xml", "pack-natives -v"); + } } diff --git a/jni/src/org/oscim/utils/TessJNI.java b/jni/src/org/oscim/utils/TessJNI.java index 2513e8e4..e07e2e54 100644 --- a/jni/src/org/oscim/utils/TessJNI.java +++ b/jni/src/org/oscim/utils/TessJNI.java @@ -1,265 +1,277 @@ package org.oscim.utils; public class TessJNI { - private long inst; + private long inst; - public TessJNI() { - inst = newTess(0); - } + public TessJNI() { + inst = newTess(0); + } - public TessJNI(int bucketSize) { - inst = newTess(bucketSize); - } + public TessJNI(int bucketSize) { + inst = newTess(bucketSize); + } - @Override - protected void finalize() { - dispose(); - } + @Override + protected void finalize() { + dispose(); + } - public void dispose() { - if (inst != 0) { - freeTess(inst); - inst = 0; - } - } + public void dispose() { + if (inst != 0) { + freeTess(inst); + inst = 0; + } + } - protected long instance() { - return inst; - } + protected long instance() { + return inst; + } - /** - * See OpenGL Red Book for description of the winding rules - * http://www.glprogramming.com/red/chapter11.html - */ - public static final class WindingRule { - public static final int ODD = 0; - public static final int NONZERO = 1; - public static final int POSITIVE = 2; - public static final int NEGATIVE = 3; - public static final int ABS_GEQ_TWO = 4; - } + /** + * See OpenGL Red Book for description of the winding rules + * http://www.glprogramming.com/red/chapter11.html + */ + public static final class WindingRule { + public static final int ODD = 0; + public static final int NONZERO = 1; + public static final int POSITIVE = 2; + public static final int NEGATIVE = 3; + public static final int ABS_GEQ_TWO = 4; + } - public static final class ElementType { - public static final int POLYGONS = 0; - public static final int CONNECTED_POLYGONS = 1; - public static final int BOUNDARY_CONTOURS = 2; - } + public static final class ElementType { + public static final int POLYGONS = 0; + public static final int CONNECTED_POLYGONS = 1; + public static final int BOUNDARY_CONTOURS = 2; + } - public void addContour2D(float[] points) { - addContour2D(points, 0, points.length >> 1); - } + public void addContour2D(float[] points) { + addContour2D(points, 0, points.length >> 1); + } - public void addContour2D(float[] points, int offset, int length) { - if (length < 6) - return; - if ((length % 2 != 0) || (offset % 2 != 0) || (points.length >> 1) < (offset + length)) - throw new IllegalArgumentException("Invalid input: length:" + length - + ", offset:" + offset - + ", points.length:" + points.length); - addContour(inst, 2, points, 8, offset, length); - } + public void addContour2D(float[] points, int offset, int length) { + if (length < 6) + return; + if ((length % 2 != 0) || (offset % 2 != 0) || (points.length >> 1) < (offset + length)) + throw new IllegalArgumentException("Invalid input: length:" + length + + ", offset:" + offset + + ", points.length:" + points.length); + addContour(inst, 2, points, 8, offset, length); + } - public void addContour2D(int[] index, float[] contour) { - addMultiContour2D(inst, index, contour, 0, index.length); - } + public void addContour2D(int[] index, float[] contour) { + addMultiContour2D(inst, index, contour, 0, index.length); + } - public void addContour2D(int[] index, float[] contour, int idxStart, int idxEnd) { - addMultiContour2D(inst, index, contour, idxStart, idxEnd); - } + public void addContour2D(int[] index, float[] contour, int idxStart, int idxEnd) { + addMultiContour2D(inst, index, contour, idxStart, idxEnd); + } - public boolean tesselate() { - return tessContour2D(inst, - TessJNI.WindingRule.POSITIVE, - TessJNI.ElementType.POLYGONS, - 3, 2) == 1; - } + public boolean tesselate() { + return tessContour2D(inst, + TessJNI.WindingRule.POSITIVE, + TessJNI.ElementType.POLYGONS, + 3, 2) == 1; + } - public boolean tesselate(int windingRule, int elementType) { - return tessContour2D(inst, windingRule, elementType, 3, 2) == 1; - } + public boolean tesselate(int windingRule, int elementType) { + return tessContour2D(inst, windingRule, elementType, 3, 2) == 1; + } - public int getVertexCount() { - return getVertexCount(inst); - } + public int getVertexCount() { + return getVertexCount(inst); + } - public int getElementCount() { - return getElementCount(inst); - } + public int getElementCount() { + return getElementCount(inst); + } - public void getVertices(float[] out, int offset, int length) { - getVertices(inst, out, offset, length); - } + public void getVertices(float[] out, int offset, int length) { + getVertices(inst, out, offset, length); + } - public void getVertices(short[] out, int offset, int length, float scale) { - getVerticesS(inst, out, offset, length, scale); - } + public void getVertices(short[] out, int offset, int length, float scale) { + getVerticesS(inst, out, offset, length, scale); + } - public void getElements(int[] out, int offset, int length) { - getElements(inst, out, offset, length); - } + public void getElements(int[] out, int offset, int length) { + getElements(inst, out, offset, length); + } - public void getElements(short[] out, int offset, int length) { - getElementsS(inst, out, offset, length); - } + public void getElements(short[] out, int offset, int length) { + getElementsS(inst, out, offset, length); + } - public void getVertexIndices(int[] out, int offset, int length) { - getVertexIndices(inst, out, offset, length); - } + public void getVertexIndices(int[] out, int offset, int length) { + getVertexIndices(inst, out, offset, length); + } - public void getElementsWithInputVertexIds(short[] dst, int dstOffset, int offset, int length) { - getElementsWithInputVertexIds(inst, dst, dstOffset, offset, length); - } + public void getElementsWithInputVertexIds(short[] dst, int dstOffset, int offset, int length) { + getElementsWithInputVertexIds(inst, dst, dstOffset, offset, length); + } - // @formatter:off - /*JNI - #include - #include - #include - void* heapAlloc( void* userData, unsigned int size ){ - TESS_NOTUSED( userData ); - return malloc( size ); - } - void* heapRealloc( void *userData, void* ptr, unsigned int size ){ - TESS_NOTUSED( userData ); - return realloc( ptr, size ); - } - void heapFree( void* userData, void* ptr ){ - TESS_NOTUSED( userData ); - free( ptr ); - } - */ - static native long newTess(int size); /* { - if (size <= 0) - return (long)tessNewTess(0); - if (size > 10) - size = 10; - TESSalloc ma; - memset(&ma, 0, sizeof(ma)); - ma.memalloc = heapAlloc; - ma.memfree = heapFree; - ma.memrealloc = heapRealloc; - //ma.userData = (void*)&allocated; - ma.meshEdgeBucketSize = 2 << size; // 512 - ma.meshVertexBucketSize = 2 << size; // 512 - ma.meshFaceBucketSize = 1 << size; // 256 - ma.dictNodeBucketSize = 2 << size; // 512 - ma.regionBucketSize = 1 << size; // 256 - ma.extraVertices = 8; - //ma.extraVertices = 256; - return (long)tessNewTess(&ma); - } */ - static native void freeTess(long inst); /* { - tessDeleteTess((TESStesselator*) inst); - } */ - /** - * Adds a contour to be tesselated. - * The type of the vertex coordinates is assumed to be TESSreal. - * - * @param tess - pointer to tesselator object. - * @param size - number of coordinates per vertex. Must be 2 or 3. - * @param pointer - pointer to the first coordinate of the first vertex in the array. - * @param stride - defines offset in bytes between consecutive vertices. - * @param count - number of vertices in contour. - */ - static native void addContour(long inst, int size, float[] contour, int stride, int offset, int count);/* { - tessAddContour((TESStesselator*) inst, size, contour + (offset * stride), stride, count); - } */ - static native void addMultiContour2D(long inst, int[] index, float[] contour, int idxStart, int idxCount);/* { - TESStesselator* tess = (TESStesselator*) inst; - int offset = 0; - // start at 0 to get the correct offset in contour.. - for (int i = 0; i < idxStart + idxCount; i++){ - int len = index[i]; - if ((len % 2 != 0) || (len < 0)) - break; - if (len < 6 || i < idxStart) { - offset += len; - continue; - } - tessAddContour(tess, 2, contour + offset, 8, len >> 1); - offset += len; - } - } */ - /** - * Tesselate contours. - * - * @param tess - pointer to tesselator object. - * @param windingRule - winding rules used for tesselation, must be one of TessWindingRule. - * @param elementType - defines the tesselation result element type, must be one of TessElementType. - * @param polySize - defines maximum vertices per polygons if output is polygons. - * @param vertexSize - defines the number of coordinates in tesselation result vertex, must be 2 or 3. - * @param normal - defines the normal of the input contours, of null the normal is calculated automatically. - * @return 1 if succeed, 0 if failed. - */ - static native int tessContour2D(long inst, int windingRule, int elementType, int polySize, int vertexSize);/*{ - return tessTesselate((TESStesselator*) inst, windingRule, elementType, polySize, vertexSize, 0); - } */ - static native int getVertexCount(long inst); /*{ - return tessGetVertexCount((TESStesselator*) inst); - }*/ - /** - * Returns pointer to first coordinate of first vertex. - */ - static native boolean getVertices(long inst, float[] out, int offset, int length);/*{ - const TESSreal* vertices = tessGetVertices((TESStesselator*) inst); - if (!vertices) - return 0; - memcpy(out, vertices + offset, length * sizeof(TESSreal)); - return 1; - }*/ - /** - * Returns pointer to first coordinate of first vertex. - */ - static native void getVerticesS(long inst, short[] out, int offset, int length, float scale);/*{ - const TESSreal* vertices = tessGetVertices((TESStesselator*) inst); - for(int i = 0; i < length; i++) - out[i] = (short)(vertices[offset++] * scale + 0.5f); - }*/ - /** - * Returns pointer to first vertex index. - * - * Vertex indices can be used to map the generated vertices to the original vertices. - * Every point added using tessAddContour() will get a new index starting at 0. - * New vertices generated at the intersections of segments are assigned value TESS_UNDEF. - */ - static native boolean getVertexIndices(long inst, int[] out, int offset, int length);/* { - const TESSindex* indices = tessGetVertexIndices((TESStesselator*) inst); - if (!indices) - return 0; - memcpy(out, indices + offset, length * sizeof(TESSindex)); - return 1; - } */ - /** - * Returns number of elements in the the tesselated output. - */ - static native int getElementCount(long inst);/*{ - return tessGetElementCount((TESStesselator*) inst); - }*/ - /** - * Returns pointer to the first element. - */ - static native boolean getElements(long inst, int[] out, int offset, int length);/*{ - const TESSindex* elements = tessGetElements((TESStesselator*) inst); - if (!elements) - return 0; - memcpy(out, elements + offset, length * sizeof(TESSindex)); - return 1; - }*/ - /** - * Returns pointer to the first element. - */ - static native void getElementsS(long inst, short[] out, int offset, int length);/*{ - const TESSindex* elements = tessGetElements((TESStesselator*) inst); - for(int i = 0; i < length; i++) - out[i] = (short)elements[offset++]; - }*/ - /** - * Returns list of triangles indices (or to the first element of convex polygons). - */ - static native void getElementsWithInputVertexIds(long inst, short[] out, int dstOffset, int offset, int length);/*{ - const TESSindex* elements = tessGetElements((TESStesselator*) inst); - const TESSindex* indices = tessGetVertexIndices((TESStesselator*) inst); - for(int i = 0; i < length; i++) - out[dstOffset++] = (short)(indices[elements[offset++]]); - }*/ -} \ No newline at end of file + // @formatter:off + /*JNI + #include + #include + #include + void* heapAlloc( void* userData, unsigned int size ){ + TESS_NOTUSED( userData ); + return malloc( size ); + } + void* heapRealloc( void *userData, void* ptr, unsigned int size ){ + TESS_NOTUSED( userData ); + return realloc( ptr, size ); + } + void heapFree( void* userData, void* ptr ){ + TESS_NOTUSED( userData ); + free( ptr ); + } + */ + static native long newTess(int size); /* { + if (size <= 0) + return (long)tessNewTess(0); + if (size > 10) + size = 10; + TESSalloc ma; + memset(&ma, 0, sizeof(ma)); + ma.memalloc = heapAlloc; + ma.memfree = heapFree; + ma.memrealloc = heapRealloc; + //ma.userData = (void*)&allocated; + ma.meshEdgeBucketSize = 2 << size; // 512 + ma.meshVertexBucketSize = 2 << size; // 512 + ma.meshFaceBucketSize = 1 << size; // 256 + ma.dictNodeBucketSize = 2 << size; // 512 + ma.regionBucketSize = 1 << size; // 256 + ma.extraVertices = 8; + //ma.extraVertices = 256; + return (long)tessNewTess(&ma); + } */ + + static native void freeTess(long inst); /* { + tessDeleteTess((TESStesselator*) inst); + } */ + + /** + * Adds a contour to be tesselated. + * The type of the vertex coordinates is assumed to be TESSreal. + * + * @param tess - pointer to tesselator object. + * @param size - number of coordinates per vertex. Must be 2 or 3. + * @param pointer - pointer to the first coordinate of the first vertex in the array. + * @param stride - defines offset in bytes between consecutive vertices. + * @param count - number of vertices in contour. + */ + static native void addContour(long inst, int size, float[] contour, int stride, int offset, int count);/* { + tessAddContour((TESStesselator*) inst, size, contour + (offset * stride), stride, count); + } */ + + static native void addMultiContour2D(long inst, int[] index, float[] contour, int idxStart, int idxCount);/* { + TESStesselator* tess = (TESStesselator*) inst; + int offset = 0; + // start at 0 to get the correct offset in contour.. + for (int i = 0; i < idxStart + idxCount; i++){ + int len = index[i]; + if ((len % 2 != 0) || (len < 0)) + break; + if (len < 6 || i < idxStart) { + offset += len; + continue; + } + tessAddContour(tess, 2, contour + offset, 8, len >> 1); + offset += len; + } + } */ + + /** + * Tesselate contours. + * + * @param tess - pointer to tesselator object. + * @param windingRule - winding rules used for tesselation, must be one of TessWindingRule. + * @param elementType - defines the tesselation result element type, must be one of TessElementType. + * @param polySize - defines maximum vertices per polygons if output is polygons. + * @param vertexSize - defines the number of coordinates in tesselation result vertex, must be 2 or 3. + * @param normal - defines the normal of the input contours, of null the normal is calculated automatically. + * @return 1 if succeed, 0 if failed. + */ + static native int tessContour2D(long inst, int windingRule, int elementType, int polySize, int vertexSize);/*{ + return tessTesselate((TESStesselator*) inst, windingRule, elementType, polySize, vertexSize, 0); + } */ + + static native int getVertexCount(long inst); /*{ + return tessGetVertexCount((TESStesselator*) inst); + }*/ + + /** + * Returns pointer to first coordinate of first vertex. + */ + static native boolean getVertices(long inst, float[] out, int offset, int length);/*{ + const TESSreal* vertices = tessGetVertices((TESStesselator*) inst); + if (!vertices) + return 0; + memcpy(out, vertices + offset, length * sizeof(TESSreal)); + return 1; + }*/ + + /** + * Returns pointer to first coordinate of first vertex. + */ + static native void getVerticesS(long inst, short[] out, int offset, int length, float scale);/*{ + const TESSreal* vertices = tessGetVertices((TESStesselator*) inst); + for(int i = 0; i < length; i++) + out[i] = (short)(vertices[offset++] * scale + 0.5f); + }*/ + + /** + * Returns pointer to first vertex index. + *

+ * Vertex indices can be used to map the generated vertices to the original vertices. + * Every point added using tessAddContour() will get a new index starting at 0. + * New vertices generated at the intersections of segments are assigned value TESS_UNDEF. + */ + static native boolean getVertexIndices(long inst, int[] out, int offset, int length);/* { + const TESSindex* indices = tessGetVertexIndices((TESStesselator*) inst); + if (!indices) + return 0; + memcpy(out, indices + offset, length * sizeof(TESSindex)); + return 1; + } */ + + /** + * Returns number of elements in the the tesselated output. + */ + static native int getElementCount(long inst);/*{ + return tessGetElementCount((TESStesselator*) inst); + }*/ + + /** + * Returns pointer to the first element. + */ + static native boolean getElements(long inst, int[] out, int offset, int length);/*{ + const TESSindex* elements = tessGetElements((TESStesselator*) inst); + if (!elements) + return 0; + memcpy(out, elements + offset, length * sizeof(TESSindex)); + return 1; + }*/ + + /** + * Returns pointer to the first element. + */ + static native void getElementsS(long inst, short[] out, int offset, int length);/*{ + const TESSindex* elements = tessGetElements((TESStesselator*) inst); + for(int i = 0; i < length; i++) + out[i] = (short)elements[offset++]; + }*/ + + /** + * Returns list of triangles indices (or to the first element of convex polygons). + */ + static native void getElementsWithInputVertexIds(long inst, short[] out, int dstOffset, int offset, int length);/*{ + const TESSindex* elements = tessGetElements((TESStesselator*) inst); + const TESSindex* indices = tessGetVertexIndices((TESStesselator*) inst); + for(int i = 0; i < length; i++) + out[dstOffset++] = (short)(indices[elements[offset++]]); + }*/ +} diff --git a/vtm-android-example/src/org/oscim/android/test/BaseMapActivity.java b/vtm-android-example/src/org/oscim/android/test/BaseMapActivity.java index c1b8a35f..cc9f8174 100644 --- a/vtm-android-example/src/org/oscim/android/test/BaseMapActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/BaseMapActivity.java @@ -61,7 +61,7 @@ public class BaseMapActivity extends MapActivity { } mBaseLayer = mMap.setBaseMap(mTileSource); - /* set initial position on first run */ + /* set initial position on first run */ MapPosition pos = new MapPosition(); mMap.getMapPosition(pos); if (pos.x == 0.5 && pos.y == 0.5) diff --git a/vtm-android-example/src/org/oscim/android/test/BitmapTileMapActivity.java b/vtm-android-example/src/org/oscim/android/test/BitmapTileMapActivity.java index a61d061a..02587576 100644 --- a/vtm-android-example/src/org/oscim/android/test/BitmapTileMapActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/BitmapTileMapActivity.java @@ -98,8 +98,8 @@ public class BitmapTileMapActivity extends MapActivity { } else { //mMapView.map().setMapPosition(p); p.setScale(2 + (1 << (int) (Math.random() * 13))); - // p.setX((p.getX() + (Math.random() * 4 - 2) / p.getScale())); - // p.setY((p.getY() + (Math.random() * 4 - 2) / p.getScale())); + // p.setX((p.getX() + (Math.random() * 4 - 2) / p.getScale())); + // p.setY((p.getY() + (Math.random() * 4 - 2) / p.getScale())); p.setX(MercatorProjection.longitudeToX(Math.random() * 180)); p.setY(MercatorProjection.latitudeToY(Math.random() * 60)); diff --git a/vtm-android-example/src/org/oscim/android/test/JeoIndoorMapActivity.java b/vtm-android-example/src/org/oscim/android/test/JeoIndoorMapActivity.java index eea516b1..9949f18b 100644 --- a/vtm-android-example/src/org/oscim/android/test/JeoIndoorMapActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/JeoIndoorMapActivity.java @@ -62,9 +62,9 @@ public class JeoIndoorMapActivity extends BaseMapActivity { showToast("load data"); InputStream is = null; try { - // File file = new File(Environment.getExternalStorageDirectory() - // .getAbsolutePath(), "osmindoor.json"); - // is = new FileInputStream(file); + // File file = new File(Environment.getExternalStorageDirectory() + // .getAbsolutePath(), "osmindoor.json"); + // is = new FileInputStream(file); URL url = new URL(PATH); URLConnection conn = url.openConnection(); @@ -83,11 +83,11 @@ public class JeoIndoorMapActivity extends BaseMapActivity { mMap.layers().add(new BuildingLayer(mMap, mBaseLayer)); mMap.layers().add(new LabelLayer(mMap, mBaseLayer)); - // mMap.layers().add(new TileGridLayer(mMap)); - // String file = Environment.getExternalStorageDirectory().getAbsolutePath(); - // VectorDataset data = (VectorDataset) JeoTest.getJsonData(file + "/states.json", true); - // Style style = JeoTest.getStyle(); - // mMap.layers().add(new JeoVectorLayer(mMap, data, style)); + // mMap.layers().add(new TileGridLayer(mMap)); + // String file = Environment.getExternalStorageDirectory().getAbsolutePath(); + // VectorDataset data = (VectorDataset) JeoTest.getJsonData(file + "/states.json", true); + // Style style = JeoTest.getStyle(); + // mMap.layers().add(new JeoVectorLayer(mMap, data, style)); } void loadJson(InputStream is) { @@ -171,7 +171,7 @@ public class JeoIndoorMapActivity extends BaseMapActivity { protected void onResume() { super.onResume(); - /* ignore saved position */ + /* ignore saved position */ //mMap.setMapPosition(49.417, 8.673, 1 << 17); mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16); } diff --git a/vtm-android-example/src/org/oscim/android/test/MarkerOverlayActivity.java b/vtm-android-example/src/org/oscim/android/test/MarkerOverlayActivity.java index 235cf296..8fc24275 100644 --- a/vtm-android-example/src/org/oscim/android/test/MarkerOverlayActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/MarkerOverlayActivity.java @@ -50,7 +50,7 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - /* directly load bitmap from resources */ + /* directly load bitmap from resources */ Bitmap bitmap = drawableToBitmap(getResources(), R.drawable.marker_poi); MarkerSymbol symbol; @@ -59,7 +59,7 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity else symbol = new MarkerSymbol(bitmap, 0.5f, 0.5f, false); - /* another option: use some bitmap drawable */ + /* another option: use some bitmap drawable */ Drawable d = getResources().getDrawable(R.drawable.ic_launcher); if (BILLBOARDS) mFocusMarker = new MarkerSymbol(drawableToBitmap(d), @@ -91,7 +91,7 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity protected void onResume() { super.onResume(); - /* ignore saved position */ + /* ignore saved position */ mMap.setMapPosition(0, 0, 1 << 2); } diff --git a/vtm-android-example/src/org/oscim/android/test/PathOverlayActivity.java b/vtm-android-example/src/org/oscim/android/test/PathOverlayActivity.java index 27b247e6..acaec592 100644 --- a/vtm-android-example/src/org/oscim/android/test/PathOverlayActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/PathOverlayActivity.java @@ -70,7 +70,7 @@ public class PathOverlayActivity extends BitmapTileMapActivity { protected void onResume() { super.onResume(); - /* ignore saved position */ + /* ignore saved position */ mMap.setMapPosition(0, 0, 1 << 2); } diff --git a/vtm-android-example/src/org/oscim/android/test/S3DBMapActivity.java b/vtm-android-example/src/org/oscim/android/test/S3DBMapActivity.java index 42398b4b..b53a6bf9 100644 --- a/vtm-android-example/src/org/oscim/android/test/S3DBMapActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/S3DBMapActivity.java @@ -64,7 +64,7 @@ public class S3DBMapActivity extends BaseMapActivity { protected void onResume() { super.onResume(); - /* ignore saved position */ + /* ignore saved position */ mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16); } } diff --git a/vtm-android-example/src/org/oscim/android/test/SimpleMapActivity.java b/vtm-android-example/src/org/oscim/android/test/SimpleMapActivity.java index 228a35ac..be6f9199 100644 --- a/vtm-android-example/src/org/oscim/android/test/SimpleMapActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/SimpleMapActivity.java @@ -69,8 +69,8 @@ public class SimpleMapActivity extends BaseMapActivity { //mMapView.map().setMapPosition(p); p.setScale(2 + (1 << (int) (Math.random() * 13))); - // p.setX((p.getX() + (Math.random() * 4 - 2) / p.getScale())); - // p.setY((p.getY() + (Math.random() * 4 - 2) / p.getScale())); + // p.setX((p.getX() + (Math.random() * 4 - 2) / p.getScale())); + // p.setY((p.getY() + (Math.random() * 4 - 2) / p.getScale())); p.setX(MercatorProjection.longitudeToX(Math.random() * 180)); p.setY(MercatorProjection.latitudeToY(Math.random() * 60)); diff --git a/vtm-android-example/src/org/oscim/android/test/VectorLayerMapActivity.java b/vtm-android-example/src/org/oscim/android/test/VectorLayerMapActivity.java index f128d410..666864c0 100644 --- a/vtm-android-example/src/org/oscim/android/test/VectorLayerMapActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/VectorLayerMapActivity.java @@ -37,39 +37,39 @@ public class VectorLayerMapActivity extends BaseMapActivity { VectorLayer vectorLayer = new VectorLayer(mMap); - // Geometry g = new GeomBuilder() - // .point(8.8, 53.1) - // .point() - // .buffer(1) - // .get(); + // Geometry g = new GeomBuilder() + // .point(8.8, 53.1) + // .point() + // .buffer(1) + // .get(); // - // vectorLayer.add(new PolygonDrawable(g, defaultStyle())); + // vectorLayer.add(new PolygonDrawable(g, defaultStyle())); // - // vectorLayer.add(new PointDrawable(53.1, 8.8, Style.builder() - // .setBuffer(0.5) - // .setFillColor(Color.RED) - // .setFillAlpha(0.2) - // .build())); + // vectorLayer.add(new PointDrawable(53.1, 8.8, Style.builder() + // .setBuffer(0.5) + // .setFillColor(Color.RED) + // .setFillAlpha(0.2) + // .build())); // - // Style.Builder sb = Style.builder() - // .setBuffer(0.5) - // .setFillColor(Color.RED) - // .setFillAlpha(0.2); + // Style.Builder sb = Style.builder() + // .setBuffer(0.5) + // .setFillColor(Color.RED) + // .setFillAlpha(0.2); // - // Style style = sb.setFillAlpha(0.2).build(); + // Style style = sb.setFillAlpha(0.2).build(); // - // int tileSize = 5; - // for (int x = -180; x < 180; x += tileSize) { - // for (int y = -90; y < 90; y += tileSize) { - // // Style style = sb.setFillAlpha(FastMath.clamp(FastMath.length(x, y) / 180, 0.2, 1)) - // // .build(); + // int tileSize = 5; + // for (int x = -180; x < 180; x += tileSize) { + // for (int y = -90; y < 90; y += tileSize) { + // // Style style = sb.setFillAlpha(FastMath.clamp(FastMath.length(x, y) / 180, 0.2, 1)) + // // .build(); // - // vectorLayer.add(new RectangleDrawable(FastMath.clamp(y, -85, 85), x, - // FastMath.clamp(y + tileSize - 0.1, -85, 85), - // x + tileSize - 0.1, style)); + // vectorLayer.add(new RectangleDrawable(FastMath.clamp(y, -85, 85), x, + // FastMath.clamp(y + tileSize - 0.1, -85, 85), + // x + tileSize - 0.1, style)); // - // } - // } + // } + // } Style.Builder sb = Style.builder() .buffer(0.5) diff --git a/vtm-android/src/org/oscim/android/MapScaleBar.java b/vtm-android/src/org/oscim/android/MapScaleBar.java index 4027ae7c..4ead3521 100644 --- a/vtm-android/src/org/oscim/android/MapScaleBar.java +++ b/vtm-android/src/org/oscim/android/MapScaleBar.java @@ -42,8 +42,8 @@ public class MapScaleBar extends Layer implements UpdateListener { private static final int BITMAP_HEIGHT = 64; private static final int BITMAP_WIDTH = 128; private static final double LATITUDE_REDRAW_THRESHOLD = 0.2; - // private static final int MARGIN_BOTTOM = 5; - // private static final int MARGIN_LEFT = 5; + // private static final int MARGIN_BOTTOM = 5; + // private static final int MARGIN_LEFT = 5; private static final double METER_FOOT_RATIO = 0.3048; private static final int ONE_KILOMETER = 1000; diff --git a/vtm-android/src/org/oscim/android/MapView.java b/vtm-android/src/org/oscim/android/MapView.java index 78394002..76440f78 100644 --- a/vtm-android/src/org/oscim/android/MapView.java +++ b/vtm-android/src/org/oscim/android/MapView.java @@ -63,13 +63,13 @@ public class MapView extends GLSurfaceView { public MapView(Context context, AttributeSet attributeSet) { super(context, attributeSet); - /* Not sure if this makes sense */ + /* Not sure if this makes sense */ this.setWillNotDraw(true); this.setClickable(true); this.setFocusable(true); this.setFocusableInTouchMode(true); - /* Setup android backedn */ + /* Setup android backedn */ AndroidGraphics.init(); AndroidAssets.init(context); GLAdapter.init(new AndroidGL()); @@ -77,10 +77,10 @@ public class MapView extends GLSurfaceView { DisplayMetrics metrics = getResources().getDisplayMetrics(); CanvasAdapter.dpi = (int) Math.max(metrics.xdpi, metrics.ydpi); - /* Initialize the Map */ + /* Initialize the Map */ mMap = new AndroidMap(this); - /* Initialize Renderer */ + /* Initialize Renderer */ setEGLConfigChooser(new GlConfigChooser()); setEGLContextClientVersion(2); diff --git a/vtm-android/src/org/oscim/android/cache/TileCache.java b/vtm-android/src/org/oscim/android/cache/TileCache.java index 277535ab..e46982a8 100644 --- a/vtm-android/src/org/oscim/android/cache/TileCache.java +++ b/vtm-android/src/org/oscim/android/cache/TileCache.java @@ -250,7 +250,7 @@ public class TileCache implements ITileCache { public synchronized TileReader getTile(Tile tile) { //if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) - // return getTileApi11(tile); + // return getTileApi11(tile); mQueryVals[0] = String.valueOf(tile.zoomLevel); mQueryVals[1] = String.valueOf(tile.tileX); diff --git a/vtm-android/src/org/oscim/android/input/GestureHandler.java b/vtm-android/src/org/oscim/android/input/GestureHandler.java index 3dd3e97d..03ffc8b7 100644 --- a/vtm-android/src/org/oscim/android/input/GestureHandler.java +++ b/vtm-android/src/org/oscim/android/input/GestureHandler.java @@ -16,11 +16,11 @@ public class GestureHandler implements OnGestureListener, OnDoubleTapListener { mMap = map; } - /* GesturListener */ + /* GesturListener */ @Override public boolean onSingleTapUp(MotionEvent e) { - // return mMap.handleGesture(Gesture.TAP, mMotionEvent.wrap(e)); + // return mMap.handleGesture(Gesture.TAP, mMotionEvent.wrap(e)); return false; } diff --git a/vtm-extras/src/org/oscim/tiling/source/oscimap/TileDecoder.java b/vtm-extras/src/org/oscim/tiling/source/oscimap/TileDecoder.java index 32e986e7..5205c98f 100644 --- a/vtm-extras/src/org/oscim/tiling/source/oscimap/TileDecoder.java +++ b/vtm-extras/src/org/oscim/tiling/source/oscimap/TileDecoder.java @@ -234,7 +234,7 @@ public class TileDecoder extends PbfDecoder { // FIXME, remove all tiles from cache then remove this below //if (layer == 0) - // layer = 5; + // layer = 5; mElem.type = polygon ? GeometryType.POLY : GeometryType.LINE; mElem.setLayer(layer); mSink.process(mElem); diff --git a/vtm-extras/src/org/oscim/utils/Triangulator.java b/vtm-extras/src/org/oscim/utils/Triangulator.java index d09b8ba9..598c8816 100644 --- a/vtm-extras/src/org/oscim/utils/Triangulator.java +++ b/vtm-extras/src/org/oscim/utils/Triangulator.java @@ -206,7 +206,7 @@ public class Triangulator { int[] V = new int[n]; - /* we want a counter-clockwise polygon in V */ + /* we want a counter-clockwise polygon in V */ if (0.0f < area(contour)) { for (int v = 0; v < n; v++) @@ -218,7 +218,7 @@ public class Triangulator { int nv = n; - /* remove nv-2 Vertices, creating 1 triangle every time */ + /* remove nv-2 Vertices, creating 1 triangle every time */ int count = 2 * nv; /* error detection */ //for (int m = 0, v = nv - 1; nv > 2;) { @@ -229,7 +229,7 @@ public class Triangulator { return false; } - /* three consecutive vertices in current polygon, */ + /* three consecutive vertices in current polygon, */ int u = v; if (nv <= u) u = 0; /* previous */ @@ -243,25 +243,25 @@ public class Triangulator { if (snip(contour, u, v, w, nv, V)) { int a, b, c, s, t; - /* true names of the vertices */ + /* true names of the vertices */ a = V[u]; b = V[v]; c = V[w]; - /* output Triangle */ + /* output Triangle */ result.add(contour.get(a)); result.add(contour.get(b)); result.add(contour.get(c)); //m++; - /* remove v from remaining polygon */ + /* remove v from remaining polygon */ for (s = v, t = v + 1; t < nv; s++, t++) { V[s] = V[t]; } nv--; - /* resest error detection counter */ + /* resest error detection counter */ count = 2 * nv; } } @@ -355,7 +355,7 @@ public class Triangulator { // * @param point The point to remove // */ //public void remove(Point point) { - // points.remove(point); + // points.remove(point); //} /** diff --git a/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfParser.java b/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfParser.java index eee264fa..232101d0 100644 --- a/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfParser.java +++ b/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfParser.java @@ -88,15 +88,15 @@ public class OsmPbfParser extends BinaryParser { long id = i.getId(); double latf = parseLat(i.getLat()), lonf = parseLon(i.getLon()); - // if (i.hasInfo()) { - // Osmformat.Info info = i.getInfo(); - // tmp = new OsmNode(new CommonEntityData(id, info.getVersion(), getDate(info), - // getUser(info), info.getChangeset(), tags), latf, lonf); - // } else { + // if (i.hasInfo()) { + // Osmformat.Info info = i.getInfo(); + // tmp = new OsmNode(new CommonEntityData(id, info.getVersion(), getDate(info), + // getUser(info), info.getChangeset(), tags), latf, lonf); + // } else { tmp = new OsmNode(latf, lonf, tags, id); - // tmp = new Node(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE, - // NOCHANGESET, tags), latf, lonf); - // } + // tmp = new Node(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE, + // NOCHANGESET, tags), latf, lonf); + // } //sink.process(new NodeContainer(tmp)); mNodeMap.put(Long.valueOf(id), tmp); } @@ -109,12 +109,12 @@ public class OsmPbfParser extends BinaryParser { int j = 0; // Index into the keysvals array. // Stuff for dense info - // long lasttimestamp = 0, lastchangeset = 0; - // int lastuserSid = 0, lastuid = 0; - // DenseInfo di = null; - // if (nodes.hasDenseinfo()) { - // di = nodes.getDenseinfo(); - // } + // long lasttimestamp = 0, lastchangeset = 0; + // int lastuserSid = 0, lastuid = 0; + // DenseInfo di = null; + // if (nodes.hasDenseinfo()) { + // di = nodes.getDenseinfo(); + // } for (int i = 0; i < nodes.getIdCount(); i++) { OsmNode tmp; @@ -174,10 +174,10 @@ public class OsmPbfParser extends BinaryParser { for (int j = 0; j < tagCnt; j++) { tags.add(new Tag(getStringById(i.getKeys(j)), getStringById(i.getVals(j)))); } - // List tags = new ArrayList(); - // for (int j = 0; j < ; j++) { - // tags.add(new Tag(getStringById(i.getKeys(j)), getStringById(i.getVals(j)))); - // } + // List tags = new ArrayList(); + // for (int j = 0; j < ; j++) { + // tags.add(new Tag(getStringById(i.getKeys(j)), getStringById(i.getVals(j)))); + // } long lastId = 0; List nodes = new ArrayList(); @@ -196,13 +196,13 @@ public class OsmPbfParser extends BinaryParser { // long changesetId, Collection tags, // List wayNodes OsmWay tmp; - // if (i.hasInfo()) { - // Osmformat.Info info = i.getInfo(); - // tmp = new Way(new CommonEntityData(id, info.getVersion(), getDate(info), - // getUser(info), info.getChangeset(), tags), nodes); - // } else { + // if (i.hasInfo()) { + // Osmformat.Info info = i.getInfo(); + // tmp = new Way(new CommonEntityData(id, info.getVersion(), getDate(info), + // getUser(info), info.getChangeset(), tags), nodes); + // } else { tmp = new OsmWay(tags, id, nodes); - // } + // } mWayMap.put(Long.valueOf(id), tmp); @@ -225,25 +225,25 @@ public class OsmPbfParser extends BinaryParser { List nodes = new ArrayList(); int memberCnt = i.getMemidsCount(); - // for (int j = 0; j < memberCnt; j++) { - // long mid = lastMid + i.getMemids(j); - // lastMid = mid; - // String role = getStringById(i.getRolesSid(j)); + // for (int j = 0; j < memberCnt; j++) { + // long mid = lastMid + i.getMemids(j); + // lastMid = mid; + // String role = getStringById(i.getRolesSid(j)); // - // Osmformat.Relation.MemberType t = i.getTypes(j); + // Osmformat.Relation.MemberType t = i.getTypes(j); // - // if (t == Osmformat.Relation.MemberType.NODE) { - // etype = EntityType.Node; - // } else if (t == Osmformat.Relation.MemberType.WAY) { - // etype = EntityType.Way; - // } else if (t == Osmformat.Relation.MemberType.RELATION) { - // etype = EntityType.Relation; - // } else { - // assert false; // TODO; Illegal file? - // } + // if (t == Osmformat.Relation.MemberType.NODE) { + // etype = EntityType.Node; + // } else if (t == Osmformat.Relation.MemberType.WAY) { + // etype = EntityType.Way; + // } else if (t == Osmformat.Relation.MemberType.RELATION) { + // etype = EntityType.Relation; + // } else { + // assert false; // TODO; Illegal file? + // } // - // nodes.add(new OsmMember(mid, etype, role)); - // } + // nodes.add(new OsmMember(mid, etype, role)); + // } // long id, int version, TimestampContainer timestampContainer, // OsmUser user, @@ -251,15 +251,15 @@ public class OsmPbfParser extends BinaryParser { // List members OsmRelation tmp = new OsmRelation(tags, id, memberCnt); - // if (i.hasInfo()) { - // Osmformat.Info info = i.getInfo(); - // tmp = new Relation(new CommonEntityData(id, info.getVersion(), getDate(info), - // getUser(info), info.getChangeset(), tags), nodes); - // } else { - // tmp = new Relation(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE, - // NOCHANGESET, tags), nodes); - // } - // sink.process(new RelationContainer(tmp)); + // if (i.hasInfo()) { + // Osmformat.Info info = i.getInfo(); + // tmp = new Relation(new CommonEntityData(id, info.getVersion(), getDate(info), + // getUser(info), info.getChangeset(), tags), nodes); + // } else { + // tmp = new Relation(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE, + // NOCHANGESET, tags), nodes); + // } + // sink.process(new RelationContainer(tmp)); } } @@ -294,34 +294,34 @@ public class OsmPbfParser extends BinaryParser { public OsmData getData() { - // for (Entry> entry : relationMembersForRelation - // .entrySet()) { + // for (Entry> entry : relationMembersForRelation + // .entrySet()) { // - // OsmRelation relation = entry.getKey(); + // OsmRelation relation = entry.getKey(); // - // for (TmpRelation member : entry.getValue()) { + // for (TmpRelation member : entry.getValue()) { // - // OsmElement memberObject = null; + // OsmElement memberObject = null; // - // if ("node".equals(member)) { - // memberObject = nodesById.get(member.id); - // } else if ("way".equals(member)) { - // memberObject = waysById.get(member.id); - // } else if ("relation".equals(member)) { - // memberObject = relationsById.get(member.id); - // } else { - // // log("missing relation " + member.id); - // continue; - // } + // if ("node".equals(member)) { + // memberObject = nodesById.get(member.id); + // } else if ("way".equals(member)) { + // memberObject = waysById.get(member.id); + // } else if ("relation".equals(member)) { + // memberObject = relationsById.get(member.id); + // } else { + // // log("missing relation " + member.id); + // continue; + // } // - // if (memberObject != null) { - // OsmMember ownMember = new OsmMember(member.role, - // memberObject); + // if (memberObject != null) { + // OsmMember ownMember = new OsmMember(member.role, + // memberObject); // - // relation.relationMembers.add(ownMember); - // } - // } - // } + // relation.relationMembers.add(ownMember); + // } + // } + // } // give up references to original collections diff --git a/vtm-jeo/src/org/oscim/theme/carto/RenderTheme.java b/vtm-jeo/src/org/oscim/theme/carto/RenderTheme.java index 2e10043a..d1d0dd86 100644 --- a/vtm-jeo/src/org/oscim/theme/carto/RenderTheme.java +++ b/vtm-jeo/src/org/oscim/theme/carto/RenderTheme.java @@ -214,7 +214,7 @@ public class RenderTheme implements IRenderTheme { //RGB c = r.color(f, CartoCSS.MARKER_FILL, RGB.black); //out.println(c); //return new RenderInstruction[] { - // new Caption(color(c), width) + // new Caption(color(c), width) //}; } diff --git a/vtm-jts/src/org/oscim/layers/JtsPathLayer.java b/vtm-jts/src/org/oscim/layers/JtsPathLayer.java index 6c63c63d..4d92a3fb 100644 --- a/vtm-jts/src/org/oscim/layers/JtsPathLayer.java +++ b/vtm-jts/src/org/oscim/layers/JtsPathLayer.java @@ -116,10 +116,10 @@ public class JtsPathLayer extends VectorLayer { public void addGreatCircle(GeoPoint startPoint, GeoPoint endPoint) { synchronized (mPoints) { - /* get the great circle path length in meters */ + /* get the great circle path length in meters */ double length = startPoint.distanceTo(endPoint); - /* add one point for every 100kms of the great circle path */ + /* add one point for every 100kms of the great circle path */ int numberOfPoints = (int) (length / 100000); addGreatCircle(startPoint, endPoint, numberOfPoints); @@ -137,12 +137,12 @@ public class JtsPathLayer extends VectorLayer { final int numberOfPoints) { /* adapted from page * http://compastic.blogspot.co.uk/2011/07/how-to-draw-great-circle-on-map - * -in.html - * which was adapted from page http://maps.forum.nu/gm_flight_path.html */ + * -in.html + * which was adapted from page http://maps.forum.nu/gm_flight_path.html */ GeomBuilder gb = new GeomBuilder(); - /* convert to radians */ + /* convert to radians */ double lat1 = startPoint.getLatitude() * Math.PI / 180; double lon1 = startPoint.getLongitude() * Math.PI / 180; double lat2 = endPoint.getLatitude() * Math.PI / 180; diff --git a/vtm-jts/src/org/oscim/layers/vector/VectorLayer.java b/vtm-jts/src/org/oscim/layers/vector/VectorLayer.java index c8050fde..57963510 100644 --- a/vtm-jts/src/org/oscim/layers/vector/VectorLayer.java +++ b/vtm-jts/src/org/oscim/layers/vector/VectorLayer.java @@ -88,7 +88,7 @@ public class VectorLayer extends AbstractVectorLayer { Envelope e = geometry.getEnvelopeInternal(); Box bbox = new Box(e.getMinX(), e.getMinY(), e.getMaxX(), e.getMaxY()); //if ("Point".equals(geometry.getGeometryType())){ - // bbox. + // bbox. //} bbox.scale(1E6); @@ -158,15 +158,15 @@ public class VectorLayer extends AbstractVectorLayer { if (Double.isNaN(bbox.xmin)) return; - // mEnvelope = new GeomBuilder() - // .point(bbox.xmin, bbox.ymin) - // .point(bbox.xmin, bbox.ymax) - // .point(bbox.xmax, bbox.ymax) - // .point(bbox.xmax, bbox.ymin) - // .point(bbox.xmin, bbox.ymin) - // .toPolygon(); + // mEnvelope = new GeomBuilder() + // .point(bbox.xmin, bbox.ymin) + // .point(bbox.xmin, bbox.ymax) + // .point(bbox.xmax, bbox.ymax) + // .point(bbox.xmax, bbox.ymin) + // .point(bbox.xmin, bbox.ymin) + // .toPolygon(); - /* reduce lines points min distance */ + /* reduce lines points min distance */ mMinX = ((bbox.xmax - bbox.xmin) / mMap.getWidth()); mMinY = ((bbox.ymax - bbox.ymin) / mMap.getHeight()); @@ -177,7 +177,7 @@ public class VectorLayer extends AbstractVectorLayer { int level = 0; Style lastStyle = null; - /* go through features, find the matching style and draw */ + /* go through features, find the matching style and draw */ synchronized (this) { tmpDrawables.clear(); mDrawables.search(bbox, tmpDrawables); @@ -294,13 +294,13 @@ public class VectorLayer extends AbstractVectorLayer { double x = (longitudeToX(px) - pos.x) * scale; double y = (latitudeToY(py) - pos.y) * scale; - /* TODO in the next line I was only able to interpolate a function + /* TODO in the next line I was only able to interpolate a function * that makes up for the zoom level. The circle should not grow, it - * should stickto the map. 0.01 / (1 << startLvl) makes it retain - * its size. Correction? */ + * should stickto the map. 0.01 / (1 << startLvl) makes it retain + * its size. Correction? */ int zoomScale = (1 << style.scalingZoomLevel); - /* Keep the circle's size constant in relation to the underlying map */ + /* Keep the circle's size constant in relation to the underlying map */ double radius = style.buffer; if (pos.scale > zoomScale) diff --git a/vtm-jts/src/org/oscim/layers/vector/geometries/Style.java b/vtm-jts/src/org/oscim/layers/vector/geometries/Style.java index 3d89708a..3d4ee0ab 100644 --- a/vtm-jts/src/org/oscim/layers/vector/geometries/Style.java +++ b/vtm-jts/src/org/oscim/layers/vector/geometries/Style.java @@ -41,8 +41,8 @@ public class Style { *

*

      * {
-     * 	Style style = Style.builder()
-     * 	    .strokeWidth(1f).strokeColor(Color.BLACK).build();
+     *     Style style = Style.builder()
+     *         .strokeWidth(1f).strokeColor(Color.BLACK).build();
      * }
      * 
*/ diff --git a/vtm-playground/resources/assets/styles/mapzen.xml b/vtm-playground/resources/assets/styles/mapzen.xml index 18e39ec4..9c64ffe8 100644 --- a/vtm-playground/resources/assets/styles/mapzen.xml +++ b/vtm-playground/resources/assets/styles/mapzen.xml @@ -66,7 +66,7 @@ - + diff --git a/vtm-playground/src/org/oscim/test/HairLineTest.java b/vtm-playground/src/org/oscim/test/HairLineTest.java index 5507512c..e135ed7a 100644 --- a/vtm-playground/src/org/oscim/test/HairLineTest.java +++ b/vtm-playground/src/org/oscim/test/HairLineTest.java @@ -75,14 +75,14 @@ public class HairLineTest extends GdxMap { //g.translate(10, 10); //l1.addLine(g); - // int o = 0; - // for (int k = 0; k < g.index.length && g.index[k] >= 0; k++) { + // int o = 0; + // for (int k = 0; k < g.index.length && g.index[k] >= 0; k++) { // - // for (int j = 0; j < g.index[k];) - // ll.addPoint(g.points[o + j++], g.points[o + j++]); + // for (int j = 0; j < g.index[k];) + // ll.addPoint(g.points[o + j++], g.points[o + j++]); // - // o += g.index[k]; - // } + // o += g.index[k]; + // } } g = new GeometryBuffer(4, 2); g.clear(); diff --git a/vtm-playground/src/org/oscim/test/PathLayerTest.java b/vtm-playground/src/org/oscim/test/PathLayerTest.java index a45e67b7..a906e736 100644 --- a/vtm-playground/src/org/oscim/test/PathLayerTest.java +++ b/vtm-playground/src/org/oscim/test/PathLayerTest.java @@ -63,11 +63,11 @@ public class PathLayerTest extends GdxMapApp { for (double lon = -180; lon <= 180; lon += 2) { //pts.add(new GeoPoint(lat, lon)); - // double longitude = lon + (pos * 180); - // if (longitude < -180) - // longitude += 360; - // if (longitude > 180) - // longitude -= 360; + // double longitude = lon + (pos * 180); + // if (longitude < -180) + // longitude += 360; + // if (longitude > 180) + // longitude -= 360; double longitude = lon; double latitude = lat + (pos * 90); diff --git a/vtm-playground/src/org/oscim/test/TileRenderTest.java b/vtm-playground/src/org/oscim/test/TileRenderTest.java index a093bf07..4999cc11 100644 --- a/vtm-playground/src/org/oscim/test/TileRenderTest.java +++ b/vtm-playground/src/org/oscim/test/TileRenderTest.java @@ -27,9 +27,9 @@ import org.oscim.tiling.source.oscimap4.OSciMap4TileSource; public class TileRenderTest extends GdxMapApp { static boolean loadOneTile = true; - // static int tileX = 34365 >> 2; - // static int tileY = 21333 >> 2; - // static byte tileZ = 14; + // static int tileX = 34365 >> 2; + // static int tileY = 21333 >> 2; + // static byte tileZ = 14; static int tileX = 68747 >> 3; static int tileY = 42648 >> 3; @@ -62,7 +62,7 @@ public class TileRenderTest extends GdxMapApp { tile.node.parent = tile.node; tile.node.parent.parent = tile.node; - /* setup TileSet contatining one tile */ + /* setup TileSet contatining one tile */ final TileSet tiles = new TileSet(); tiles.cnt = 1; tiles.tiles[0] = tile; @@ -74,7 +74,7 @@ public class TileRenderTest extends GdxMapApp { tileManager = new TileManager(mMap, 100); } - /* get the loader created by VectorTileLayer ... */ + /* get the loader created by VectorTileLayer ... */ final TestTileLoader[] tileLoader = {null}; TestVectorTileLayer tileLayer = new TestVectorTileLayer(mMap, tileManager); @@ -89,7 +89,7 @@ public class TileRenderTest extends GdxMapApp { //tileLayer.setRenderTheme(theme); //tileLayer.setRenderTheme(new DebugTheme()); - /* need to create the labellayer here to get the tileloaded event */ + /* need to create the labellayer here to get the tileloaded event */ LabelLayer labelLayer = new LabelLayer(mMap, tileLayer); //mMap.layers().add(tileLayer); @@ -169,7 +169,7 @@ public class TileRenderTest extends GdxMapApp { @Override public void onMapEvent(Event event, MapPosition mapPosition) { - /* ignore map events */ + /* ignore map events */ if (event != Map.CLEAR_EVENT) return; diff --git a/vtm-playground/src/org/oscim/test/VectorLayerTest.java b/vtm-playground/src/org/oscim/test/VectorLayerTest.java index 8c8628cf..1e8ee251 100644 --- a/vtm-playground/src/org/oscim/test/VectorLayerTest.java +++ b/vtm-playground/src/org/oscim/test/VectorLayerTest.java @@ -35,19 +35,19 @@ public class VectorLayerTest extends GdxMapApp { VectorLayer vectorLayer = new VectorLayer(mMap); - // vectorLayer.add(new PointDrawable(0, 180, Style.builder() - // .setBuffer(10) - // .setFillColor(Color.RED) - // .setFillAlpha(0.5) - // .build())); + // vectorLayer.add(new PointDrawable(0, 180, Style.builder() + // .setBuffer(10) + // .setFillColor(Color.RED) + // .setFillAlpha(0.5) + // .build())); // - // Geometry g = new GeomBuilder() - // .point(180, 0) - // .point() - // .buffer(6) - // .get(); + // Geometry g = new GeomBuilder() + // .point(180, 0) + // .point() + // .buffer(6) + // .get(); // - // vectorLayer.add(new PolygonDrawable(g, defaultStyle())); + // vectorLayer.add(new PolygonDrawable(g, defaultStyle())); // Style.Builder sb = Style.builder() @@ -55,18 +55,18 @@ public class VectorLayerTest extends GdxMapApp { .fillColor(Color.RED) .fillAlpha(0.2); - // int tileSize = 5; - // for (int x = -180; x < 200; x += tileSize) { - // for (int y = -90; y < 90; y += tileSize) { - // // Style style = sb.setFillAlpha(FastMath.clamp(FastMath.length(x, y) / 180, 0.2, 1)) - // // .build(); + // int tileSize = 5; + // for (int x = -180; x < 200; x += tileSize) { + // for (int y = -90; y < 90; y += tileSize) { + // // Style style = sb.setFillAlpha(FastMath.clamp(FastMath.length(x, y) / 180, 0.2, 1)) + // // .build(); // - // vectorLayer.add(new RectangleDrawable(FastMath.clamp(y, -85, 85), x, - // FastMath.clamp(y + tileSize - 0.1, -85, 85), - // x + tileSize - 0.1, style)); + // vectorLayer.add(new RectangleDrawable(FastMath.clamp(y, -85, 85), x, + // FastMath.clamp(y + tileSize - 0.1, -85, 85), + // x + tileSize - 0.1, style)); // - // } - // } + // } + // } for (int i = 0; i < 1000; i++) { Style style = sb.buffer(Math.random() * 1) diff --git a/vtm-playground/src/org/oscim/test/gdx/poi3d/GdxModelLayer.java b/vtm-playground/src/org/oscim/test/gdx/poi3d/GdxModelLayer.java index cccbbd60..ba332093 100644 --- a/vtm-playground/src/org/oscim/test/gdx/poi3d/GdxModelLayer.java +++ b/vtm-playground/src/org/oscim/test/gdx/poi3d/GdxModelLayer.java @@ -21,24 +21,24 @@ public class GdxModelLayer extends Layer implements Map.UpdateListener { public GdxModelLayer(Map map) { super(map); - // tileLayer.addHook(new TileLoaderProcessHook() { + // tileLayer.addHook(new TileLoaderProcessHook() { // - // @Override - // public boolean process(MapTile tile, ElementLayers layers, MapElement element) { + // @Override + // public boolean process(MapTile tile, ElementLayers layers, MapElement element) { // - // if (!element.tags.contains(TREE_TAG)) - // return false; + // if (!element.tags.contains(TREE_TAG)) + // return false; // - // Poi3DTileData td = get(tile); - // PointF p = element.getPoint(0); - // SymbolItem s = SymbolItem.pool.get(); - // s.x = p.x; - // s.y = p.y; - // td.symbols.push(s); + // Poi3DTileData td = get(tile); + // PointF p = element.getPoint(0); + // SymbolItem s = SymbolItem.pool.get(); + // s.x = p.x; + // s.y = p.y; + // td.symbols.push(s); // - // return true; - // } - // }); + // return true; + // } + // }); //mTileLayer = tileLayer; mRenderer = g3d = new GdxRenderer3D(mMap); @@ -57,11 +57,11 @@ public class GdxModelLayer extends Layer implements Map.UpdateListener { loading = true; } - // TileSet mTileSet = new TileSet(); - // TileSet mPrevTiles = new TileSet(); + // TileSet mTileSet = new TileSet(); + // TileSet mPrevTiles = new TileSet(); // - // LinkedHashMap> mTileMap = - // new LinkedHashMap>(); + // LinkedHashMap> mTileMap = + // new LinkedHashMap>(); boolean loading; Model mModel; @@ -92,14 +92,14 @@ public class GdxModelLayer extends Layer implements Map.UpdateListener { @Override public void onMapEvent(Event ev, MapPosition pos) { - // if (ev == Map.CLEAR_EVENT) { - // mTileSet = new TileSet(); - // mPrevTiles = new TileSet(); - // mTileMap = new LinkedHashMap>(); - // synchronized (g3d) { - // g3d.instances.clear(); - // } - // } + // if (ev == Map.CLEAR_EVENT) { + // mTileSet = new TileSet(); + // mPrevTiles = new TileSet(); + // mTileMap = new LinkedHashMap>(); + // synchronized (g3d) { + // g3d.instances.clear(); + // } + // } // if (loading && assets.update()) { doneLoading(); @@ -122,116 +122,116 @@ public class GdxModelLayer extends Layer implements Map.UpdateListener { g3d.cam.setMapPosition(x * scale - pos.x, y * scale - pos.y, scale / pos.scale); // - // // log.debug("update"); + // // log.debug("update"); // - // mTileLayer.tileRenderer().getVisibleTiles(mTileSet); + // mTileLayer.tileRenderer().getVisibleTiles(mTileSet); // - // if (mTileSet.cnt == 0) { - // mTileSet.releaseTiles(); - // return; - // } + // if (mTileSet.cnt == 0) { + // mTileSet.releaseTiles(); + // return; + // } // - // boolean changed = false; + // boolean changed = false; // - // Array added = new Array(); - // Array removed = new Array(); + // Array added = new Array(); + // Array removed = new Array(); - // for (int i = 0; i < mTileSet.cnt; i++) { - // MapTile t = mTileSet.tiles[i]; - // if (mPrevTiles.contains(t)) - // continue; + // for (int i = 0; i < mTileSet.cnt; i++) { + // MapTile t = mTileSet.tiles[i]; + // if (mPrevTiles.contains(t)) + // continue; // - // Array instances = new Array(); + // Array instances = new Array(); // - // Poi3DTileData ld = (Poi3DTileData) t.getData(POI_DATA); - // if (ld == null) - // continue; + // Poi3DTileData ld = (Poi3DTileData) t.getData(POI_DATA); + // if (ld == null) + // continue; // - // for (SymbolItem it : ld.symbols) { + // for (SymbolItem it : ld.symbols) { // - // SharedModel inst = new SharedModel(mModel); - // inst.userData = it; - // // float r = 0.5f + 0.5f * (float) Math.random(); - // // float g = 0.5f + 0.5f * (float) Math.random(); - // // float b = 0.5f + 0.5f * (float) Math.random(); + // SharedModel inst = new SharedModel(mModel); + // inst.userData = it; + // // float r = 0.5f + 0.5f * (float) Math.random(); + // // float g = 0.5f + 0.5f * (float) Math.random(); + // // float b = 0.5f + 0.5f * (float) Math.random(); // - // // inst.transform.setTranslation(new Vector3(it.x, it.y, - // // 10)); - // // inst.materials.get(0).set(ColorAttribute.createDiffuse(r, - // // g, b, 0.8f)); - // instances.add(inst); - // added.add(inst); - // } + // // inst.transform.setTranslation(new Vector3(it.x, it.y, + // // 10)); + // // inst.materials.get(0).set(ColorAttribute.createDiffuse(r, + // // g, b, 0.8f)); + // instances.add(inst); + // added.add(inst); + // } // - // if (instances.size == 0) - // continue; + // if (instances.size == 0) + // continue; // - // log.debug("add " + t + " " + instances.size); + // log.debug("add " + t + " " + instances.size); // - // changed = true; + // changed = true; // - // mTileMap.put(t, instances); - // } + // mTileMap.put(t, instances); + // } // - // for (int i = 0; i < mPrevTiles.cnt; i++) { - // MapTile t = mPrevTiles.tiles[i]; - // if (mTileSet.contains(t)) - // continue; + // for (int i = 0; i < mPrevTiles.cnt; i++) { + // MapTile t = mPrevTiles.tiles[i]; + // if (mTileSet.contains(t)) + // continue; // - // Array instances = mTileMap.get(t); - // if (instances == null) - // continue; + // Array instances = mTileMap.get(t); + // if (instances == null) + // continue; // - // changed = true; + // changed = true; // - // removed.addAll(instances); - // mTileMap.remove(t); - // log.debug("remove " + t); - // } + // removed.addAll(instances); + // mTileMap.remove(t); + // log.debug("remove " + t); + // } // - // mPrevTiles.releaseTiles(); + // mPrevTiles.releaseTiles(); // - // int zoom = mTileSet.tiles[0].zoomLevel; + // int zoom = mTileSet.tiles[0].zoomLevel; // - // TileSet tmp = mPrevTiles; - // mPrevTiles = mTileSet; - // mTileSet = tmp; + // TileSet tmp = mPrevTiles; + // mPrevTiles = mTileSet; + // mTileSet = tmp; // - // if (!changed) - // return; + // if (!changed) + // return; // - // // scale aka tree height - // float scale = (float) (1f / (1 << (17 - zoom))) * 8; + // // scale aka tree height + // float scale = (float) (1f / (1 << (17 - zoom))) * 8; // - // double tileX = (pos.x * (Tile.SIZE << zoom)); - // double tileY = (pos.y * (Tile.SIZE << zoom)); + // double tileX = (pos.x * (Tile.SIZE << zoom)); + // double tileY = (pos.y * (Tile.SIZE << zoom)); // - // synchronized (g3d) { + // synchronized (g3d) { // - // for (Entry> e : mTileMap.entrySet()) { - // Tile t = e.getKey(); + // for (Entry> e : mTileMap.entrySet()) { + // Tile t = e.getKey(); // - // float dx = (float) (t.tileX * Tile.SIZE - tileX); - // float dy = (float) (t.tileY * Tile.SIZE - tileY); + // float dx = (float) (t.tileX * Tile.SIZE - tileX); + // float dy = (float) (t.tileY * Tile.SIZE - tileY); // - // for (SharedModel inst : e.getValue()) { - // SymbolItem it = (SymbolItem) inst.userData; + // for (SharedModel inst : e.getValue()) { + // SymbolItem it = (SymbolItem) inst.userData; // - // // variable height - // float s = scale + (it.x * it.y) % 3; - // float r = (it.x * it.y) % 360; + // // variable height + // float s = scale + (it.x * it.y) % 3; + // float r = (it.x * it.y) % 360; // - // inst.transform.idt(); - // inst.transform.scale(s, s, s); - // inst.transform.translate((dx + it.x) / s, (dy + it.y) / s, 0); - // inst.transform.rotate(0, 0, 1, r); + // inst.transform.idt(); + // inst.transform.scale(s, s, s); + // inst.transform.translate((dx + it.x) / s, (dy + it.y) / s, 0); + // inst.transform.rotate(0, 0, 1, r); // - // // inst.transform.setToTranslationAndScaling((dx + - // // it.x), (dy + it.y), - // // 0, s, s, s); + // // inst.transform.setToTranslationAndScaling((dx + + // // it.x), (dy + it.y), + // // 0, s, s, s); // - // } - // } + // } + // } } } diff --git a/vtm-playground/src/org/oscim/test/gdx/poi3d/GdxModelRenderer.java b/vtm-playground/src/org/oscim/test/gdx/poi3d/GdxModelRenderer.java index da5edf5a..b0116684 100644 --- a/vtm-playground/src/org/oscim/test/gdx/poi3d/GdxModelRenderer.java +++ b/vtm-playground/src/org/oscim/test/gdx/poi3d/GdxModelRenderer.java @@ -138,27 +138,27 @@ public class GdxModelRenderer extends LayerRenderer { //renderContext.begin(); - // if (shader == null) { - // r = instances.get(0).getRenderable(r); - // DefaultShader.Config c = new DefaultShader.Config(); - // c.numBones = 0; - // c.numDirectionalLights = 1; - // r.environment = lights; + // if (shader == null) { + // r = instances.get(0).getRenderable(r); + // DefaultShader.Config c = new DefaultShader.Config(); + // c.numBones = 0; + // c.numDirectionalLights = 1; + // r.environment = lights; // - // shader = new DefaultShader(r, c); - // shader.init(); - // } + // shader = new DefaultShader(r, c); + // shader.init(); + // } mBatch.begin(cam); //shader.begin(cam, renderContext); for (SharedModel instance : instances) { instance.transform.getTranslation(tempVector); //instance.getRenderables(renderables, pool); - // if (tempVector.x * tempVector.x + tempVector.y * tempVector.y > sqRadius) - // continue; - // tempVector.scl(0.8f, 0.8f, 1); - // if (!GeometryUtils.pointInPoly(tempVector.x, tempVector.y, mBox, 8, 0)) - // continue; + // if (tempVector.x * tempVector.x + tempVector.y * tempVector.y > sqRadius) + // continue; + // tempVector.scl(0.8f, 0.8f, 1); + // if (!GeometryUtils.pointInPoly(tempVector.x, tempVector.y, mBox, 8, 0)) + // continue; mBatch.render(instance); diff --git a/vtm-playground/src/org/oscim/test/gdx/poi3d/SharedModel.java b/vtm-playground/src/org/oscim/test/gdx/poi3d/SharedModel.java index 74752646..946ea1c6 100644 --- a/vtm-playground/src/org/oscim/test/gdx/poi3d/SharedModel.java +++ b/vtm-playground/src/org/oscim/test/gdx/poi3d/SharedModel.java @@ -317,12 +317,12 @@ public class SharedModel implements RenderableProvider { if (nodePart.invBoneBindTransforms != null) nodePartBones.put(copy, nodePart.invBoneBindTransforms); -// final int index = materials.indexOf(nodePart.material, false); -// if (index < 0) -// materials.add(copy.material = nodePart.material.copy()); -// else -// copy.material = materials.get(index); -// +// final int index = materials.indexOf(nodePart.material, false); +// if (index < 0) +// materials.add(copy.material = nodePart.material.copy()); +// else +// copy.material = materials.get(index); +// copy.material = nodePart.material; return copy; @@ -502,29 +502,29 @@ public class SharedModel implements RenderableProvider { return null; } -// /** @param id The ID of the material to fetch. -// * @return The {@link Material} with the specified id, or null if not available. */ -// public Material getMaterial(final String id) { -// return getMaterial(id, true); -// } -// -// /** @param id The ID of the material to fetch. -// * @param ignoreCase whether to use case sensitivity when comparing the material id. -// * @return The {@link Material} with the specified id, or null if not available. */ -// public Material getMaterial(final String id, boolean ignoreCase) { -// final int n = materials.size; -// Material material; -// if (ignoreCase) { -// for (int i = 0; i < n; i++) -// if ((material = materials.get(i)).id.equalsIgnoreCase(id)) -// return material; -// } else { -// for (int i = 0; i < n; i++) -// if ((material = materials.get(i)).id.equals(id)) -// return material; -// } -// return null; -// } +// /** @param id The ID of the material to fetch. +// * @return The {@link Material} with the specified id, or null if not available. */ +// public Material getMaterial(final String id) { +// return getMaterial(id, true); +// } +// +// /** @param id The ID of the material to fetch. +// * @param ignoreCase whether to use case sensitivity when comparing the material id. +// * @return The {@link Material} with the specified id, or null if not available. */ +// public Material getMaterial(final String id, boolean ignoreCase) { +// final int n = materials.size; +// Material material; +// if (ignoreCase) { +// for (int i = 0; i < n; i++) +// if ((material = materials.get(i)).id.equalsIgnoreCase(id)) +// return material; +// } else { +// for (int i = 0; i < n; i++) +// if ((material = materials.get(i)).id.equals(id)) +// return material; +// } +// return null; +// } /** * @param id The ID of the node to fetch. diff --git a/vtm-playground/src/org/oscim/test/renderer/CustomRenderer.java b/vtm-playground/src/org/oscim/test/renderer/CustomRenderer.java index a1b2f18b..c301342f 100644 --- a/vtm-playground/src/org/oscim/test/renderer/CustomRenderer.java +++ b/vtm-playground/src/org/oscim/test/renderer/CustomRenderer.java @@ -107,7 +107,7 @@ public class CustomRenderer extends LayerRenderer { GLState.enableVertexArrays(hVertexPosition, -1); - /* apply view and projection matrices */ + /* apply view and projection matrices */ // set mvp (tmp) matrix relative to mMapPosition // i.e. fixed on the map diff --git a/vtm-playground/src/org/oscim/test/renderer/HexagonRenderTest.java b/vtm-playground/src/org/oscim/test/renderer/HexagonRenderTest.java index a9c99d6f..82b30d7f 100644 --- a/vtm-playground/src/org/oscim/test/renderer/HexagonRenderTest.java +++ b/vtm-playground/src/org/oscim/test/renderer/HexagonRenderTest.java @@ -31,11 +31,11 @@ public class HexagonRenderTest extends GdxMap { GdxMapApp.run(new HexagonRenderTest(), null, 400); } - /* This is an example how to integrate custom OpenGL drawing routines as map + /* This is an example how to integrate custom OpenGL drawing routines as map * overlay - * - * based on chapter 2 from: - * https://github.com/dalinaum/opengl-es-book-samples/tree/master/Android */ + * + * based on chapter 2 from: + * https://github.com/dalinaum/opengl-es-book-samples/tree/master/Android */ static class HexagonRenderer extends BucketRenderer { @@ -65,8 +65,8 @@ public class HexagonRenderTest extends GdxMap { } //if (mZoom != v.pos.zoomLevel) { - // mMapPosition.copy(v.pos); - // mZoom = v.pos.zoomLevel; + // mMapPosition.copy(v.pos); + // mZoom = v.pos.zoomLevel; //} } @@ -105,7 +105,7 @@ public class HexagonRenderTest extends GdxMap { GLState.enableVertexArrays(hVertexPosition, -1); - /* apply view and projection matrices */ + /* apply view and projection matrices */ // set mvp (tmp) matrix relative to mMapPosition // i.e. fixed on the map setMatrix(v); @@ -123,7 +123,7 @@ public class HexagonRenderTest extends GdxMap { gl.uniform2f(hCenterPosition, xx * (mCellScale * 1.5f), yy * mCellScale); //float alpha = 1 + (float) Math.log10(FastMath.clamp( - // (float) Math.sqrt(xx * xx + yy * yy) / offset_y, 0.0f, 1.0f)) * 2; + // (float) Math.sqrt(xx * xx + yy * yy) / offset_y, 0.0f, 1.0f)) * 2; float alpha = (float) Math.sqrt(xx * xx + yy * yy) / offset_y; diff --git a/vtm-tests/test/org/oscim/tiling/source/OkHttpEngineTest.java b/vtm-tests/test/org/oscim/tiling/source/OkHttpEngineTest.java index 90a66a07..fe352550 100644 --- a/vtm-tests/test/org/oscim/tiling/source/OkHttpEngineTest.java +++ b/vtm-tests/test/org/oscim/tiling/source/OkHttpEngineTest.java @@ -67,23 +67,23 @@ public class OkHttpEngineTest { assertThat(response).isEqualTo("TEST RESPONSE"); } - // @Test(expected = IOException.class) - // public void close_shouldCloseInputStream() throws Exception { - // engine.sendRequest(new Tile(1, 2, new Integer(3).byteValue())); - // engine.close(); - // // Calling read after the stream is closed should throw an exception. - // InputStream responseStream = engine.read(); - // responseStream.read(); - // } + // @Test(expected = IOException.class) + // public void close_shouldCloseInputStream() throws Exception { + // engine.sendRequest(new Tile(1, 2, new Integer(3).byteValue())); + // engine.close(); + // // Calling read after the stream is closed should throw an exception. + // InputStream responseStream = engine.read(); + // responseStream.read(); + // } // - // @Test(expected = IOException.class) - // public void requestCompleted_shouldCloseInputStream() throws Exception { - // engine.sendRequest(new Tile(1, 2, new Integer(3).byteValue())); - // engine.requestCompleted(true); - // // Calling read after the stream is closed should throw an exception. - // InputStream responseStream = engine.read(); - // responseStream.read(); - // } + // @Test(expected = IOException.class) + // public void requestCompleted_shouldCloseInputStream() throws Exception { + // engine.sendRequest(new Tile(1, 2, new Integer(3).byteValue())); + // engine.requestCompleted(true); + // // Calling read after the stream is closed should throw an exception. + // InputStream responseStream = engine.read(); + // responseStream.read(); + // } @Test public void requestCompleted_shouldReturnValueGiven() throws Exception { diff --git a/vtm-tests/test/org/oscim/utils/KeyMapTest.java b/vtm-tests/test/org/oscim/utils/KeyMapTest.java index efbaa365..10d4c5e2 100644 --- a/vtm-tests/test/org/oscim/utils/KeyMapTest.java +++ b/vtm-tests/test/org/oscim/utils/KeyMapTest.java @@ -51,7 +51,7 @@ public class KeyMapTest { Assert.assertTrue(it == it2); } - /* replace the items with itself */ + /* replace the items with itself */ for (Item it : items) { Item it2 = map2.put(it); Assert.assertTrue(it == it2); diff --git a/vtm-tests/test/org/oscim/utils/RTreeTest.java b/vtm-tests/test/org/oscim/utils/RTreeTest.java index 334f2b9d..06a518e4 100644 --- a/vtm-tests/test/org/oscim/utils/RTreeTest.java +++ b/vtm-tests/test/org/oscim/utils/RTreeTest.java @@ -41,9 +41,9 @@ public class RTreeTest { @Override public String toString() { - // return val + "/" - // + Arrays.toString(min) + "/" - // + Arrays.toString(max); + // return val + "/" + // + Arrays.toString(min) + "/" + // + Arrays.toString(max); return String.valueOf(val); } } @@ -82,8 +82,8 @@ public class RTreeTest { min[0] = 0; min[1] = 0; - // max[0] = 4; - // max[1] = 4; + // max[0] = 4; + // max[1] = 4; final ArrayList results = new ArrayList(); @@ -146,14 +146,14 @@ public class RTreeTest { assertEquals(results.size(), numItems); - // for (int i = 999; i >= 0; i--) { - // Item it = results.remove(i); - // boolean removed = t.remove(it.min, it.max, it); - // //out.println("REMOVED: " + it + " " + removed); + // for (int i = 999; i >= 0; i--) { + // Item it = results.remove(i); + // boolean removed = t.remove(it.min, it.max, it); + // //out.println("REMOVED: " + it + " " + removed); // - // Assert.assertEquals(i, t.count()); - // } - // Assert.assertEquals(0, t.count()); + // Assert.assertEquals(i, t.count()); + // } + // Assert.assertEquals(0, t.count()); } @Test @@ -189,14 +189,14 @@ public class RTreeTest { assertEquals(numItems, results.size()); - // for (int i = 999; i >= 0; i--) { - // Item it = results.remove(i); - // boolean removed = t.remove(it.min, it.max, it); - // //out.println("REMOVED: " + it + " " + removed); + // for (int i = 999; i >= 0; i--) { + // Item it = results.remove(i); + // boolean removed = t.remove(it.min, it.max, it); + // //out.println("REMOVED: " + it + " " + removed); // - // Assert.assertEquals(i, t.count()); - // } - // Assert.assertEquals(0, t.count()); + // Assert.assertEquals(i, t.count()); + // } + // Assert.assertEquals(0, t.count()); } @Test @@ -220,22 +220,22 @@ public class RTreeTest { Assert.assertEquals(10000, t.size()); - /*SearchCb cb = new SearchCb() { + /*SearchCb cb = new SearchCb() { @Override - public boolean call(Item item, Object context) { - //out.println("found: " + item); - //results.add(item); - return true; - } - }; + public boolean call(Item item, Object context) { + //out.println("found: " + item); + //results.add(item); + return true; + } + }; - int counter = 0; + int counter = 0; - for (int i = 0; i < 10000; i++) { - counter += t.search(min, max, cb, null); - } + for (int i = 0; i < 10000; i++) { + counter += t.search(min, max, cb, null); + } - System.out.println("found: " + counter);*/ + System.out.println("found: " + counter);*/ } @Test diff --git a/vtm-tests/test/org/oscim/utils/pool/InlistTest.java b/vtm-tests/test/org/oscim/utils/pool/InlistTest.java index 603017aa..5c16ab03 100644 --- a/vtm-tests/test/org/oscim/utils/pool/InlistTest.java +++ b/vtm-tests/test/org/oscim/utils/pool/InlistTest.java @@ -23,14 +23,14 @@ public class InlistTest { list.push(new Thing(4)); list.push(new Thing(5)); - /* iterate items */ + /* iterate items */ int i = 5; for (Thing it : list) assertEquals(it.value, i--); assertEquals(i, 0); - /* iterate with insertion order */ + /* iterate with insertion order */ list.reverse(); i = 1; for (Thing it : list) @@ -42,7 +42,7 @@ public class InlistTest { List list2 = new List(); - /* pop list and append to list2 */ + /* pop list and append to list2 */ for (int j = 5; j > 0; j--) { Thing t = list.pop(); assertEquals(t.value, j); @@ -51,7 +51,7 @@ public class InlistTest { list2.append(t); } - /* check nothing to iterate */ + /* check nothing to iterate */ for (Thing t : list) assert (t == null && t != null); @@ -60,7 +60,7 @@ public class InlistTest { list.push(new Thing(6)); - /* move items from list2 to list */ + /* move items from list2 to list */ list.appendList(list2.clear()); assertNull(list2.head()); diff --git a/vtm-web-app/src/org/oscim/web/client/GwtLauncher.java b/vtm-web-app/src/org/oscim/web/client/GwtLauncher.java index 903b0dde..3940dd88 100644 --- a/vtm-web-app/src/org/oscim/web/client/GwtLauncher.java +++ b/vtm-web-app/src/org/oscim/web/client/GwtLauncher.java @@ -65,10 +65,10 @@ public class GwtLauncher extends GwtApplication { private static native int getWindowWidth() /*-{ return $wnd.innerWidth; - }-*/; + }-*/; private static native int getWindowHeight() /*-{ return $wnd.innerHeight; - }-*/; + }-*/; } diff --git a/vtm-web-app/src/org/oscim/web/client/SearchBox.java b/vtm-web-app/src/org/oscim/web/client/SearchBox.java index 7b348e7a..eb80e520 100644 --- a/vtm-web-app/src/org/oscim/web/client/SearchBox.java +++ b/vtm-web-app/src/org/oscim/web/client/SearchBox.java @@ -103,31 +103,31 @@ public class SearchBox { public final native String getId() /*-{ return this.osm_id; - }-*/; + }-*/; public final native String name() /*-{ - return this.display_name; - }-*/; + return this.display_name; + }-*/; public final native BBox getBBox() /*-{ - return this.boundingbox - }-*/; + return this.boundingbox + }-*/; public final native String getWkt() /*-{ - return this.geotext; - }-*/; + return this.geotext; + }-*/; private final native String latitude() /*-{ - return this.lat; - }-*/; + return this.lat; + }-*/; private final native String longitude() /*-{ - return this.lon; - }-*/; + return this.lon; + }-*/; public final native String getIcon() /*-{ - return this.icon; - }-*/; + return this.icon; + }-*/; @Override public double getLatitude() { @@ -248,7 +248,7 @@ public class SearchBox { mOverlay.clearPath(); //log.debug("selected " + d.getName() + " " + d.getLatitude() + " " - // + d.getLongitude()); + // + d.getLongitude()); BoundingBox b = d.getBoundingBox(); if (b != null) { diff --git a/vtm-web-app/src/org/oscim/web/client/WKTReader.java b/vtm-web-app/src/org/oscim/web/client/WKTReader.java index 11189852..7e187477 100644 --- a/vtm-web-app/src/org/oscim/web/client/WKTReader.java +++ b/vtm-web-app/src/org/oscim/web/client/WKTReader.java @@ -220,21 +220,21 @@ public class WKTReader { return neg ? -val : val; } - // public static void main(String[] args) { - // WKTReader r = new WKTReader(); - // GeometryBuffer geom = new GeometryBuffer(10, 10); - // try { - // String wkt = "MULTIPOINT(0 0,1 0)"; - // r.parse(wkt, geom); - // for (int i = 0; i < geom.index.length; i++) { - // int len = geom.index[i]; - // if (len < 0) - // break; - // for (int p = 0; p < len; p += 2) - // System.out.println(len + ": " + geom.points[p] + "," + geom.points[p + 1]); - // } - // } catch (Exception e) { - // e.printStackTrace(); - // } - // } + // public static void main(String[] args) { + // WKTReader r = new WKTReader(); + // GeometryBuffer geom = new GeometryBuffer(10, 10); + // try { + // String wkt = "MULTIPOINT(0 0,1 0)"; + // r.parse(wkt, geom); + // for (int i = 0; i < geom.index.length; i++) { + // int len = geom.index[i]; + // if (len < 0) + // break; + // for (int p = 0; p < len; p += 2) + // System.out.println(len + ": " + geom.points[p] + "," + geom.points[p + 1]); + // } + // } catch (Exception e) { + // e.printStackTrace(); + // } + // } } diff --git a/vtm-web-app/war/default.css b/vtm-web-app/war/default.css index 9f4c1b60..8a06d633 100644 --- a/vtm-web-app/war/default.css +++ b/vtm-web-app/war/default.css @@ -1,106 +1,106 @@ .header { - background-color: #ddd; - text-align: center; + background-color: #ddd; + text-align: center; } html,body { - height: 100%; - width: 100%; - margin: 0 0 0 0; - font-family: Arial, "MS Trebuchet", sans-serif; + height: 100%; + width: 100%; + margin: 0 0 0 0; + font-family: Arial, "MS Trebuchet", sans-serif; } #credits { - position: absolute; - bottom: 0.2em; - right: 0.2em; - z-index: 20000; - color: white; - background-color: #000; - opacity: 0.5; - padding: 0.2em 0.5em 0.2em 0.5em; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - font-size: 11px; + position: absolute; + bottom: 0.2em; + right: 0.2em; + z-index: 20000; + color: white; + background-color: #000; + opacity: 0.5; + padding: 0.2em 0.5em 0.2em 0.5em; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + font-size: 11px; } #credits a { - color: white; - text-decoration: none; - font-variant: small-caps; + color: white; + text-decoration: none; + font-variant: small-caps; } #search { - z-index: 20000; - position: absolute; - top: 0.5em; - left: 0.5em; - background-color: rgba(0, 0, 0, 0.8); - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - visibility: hidden; + z-index: 20000; + position: absolute; + top: 0.5em; + left: 0.5em; + background-color: rgba(0, 0, 0, 0.8); + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + visibility: hidden; } #listContainer { - color: #FFFFFF; + color: #FFFFFF; } #nameFieldContainer,.gwt-TextBox { - width: 250px; + width: 250px; } /* Turn on a 16x16 scrollbar */ ::-webkit-scrollbar { - width: 10px; - height: 0px; + width: 10px; + height: 0px; } /* Turn on single button up on top, and down on bottom */ ::-webkit-scrollbar-button:start:decrement,::-webkit-scrollbar-button:end:increment - { - display: block; + { + display: block; } /* Turn off the down area up on top, and up area on bottom */ ::-webkit-scrollbar-button:vertical:start:increment,::-webkit-scrollbar-button:vertical:end:decrement - { - display: none; + { + display: none; } /* Place The scroll down button at the bottom */ ::-webkit-scrollbar-button:end:increment { - /*background-image: url(images/scroll_cntrl_dwn.png);*/ - + /*background-image: url(images/scroll_cntrl_dwn.png);*/ + } /* Place The scroll up button at the up */ ::-webkit-scrollbar-button:start:decrement { - /*background-image: url(images/scroll_cntrl_up.png);*/ - + /*background-image: url(images/scroll_cntrl_up.png);*/ + } /* Top area above thumb and below up button */ ::-webkit-scrollbar-track-piece:vertical:start { - /*background-image: url(images/scroll_gutter_top.png), url(images/scroll_gutter_mid.png); - background-repeat: no-repeat, repeat-y;*/ - + /*background-image: url(images/scroll_gutter_top.png), url(images/scroll_gutter_mid.png); + background-repeat: no-repeat, repeat-y;*/ + } /* Bottom area below thumb and down button */ ::-webkit-scrollbar-track-piece:vertical:end { - /*background-image: url(images/scroll_gutter_btm.png), url(images/scroll_gutter_mid.png); - background-repeat: no-repeat, repeat-y; - background-position: bottom left, 0 0;*/ - + /*background-image: url(images/scroll_gutter_btm.png), url(images/scroll_gutter_mid.png); + background-repeat: no-repeat, repeat-y; + background-position: bottom left, 0 0;*/ + } /* The thumb itself */ ::-webkit-scrollbar-thumb:vertical { - height: 56px; - width: 12px; - /* -webkit-border-image: url(images/scroll_thumb.png) 8 0 8 0 stretch stretch;*/ - background-color: #DDDDDD; - opacity: 0.5; -} \ No newline at end of file + height: 56px; + width: 12px; + /* -webkit-border-image: url(images/scroll_thumb.png) 8 0 8 0 stretch stretch;*/ + background-color: #DDDDDD; + opacity: 0.5; +} diff --git a/vtm-web-app/war/index.html b/vtm-web-app/war/index.html index 02b10b24..0bdfe90e 100644 --- a/vtm-web-app/war/index.html +++ b/vtm-web-app/war/index.html @@ -16,15 +16,15 @@ @@ -43,19 +43,19 @@ diff --git a/vtm-web-js/src/org/oscim/web/client/GwtLauncher.java b/vtm-web-js/src/org/oscim/web/client/GwtLauncher.java index 3a383213..f7b32548 100644 --- a/vtm-web-js/src/org/oscim/web/client/GwtLauncher.java +++ b/vtm-web-js/src/org/oscim/web/client/GwtLauncher.java @@ -75,10 +75,10 @@ public class GwtLauncher extends GwtApplication { private static native int getWindowWidth() /*-{ return $wnd.innerWidth; - }-*/; + }-*/; private static native int getWindowHeight() /*-{ return $wnd.innerHeight; - }-*/; + }-*/; } diff --git a/vtm-web-js/src/org/oscim/web/client/GwtMap.java b/vtm-web-js/src/org/oscim/web/client/GwtMap.java index 3b2a3c13..c4939f60 100644 --- a/vtm-web-js/src/org/oscim/web/client/GwtMap.java +++ b/vtm-web-js/src/org/oscim/web/client/GwtMap.java @@ -66,7 +66,7 @@ public class GwtMap extends GdxMap { private final native void createLayersN()/*-{ $wnd.createLayers(); - }-*/; + }-*/; @Override protected void createLayers() { diff --git a/vtm-web-js/src/org/oscim/web/js/JsBitmapTileLayer.java b/vtm-web-js/src/org/oscim/web/js/JsBitmapTileLayer.java index 5bc51add..6bd4fb10 100644 --- a/vtm-web-js/src/org/oscim/web/js/JsBitmapTileLayer.java +++ b/vtm-web-js/src/org/oscim/web/js/JsBitmapTileLayer.java @@ -15,8 +15,8 @@ public class JsBitmapTileLayer extends BitmapTileLayer implements ExportOverlay< super(map, tileSource); } - // @ExportConstructor - // public static BitmapTileLayer constructor(Map map, TileSource tileSource) { - // return new JsBitmapTileLayer(map, tileSource); - // } + // @ExportConstructor + // public static BitmapTileLayer constructor(Map map, TileSource tileSource) { + // return new JsBitmapTileLayer(map, tileSource); + // } } diff --git a/vtm-web-js/src/org/oscim/web/js/JsBitmapTileSource.java b/vtm-web-js/src/org/oscim/web/js/JsBitmapTileSource.java index c993355b..17778f96 100644 --- a/vtm-web-js/src/org/oscim/web/js/JsBitmapTileSource.java +++ b/vtm-web-js/src/org/oscim/web/js/JsBitmapTileSource.java @@ -19,9 +19,9 @@ public class JsBitmapTileSource extends BitmapTileSource implements public ITileDataSource getDataSource() { return null; } - // @ExportConstructor - // public static BitmapTileSource constructor(String url, int zoomMin, int zoomMax) { - // return new JsBitmapTileSource(url, zoomMin, zoomMax); - // } + // @ExportConstructor + // public static BitmapTileSource constructor(String url, int zoomMin, int zoomMax) { + // return new JsBitmapTileSource(url, zoomMin, zoomMax); + // } } diff --git a/vtm-web-js/src/org/oscim/web/js/JsMap.java b/vtm-web-js/src/org/oscim/web/js/JsMap.java index fed9416a..a9e94b0a 100644 --- a/vtm-web-js/src/org/oscim/web/js/JsMap.java +++ b/vtm-web-js/src/org/oscim/web/js/JsMap.java @@ -53,7 +53,7 @@ public class JsMap implements Exportable { mMap = map; } - // @ExportInstanceMethod("foo") + // @ExportInstanceMethod("foo") // public static String instanceMethod(Map instance, String surname) { // return instance.getName() + "-" + surname; // } diff --git a/vtm-web-js/src/org/oscim/web/js/JsOverlays.java b/vtm-web-js/src/org/oscim/web/js/JsOverlays.java index c6b145b0..00897fba 100644 --- a/vtm-web-js/src/org/oscim/web/js/JsOverlays.java +++ b/vtm-web-js/src/org/oscim/web/js/JsOverlays.java @@ -122,8 +122,8 @@ public class JsOverlays implements Exportable { } } - // @ExportPackage("vtm") - // @Export("Viewport") - // public interface XViewport extends ExportOverlay + // @ExportPackage("vtm") + // @Export("Viewport") + // public interface XViewport extends ExportOverlay // } diff --git a/vtm-web-js/war/default.css b/vtm-web-js/war/default.css index b501f39c..b4ea94f3 100644 --- a/vtm-web-js/war/default.css +++ b/vtm-web-js/war/default.css @@ -1,102 +1,102 @@ .header { - background-color: #ddd; - text-align: center; + background-color: #ddd; + text-align: center; } html,body { - height: 100%; - width: 100%; - margin: 0 0 0 0; - font-family: Arial, "MS Trebuchet", sans-serif; + height: 100%; + width: 100%; + margin: 0 0 0 0; + font-family: Arial, "MS Trebuchet", sans-serif; } #credits { - position: absolute; - bottom: 0.2em; - right: 0.2em; - z-index: 20000; - color: white; - background-color: #000; - opacity: 0.5; - padding: 0.2em 0.5em 0.2em 0.5em; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - font-size: 11px; + position: absolute; + bottom: 0.2em; + right: 0.2em; + z-index: 20000; + color: white; + background-color: #000; + opacity: 0.5; + padding: 0.2em 0.5em 0.2em 0.5em; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + font-size: 11px; } #credits a { - color: white; - text-decoration: none; - font-variant: small-caps; + color: white; + text-decoration: none; + font-variant: small-caps; } #search { - z-index: 20000; - position: absolute; - top: 0.5em; - left: 0.5em; - background-color: rgba(0, 0, 0, 0.8); - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - visibility: hidden; + z-index: 20000; + position: absolute; + top: 0.5em; + left: 0.5em; + background-color: rgba(0, 0, 0, 0.8); + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + visibility: hidden; } #listContainer { - color: #FFFFFF; + color: #FFFFFF; } #nameFieldContainer,.gwt-TextBox { - width: 250px; + width: 250px; } /* Turn on a 16x16 scrollbar */ ::-webkit-scrollbar { - width: 10px; - height: 0px; + width: 10px; + height: 0px; } /* Turn on single button up on top, and down on bottom */ ::-webkit-scrollbar-button:start:decrement,::-webkit-scrollbar-button:end:increment - { - display: block; + { + display: block; } /* Turn off the down area up on top, and up area on bottom */ ::-webkit-scrollbar-button:vertical:start:increment,::-webkit-scrollbar-button:vertical:end:decrement - { - display: none; + { + display: none; } /* Place The scroll down button at the bottom */ ::-webkit-scrollbar-button:end:increment { - /*background-image: url(images/scroll_cntrl_dwn.png);*/ + /*background-image: url(images/scroll_cntrl_dwn.png);*/ } /* Place The scroll up button at the up */ ::-webkit-scrollbar-button:start:decrement { - /*background-image: url(images/scroll_cntrl_up.png);*/ + /*background-image: url(images/scroll_cntrl_up.png);*/ } /* Top area above thumb and below up button */ ::-webkit-scrollbar-track-piece:vertical:start { - /*background-image: url(images/scroll_gutter_top.png), url(images/scroll_gutter_mid.png); - background-repeat: no-repeat, repeat-y;*/ + /*background-image: url(images/scroll_gutter_top.png), url(images/scroll_gutter_mid.png); + background-repeat: no-repeat, repeat-y;*/ } /* Bottom area below thumb and down button */ ::-webkit-scrollbar-track-piece:vertical:end { - /*background-image: url(images/scroll_gutter_btm.png), url(images/scroll_gutter_mid.png); - background-repeat: no-repeat, repeat-y; - background-position: bottom left, 0 0;*/ + /*background-image: url(images/scroll_gutter_btm.png), url(images/scroll_gutter_mid.png); + background-repeat: no-repeat, repeat-y; + background-position: bottom left, 0 0;*/ } /* The thumb itself */ ::-webkit-scrollbar-thumb:vertical { - height: 56px; - width: 12px; - /* -webkit-border-image: url(images/scroll_thumb.png) 8 0 8 0 stretch stretch;*/ - background-color: #DDDDDD; - opacity: 0.5; + height: 56px; + width: 12px; + /* -webkit-border-image: url(images/scroll_thumb.png) 8 0 8 0 stretch stretch;*/ + background-color: #DDDDDD; + opacity: 0.5; } diff --git a/vtm-web-js/war/map.js b/vtm-web-js/war/map.js index 32ec8906..95fd9785 100644 --- a/vtm-web-js/war/map.js +++ b/vtm-web-js/war/map.js @@ -1,42 +1,42 @@ var mapconfig = { - zoom : 12, - latitude : 53.075, - longitude : 8.8080, - tileSize : 400 + zoom : 12, + latitude : 53.075, + longitude : 8.8080, + tileSize : 400 } function createLayers() { - var m = map.map(); + var m = map.map(); - // var t = map.loadTheme("DEFAULT"); - // var ts = new vtm.OSciMap4TileSource(); - // var l = new vtm.OsmTileLayer(m); - // l.setTileSource(ts) - // l.setRenderTheme(t) + // var t = map.loadTheme("DEFAULT"); + // var ts = new vtm.OSciMap4TileSource(); + // var l = new vtm.OsmTileLayer(m); + // l.setTileSource(ts) + // l.setRenderTheme(t) - var s = new vtm.BitmapTileSource("http://a.tile.stamen.com/toner", 0, 18); - var l = new vtm.BitmapTileLayer(m, s); - map.addLayer(l) - // map.addLayer(new vtm.BuildingLayer(m, l)) - // map.addLayer(new vtm.LabelLayer(m, l)) + var s = new vtm.BitmapTileSource("http://a.tile.stamen.com/toner", 0, 18); + var l = new vtm.BitmapTileLayer(m, s); + map.addLayer(l) + // map.addLayer(new vtm.BuildingLayer(m, l)) + // map.addLayer(new vtm.LabelLayer(m, l)) - t = map.loadTheme("TRONRENDER") - ts = new vtm.OsmLanduseJsonTileSource() - l = new vtm.VectorTileLayer(m, ts) - l.setRenderTheme(t) - map.addLayer(l) + t = map.loadTheme("TRONRENDER") + ts = new vtm.OsmLanduseJsonTileSource() + l = new vtm.VectorTileLayer(m, ts) + l.setRenderTheme(t) + map.addLayer(l) } function canvasResize() { - div = document.getElementById('canvas-area') - canvas = document.getElementById('map-canvas') - var w = div.scrollWidth; - var h = div.scrollHeight; - // console.log(div.clientHeight + " " + div.clientWidth) - canvas.width = w; - canvas.height = h; - canvas.style.width = w + 'px'; - canvas.style.height = h + 'px'; + div = document.getElementById('canvas-area') + canvas = document.getElementById('map-canvas') + var w = div.scrollWidth; + var h = div.scrollHeight; + // console.log(div.clientHeight + " " + div.clientWidth) + canvas.width = w; + canvas.height = h; + canvas.style.width = w + 'px'; + canvas.style.height = h + 'px'; } canvasResize(); window.addEventListener('resize', canvasResize, false); diff --git a/vtm-web/src/org/oscim/gdx/client/GdxGL.java b/vtm-web/src/org/oscim/gdx/client/GdxGL.java index 066ca1cd..4980a2d0 100644 --- a/vtm-web/src/org/oscim/gdx/client/GdxGL.java +++ b/vtm-web/src/org/oscim/gdx/client/GdxGL.java @@ -37,10 +37,10 @@ public class GdxGL extends GwtGL20 implements GL { this.gl = gl; } - // @Override - // public void glGetShaderSource(int shader, int bufsize, Buffer length, String source) { + // @Override + // public void glGetShaderSource(int shader, int bufsize, Buffer length, String source) { // - // } + // } @Override public void glTexImage2D(int target, int level, int internalformat, int width, int height, diff --git a/vtm-web/src/org/oscim/gdx/client/MapConfig.java b/vtm-web/src/org/oscim/gdx/client/MapConfig.java index 9dc1e010..33f4fffe 100644 --- a/vtm-web/src/org/oscim/gdx/client/MapConfig.java +++ b/vtm-web/src/org/oscim/gdx/client/MapConfig.java @@ -24,26 +24,26 @@ public class MapConfig extends JavaScriptObject { public static native MapConfig get()/*-{ return $wnd.mapconfig; - }-*/; + }-*/; public final native double getLatitude() /*-{ return this.latitude || 0; - }-*/; + }-*/; public final native double getLongitude() /*-{ - return this.longitude || 0; - }-*/; + return this.longitude || 0; + }-*/; public final native int getZoom() /*-{ - return this.zoom || 2; - }-*/; + return this.zoom || 2; + }-*/; public final native String getTileSource() /*-{ - return this.tilesource; - }-*/; + return this.tilesource; + }-*/; public final native int getTileSize() /*-{ - return this.tileSize || 256; - }-*/; + return this.tileSize || 256; + }-*/; } diff --git a/vtm-web/src/org/oscim/gdx/client/MapUrl.java b/vtm-web/src/org/oscim/gdx/client/MapUrl.java index fafc2f07..6c9ce2fa 100644 --- a/vtm-web/src/org/oscim/gdx/client/MapUrl.java +++ b/vtm-web/src/org/oscim/gdx/client/MapUrl.java @@ -59,10 +59,10 @@ public class MapUrl extends Timer { rotation = Float.parseFloat(p.substring(4)); else if (p.startsWith("tilt=")) tilt = Float.parseFloat(p.substring(5)); - // else if (p.startsWith("theme=")) - // themeName = p.substring(6); - // else if (p.startsWith("map=")) - // mapName = p.substring(4); + // else if (p.startsWith("theme=")) + // themeName = p.substring(6); + // else if (p.startsWith("map=")) + // mapName = p.substring(4); else { String[] opt = p.split("="); if (opt.length > 1) diff --git a/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtApplication.java b/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtApplication.java index 87d4f6b8..56b5ef4a 100644 --- a/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtApplication.java +++ b/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtApplication.java @@ -332,19 +332,19 @@ public abstract class GwtApplication implements EntryPoint, Application { **/ private static native AgentInfo computeAgentInfo() /*-{ var userAgent = navigator.userAgent.toLowerCase(); - return { - // browser type flags - isFirefox : userAgent.indexOf("firefox") != -1, - isChrome : userAgent.indexOf("chrome") != -1, - isSafari : userAgent.indexOf("safari") != -1, - isOpera : userAgent.indexOf("opera") != -1, - isIE : userAgent.indexOf("msie") != -1, - // OS type flags - isMacOS : userAgent.indexOf("mac") != -1, - isLinux : userAgent.indexOf("linux") != -1, - isWindows : userAgent.indexOf("win") != -1 - }; - }-*/; + return { + // browser type flags + isFirefox : userAgent.indexOf("firefox") != -1, + isChrome : userAgent.indexOf("chrome") != -1, + isSafari : userAgent.indexOf("safari") != -1, + isOpera : userAgent.indexOf("opera") != -1, + isIE : userAgent.indexOf("msie") != -1, + // OS type flags + isMacOS : userAgent.indexOf("mac") != -1, + isLinux : userAgent.indexOf("linux") != -1, + isWindows : userAgent.indexOf("win") != -1 + }; + }-*/; /** * Returned by {@link #agentInfo}. Kindly borrowed from PlayN. @@ -352,35 +352,35 @@ public abstract class GwtApplication implements EntryPoint, Application { public static class AgentInfo extends JavaScriptObject { public final native boolean isFirefox() /*-{ return this.isFirefox; - }-*/; + }-*/; public final native boolean isChrome() /*-{ - return this.isChrome; - }-*/; + return this.isChrome; + }-*/; public final native boolean isSafari() /*-{ - return this.isSafari; - }-*/; + return this.isSafari; + }-*/; public final native boolean isOpera() /*-{ - return this.isOpera; - }-*/; + return this.isOpera; + }-*/; public final native boolean isIE() /*-{ - return this.isIE; - }-*/; + return this.isIE; + }-*/; public final native boolean isMacOS() /*-{ - return this.isMacOS; - }-*/; + return this.isMacOS; + }-*/; public final native boolean isLinux() /*-{ - return this.isLinux; - }-*/; + return this.isLinux; + }-*/; public final native boolean isWindows() /*-{ - return this.isWindows; - }-*/; + return this.isWindows; + }-*/; protected AgentInfo() { } diff --git a/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtGraphics.java b/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtGraphics.java index a8199ed3..c62dd37c 100644 --- a/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtGraphics.java +++ b/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtGraphics.java @@ -96,15 +96,15 @@ public class GwtGraphics implements Graphics { public static native double getDevicePixelRatioJSNI() /*-{ return $wnd.devicePixelRatio || 1.0; - }-*/; + }-*/; public static native int getWindowWidthJSNI() /*-{ return $wnd.innerWidth; - }-*/; + }-*/; public static native int getWindowHeightJSNI() /*-{ - return $wnd.innerHeight; - }-*/; + return $wnd.innerHeight; + }-*/; public WebGLRenderingContext getContext() { return context; @@ -173,22 +173,22 @@ public class GwtGraphics implements Graphics { } private native int getScreenWidthJSNI() /*-{ - return $wnd.screen.width; - }-*/; + return $wnd.screen.width; + }-*/; private native int getScreenHeightJSNI() /*-{ - return $wnd.screen.height; - }-*/; + return $wnd.screen.height; + }-*/; private native boolean isFullscreenJSNI() /*-{ - if ("webkitIsFullScreen" in $doc) { - return $doc.webkitIsFullScreen; - } - if ("mozFullScreen" in $doc) { - return $doc.mozFullScreen; - } - return false - }-*/; + if ("webkitIsFullScreen" in $doc) { + return $doc.webkitIsFullScreen; + } + if ("mozFullScreen" in $doc) { + return $doc.mozFullScreen; + } + return false + }-*/; private void fullscreenChanged() { if (!isFullscreen()) { @@ -198,39 +198,39 @@ public class GwtGraphics implements Graphics { } private native boolean setFullscreenJSNI(GwtGraphics graphics, CanvasElement element) /*-{ - if (element.webkitRequestFullScreen) { - element.width = $wnd.screen.width; - element.height = $wnd.screen.height; - element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); - $doc - .addEventListener( - "webkitfullscreenchange", - function() { - graphics.@com.badlogic.gdx.backends.gwt.GwtGraphics::fullscreenChanged()(); - }, false); - return true; - } - if (element.mozRequestFullScreen) { - element.width = $wnd.screen.width; - element.height = $wnd.screen.height; - element.mozRequestFullScreen(); - $doc - .addEventListener( - "mozfullscreenchange", - function() { - graphics.@com.badlogic.gdx.backends.gwt.GwtGraphics::fullscreenChanged()(); - }, false); - return true; - } - return false; - }-*/; + if (element.webkitRequestFullScreen) { + element.width = $wnd.screen.width; + element.height = $wnd.screen.height; + element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); + $doc + .addEventListener( + "webkitfullscreenchange", + function() { + graphics.@com.badlogic.gdx.backends.gwt.GwtGraphics::fullscreenChanged()(); + }, false); + return true; + } + if (element.mozRequestFullScreen) { + element.width = $wnd.screen.width; + element.height = $wnd.screen.height; + element.mozRequestFullScreen(); + $doc + .addEventListener( + "mozfullscreenchange", + function() { + graphics.@com.badlogic.gdx.backends.gwt.GwtGraphics::fullscreenChanged()(); + }, false); + return true; + } + return false; + }-*/; private native void exitFullscreen() /*-{ - if ($doc.webkitExitFullscreen) - $doc.webkitExitFullscreen(); - if ($doc.mozExitFullscreen) - $doc.mozExitFullscreen(); - }-*/; + if ($doc.webkitExitFullscreen) + $doc.webkitExitFullscreen(); + if ($doc.mozExitFullscreen) + $doc.mozExitFullscreen(); + }-*/; @Override public DisplayMode getDesktopDisplayMode() { diff --git a/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtInput.java b/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtInput.java index b46262ea..a5e7d110 100644 --- a/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtInput.java +++ b/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtInput.java @@ -271,22 +271,22 @@ public class GwtInput implements Input { */ private native boolean isCursorCatchedJSNI() /*-{ if (!navigator.pointer) { - navigator.pointer = navigator.webkitPointer || navigator.mozPointer; - } - if (navigator.pointer) { - if (typeof (navigator.pointer.isLocked) === "boolean") { - // Chrome initially launched with this interface - return navigator.pointer.isLocked; - } else if (typeof (navigator.pointer.isLocked) === "function") { - // Some older builds might provide isLocked as a function - return navigator.pointer.isLocked(); - } else if (typeof (navigator.pointer.islocked) === "function") { - // For compatibility with early Firefox build - return navigator.pointer.islocked(); - } - } - return false; - }-*/; + navigator.pointer = navigator.webkitPointer || navigator.mozPointer; + } + if (navigator.pointer) { + if (typeof (navigator.pointer.isLocked) === "boolean") { + // Chrome initially launched with this interface + return navigator.pointer.isLocked; + } else if (typeof (navigator.pointer.isLocked) === "function") { + // Some older builds might provide isLocked as a function + return navigator.pointer.isLocked(); + } else if (typeof (navigator.pointer.islocked) === "function") { + // For compatibility with early Firefox build + return navigator.pointer.islocked(); + } + } + return false; + }-*/; /** * from https://github.com/toji/game-shim/blob/master/game-shim.js @@ -295,40 +295,40 @@ public class GwtInput implements Input { */ private native void setCursorCatchedJSNI(CanvasElement element) /*-{ // Navigator pointer is not the right interface according to spec. - // Here for backwards compatibility only - if (!navigator.pointer) { - navigator.pointer = navigator.webkitPointer || navigator.mozPointer; - } - // element.requestPointerLock - if (!element.requestPointerLock) { - element.requestPointerLock = (function() { - return element.webkitRequestPointerLock - || element.mozRequestPointerLock || function() { - if (navigator.pointer) { - navigator.pointer.lock(element); - } - }; - })(); - } - element.requestPointerLock(); - }-*/; + // Here for backwards compatibility only + if (!navigator.pointer) { + navigator.pointer = navigator.webkitPointer || navigator.mozPointer; + } + // element.requestPointerLock + if (!element.requestPointerLock) { + element.requestPointerLock = (function() { + return element.webkitRequestPointerLock + || element.mozRequestPointerLock || function() { + if (navigator.pointer) { + navigator.pointer.lock(element); + } + }; + })(); + } + element.requestPointerLock(); + }-*/; /** * from https://github.com/toji/game-shim/blob/master/game-shim.js */ private native void exitCursorCatchedJSNI() /*-{ - if (!$doc.exitPointerLock) { - $doc.exitPointerLock = (function() { - return $doc.webkitExitPointerLock || $doc.mozExitPointerLock - || function() { - if (navigator.pointer) { - var elem = this; - navigator.pointer.unlock(); - } - }; - })(); - } - }-*/; + if (!$doc.exitPointerLock) { + $doc.exitPointerLock = (function() { + return $doc.webkitExitPointerLock || $doc.mozExitPointerLock + || function() { + if (navigator.pointer) { + var elem = this; + navigator.pointer.unlock(); + } + }; + })(); + } + }-*/; /** * from https://github.com/toji/game-shim/blob/master/game-shim.js @@ -337,8 +337,8 @@ public class GwtInput implements Input { * @return movement in x direction */ private native float getMovementXJSNI(NativeEvent event) /*-{ - return event.movementX || event.webkitMovementX || 0; - }-*/; + return event.movementX || event.webkitMovementX || 0; + }-*/; /** * from https://github.com/toji/game-shim/blob/master/game-shim.js @@ -347,12 +347,12 @@ public class GwtInput implements Input { * @return movement in y direction */ private native float getMovementYJSNI(NativeEvent event) /*-{ - return event.movementY || event.webkitMovementY || 0; - }-*/; + return event.movementY || event.webkitMovementY || 0; + }-*/; private static native boolean isTouchScreen() /*-{ - return (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0)); - }-*/; + return (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0)); + }-*/; /** * works only for Chrome > Version 18 with enabled Mouse Lock enable in @@ -384,55 +384,55 @@ public class GwtInput implements Input { // kindly borrowed from our dear playn friends... static native void addEventListener(JavaScriptObject target, String name, GwtInput handler, boolean capture) /*-{ - target - .addEventListener( - name, - function(e) { - handler.@com.badlogic.gdx.backends.gwt.GwtInput::handleEvent(Lcom/google/gwt/dom/client/NativeEvent;)(e); - }, capture); - }-*/; + target + .addEventListener( + name, + function(e) { + handler.@com.badlogic.gdx.backends.gwt.GwtInput::handleEvent(Lcom/google/gwt/dom/client/NativeEvent;)(e); + }, capture); + }-*/; private static native float getMouseWheelVelocity(NativeEvent evt) /*-{ - var delta = 0.0; - var agentInfo = @com.badlogic.gdx.backends.gwt.GwtApplication::agentInfo()(); + var delta = 0.0; + var agentInfo = @com.badlogic.gdx.backends.gwt.GwtApplication::agentInfo()(); - if (agentInfo.isFirefox) { - if (agentInfo.isMacOS) { - delta = 1.0 * evt.detail; - } else { - delta = 1.0 * evt.detail / 3; - } - } else if (agentInfo.isOpera) { - if (agentInfo.isLinux) { - delta = -1.0 * evt.wheelDelta / 80; - } else { - // on mac - delta = -1.0 * evt.wheelDelta / 40; - } - } else if (agentInfo.isChrome || agentInfo.isSafari) { - delta = -1.0 * evt.wheelDelta / 120; - // handle touchpad for chrome - if (Math.abs(delta) < 1) { - if (agentInfo.isWindows) { - delta = -1.0 * evt.wheelDelta; - } else if (agentInfo.isMacOS) { - delta = -1.0 * evt.wheelDelta / 3; - } - } - } - return delta; - }-*/; + if (agentInfo.isFirefox) { + if (agentInfo.isMacOS) { + delta = 1.0 * evt.detail; + } else { + delta = 1.0 * evt.detail / 3; + } + } else if (agentInfo.isOpera) { + if (agentInfo.isLinux) { + delta = -1.0 * evt.wheelDelta / 80; + } else { + // on mac + delta = -1.0 * evt.wheelDelta / 40; + } + } else if (agentInfo.isChrome || agentInfo.isSafari) { + delta = -1.0 * evt.wheelDelta / 120; + // handle touchpad for chrome + if (Math.abs(delta) < 1) { + if (agentInfo.isWindows) { + delta = -1.0 * evt.wheelDelta; + } else if (agentInfo.isMacOS) { + delta = -1.0 * evt.wheelDelta / 3; + } + } + } + return delta; + }-*/; /** * Kindly borrowed from PlayN. **/ protected static native String getMouseWheelEvent() /*-{ - if (navigator.userAgent.toLowerCase().indexOf('firefox') != -1) { - return "DOMMouseScroll"; - } else { - return "mousewheel"; - } - }-*/; + if (navigator.userAgent.toLowerCase().indexOf('firefox') != -1) { + return "DOMMouseScroll"; + } else { + return "mousewheel"; + } + }-*/; /** * Kindly borrowed from PlayN. @@ -452,15 +452,15 @@ public class GwtInput implements Input { private void hookEvents() { addEventListener(canvas, "mousedown", this, true); - // addEventListener(Document.get(), "mousedown", this, true); + // addEventListener(Document.get(), "mousedown", this, true); addEventListener(canvas, "mouseup", this, true); - // addEventListener(Document.get(), "mouseup", this, true); + // addEventListener(Document.get(), "mouseup", this, true); addEventListener(canvas, "mousemove", this, true); - // addEventListener(Document.get(), "mousemove", this, true); + // addEventListener(Document.get(), "mousemove", this, true); addEventListener(canvas, getMouseWheelEvent(), this, true); - // addEventListener(Document.get(), "keydown", this, false); - // addEventListener(Document.get(), "keyup", this, false); - // addEventListener(Document.get(), "keypress", this, false); + // addEventListener(Document.get(), "keydown", this, false); + // addEventListener(Document.get(), "keyup", this, false); + // addEventListener(Document.get(), "keypress", this, false); addEventListener(canvas, "keydown", this, false); addEventListener(canvas, "keyup", this, false); addEventListener(canvas, "keypress", this, false); diff --git a/vtm-web/src/org/oscim/gdx/emu/org/oscim/renderer/GLMatrix.java b/vtm-web/src/org/oscim/gdx/emu/org/oscim/renderer/GLMatrix.java index c40aeab7..4a5ff3e5 100644 --- a/vtm-web/src/org/oscim/gdx/emu/org/oscim/renderer/GLMatrix.java +++ b/vtm-web/src/org/oscim/gdx/emu/org/oscim/renderer/GLMatrix.java @@ -379,25 +379,25 @@ public class GLMatrix { System.arraycopy(tmp, 0, mata, 0, 16); } - // @Override - // public void finalize() { - // if (pointer != 0) - // delete(pointer); - // } + // @Override + // public void finalize() { + // if (pointer != 0) + // delete(pointer); + // } - /* Copyright (C) 2007 The Android Open Source Project + /* Copyright (C) 2007 The Android Open Source Project * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ /** * Define a projection matrix in terms of six clip planes diff --git a/vtm-web/src/org/oscim/gdx/emu/org/oscim/tiling/source/LwHttp.java b/vtm-web/src/org/oscim/gdx/emu/org/oscim/tiling/source/LwHttp.java index ed70c801..c105ade3 100644 --- a/vtm-web/src/org/oscim/gdx/emu/org/oscim/tiling/source/LwHttp.java +++ b/vtm-web/src/org/oscim/gdx/emu/org/oscim/tiling/source/LwHttp.java @@ -118,8 +118,8 @@ public class LwHttp implements HttpEngine { @Override public boolean requestCompleted(boolean success) { - // mHttpRequest.clearOnReadyStateChange(); - // mHttpRequest = null; + // mHttpRequest.clearOnReadyStateChange(); + // mHttpRequest = null; return true; } diff --git a/vtm-web/src/org/oscim/gdx/emu/org/oscim/tiling/source/bitmap/BitmapTileSource.java b/vtm-web/src/org/oscim/gdx/emu/org/oscim/tiling/source/bitmap/BitmapTileSource.java index f2783467..25f02b14 100644 --- a/vtm-web/src/org/oscim/gdx/emu/org/oscim/tiling/source/bitmap/BitmapTileSource.java +++ b/vtm-web/src/org/oscim/gdx/emu/org/oscim/tiling/source/bitmap/BitmapTileSource.java @@ -87,11 +87,11 @@ public class BitmapTileSource extends UrlTileSource { final Image img = new Image(); img.setVisible(false); - /* As if researching CORS issues doesnt result in + /* As if researching CORS issues doesnt result in * enough headache... - * - * Here are some more special Chrome/Webkit quirks: - * MUST SET CORS BEFORE URL! */ + * + * Here are some more special Chrome/Webkit quirks: + * MUST SET CORS BEFORE URL! */ img.getElement().setAttribute("crossorigin", "anonymous"); img.setUrl(uri); diff --git a/vtm-web/src/org/oscim/gdx/emu/org/oscim/utils/Tessellator.java b/vtm-web/src/org/oscim/gdx/emu/org/oscim/utils/Tessellator.java index 26d698da..41eaeabe 100644 --- a/vtm-web/src/org/oscim/gdx/emu/org/oscim/utils/Tessellator.java +++ b/vtm-web/src/org/oscim/gdx/emu/org/oscim/utils/Tessellator.java @@ -124,17 +124,17 @@ public class Tessellator { return 0; } - // if (vo.length() != plen) { - // // TODO handle different output points - // log.debug(" + io.length()); + // if (vo.length() != plen) { + // // TODO handle different output points + // log.debug(" + io.length()); // - // //for (int i = 0; i < vo.length(); i += 2) - // // log.debug(vo.get(i) + " " + vo.get(i + 1)); - // //for (int i = ppos; i < ppos + plen; i += 2) - // // log.debug( points[i]+ " " + points[i + 1]); + // //for (int i = 0; i < vo.length(); i += 2) + // // log.debug(vo.get(i) + " " + vo.get(i + 1)); + // //for (int i = ppos; i < ppos + plen; i += 2) + // // log.debug( points[i]+ " " + points[i + 1]); // - // return 0; - // } + // return 0; + // } int numIndices = io.length(); @@ -164,17 +164,17 @@ public class Tessellator { static native Int32Array tessellate(JsArrayNumber points, int pOffset, int pLength, JsArrayInteger bounds, int bOffset, int bLength)/*-{ - return $wnd.tessellate(points, pOffset, pOffset + pLength, bounds, - bOffset, bOffset + bLength, false); - }-*/; + return $wnd.tessellate(points, pOffset, pOffset + pLength, bounds, + bOffset, bOffset + bLength, false); + }-*/; static native TessResult tessellate2(JsArrayNumber points, int pOffset, int pLength, JsArrayInteger bounds, int bOffset, int bLength) /*-{ - return $wnd.tessellate(points, pOffset, pOffset + pLength, bounds, - bOffset, bOffset + bLength, true); - }-*/; + return $wnd.tessellate(points, pOffset, pOffset + pLength, bounds, + bOffset, bOffset + bLength, true); + }-*/; static final class TessResult extends JavaScriptObject { protected TessResult() { @@ -182,10 +182,10 @@ public class Tessellator { native Float32Array getPoints(JavaScriptObject result)/*-{ return result.vertices; - }-*/; + }-*/; native Int32Array getIndices(JavaScriptObject result)/*-{ - return result.triangles; - }-*/; + return result.triangles; + }-*/; } } diff --git a/vtm-web/src/org/oscim/gdx/resources/js/tessellate.js b/vtm-web/src/org/oscim/gdx/resources/js/tessellate.js index 307c14c0..57c73bc1 100644 --- a/vtm-web/src/org/oscim/gdx/resources/js/tessellate.js +++ b/vtm-web/src/org/oscim/gdx/resources/js/tessellate.js @@ -1,107 +1,107 @@ tessellate = (function() { - Module.TOTAL_MEMORY = 1024 * 1024; + Module.TOTAL_MEMORY = 1024 * 1024; - var c_tessellate = Module.cwrap('tessellate', 'void', [ 'number', 'number', - 'number', 'number', 'number', 'number' ]); + var c_tessellate = Module.cwrap('tessellate', 'void', [ 'number', 'number', + 'number', 'number', 'number', 'number' ]); - // special tessellator for extrusion layer - only returns triangle indices - var tessellate = function(vertices, v_start, v_end, boundaries, b_start, - b_end, mode) { - var i; + // special tessellator for extrusion layer - only returns triangle indices + var tessellate = function(vertices, v_start, v_end, boundaries, b_start, + b_end, mode) { + var i; - var v_len = (v_end - v_start); - var b_len = (b_end - b_start); + var v_len = (v_end - v_start); + var b_len = (b_end - b_start); - var p = Module._malloc(v_len * 8); + var p = Module._malloc(v_len * 8); - for (i = 0; i < v_len; ++i) - Module.setValue(p + i * 8, vertices[v_start + i], 'double'); + for (i = 0; i < v_len; ++i) + Module.setValue(p + i * 8, vertices[v_start + i], 'double'); - var contours = Module._malloc((b_len + 1) * 4); + var contours = Module._malloc((b_len + 1) * 4); - // pointer to first contour - Module.setValue(contours + 0, p + 0, 'i32'); - var offset = p; + // pointer to first contour + Module.setValue(contours + 0, p + 0, 'i32'); + var offset = p; - // pointer to further contours + end - for (i = 0; i < b_len; ++i) { - offset += 8 * boundaries[b_start + i]; - Module.setValue(contours + 4 * (i + 1), offset, 'i32'); - } + // pointer to further contours + end + for (i = 0; i < b_len; ++i) { + offset += 8 * boundaries[b_start + i]; + Module.setValue(contours + 4 * (i + 1), offset, 'i32'); + } - var ppcoordinates_out = Module._malloc(4); - var pptris_out = Module._malloc(4); - var pnverts = Module._malloc(4); - var pntris = Module._malloc(4); + var ppcoordinates_out = Module._malloc(4); + var pptris_out = Module._malloc(4); + var pnverts = Module._malloc(4); + var pntris = Module._malloc(4); - c_tessellate(ppcoordinates_out, pnverts, pptris_out, pntris, contours, - contours + 4 * (b_len + 1)); + c_tessellate(ppcoordinates_out, pnverts, pptris_out, pntris, contours, + contours + 4 * (b_len + 1)); - var pcoordinates_out = Module.getValue(ppcoordinates_out, 'i32'); - var ptris_out = Module.getValue(pptris_out, 'i32'); + var pcoordinates_out = Module.getValue(ppcoordinates_out, 'i32'); + var ptris_out = Module.getValue(pptris_out, 'i32'); - var nverts = Module.getValue(pnverts, 'i32'); - var ntris = Module.getValue(pntris, 'i32'); + var nverts = Module.getValue(pnverts, 'i32'); + var ntris = Module.getValue(pntris, 'i32'); - var result_triangles = null; - var result_vertices = null; + var result_triangles = null; + var result_vertices = null; - if (mode){ - result_triangles = new Int32Array(ntris * 3); - for (i = 0; i < 3 * ntris; ++i) - result_triangles[i] = Module.getValue(ptris_out + i * 4, 'i32'); - - result_vertices = new Float32Array(nverts * 2); - for (i = 0; i < 2 * nverts; ++i) - result_vertices[i] = Module.getValue(pcoordinates_out + i * 8, 'double'); - - } else { - if (nverts * 2 == v_len) { - result_triangles = new Int32Array(ntris * 3); - - for (i = 0; i < 3 * ntris; ++i) { - result_triangles[i] = Module.getValue(ptris_out + i * 4, 'i32') * 2; - } - // when a ring has an odd number of points one (or rather two) - // additional vertices will be added. so the following rings - // needs extra offset... - var start = 0; - for ( var j = 0, m = b_len - 1; j < m; j++) { - start += boundaries[b_start + j]; + if (mode){ + result_triangles = new Int32Array(ntris * 3); + for (i = 0; i < 3 * ntris; ++i) + result_triangles[i] = Module.getValue(ptris_out + i * 4, 'i32'); + + result_vertices = new Float32Array(nverts * 2); + for (i = 0; i < 2 * nverts; ++i) + result_vertices[i] = Module.getValue(pcoordinates_out + i * 8, 'double'); + + } else { + if (nverts * 2 == v_len) { + result_triangles = new Int32Array(ntris * 3); + + for (i = 0; i < 3 * ntris; ++i) { + result_triangles[i] = Module.getValue(ptris_out + i * 4, 'i32') * 2; + } + // when a ring has an odd number of points one (or rather two) + // additional vertices will be added. so the following rings + // needs extra offset... + var start = 0; + for ( var j = 0, m = b_len - 1; j < m; j++) { + start += boundaries[b_start + j]; - // even number of points? - if (!((boundaries[b_start + j] >> 1) & 1)) - continue; + // even number of points? + if (!((boundaries[b_start + j] >> 1) & 1)) + continue; - for ( var n = ntris * 3, tri = 0; tri < n; tri++) - if (result_triangles[tri] >= start) - result_triangles[tri] += 2; + for ( var n = ntris * 3, tri = 0; tri < n; tri++) + if (result_triangles[tri] >= start) + result_triangles[tri] += 2; - start += 2; - } - } - } - - Module._free(pnverts); - Module._free(pntris); - - Module._free(ppcoordinates_out); - Module._free(pcoordinates_out); - - Module._free(pptris_out); - Module._free(ptris_out); + start += 2; + } + } + } + + Module._free(pnverts); + Module._free(pntris); + + Module._free(ppcoordinates_out); + Module._free(pcoordinates_out); + + Module._free(pptris_out); + Module._free(ptris_out); - Module._free(p); - Module._free(contours); - - if (mode) - return { vertices: result_vertices, triangles: result_triangles }; - else - return result_triangles; - - }; + Module._free(p); + Module._free(contours); + + if (mode) + return { vertices: result_vertices, triangles: result_triangles }; + else + return result_triangles; + + }; - return tessellate; + return tessellate; })(); diff --git a/vtm-web/src/org/oscim/tiling/source/geojson/Feature.java b/vtm-web/src/org/oscim/tiling/source/geojson/Feature.java index 5b04f0f3..c746f56c 100644 --- a/vtm-web/src/org/oscim/tiling/source/geojson/Feature.java +++ b/vtm-web/src/org/oscim/tiling/source/geojson/Feature.java @@ -27,15 +27,15 @@ public class Feature extends GeoJsonObject { public final native Geometry getGeometry() /*-{ return this.geometry; - }-*/; + }-*/; public final native String getId() /*-{ return this.id; - }-*/; + }-*/; public final native void setId(String id) /*-{ - this.id = id; - }-*/; + this.id = id; + }-*/; public final Map getProperties(HashMap map) { map.clear(); @@ -45,8 +45,8 @@ public class Feature extends GeoJsonObject { } public final native void fromJavascriptObject(HashMap s) /*-{ - for(var key in this.properties) { - s.@java.util.HashMap::put(Ljava/lang/Object;Ljava/lang/Object;)(key, Object(this.properties[key])); - } - }-*/; + for(var key in this.properties) { + s.@java.util.HashMap::put(Ljava/lang/Object;Ljava/lang/Object;)(key, Object(this.properties[key])); + } + }-*/; } diff --git a/vtm-web/src/org/oscim/tiling/source/geojson/FeatureCollection.java b/vtm-web/src/org/oscim/tiling/source/geojson/FeatureCollection.java index 2b901031..c2fde06b 100644 --- a/vtm-web/src/org/oscim/tiling/source/geojson/FeatureCollection.java +++ b/vtm-web/src/org/oscim/tiling/source/geojson/FeatureCollection.java @@ -33,6 +33,6 @@ public class FeatureCollection extends JavaScriptObject { public final native JsArray getFeaturesInternal()/*-{ return this.features; - }-*/; + }-*/; } diff --git a/vtm-web/src/org/oscim/tiling/source/geojson/GeoJsonObject.java b/vtm-web/src/org/oscim/tiling/source/geojson/GeoJsonObject.java index 3ca3fa48..f16b01ab 100644 --- a/vtm-web/src/org/oscim/tiling/source/geojson/GeoJsonObject.java +++ b/vtm-web/src/org/oscim/tiling/source/geojson/GeoJsonObject.java @@ -26,9 +26,9 @@ public abstract class GeoJsonObject extends JavaScriptObject { public final native double[] getBbox()/*-{ return bbox; - }-*/; + }-*/; public final native void setBbox(double[] bbox) /*-{ this.bbox = bbox; - }-*/; + }-*/; } diff --git a/vtm-web/src/org/oscim/tiling/source/geojson/GeoJsonTileDecoder.java b/vtm-web/src/org/oscim/tiling/source/geojson/GeoJsonTileDecoder.java index 647c1c07..4ce6569f 100644 --- a/vtm-web/src/org/oscim/tiling/source/geojson/GeoJsonTileDecoder.java +++ b/vtm-web/src/org/oscim/tiling/source/geojson/GeoJsonTileDecoder.java @@ -65,12 +65,12 @@ public class GeoJsonTileDecoder implements ITileDecoder { mapElement.clear(); mapElement.tags.clear(); - /* add tag information */ + /* add tag information */ mTileSource.decodeTags(mapElement, f.getProperties(mProperties)); if (mapElement.tags.numTags == 0) continue; - /* add geometry information */ + /* add geometry information */ decodeGeometry(f.getGeometry()); if (mapElement.type == GeometryType.NONE) diff --git a/vtm-web/src/org/oscim/tiling/source/geojson/Geometry.java b/vtm-web/src/org/oscim/tiling/source/geojson/Geometry.java index 5dea6a1b..20fb9cc0 100644 --- a/vtm-web/src/org/oscim/tiling/source/geojson/Geometry.java +++ b/vtm-web/src/org/oscim/tiling/source/geojson/Geometry.java @@ -27,9 +27,9 @@ public abstract class Geometry extends JsArray { public final native String type()/*-{ return this.type - }-*/; + }-*/; public final native JsArray getCoordinates() /*-{ return this.coordinates; - }-*/; + }-*/; } diff --git a/vtm-web/src/org/oscim/tiling/source/geojson/JsArrayCollection.java b/vtm-web/src/org/oscim/tiling/source/geojson/JsArrayCollection.java index ae9284ca..a6b85726 100644 --- a/vtm-web/src/org/oscim/tiling/source/geojson/JsArrayCollection.java +++ b/vtm-web/src/org/oscim/tiling/source/geojson/JsArrayCollection.java @@ -83,19 +83,19 @@ public class JsArrayCollection extends AbstractCollection { public native final JsArr slice(int start, int end)/*-{ return this.slice(start, end); - }-*/; + }-*/; public static final native JsArr create() /*-{ return []; - }-*/; + }-*/; public final native int size() /*-{ - return this.length; - }-*/; + return this.length; + }-*/; public final native T get(int i) /*-{ - return this[i]; - }-*/; + return this[i]; + }-*/; } } diff --git a/vtm-web/src/org/oscim/tiling/source/geojson/LngLat.java b/vtm-web/src/org/oscim/tiling/source/geojson/LngLat.java index b2170a22..eb4c4437 100644 --- a/vtm-web/src/org/oscim/tiling/source/geojson/LngLat.java +++ b/vtm-web/src/org/oscim/tiling/source/geojson/LngLat.java @@ -10,9 +10,9 @@ public class LngLat extends JavaScriptObject { public final native double getLongitude() /*-{ return this[0]; - }-*/; + }-*/; public final native double getLatitude() /*-{ return this[1]; - }-*/; + }-*/; } diff --git a/vtm-web/src/org/oscim/tiling/source/geojson/MultiLineString.java b/vtm-web/src/org/oscim/tiling/source/geojson/MultiLineString.java index 0a4ac9c0..92cdfd2b 100644 --- a/vtm-web/src/org/oscim/tiling/source/geojson/MultiLineString.java +++ b/vtm-web/src/org/oscim/tiling/source/geojson/MultiLineString.java @@ -23,10 +23,10 @@ public class MultiLineString extends Geometry { public final native LineString getGeometryN(int i) /*-{ return this[i]; - }-*/; + }-*/; public final native int getNumGeometries() /*-{ return this.length; - }-*/; + }-*/; } diff --git a/vtm-web/src/org/oscim/tiling/source/geojson/MultiPolygon.java b/vtm-web/src/org/oscim/tiling/source/geojson/MultiPolygon.java index f1ecf681..a31ea190 100644 --- a/vtm-web/src/org/oscim/tiling/source/geojson/MultiPolygon.java +++ b/vtm-web/src/org/oscim/tiling/source/geojson/MultiPolygon.java @@ -23,10 +23,10 @@ public class MultiPolygon extends Geometry { public final native Polygon getGeometryN(int i) /*-{ return this[i]; - }-*/; + }-*/; public final native int getNumGeometries() /*-{ return this.length; - }-*/; + }-*/; } diff --git a/vtm-web/src/org/oscim/tiling/source/geojson/Polygon.java b/vtm-web/src/org/oscim/tiling/source/geojson/Polygon.java index d462d0a8..39b9da79 100644 --- a/vtm-web/src/org/oscim/tiling/source/geojson/Polygon.java +++ b/vtm-web/src/org/oscim/tiling/source/geojson/Polygon.java @@ -23,14 +23,14 @@ public class Polygon extends Geometry { public final native LineString getExteriorRing()/*-{ return this[0]; - }-*/; + }-*/; public final native LineString getRing(int i) /*-{ return this[i]; - }-*/; + }-*/; public final native int getNumRings() /*-{ - return this.length; - }-*/; + return this.length; + }-*/; } diff --git a/vtm/src/org/oscim/core/GeometryBuffer.java b/vtm/src/org/oscim/core/GeometryBuffer.java index d9a62f76..d9dc57fc 100644 --- a/vtm/src/org/oscim/core/GeometryBuffer.java +++ b/vtm/src/org/oscim/core/GeometryBuffer.java @@ -212,18 +212,18 @@ public class GeometryBuffer { public GeometryBuffer startLine() { setOrCheckMode(GeometryType.LINE); - /* ignore */ + /* ignore */ if (index[indexPos] > 0) { - /* start next */ + /* start next */ if ((index[0] >= 0) && (++indexPos >= index.length)) ensureIndexSize(indexPos, true); - /* initialize with zero points */ + /* initialize with zero points */ index[indexPos] = 0; } - /* set new end marker */ + /* set new end marker */ if (index.length > indexPos + 1) index[indexPos + 1] = -1; return this; @@ -243,14 +243,14 @@ public class GeometryBuffer { /* end polygon */ index[++indexPos] = 0; - /* next polygon start */ + /* next polygon start */ indexPos++; } - /* initialize with zero points */ + /* initialize with zero points */ index[indexPos] = 0; - /* set new end marker */ + /* set new end marker */ if (index.length > indexPos + 1) index[indexPos + 1] = -1; @@ -266,10 +266,10 @@ public class GeometryBuffer { if ((indexPos + 2) > index.length) ensureIndexSize(indexPos + 1, true); - /* initialize with zero points */ + /* initialize with zero points */ index[++indexPos] = 0; - /* set new end marker */ + /* set new end marker */ if (index.length > indexPos + 1) index[indexPos + 1] = -1; } @@ -378,7 +378,7 @@ public class GeometryBuffer { float px = points[inPos++]; float py = points[inPos++]; - /* add first point */ + /* add first point */ points[outPos++] = px; points[outPos++] = py; int cnt = 2; diff --git a/vtm/src/org/oscim/layers/MapEventLayer.java b/vtm/src/org/oscim/layers/MapEventLayer.java index 6814e789..d58a541d 100644 --- a/vtm/src/org/oscim/layers/MapEventLayer.java +++ b/vtm/src/org/oscim/layers/MapEventLayer.java @@ -172,7 +172,7 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen pivotY = mPrevY1 - mMap.getHeight() / 2; } - /* handle double tap zoom */ + /* handle double tap zoom */ mMap.animator().animateZoom(300, 2, pivotX, pivotY); } else if (mStartMove > 0) { @@ -181,7 +181,7 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen float vx = mTracker.getVelocityX(); float vy = mTracker.getVelocityY(); - /* reduce velocity for short moves */ + /* reduce velocity for short moves */ float t = e.getTime() - mStartMove; if (t < FLING_MIN_THREHSHOLD) { t = t / FLING_MIN_THREHSHOLD; @@ -227,9 +227,9 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen mPrevX1 = x1; mPrevY1 = y1; - /* double-tap drag zoom */ + /* double-tap drag zoom */ if (mDoubleTap) { - /* just ignore first move event to set mPrevX/Y */ + /* just ignore first move event to set mPrevX/Y */ if (!mDown) { mDown = true; return; @@ -248,7 +248,7 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen return; } - /* simple move */ + /* simple move */ if (!mEnableMove) return; @@ -290,7 +290,7 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen if (mDoTilt) { tiltBy = my / 5; } else if (Math.abs(my) > (dpi / PINCH_TILT_THRESHOLD)) { - /* enter exclusive tilt mode */ + /* enter exclusive tilt mode */ mCanScale = false; mCanRotate = false; mDoTilt = true; @@ -317,25 +317,25 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen } else { r = Math.abs(r); if (r > PINCH_ROTATE_THRESHOLD) { - /* start rotate, disable tilt */ + /* start rotate, disable tilt */ mDoRotate = true; mCanTilt = false; mAngle = rad; } else if (!mDoScale) { - /* reduce pinch trigger by the amount of rotation */ + /* reduce pinch trigger by the amount of rotation */ deltaPinch *= 1 - (r / PINCH_ROTATE_THRESHOLD); } else { mPrevPinchWidth = pinchWidth; } } } else if (mDoScale && mEnableRotate) { - /* re-enable rotation when higher threshold is reached */ + /* re-enable rotation when higher threshold is reached */ double rad = Math.atan2(dy, dx); double r = rad - mAngle; if (r > PINCH_ROTATE_THRESHOLD2) { - /* start rotate again */ + /* start rotate again */ mDoRotate = true; mCanRotate = true; mAngle = rad; @@ -344,7 +344,7 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen if (mCanScale || mDoRotate) { if (!(mDoScale || mDoRotate)) { - /* enter exclusive scale mode */ + /* enter exclusive scale mode */ if (Math.abs(deltaPinch) > (dpi / PINCH_ZOOM_THRESHOLD)) { if (!mDoRotate) { diff --git a/vtm/src/org/oscim/layers/PathLayer.java b/vtm/src/org/oscim/layers/PathLayer.java index 245360b1..5ca34fd8 100644 --- a/vtm/src/org/oscim/layers/PathLayer.java +++ b/vtm/src/org/oscim/layers/PathLayer.java @@ -129,10 +129,10 @@ public class PathLayer extends Layer { public void addGreatCircle(GeoPoint startPoint, GeoPoint endPoint) { synchronized (mPoints) { - /* get the great circle path length in meters */ + /* get the great circle path length in meters */ double length = startPoint.distanceTo(endPoint); - /* add one point for every 100kms of the great circle path */ + /* add one point for every 100kms of the great circle path */ int numberOfPoints = (int) (length / 100000); addGreatCircle(startPoint, endPoint, numberOfPoints); diff --git a/vtm/src/org/oscim/layers/marker/ItemizedLayer.java b/vtm/src/org/oscim/layers/marker/ItemizedLayer.java index a13866da..c7a3a916 100644 --- a/vtm/src/org/oscim/layers/marker/ItemizedLayer.java +++ b/vtm/src/org/oscim/layers/marker/ItemizedLayer.java @@ -117,10 +117,10 @@ public class ItemizedLayer extends MarkerLayer * easily override behavior without resorting to overriding the * ItemGestureListener methods. */ - // @Override - // public boolean onTap(MotionEvent event, MapPosition pos) { - // return activateSelectedItems(event, mActiveItemSingleTap); - // } + // @Override + // public boolean onTap(MotionEvent event, MapPosition pos) { + // return activateSelectedItems(event, mActiveItemSingleTap); + // } protected boolean onSingleTapUpHelper(int index, Item item) { return mOnItemGestureListener.onItemSingleTapUp(index, item); } @@ -175,7 +175,7 @@ public class ItemizedLayer extends MarkerLayer int inside = -1; double insideY = -Double.MAX_VALUE; - /* squared dist: 50*50 pixel ~ 2mm on 400dpi */ + /* squared dist: 50*50 pixel ~ 2mm on 400dpi */ double dist = 2500; for (int i = 0; i < size; i++) { diff --git a/vtm/src/org/oscim/layers/marker/MarkerRenderer.java b/vtm/src/org/oscim/layers/marker/MarkerRenderer.java index 297e7291..b9904549 100644 --- a/vtm/src/org/oscim/layers/marker/MarkerRenderer.java +++ b/vtm/src/org/oscim/layers/marker/MarkerRenderer.java @@ -101,7 +101,7 @@ public class MarkerRenderer extends BucketRenderer { float cos = (float) Math.cos(angle); float sin = (float) Math.sin(angle); - /* check visibility */ + /* check visibility */ for (InternalItem it : mItems) { it.changes = false; it.x = (float) ((it.px - mx) * scale); @@ -131,10 +131,10 @@ public class MarkerRenderer extends BucketRenderer { //log.debug(numVisible + " " + changedVisible + " " + changesInvisible); - /* only update when zoomlevel changed, new items are visible + /* only update when zoomlevel changed, new items are visible * or more than 10 of the current items became invisible */ //if ((numVisible == 0) && (changedVisible == 0 && changesInvisible < 10)) - // return; + // return; buckets.clear(); if (numVisible == 0) { @@ -182,7 +182,7 @@ public class MarkerRenderer extends BucketRenderer { tmp[i] = it; it.item = mMarkerLayer.createItem(i); - /* pre-project points */ + /* pre-project points */ MercatorProjection.project(it.item.getPoint(), mMapPoint); it.px = mMapPoint.x; it.py = mMapPoint.y; @@ -228,24 +228,24 @@ public class MarkerRenderer extends BucketRenderer { } }; - // /** - // * Returns the Item at the given index. - // * - // * @param position - // * the position of the item to return - // * @return the Item of the given index. - // */ - // public final Item getItem(int position) { + // /** + // * Returns the Item at the given index. + // * + // * @param position + // * the position of the item to return + // * @return the Item of the given index. + // */ + // public final Item getItem(int position) { // - // synchronized (lock) { - // InternalItem item = mItems; - // for (int i = mSize - position - 1; i > 0 && item != null; i--) - // item = item.next; + // synchronized (lock) { + // InternalItem item = mItems; + // for (int i = mSize - position - 1; i > 0 && item != null; i--) + // item = item.next; // - // if (item != null) - // return item.item; + // if (item != null) + // return item.item; // - // return null; - // } - // } + // return null; + // } + // } } diff --git a/vtm/src/org/oscim/layers/tile/MapTile.java b/vtm/src/org/oscim/layers/tile/MapTile.java index 4790d4ab..f3df7ebd 100644 --- a/vtm/src/org/oscim/layers/tile/MapTile.java +++ b/vtm/src/org/oscim/layers/tile/MapTile.java @@ -247,7 +247,7 @@ public class MapTile extends Tile { node.child(i).refs--; } - /* removed all proxy references for this tile */ + /* removed all proxy references for this tile */ proxy = 0; if (state == DEADBEEF) { @@ -411,9 +411,9 @@ public class MapTile extends Tile { if (state == newState) return; - /* Renderer could have uploaded the tile while the layer - * was cleared. This prevents to set tile to READY state. */ - /* All other state changes are on the main-thread. */ + /* Renderer could have uploaded the tile while the layer + * was cleared. This prevents to set tile to READY state. */ + /* All other state changes are on the main-thread. */ if (state == DEADBEEF) return; diff --git a/vtm/src/org/oscim/layers/tile/TileManager.java b/vtm/src/org/oscim/layers/tile/TileManager.java index b54275b4..7187b84a 100644 --- a/vtm/src/org/oscim/layers/tile/TileManager.java +++ b/vtm/src/org/oscim/layers/tile/TileManager.java @@ -198,28 +198,28 @@ public class TileManager { mIndex.drop(); - /* Pass VBOs and VertexItems back to pools */ + /* Pass VBOs and VertexItems back to pools */ for (int i = 0; i < mTilesEnd; i++) { MapTile t = mTiles[i]; if (t == null) continue; - /* Check if tile is used by another thread */ + /* Check if tile is used by another thread */ if (!t.isLocked()) t.clear(); - /* In case the tile is still loading or used by + /* In case the tile is still loading or used by * another thread: clear when returned from loader - * or becomes unlocked */ + * or becomes unlocked */ t.setState(DEADBEEF); } - /* clear references to cached MapTiles */ + /* clear references to cached MapTiles */ Arrays.fill(mTiles, null); mTilesEnd = 0; mTilesCount = 0; - /* set up TileSet large enough to hold current tiles */ + /* set up TileSet large enough to hold current tiles */ int num = Math.max(mMap.getWidth(), mMap.getHeight()); int size = Tile.SIZE >> 1; int numTiles = (num * num) / (size * size) * 4; @@ -244,11 +244,11 @@ public class TileManager { init(); } /* clear JobQueue and set tiles to state == NONE. - * one could also append new tiles and sort in JobQueue - * but this has the nice side-effect that MapWorkers dont - * start with old jobs while new jobs are calculated, which - * should increase the chance that they are free when new - * jobs come in. */ + * one could also append new tiles and sort in JobQueue + * but this has the nice side-effect that MapWorkers dont + * start with old jobs while new jobs are calculated, which + * should increase the chance that they are free when new + * jobs come in. */ jobQueue.clear(); if (pos.zoomLevel < mMinZoom) { @@ -263,29 +263,29 @@ public class TileManager { int tileZoom = clamp(pos.zoomLevel, mMinZoom, mMaxZoom); if (mZoomTable == null) { - /* greater 1 when zoomed in further than - * tile zoomlevel, so [1..2] while whithin - * min/maxZoom */ + /* greater 1 when zoomed in further than + * tile zoomlevel, so [1..2] while whithin + * min/maxZoom */ double scaleDiv = pos.scale / (1 << tileZoom); mLoadParent = scaleDiv < 1.5; int zoomDiff = tileZoom - mPrevZoomlevel; if (zoomDiff == 1) { - /* dont switch zoomlevel up yet */ + /* dont switch zoomlevel up yet */ if (scaleDiv < mLevelUpThreshold) { tileZoom = mPrevZoomlevel; mLoadParent = false; } } else if (zoomDiff == -1) { - /* dont switch zoomlevel down yet */ + /* dont switch zoomlevel down yet */ if (scaleDiv > mLevelDownThreshold) { tileZoom = mPrevZoomlevel; mLoadParent = true; } } - // log.debug("p:{} {}:{}=>{} | {} <> {}", mLoadParent, - // mPrevZoomlevel, pos.zoomLevel, tileZoom, - // scaleDiv, (pos.scale / (1 << tileZoom))); + // log.debug("p:{} {}:{}=>{} | {} <> {}", mLoadParent, + // mPrevZoomlevel, pos.zoomLevel, tileZoom, + // scaleDiv, (pos.scale / (1 << tileZoom))); } else { mLoadParent = false; int match = 0; @@ -302,8 +302,8 @@ public class TileManager { mViewport.getMapExtents(mMapPlane, Tile.SIZE / 2); - /* scan visible tiles. callback function calls 'addTile' - * which updates mNewTiles */ + /* scan visible tiles. callback function calls 'addTile' + * which updates mNewTiles */ mNewTiles.cnt = 0; mScanBox.scan(pos.x, pos.y, pos.scale, tileZoom, mMapPlane); @@ -318,7 +318,7 @@ public class TileManager { Arrays.sort(newTiles, 0, newCnt, TileSet.coordComparator); if (!changed) { - /* compare if any tile has changed */ + /* compare if any tile has changed */ for (int i = 0; i < newCnt; i++) { if (newTiles[i] != curTiles[i]) { changed = true; @@ -329,13 +329,13 @@ public class TileManager { if (changed) { synchronized (mTilelock) { - /* lock new tiles */ + /* lock new tiles */ mNewTiles.lockTiles(); - /* unlock previous tiles */ + /* unlock previous tiles */ mCurrentTiles.releaseTiles(); - /* swap newTiles with currentTiles */ + /* swap newTiles with currentTiles */ TileSet tmp = mCurrentTiles; mCurrentTiles = mNewTiles; mNewTiles = tmp; @@ -343,11 +343,11 @@ public class TileManager { mUpdateSerial++; } - /* request rendering as tiles changed */ + /* request rendering as tiles changed */ mMap.render(); } - /* Add tile jobs to queue */ + /* Add tile jobs to queue */ if (mJobs.isEmpty()) return false; @@ -355,7 +355,7 @@ public class TileManager { jobs = mJobs.toArray(jobs); updateDistances(jobs, jobs.length, pos); - /* sets tiles to state == LOADING */ + /* sets tiles to state == LOADING */ jobQueue.setJobs(jobs); mJobs.clear(); @@ -369,7 +369,7 @@ public class TileManager { } } - /* limit cache items */ + /* limit cache items */ int remove = mTilesCount - (mCacheLimit - mCacheReduce); if (remove > CACHE_THRESHOLD || mTilesToUpload > MAX_TILES_IN_QUEUE) { @@ -411,7 +411,7 @@ public class TileManager { if (tileSet.serial == mUpdateSerial) return false; - /* do not flip mNew/mCurrentTiles while copying */ + /* do not flip mNew/mCurrentTiles while copying */ synchronized (mTilelock) { tileSet.setTiles(mCurrentTiles); tileSet.serial = mUpdateSerial; @@ -434,13 +434,13 @@ public class TileManager { } if (mLoadParent && (zoomLevel > mMinZoom) && (mZoomTable == null)) { - /* prefetch parent */ + /* prefetch parent */ MapTile p = tile.node.parent(); if (p == null) { TileNode n = mIndex.add(x >> 1, y >> 1, zoomLevel - 1); p = n.item = new MapTile(n, x >> 1, y >> 1, zoomLevel - 1); addToCache(p); - /* this prevents to add tile twice to queue */ + /* this prevents to add tile twice to queue */ p.setState(LOADING); mJobs.add(p); } else if (!p.isActive()) { @@ -456,8 +456,8 @@ public class TileManager { if (mTilesEnd == mTiles.length) { if (mTilesEnd > mTilesCount) { TileDistanceSort.sort(mTiles, 0, mTilesEnd); - /* sorting also repacks the 'sparse' filled array - * so end of mTiles is at mTilesCount now */ + /* sorting also repacks the 'sparse' filled array + * so end of mTiles is at mTilesCount now */ mTilesEnd = mTilesCount; } @@ -474,8 +474,8 @@ public class TileManager { } private boolean removeFromCache(MapTile t) { - /* TODO check valid states here:When in CANCEL state tile belongs to - * TileLoader thread, defer clearing to jobCompleted() */ + /* TODO check valid states here:When in CANCEL state tile belongs to + * TileLoader thread, defer clearing to jobCompleted() */ if (dbg) log.debug("remove from cache {} {} {}", @@ -497,10 +497,10 @@ public class TileManager { private void limitCache(MapPosition pos, int remove) { MapTile[] tiles = mTiles; - /* count tiles that have new data */ + /* count tiles that have new data */ int newTileCnt = 0; - /* remove tiles that were never loaded */ + /* remove tiles that were never loaded */ for (int i = 0; i < mTilesEnd; i++) { MapTile t = tiles[i]; if (t == null) @@ -516,7 +516,7 @@ public class TileManager { continue; } - /* make sure tile cannot be used by GL or MapWorker Thread */ + /* make sure tile cannot be used by GL or MapWorker Thread */ if (t.state(NONE) && removeFromCache(t)) { tiles[i] = null; remove--; @@ -529,16 +529,16 @@ public class TileManager { updateDistances(tiles, mTilesEnd, pos); TileDistanceSort.sort(tiles, 0, mTilesEnd); - /* sorting also repacks the 'sparse' filled array - * so end of mTiles is at mTilesCount now */ + /* sorting also repacks the 'sparse' filled array + * so end of mTiles is at mTilesCount now */ mTilesEnd = mTilesCount; - /* start with farest away tile */ + /* start with farest away tile */ for (int i = mTilesCount - 1; i >= 0 && remove > 0; i--) { MapTile t = tiles[i]; - /* dont remove tile used by TileRenderer, or somewhere else - * try again in next run. */ + /* dont remove tile used by TileRenderer, or somewhere else + * try again in next run. */ if (t.isLocked()) { if (dbg) log.debug("{} locked (state={}, d={})", @@ -550,7 +550,7 @@ public class TileManager { continue; } - /* cancel loading of tiles that should not even be cached */ + /* cancel loading of tiles that should not even be cached */ if (t.state(LOADING)) { t.setState(CANCEL); if (dbg) @@ -558,7 +558,7 @@ public class TileManager { continue; } - /* clear new and unused tile */ + /* clear new and unused tile */ if (t.state(NEW_DATA)) { newTileCnt--; if (dbg) @@ -596,11 +596,11 @@ public class TileManager { */ public void jobCompleted(MapTile tile, QueryResult result) { - /* send TILE_LOADED event on main-loop */ + /* send TILE_LOADED event on main-loop */ mMap.post(new JobCompletedEvent(tile, result)); - /* locked means the tile is visible or referenced by - * a tile that might be visible. */ + /* locked means the tile is visible or referenced by + * a tile that might be visible. */ if (tile.isLocked()) { if (result == QueryResult.DELAYED && tile.isLocked()) mMap.updateMap(false); @@ -631,7 +631,7 @@ public class TileManager { tile, result, tile.state()); - /* got orphaned tile */ + /* got orphaned tile */ if (tile.state(DEADBEEF)) { tile.clear(); return; @@ -642,7 +642,7 @@ public class TileManager { } private static void updateDistances(MapTile[] tiles, int size, MapPosition pos) { - /* TODO there is probably a better quad-tree distance function */ + /* TODO there is probably a better quad-tree distance function */ int zoom = 20; long x = (long) (pos.x * (1 << zoom)); long y = (long) (pos.y * (1 << zoom)); @@ -696,7 +696,7 @@ public class TileManager { int xx = x; if (x < 0 || x >= xmax) { - /* flip-around date line */ + /* flip-around date line */ if (x < 0) xx = xmax + x; else @@ -706,7 +706,7 @@ public class TileManager { continue; } - /* check if tile is already added */ + /* check if tile is already added */ for (int i = 0; i < cnt; i++) if (tiles[i].tileX == xx && tiles[i].tileY == y) { tile = tiles[i]; diff --git a/vtm/src/org/oscim/layers/tile/TileRenderer.java b/vtm/src/org/oscim/layers/tile/TileRenderer.java index bff8422d..c4867801 100644 --- a/vtm/src/org/oscim/layers/tile/TileRenderer.java +++ b/vtm/src/org/oscim/layers/tile/TileRenderer.java @@ -88,11 +88,11 @@ public abstract class TileRenderer extends LayerRenderer { return; } - /* keep constant while rendering frame */ + /* keep constant while rendering frame */ mLayerAlpha = mAlpha; mOverdrawColor = mOverdraw; - /* get current tiles to draw */ + /* get current tiles to draw */ synchronized (tilelock) { boolean tilesChanged = mTileManager.getActiveTiles(mDrawTiles); @@ -102,10 +102,10 @@ public abstract class TileRenderer extends LayerRenderer { return; } - /* update isVisible flag true for tiles that intersect view */ + /* update isVisible flag true for tiles that intersect view */ if (tilesChanged || v.changed()) { - /* lock tiles while updating isVisible state */ + /* lock tiles while updating isVisible state */ mProxyTileCnt = 0; MapTile[] tiles = mDrawTiles.tiles; @@ -114,7 +114,7 @@ public abstract class TileRenderer extends LayerRenderer { for (int i = 0; i < mDrawTiles.cnt; i++) tiles[i].isVisible = false; - /* check visibile tiles */ + /* check visibile tiles */ mScanBox.scan(v.pos.x, v.pos.y, v.pos.scale, tileZoom, v.plane); } } @@ -128,8 +128,8 @@ public abstract class TileRenderer extends LayerRenderer { public void clearTiles() { synchronized (tilelock) { - /* Clear all references to MapTiles as all current - * tiles will also be removed from TileManager. */ + /* Clear all references to MapTiles as all current + * tiles will also be removed from TileManager. */ mDrawTiles.releaseTiles(); mDrawTiles.tiles = new MapTile[1]; mDrawTiles.cnt = 0; @@ -156,7 +156,7 @@ public abstract class TileRenderer extends LayerRenderer { continue; } - /* load tile that is referenced by this holder */ + /* load tile that is referenced by this holder */ MapTile proxy = tile.holder; if (proxy != null && proxy.state(NEW_DATA)) { uploadCnt += uploadTileData(proxy); @@ -164,11 +164,11 @@ public abstract class TileRenderer extends LayerRenderer { continue; } - /* check near relatives than can serve as proxy */ + /* check near relatives than can serve as proxy */ proxy = tile.getProxy(PROXY_PARENT, NEW_DATA); if (proxy != null) { uploadCnt += uploadTileData(proxy); - /* dont load child proxies */ + /* dont load child proxies */ continue; } @@ -188,7 +188,7 @@ public abstract class TileRenderer extends LayerRenderer { tile.setState(READY); RenderBuckets buckets = tile.getBuckets(); - /* tile might only contain label layers */ + /* tile might only contain label layers */ if (buckets == null) return 0; @@ -217,18 +217,18 @@ public abstract class TileRenderer extends LayerRenderer { int prevSerial = tileSet.serial; - /* ensure tiles keep visible state */ + /* ensure tiles keep visible state */ synchronized (tilelock) { MapTile[] newTiles = mDrawTiles.tiles; int cnt = mDrawTiles.cnt; - /* ensure same size */ + /* ensure same size */ if (tileSet.tiles.length != newTiles.length) { tileSet.tiles = new MapTile[newTiles.length]; } - /* lock tiles to not be removed from cache */ + /* lock tiles to not be removed from cache */ tileSet.cnt = 0; for (int i = 0; i < cnt; i++) { MapTile t = newTiles[i]; @@ -236,7 +236,7 @@ public abstract class TileRenderer extends LayerRenderer { t.lock(); } - /* unlock previous tiles */ + /* unlock previous tiles */ tileSet.releaseTiles(); for (int i = 0; i < cnt; i++) { @@ -271,8 +271,8 @@ public abstract class TileRenderer extends LayerRenderer { t.isVisible = true; } - /* add placeholder tiles to show both sides - * of date line. a little too complicated... */ + /* add placeholder tiles to show both sides + * of date line. a little too complicated... */ int xmax = 1 << mZoom; if (x1 >= 0 && x2 < xmax) return; @@ -326,7 +326,7 @@ public abstract class TileRenderer extends LayerRenderer { public static long getMinFade(MapTile tile, int proxyLevel) { long minFade = MapRenderer.frametime - 50; - /* check children for grandparent, parent or current */ + /* check children for grandparent, parent or current */ if (proxyLevel <= 0) { for (int c = 0; c < 4; c++) { MapTile ci = tile.node.child(c); @@ -336,9 +336,9 @@ public abstract class TileRenderer extends LayerRenderer { if (ci.fadeTime > 0 && ci.fadeTime < minFade) minFade = ci.fadeTime; - /* when drawing the parent of the current level - * we also check if the children of current level - * are visible */ + /* when drawing the parent of the current level + * we also check if the children of current level + * are visible */ if (proxyLevel >= -1) { long m = getMinFade(ci, proxyLevel - 1); if (m < minFade) @@ -347,7 +347,7 @@ public abstract class TileRenderer extends LayerRenderer { } } - /* check parents for child, current or parent */ + /* check parents for child, current or parent */ TileNode p = tile.node.parent; for (int i = proxyLevel; i >= -1; i--) { diff --git a/vtm/src/org/oscim/layers/tile/TileSet.java b/vtm/src/org/oscim/layers/tile/TileSet.java index 919e2279..cf16318f 100644 --- a/vtm/src/org/oscim/layers/tile/TileSet.java +++ b/vtm/src/org/oscim/layers/tile/TileSet.java @@ -81,7 +81,7 @@ public final class TileSet { /* lock tiles (and their proxies) to not be removed from cache */ source.lockTiles(); - /* unlock previous tiles */ + /* unlock previous tiles */ releaseTiles(); if (source.tiles.length != tiles.length) { diff --git a/vtm/src/org/oscim/layers/tile/VectorTileRenderer.java b/vtm/src/org/oscim/layers/tile/VectorTileRenderer.java index a26043f1..41670e70 100644 --- a/vtm/src/org/oscim/layers/tile/VectorTileRenderer.java +++ b/vtm/src/org/oscim/layers/tile/VectorTileRenderer.java @@ -47,7 +47,7 @@ public class VectorTileRenderer extends TileRenderer { @Override public synchronized void render(GLViewport v) { - /* discard depth projection from tilt, depth buffer + /* discard depth projection from tilt, depth buffer * is used for clipping */ mClipProj.copy(v.proj); mClipProj.setValue(10, 0); @@ -71,9 +71,9 @@ public class VectorTileRenderer extends TileRenderer { gl.depthMask(true); gl.clear(GL.DEPTH_BUFFER_BIT); - /* always write depth for non-proxy tiles + /* always write depth for non-proxy tiles * this is used in drawProxies pass to not - * draw where tiles were already drawn */ + * draw where tiles were already drawn */ gl.depthFunc(GL.ALWAYS); mClipMode = PolygonBucket.CLIP_DEPTH; @@ -83,24 +83,24 @@ public class VectorTileRenderer extends TileRenderer { } } - /* draw visible tiles */ + /* draw visible tiles */ for (int i = 0; i < tileCnt; i++) { MapTile t = tiles[i]; if (t.isVisible && t.state(READY)) drawTile(t, v, 0); } - /* draw parent or children as proxy for visibile tiles that dont - * have data yet. Proxies are clipped to the region where nothing - * was drawn to depth buffer. - * TODO draw proxies for placeholder */ + /* draw parent or children as proxy for visibile tiles that dont + * have data yet. Proxies are clipped to the region where nothing + * was drawn to depth buffer. + * TODO draw proxies for placeholder */ if (!drawProxies) return; - /* only draw where no other tile is drawn */ + /* only draw where no other tile is drawn */ gl.depthFunc(GL.LESS); - /* draw child or parent proxies */ + /* draw child or parent proxies */ boolean preferParent = (v.pos.getZoomScale() < 1.5) || (v.pos.zoomLevel < tiles[0].zoomLevel); @@ -127,7 +127,7 @@ public class VectorTileRenderer extends TileRenderer { } } - /* draw grandparents */ + /* draw grandparents */ for (int i = 0; i < tileCnt; i++) { MapTile t = tiles[i]; if ((!t.isVisible) || (t.lastDraw == mDrawSerial)) @@ -137,19 +137,19 @@ public class VectorTileRenderer extends TileRenderer { gl.depthMask(false); - /* make sure stencil buffer write is disabled */ + /* make sure stencil buffer write is disabled */ //GL.stencilMask(0x00); } private void drawTile(MapTile tile, GLViewport v, int proxyLevel) { - /* ensure to draw parents only once */ + /* ensure to draw parents only once */ if (tile.lastDraw == mDrawSerial) return; tile.lastDraw = mDrawSerial; - /* use holder proxy when it is set */ + /* use holder proxy when it is set */ RenderBuckets buckets = (tile.holder == null) ? tile.getBuckets() : tile.holder.getBuckets(); @@ -160,14 +160,14 @@ public class VectorTileRenderer extends TileRenderer { } MapPosition pos = v.pos; - /* place tile relative to map position */ + /* place tile relative to map position */ int z = tile.zoomLevel; float div = FastMath.pow(z - pos.zoomLevel); double tileScale = Tile.SIZE * pos.scale; float x = (float) ((tile.x - pos.x) * tileScale); float y = (float) ((tile.y - pos.y) * tileScale); - /* scale relative to zoom-level of this tile */ + /* scale relative to zoom-level of this tile */ float scale = (float) (pos.scale / (1 << z)); v.mvp.setTransScale(x, y, scale / COORD_SCALE); @@ -186,7 +186,7 @@ public class VectorTileRenderer extends TileRenderer { case POLYGON: b = PolygonBucket.Renderer.draw(b, v, div, first); first = false; - /* set test for clip to tile region */ + /* set test for clip to tile region */ gl.stencilFunc(GL.EQUAL, 0x80, 0x80); break; case LINE: @@ -205,13 +205,13 @@ public class VectorTileRenderer extends TileRenderer { b = BitmapBucket.Renderer.draw(b, v, 1, mLayerAlpha); break; default: - /* just in case */ + /* just in case */ log.error("unknown layer {}", b.type); b = b.next; break; } - /* make sure buffers are bound again */ + /* make sure buffers are bound again */ buckets.bind(); } @@ -231,7 +231,7 @@ public class VectorTileRenderer extends TileRenderer { if (tile.holder == null) { fadeTime = getMinFade(tile, proxyLevel); } else { - /* need to use time from original tile */ + /* need to use time from original tile */ fadeTime = tile.holder.fadeTime; if (fadeTime == 0) fadeTime = getMinFade(tile.holder, proxyLevel); diff --git a/vtm/src/org/oscim/layers/tile/bitmap/BitmapTileLayer.java b/vtm/src/org/oscim/layers/tile/bitmap/BitmapTileLayer.java index cdd701ea..ace525cc 100644 --- a/vtm/src/org/oscim/layers/tile/bitmap/BitmapTileLayer.java +++ b/vtm/src/org/oscim/layers/tile/bitmap/BitmapTileLayer.java @@ -117,30 +117,30 @@ public class BitmapTileLayer extends TileLayer { */ final TexturePool pool = new TexturePool(POOL_FILL) { - // int sum = 0; + // int sum = 0; // - // public TextureItem release(TextureItem item) { - // log.debug(getFill() + " " + sum + " release tex " + item.id); - // return super.release(item); - // }; + // public TextureItem release(TextureItem item) { + // log.debug(getFill() + " " + sum + " release tex " + item.id); + // return super.release(item); + // }; // - // public synchronized TextureItem get() { - // log.debug(getFill() + " " + sum + " get tex "); + // public synchronized TextureItem get() { + // log.debug(getFill() + " " + sum + " get tex "); // - // return super.get(); - // }; + // return super.get(); + // }; // - // protected TextureItem createItem() { - // log.debug(getFill() + " " + (sum++) + " create tex "); + // protected TextureItem createItem() { + // log.debug(getFill() + " " + (sum++) + " create tex "); // - // return super.createItem(); - // }; + // return super.createItem(); + // }; // - // protected void freeItem(TextureItem t) { - // log.debug(getFill() + " " + (sum--) + " free tex "); - // super.freeItem(t); + // protected void freeItem(TextureItem t) { + // log.debug(getFill() + " " + (sum--) + " free tex "); + // super.freeItem(t); // - // }; + // }; }; } diff --git a/vtm/src/org/oscim/layers/tile/buildings/BuildingLayer.java b/vtm/src/org/oscim/layers/tile/buildings/BuildingLayer.java index 71b4e22d..b779f70f 100644 --- a/vtm/src/org/oscim/layers/tile/buildings/BuildingLayer.java +++ b/vtm/src/org/oscim/layers/tile/buildings/BuildingLayer.java @@ -87,7 +87,7 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook { if (v != null) minHeight = Integer.parseInt(v); - /* 12m default */ + /* 12m default */ if (height == 0) height = 12 * 100; @@ -130,27 +130,27 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook { get(tile).setBuckets(null); } - // private int multi; - // @Override - // public void onInputEvent(Event event, MotionEvent e) { - // int action = e.getAction() & MotionEvent.ACTION_MASK; - // if (action == MotionEvent.ACTION_POINTER_DOWN) { - // multi++; - // } else if (action == MotionEvent.ACTION_POINTER_UP) { - // multi--; - // if (!mActive && mAlpha > 0) { - // // finish hiding - // //log.debug("add multi hide timer " + mAlpha); - // addShowTimer(mFadeTime * mAlpha, false); - // } - // } else if (action == MotionEvent.ACTION_CANCEL) { - // multi = 0; - // log.debug("cancel " + multi); - // if (mTimer != null) { - // mTimer.cancel(); - // mTimer = null; - // } - // } - // } + // private int multi; + // @Override + // public void onInputEvent(Event event, MotionEvent e) { + // int action = e.getAction() & MotionEvent.ACTION_MASK; + // if (action == MotionEvent.ACTION_POINTER_DOWN) { + // multi++; + // } else if (action == MotionEvent.ACTION_POINTER_UP) { + // multi--; + // if (!mActive && mAlpha > 0) { + // // finish hiding + // //log.debug("add multi hide timer " + mAlpha); + // addShowTimer(mFadeTime * mAlpha, false); + // } + // } else if (action == MotionEvent.ACTION_CANCEL) { + // multi = 0; + // log.debug("cancel " + multi); + // if (mTimer != null) { + // mTimer.cancel(); + // mTimer = null; + // } + // } + // } } diff --git a/vtm/src/org/oscim/layers/tile/buildings/BuildingRenderer.java b/vtm/src/org/oscim/layers/tile/buildings/BuildingRenderer.java index fe82e901..4e538cba 100644 --- a/vtm/src/org/oscim/layers/tile/buildings/BuildingRenderer.java +++ b/vtm/src/org/oscim/layers/tile/buildings/BuildingRenderer.java @@ -54,7 +54,7 @@ public class BuildingRenderer extends ExtrusionRenderer { int diff = (v.pos.zoomLevel - mZoomMin); - /* if below min zoom or already faded out */ + /* if below min zoom or already faded out */ if (diff < -1) { mAlpha = 0; mShow = false; @@ -100,12 +100,12 @@ public class BuildingRenderer extends ExtrusionRenderer { MapTile[] tiles = mTileSet.tiles; TileDistanceSort.sort(tiles, 0, mTileSet.cnt); - /* keep a list of tiles available for rendering */ + /* keep a list of tiles available for rendering */ int maxTiles = mTileSet.cnt * 4; if (mExtrusionBucketSet.length < maxTiles) mExtrusionBucketSet = new ExtrusionBuckets[maxTiles]; - /* compile one tile max per frame */ + /* compile one tile max per frame */ boolean compiled = false; int activeTiles = 0; @@ -134,9 +134,9 @@ public class BuildingRenderer extends ExtrusionRenderer { if (t == null) continue; - // for (MapTile c : mTiles) - // if (c == t) - // continue O; + // for (MapTile c : mTiles) + // if (c == t) + // continue O; ExtrusionBuckets ebs = getBuckets(t); if (ebs == null) @@ -151,7 +151,7 @@ public class BuildingRenderer extends ExtrusionRenderer { } } } else if (zoom == mZoomMin - 1) { - /* check if proxy children are ready */ + /* check if proxy children are ready */ for (int i = 0; i < mTileSet.cnt; i++) { MapTile t = tiles[i]; for (byte j = 0; j < 4; j++) { @@ -169,7 +169,7 @@ public class BuildingRenderer extends ExtrusionRenderer { } } - /* load more tiles on next frame */ + /* load more tiles on next frame */ if (compiled) MapRenderer.animate(); @@ -189,7 +189,7 @@ public class BuildingRenderer extends ExtrusionRenderer { public void render(GLViewport v) { super.render(v); - /* release lock on tile data */ + /* release lock on tile data */ mTileRenderer.releaseTiles(mTileSet); } diff --git a/vtm/src/org/oscim/layers/tile/buildings/S3DBTileLoader.java b/vtm/src/org/oscim/layers/tile/buildings/S3DBTileLoader.java index 37b0eba0..3656479b 100644 --- a/vtm/src/org/oscim/layers/tile/buildings/S3DBTileLoader.java +++ b/vtm/src/org/oscim/layers/tile/buildings/S3DBTileLoader.java @@ -111,7 +111,7 @@ class S3DBTileLoader extends TileLoader { boolean isRoof = element.tags.containsKey(ROOF_KEY); //if (isRoof) - // log.debug(element.tags.toString()); + // log.debug(element.tags.toString()); int c = 0; if (element.tags.containsKey(COLOR_KEY)) { diff --git a/vtm/src/org/oscim/layers/tile/vector/VectorTileLayer.java b/vtm/src/org/oscim/layers/tile/vector/VectorTileLayer.java index 65bcd21a..8835f1d0 100644 --- a/vtm/src/org/oscim/layers/tile/vector/VectorTileLayer.java +++ b/vtm/src/org/oscim/layers/tile/vector/VectorTileLayer.java @@ -108,13 +108,13 @@ public class VectorTileLayer extends TileLayer { public void setRenderTheme(IRenderTheme theme) { /* wait for loaders to finish all current jobs to * not change theme instance hold by loader instance - * while running */ + * while running */ pauseLoaders(true); mTileManager.clearJobs(); mTheme = theme; - // for (TileLoader l : mTileLoader) - // ((VectorTileLoader) l).setRenderTheme(theme); + // for (TileLoader l : mTileLoader) + // ((VectorTileLoader) l).setRenderTheme(theme); tileRenderer().setOverdrawColor(theme.getMapBackground()); @@ -203,8 +203,8 @@ public class VectorTileLayer extends TileLayer { } public void callHooksComplete(MapTile tile, boolean success) { - /* NB: cannot use internal iterater as this function - * is called concurently by TileLoaders */ + /* NB: cannot use internal iterater as this function + * is called concurently by TileLoaders */ LList th = mLoaderThemeHooks.head(); while (th != null) { diff --git a/vtm/src/org/oscim/layers/tile/vector/VectorTileLoader.java b/vtm/src/org/oscim/layers/tile/vector/VectorTileLoader.java index 71171233..258673a7 100644 --- a/vtm/src/org/oscim/layers/tile/vector/VectorTileLoader.java +++ b/vtm/src/org/oscim/layers/tile/vector/VectorTileLoader.java @@ -119,13 +119,13 @@ public class VectorTileLoader extends TileLoader implements RenderStyle.Callback //mTileLayer.getLoaderHooks(); - /* account for area changes with latitude */ + /* account for area changes with latitude */ double lat = MercatorProjection.toLatitude(tile.y); mLineScale = (float) Math.pow(STROKE_INCREASE, tile.zoomLevel - STROKE_MIN_ZOOM); if (mLineScale < 1) mLineScale = 1; - /* scale line width relative to latitude + PI * thumb */ + /* scale line width relative to latitude + PI * thumb */ mLineScale *= 0.4f + 0.6f * ((float) Math.sin(Math.abs(lat) * (Math.PI / 180))); mBuckets = new RenderBuckets(); tile.data = mBuckets; @@ -150,7 +150,7 @@ public class VectorTileLoader extends TileLoader implements RenderStyle.Callback mTileLayer.callHooksComplete(mTile, ok); - /* finish buckets- tessellate and cleanup on worker-thread */ + /* finish buckets- tessellate and cleanup on worker-thread */ mBuckets.prepare(); clearState(); @@ -205,7 +205,7 @@ public class VectorTileLoader extends TileLoader implements RenderStyle.Callback mElement = element; - /* get and apply render instructions */ + /* get and apply render instructions */ if (element.type == GeometryType.POINT) { renderNode(renderTheme.matchElement(element.type, tags, mTile.zoomLevel)); } else { @@ -265,7 +265,7 @@ public class VectorTileLoader extends TileLoader implements RenderStyle.Callback lb.addLine(mElement); - /* keep reference for outline layer(s) */ + /* keep reference for outline layer(s) */ mCurLineBucket = lb; } else { diff --git a/vtm/src/org/oscim/layers/tile/vector/labeling/Debug.java b/vtm/src/org/oscim/layers/tile/vector/labeling/Debug.java index 45b4acca..7bb583ea 100644 --- a/vtm/src/org/oscim/layers/tile/vector/labeling/Debug.java +++ b/vtm/src/org/oscim/layers/tile/vector/labeling/Debug.java @@ -79,18 +79,18 @@ class Debug { } public static void draw(MapPosition pos, GLViewport m, RenderBuckets layers) { - // if (layers.baseLayers != null) { - // //setMatrix(pos, m, true); + // if (layers.baseLayers != null) { + // //setMatrix(pos, m, true); // - // for (RenderElement l = layers.baseLayers; l != null;) { - // if (l.type == RenderElement.POLYGON) { - // l = PolygonLayer.Renderer.draw(pos, l, m, true, 1, false); - // } else { - // //float div = (float) (mMapPosition.scale / (1 << pos.zoomLevel)); - // l = LineLayer.Renderer.draw(layers, l, pos, m, div); - // } - // } - // } + // for (RenderElement l = layers.baseLayers; l != null;) { + // if (l.type == RenderElement.POLYGON) { + // l = PolygonLayer.Renderer.draw(pos, l, m, true, 1, false); + // } else { + // //float div = (float) (mMapPosition.scale / (1 << pos.zoomLevel)); + // l = LineLayer.Renderer.draw(layers, l, pos, m, div); + // } + // } + // } } } diff --git a/vtm/src/org/oscim/layers/tile/vector/labeling/LabelLayer.java b/vtm/src/org/oscim/layers/tile/vector/labeling/LabelLayer.java index e877efc2..62e94732 100644 --- a/vtm/src/org/oscim/layers/tile/vector/labeling/LabelLayer.java +++ b/vtm/src/org/oscim/layers/tile/vector/labeling/LabelLayer.java @@ -103,22 +103,22 @@ public class LabelLayer extends Layer implements Map.UpdateListener, TileManager mWorker.submit(MAX_RELABEL_DELAY); } - // @Override - // public void onMotionEvent(MotionEvent e) { - // // int action = e.getAction() & MotionEvent.ACTION_MASK; - // // if (action == MotionEvent.ACTION_POINTER_DOWN) { - // // multi++; - // // mTextRenderer.hold(true); - // // } else if (action == MotionEvent.ACTION_POINTER_UP) { - // // multi--; - // // if (multi == 0) - // // mTextRenderer.hold(false); - // // } else if (action == MotionEvent.ACTION_CANCEL) { - // // multi = 0; - // // log.debug("cancel " + multi); - // // mTextRenderer.hold(false); - // // } - // } + // @Override + // public void onMotionEvent(MotionEvent e) { + // // int action = e.getAction() & MotionEvent.ACTION_MASK; + // // if (action == MotionEvent.ACTION_POINTER_DOWN) { + // // multi++; + // // mTextRenderer.hold(true); + // // } else if (action == MotionEvent.ACTION_POINTER_UP) { + // // multi--; + // // if (multi == 0) + // // mTextRenderer.hold(false); + // // } else if (action == MotionEvent.ACTION_CANCEL) { + // // multi = 0; + // // log.debug("cancel " + multi); + // // mTextRenderer.hold(false); + // // } + // } @Override public void onTileManagerEvent(Event e, MapTile tile) { diff --git a/vtm/src/org/oscim/layers/tile/vector/labeling/LabelPlacement.java b/vtm/src/org/oscim/layers/tile/vector/labeling/LabelPlacement.java index 1654dd56..f208ead3 100644 --- a/vtm/src/org/oscim/layers/tile/vector/labeling/LabelPlacement.java +++ b/vtm/src/org/oscim/layers/tile/vector/labeling/LabelPlacement.java @@ -177,11 +177,11 @@ public class LabelPlacement { if (ti.text.caption) continue; - /* acquire a TextItem to add to TextLayer */ + /* acquire a TextItem to add to TextLayer */ if (l == null) l = getLabel(); - /* check if path at current scale is long enough */ + /* check if path at current scale is long enough */ if (!dbg && ti.width > ti.length * scale) continue; @@ -277,7 +277,7 @@ public class LabelPlacement { boolean updateLabels(LabelTask work) { - /* get current tiles */ + /* get current tiles */ boolean changedTiles = mTileRenderer.getVisibleTiles(mTileSet); if (mTileSet.cnt == 0) { @@ -287,7 +287,7 @@ public class LabelPlacement { MapPosition pos = work.pos; boolean changedPos = mMap.viewport().getMapPosition(pos); - /* do not loop! */ + /* do not loop! */ if (!changedTiles && !changedPos) return false; @@ -296,12 +296,12 @@ public class LabelPlacement { MapTile[] tiles = mTileSet.tiles; int zoom = tiles[0].zoomLevel; - /* estimation for visible area to be labeled */ + /* estimation for visible area to be labeled */ int mw = (mMap.getWidth() + Tile.SIZE) / 2; int mh = (mMap.getHeight() + Tile.SIZE) / 2; mSquareRadius = mw * mw + mh * mh; - /* scale of tiles zoom-level relative to current position */ + /* scale of tiles zoom-level relative to current position */ double scale = pos.scale / (1 << zoom); double angle = Math.toRadians(pos.bearing); @@ -317,14 +317,14 @@ public class LabelPlacement { double tileX = (pos.x * (Tile.SIZE << zoom)); double tileY = (pos.y * (Tile.SIZE << zoom)); - /* put current label to previous label */ + /* put current label to previous label */ Label prevLabels = mLabels; - /* new labels */ + /* new labels */ mLabels = null; Label l = null; - /* add currently active labels first */ + /* add currently active labels first */ for (l = prevLabels; l != null; ) { if (l.text.caption) { @@ -381,7 +381,7 @@ public class LabelPlacement { l = mPool.releaseAndGetNext(l); } - /* add way labels */ + /* add way labels */ for (int i = 0, n = mTileSet.cnt; i < n; i++) { MapTile t = tiles[i]; if (!t.state(READY | NEW_DATA)) @@ -394,7 +394,7 @@ public class LabelPlacement { l = addWayLabels(t, l, dx, dy, scale); } - /* add caption */ + /* add caption */ for (int i = 0, n = mTileSet.cnt; i < n; i++) { MapTile t = tiles[i]; if (!t.state(READY | NEW_DATA)) @@ -421,7 +421,7 @@ public class LabelPlacement { continue; } - /* flip way label orientation */ + /* flip way label orientation */ if (cos * (ti.x2 - ti.x1) - sin * (ti.y2 - ti.y1) < 0) { float tmp = ti.x1; ti.x1 = ti.x2; @@ -433,7 +433,7 @@ public class LabelPlacement { } } - /* add symbol items */ + /* add symbol items */ for (int i = 0, n = mTileSet.cnt; i < n; i++) { MapTile t = tiles[i]; if (!t.state(READY | NEW_DATA)) @@ -466,15 +466,15 @@ public class LabelPlacement { } } - /* temporary used Label */ + /* temporary used Label */ l = (Label) mPool.release(l); - /* draw text to bitmaps and create vertices */ + /* draw text to bitmaps and create vertices */ work.textLayer.labels = groupLabels(mLabels); work.textLayer.prepare(); work.textLayer.labels = null; - /* remove tile locks */ + /* remove tile locks */ mTileRenderer.releaseTiles(mTileSet); return true; @@ -495,7 +495,7 @@ public class LabelPlacement { TextStyle t = cur.text; float w = cur.width; - /* iterate through following */ + /* iterate through following */ for (Label l = (Label) cur.next; l != null; l = (Label) l.next) { if (w != l.width || t != l.text || !cur.string.equals(l.string)) { @@ -508,18 +508,18 @@ public class LabelPlacement { } l.string = cur.string; - /* insert l after cur */ + /* insert l after cur */ Label tmp = (Label) cur.next; cur.next = l; - /* continue outer loop at l */ + /* continue outer loop at l */ cur = l; - /* remove l from previous place */ + /* remove l from previous place */ p.next = l.next; l.next = tmp; - /* continue from previous */ + /* continue from previous */ l = p; } } diff --git a/vtm/src/org/oscim/layers/tile/vector/labeling/WayDecorator.java b/vtm/src/org/oscim/layers/tile/vector/labeling/WayDecorator.java index a20d4910..a76c0e53 100644 --- a/vtm/src/org/oscim/layers/tile/vector/labeling/WayDecorator.java +++ b/vtm/src/org/oscim/layers/tile/vector/labeling/WayDecorator.java @@ -52,32 +52,32 @@ public final class WayDecorator { //int clip; //if ((clip = clipper.clipNext(curX, curY)) != 0) { - // if (clip < 0) { - // prevX = clipper.out[0]; - // prevY = clipper.out[1]; - // curX = clipper.out[2]; - // curY = clipper.out[3]; + // if (clip < 0) { + // prevX = clipper.out[0]; + // prevY = clipper.out[1]; + // curX = clipper.out[2]; + // curY = clipper.out[3]; // - // if (prevX == min) - // edge |= 1 << 0; - // else if (prevX == max) - // edge |= 1 << 1; + // if (prevX == min) + // edge |= 1 << 0; + // else if (prevX == max) + // edge |= 1 << 1; // - // if (prevY == min) - // edge |= 1 << 2; - // else if (prevY == max) - // edge |= 1 << 3; + // if (prevY == min) + // edge |= 1 << 2; + // else if (prevY == max) + // edge |= 1 << 3; // - // if (curX == min) - // edge |= 1 << 4; - // else if (curX == max) - // edge |= 1 << 5; + // if (curX == min) + // edge |= 1 << 4; + // else if (curX == max) + // edge |= 1 << 5; // - // if (curY == min) - // edge |= 1 << 5; - // else if (curY == max) - // edge |= 1 << 6; - // } + // if (curY == min) + // edge |= 1 << 5; + // else if (curY == max) + // edge |= 1 << 6; + // } //} int last = i; @@ -101,13 +101,13 @@ public final class WayDecorator { float nextY = coordinates[j + 1]; //if ((clip = clipper.clipNext(nextX, nextY)) != 0) { - // if (clip < 0) { - // curX = clipper.out[0]; - // curY = clipper.out[1]; - // // TODO break when cur has changed - // nextX = clipper.out[2]; - // nextY = clipper.out[3]; - // } + // if (clip < 0) { + // curX = clipper.out[0]; + // curY = clipper.out[1]; + // // TODO break when cur has changed + // nextX = clipper.out[2]; + // nextY = clipper.out[3]; + // } //} float wx = nextX - curX; @@ -146,15 +146,15 @@ public final class WayDecorator { last = j - 2; //if (clip < 0) { - // if (nextX == min) - // edge |= 1 << 4; - // else if (nextX == max) - // edge |= 1 << 5; + // if (nextX == min) + // edge |= 1 << 4; + // else if (nextX == max) + // edge |= 1 << 5; // - // if (nextY == min) - // edge |= 1 << 6; - // else if (nextY == max) - // edge |= 1 << 7; + // if (nextY == min) + // edge |= 1 << 6; + // else if (nextY == max) + // edge |= 1 << 7; //} } @@ -198,8 +198,8 @@ public final class WayDecorator { // link items together //if (t != null) { - // t.n1 = n; - // n.n2 = t; + // t.n1 = n; + // n.n2 = t; //} t = n; diff --git a/vtm/src/org/oscim/layers/vector/AbstractVectorLayer.java b/vtm/src/org/oscim/layers/vector/AbstractVectorLayer.java index 9f5ea31a..086184e4 100644 --- a/vtm/src/org/oscim/layers/vector/AbstractVectorLayer.java +++ b/vtm/src/org/oscim/layers/vector/AbstractVectorLayer.java @@ -95,42 +95,42 @@ public abstract class AbstractVectorLayer extends Layer implements UpdateList v.getMapPosition(t.position); } - /* Hmm what is this for? */ - // double scale = t.position.scale * Tile.SIZE; - // t.position.x = (long) (t.position.x * scale) / scale; - // t.position.y = (long) (t.position.y * scale) / scale; + /* Hmm what is this for? */ + // double scale = t.position.scale * Tile.SIZE; + // t.position.x = (long) (t.position.x * scale) / scale; + // t.position.y = (long) (t.position.y * scale) / scale; bbox.map2mercator(); - // double xmin = bbox.xmin; - // double xmax = bbox.xmax; - // Box lbox = null; - // Box rbox = null; - // if (bbox.xmin < -180) { - // bbox.xmin = -180; - // lbox = new Box(bbox); - // } - // if (bbox.xmax > 180) { - // bbox.xmax = 180; - // rbox = new Box(bbox); - // } + // double xmin = bbox.xmin; + // double xmax = bbox.xmax; + // Box lbox = null; + // Box rbox = null; + // if (bbox.xmin < -180) { + // bbox.xmin = -180; + // lbox = new Box(bbox); + // } + // if (bbox.xmax > 180) { + // bbox.xmax = 180; + // rbox = new Box(bbox); + // } processFeatures(t, bbox); //if (lbox != null) { - // t.position.x += 1; - // lbox.xmax = 180; - // lbox.xmin = xmin + 180; - // processFeatures(t, lbox); - // t.position.x -= 1; + // t.position.x += 1; + // lbox.xmax = 180; + // lbox.xmin = xmin + 180; + // processFeatures(t, lbox); + // t.position.x -= 1; //} // //if (rbox != null) { - // t.position.x -= 1; - // rbox.xmin = -180; - // rbox.xmax = xmax - 180; - // processFeatures(t, rbox); - // t.position.x += 1; + // t.position.x -= 1; + // rbox.xmin = -180; + // rbox.xmax = xmax - 180; + // processFeatures(t, rbox); + // t.position.x += 1; //} t.buckets.prepare(); diff --git a/vtm/src/org/oscim/map/Animator.java b/vtm/src/org/oscim/map/Animator.java index 421a76bb..476d6999 100644 --- a/vtm/src/org/oscim/map/Animator.java +++ b/vtm/src/org/oscim/map/Animator.java @@ -67,7 +67,7 @@ public class Animator { mMap.getMapPosition(mStartPos); /* TODO for large distance first scale out, then in * calculate the maximum scale at which the BoundingBox - * is completely visible */ + * is completely visible */ double dx = Math.abs(longitudeToX(bbox.getMaxLongitude()) - longitudeToX(bbox.getMinLongitude())); @@ -211,8 +211,8 @@ public class Animator { ViewController v = mMap.viewport(); - /* cancel animation when position was changed since last - * update, i.e. when it was modified outside the animator. */ + /* cancel animation when position was changed since last + * update, i.e. when it was modified outside the animator. */ if (v.getMapPosition(mCurPos)) { log.debug("cancel anim - changed"); cancel(); @@ -255,7 +255,7 @@ public class Animator { cancel(); } - /* remember current map position */ + /* remember current map position */ final boolean changed = v.getMapPosition(mCurPos); if (changed) { diff --git a/vtm/src/org/oscim/map/ViewController.java b/vtm/src/org/oscim/map/ViewController.java index 5b7ca085..a9c51be5 100644 --- a/vtm/src/org/oscim/map/ViewController.java +++ b/vtm/src/org/oscim/map/ViewController.java @@ -37,13 +37,13 @@ public class ViewController extends Viewport { mHeight = height; mWidth = width; - /* setup projection matrix: + /* setup projection matrix: * 0. scale to window coordinates - * 1. translate to VIEW_DISTANCE - * 2. apply projection - * setup inverse projection: - * 0. invert projection - * 1. invert translate to VIEW_DISTANCE */ + * 1. translate to VIEW_DISTANCE + * 2. apply projection + * setup inverse projection: + * 0. invert projection + * 1. invert translate to VIEW_DISTANCE */ float ratio = (mHeight / mWidth) * VIEW_SCALE; @@ -55,14 +55,14 @@ public class ViewController extends Viewport { mTmpMatrix.setTranslation(0, 0, -VIEW_DISTANCE); mProjMatrix.multiplyRhs(mTmpMatrix); - /* set inverse projection matrix (without scaling) */ + /* set inverse projection matrix (without scaling) */ mProjMatrix.get(mat); GLMatrix.invertM(mat, 0, mat, 0); mProjMatrixInverse.set(mat); mProjMatrixUnscaled.copy(mProjMatrix); - /* scale to window coordinates */ + /* scale to window coordinates */ mTmpMatrix.setScale(1 / mWidth, 1 / mWidth, 1 / mWidth); mProjMatrix.multiplyRhs(mTmpMatrix); @@ -97,16 +97,16 @@ public class ViewController extends Viewport { mPos.x = x; mPos.y = y; - /* clamp latitude */ + /* clamp latitude */ mPos.y = FastMath.clamp(mPos.y, 0, 1); - /* wrap longitude */ + /* wrap longitude */ while (mPos.x > 1) mPos.x -= 1; while (mPos.x < 0) mPos.x += 1; - /* limit longitude */ + /* limit longitude */ if (mPos.x > mMaxX) mPos.x = mMaxX; else if (mPos.x < mMinX) @@ -228,24 +228,24 @@ public class ViewController extends Viewport { mPos.copy(mapPosition); limitPosition(mPos); - // mPos.scale = clamp(mapPosition.scale, mMinScale, mMaxScale); - // mPos.x = mapPosition.x; - // mPos.y = mapPosition.y; - // mPos.tilt = limitTilt(mapPosition.tilt); - // mPos.bearing = mapPosition.bearing; + // mPos.scale = clamp(mapPosition.scale, mMinScale, mMaxScale); + // mPos.x = mapPosition.x; + // mPos.y = mapPosition.y; + // mPos.tilt = limitTilt(mapPosition.tilt); + // mPos.bearing = mapPosition.bearing; updateMatrices(); } private void updateMatrices() { - /* - view matrix: - * 0. apply rotate - * 1. apply tilt */ + /* - view matrix: + * 0. apply rotate + * 1. apply tilt */ mRotationMatrix.setRotation(mPos.bearing, 0, 0, 1); mTmpMatrix.setRotation(mPos.tilt, 1, 0, 0); - /* apply first rotation, then tilt */ + /* apply first rotation, then tilt */ mRotationMatrix.multiplyLhs(mTmpMatrix); mViewMatrix.copy(mRotationMatrix); diff --git a/vtm/src/org/oscim/map/Viewport.java b/vtm/src/org/oscim/map/Viewport.java index 7d9d0267..e820a1a5 100644 --- a/vtm/src/org/oscim/map/Viewport.java +++ b/vtm/src/org/oscim/map/Viewport.java @@ -195,9 +195,9 @@ public class Viewport { unproject(1, -1, box, 0); /* top-left */ unproject(-1, -1, box, 2); - /* bottom-left */ + /* bottom-left */ unproject(-1, 1, box, 4); - /* bottom-right */ + /* bottom-right */ unproject(1, 1, box, 6); if (add == 0) @@ -290,7 +290,7 @@ public class Viewport { } protected void unprojectScreen(double x, double y, float[] out) { - /* scale to -1..1 */ + /* scale to -1..1 */ float mx = (float) (1 - (x / mWidth * 2)); float my = (float) (1 - (y / mHeight * 2)); diff --git a/vtm/src/org/oscim/renderer/BufferObject.java b/vtm/src/org/oscim/renderer/BufferObject.java index e1f53bd4..da74f443 100644 --- a/vtm/src/org/oscim/renderer/BufferObject.java +++ b/vtm/src/org/oscim/renderer/BufferObject.java @@ -67,7 +67,7 @@ public final class BufferObject extends Inlist { GLState.bindBuffer(target, id); - /* reuse memory allocated for vbo when possible and allocated + /* reuse memory allocated for vbo when possible and allocated * memory is less then four times the new data */ if (!GLAdapter.NO_BUFFER_SUB_DATA && !clear && (size > newSize) && (size < newSize * 4)) { @@ -125,7 +125,7 @@ public final class BufferObject extends Inlist { if (size != 0) { /* find the item with minimal size greater 'size' bytes. */ BufferObject bo = pool[t]; - /* actually points to BufferObject before min */ + /* actually points to BufferObject before min */ BufferObject min = null; BufferObject prev = null; diff --git a/vtm/src/org/oscim/renderer/ExtrusionRenderer.java b/vtm/src/org/oscim/renderer/ExtrusionRenderer.java index 255ff9a4..110a0723 100644 --- a/vtm/src/org/oscim/renderer/ExtrusionRenderer.java +++ b/vtm/src/org/oscim/renderer/ExtrusionRenderer.java @@ -78,12 +78,12 @@ public abstract class ExtrusionRenderer extends LayerRenderer { int sumIndices = eb.idx[0] + eb.idx[1] + eb.idx[2]; - /* extrusion */ + /* extrusion */ if (sumIndices > 0) gl.drawElements(GL.TRIANGLES, sumIndices, GL.UNSIGNED_SHORT, eb.off[0]); - /* mesh */ + /* mesh */ if (eb.idx[4] > 0) { gl.drawElements(GL.TRIANGLES, eb.idx[4], GL.UNSIGNED_SHORT, eb.off[4]); @@ -106,7 +106,7 @@ public abstract class ExtrusionRenderer extends LayerRenderer { s.useProgram(); GLState.enableVertexArrays(s.aPos, -1); - /* only use face-culling when it's unlikely + /* only use face-culling when it's unlikely * that one'moves through the building' */ if (v.pos.zoomLevel < 18) gl.enable(GL.CULL_FACE); @@ -140,7 +140,7 @@ public abstract class ExtrusionRenderer extends LayerRenderer { renderCombined(s.aPos, ebs[i]); } - /* only draw to color buffer */ + /* only draw to color buffer */ gl.colorMask(true, true, true, true); gl.depthMask(false); gl.depthFunc(GL.EQUAL); @@ -183,32 +183,32 @@ public abstract class ExtrusionRenderer extends LayerRenderer { gl.vertexAttribPointer(s.aLight, 2, GL.UNSIGNED_BYTE, false, 8, eb.getVertexOffset() + 6); - /* draw extruded outlines */ + /* draw extruded outlines */ if (eb.idx[0] > 0) { if (mTranslucent) { gl.depthFunc(GL.EQUAL); setMatrix(s, v, ebs[i]); } - /* draw roof */ + /* draw roof */ gl.uniform1i(s.uMode, 0); gl.drawElements(GL.TRIANGLES, eb.idx[2], GL.UNSIGNED_SHORT, eb.off[2]); - /* draw sides 1 */ + /* draw sides 1 */ gl.uniform1i(s.uMode, 1); gl.drawElements(GL.TRIANGLES, eb.idx[0], GL.UNSIGNED_SHORT, eb.off[0]); - /* draw sides 2 */ + /* draw sides 2 */ gl.uniform1i(s.uMode, 2); gl.drawElements(GL.TRIANGLES, eb.idx[1], GL.UNSIGNED_SHORT, eb.off[1]); if (mTranslucent) { - /* drawing gl_lines with the same coordinates - * does not result in same depth values as - * polygons, so add offset and draw gl_lequal */ + /* drawing gl_lines with the same coordinates + * does not result in same depth values as + * polygons, so add offset and draw gl_lequal */ gl.depthFunc(GL.LEQUAL); v.mvp.addDepthOffset(100); v.mvp.setAsUniform(s.uMVP); @@ -220,14 +220,14 @@ public abstract class ExtrusionRenderer extends LayerRenderer { GL.UNSIGNED_SHORT, eb.off[3]); } - /* draw triangle meshes */ + /* draw triangle meshes */ if (eb.idx[4] > 0) { gl.drawElements(GL.TRIANGLES, eb.idx[4], GL.UNSIGNED_SHORT, eb.off[4]); } } - /* just a temporary reference! */ + /* just a temporary reference! */ ebs[i] = null; } @@ -259,8 +259,8 @@ public abstract class ExtrusionRenderer extends LayerRenderer { v.mvp.multiplyLhs(v.viewproj); if (mTranslucent) { - /* should avoid z-fighting of overlapping - * building from different tiles */ + /* should avoid z-fighting of overlapping + * building from different tiles */ int zoom = (1 << z); int delta = (int) (l.x * zoom) % 4 + (int) (l.y * zoom) % 4 * 4; v.mvp.addDepthOffset(delta); diff --git a/vtm/src/org/oscim/renderer/GLMatrix.java b/vtm/src/org/oscim/renderer/GLMatrix.java index c2512d66..83ba3a65 100644 --- a/vtm/src/org/oscim/renderer/GLMatrix.java +++ b/vtm/src/org/oscim/renderer/GLMatrix.java @@ -300,19 +300,19 @@ public class GLMatrix { private native static ByteBuffer getBuffer(long self); - /* Copyright (C) 2007 The Android Open Source Project + /* Copyright (C) 2007 The Android Open Source Project * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ /** * Define a projection matrix in terms of six clip planes diff --git a/vtm/src/org/oscim/renderer/GridRenderer.java b/vtm/src/org/oscim/renderer/GridRenderer.java index a513b97b..68f4aa91 100644 --- a/vtm/src/org/oscim/renderer/GridRenderer.java +++ b/vtm/src/org/oscim/renderer/GridRenderer.java @@ -48,12 +48,12 @@ public class GridRenderer extends BucketRenderer { public GridRenderer(int numLines, LineStyle lineStyle, TextStyle textStyle) { int size = Tile.SIZE; - /* not needed to set but we know: 16 lines 'a' two points */ + /* not needed to set but we know: 16 lines 'a' two points */ mLines = new GeometryBuffer(2 * 16, 16); float pos = -size * 4; - /* 8 vertical lines */ + /* 8 vertical lines */ for (int i = 0; i < 8 * numLines; i++) { float x = pos + i * size / numLines; mLines.startLine(); @@ -61,7 +61,7 @@ public class GridRenderer extends BucketRenderer { mLines.addPoint(x, pos + size * 8); } - /* 8 horizontal lines */ + /* 8 horizontal lines */ for (int j = 0; j < 8 * numLines; j++) { float y = pos + j * size / numLines; mLines.startLine(); @@ -119,7 +119,7 @@ public class GridRenderer extends BucketRenderer { int x = (int) (v.pos.x * z); int y = (int) (v.pos.y * z); - /* update buckets when map moved by at least one tile */ + /* update buckets when map moved by at least one tile */ if (x == mCurX && y == mCurY && z == mCurZ) return; diff --git a/vtm/src/org/oscim/renderer/MapRenderer.java b/vtm/src/org/oscim/renderer/MapRenderer.java index 9209ae1e..85cbce53 100644 --- a/vtm/src/org/oscim/renderer/MapRenderer.java +++ b/vtm/src/org/oscim/renderer/MapRenderer.java @@ -66,7 +66,7 @@ public class MapRenderer { mViewport = new GLViewport(); mBufferPool = new NativeBufferPool(); - /* FIXME should be done in 'destroy' method + /* FIXME should be done in 'destroy' method * clear all previous vbo refs */ BufferObject.clear(); setBackgroundColor(Color.DKGRAY); @@ -115,13 +115,13 @@ public class MapRenderer { if (GLAdapter.debugView) { /* modify this to scale only the view, to see - * which tiles are rendered */ + * which tiles are rendered */ mViewport.mvp.setScale(0.5f, 0.5f, 1); mViewport.viewproj.multiplyLhs(mViewport.mvp); mViewport.proj.multiplyLhs(mViewport.mvp); } - /* update layers */ + /* update layers */ LayerRenderer[] layers = mMap.layers().getLayerRenderer(); for (int i = 0, n = layers.length; i < n; i++) { diff --git a/vtm/src/org/oscim/renderer/OffscreenRenderer.java b/vtm/src/org/oscim/renderer/OffscreenRenderer.java index a4c8b2cc..acbf1d54 100644 --- a/vtm/src/org/oscim/renderer/OffscreenRenderer.java +++ b/vtm/src/org/oscim/renderer/OffscreenRenderer.java @@ -203,7 +203,7 @@ public class OffscreenRenderer extends LayerRenderer { mShader.useProgram(); - /* bind depth texture */ + /* bind depth texture */ if (useDepthTexture) { gl.activeTexture(GL.TEXTURE1); GLState.bindTex2D(renderDepth); diff --git a/vtm/src/org/oscim/renderer/atlas/TextureAtlas.java b/vtm/src/org/oscim/renderer/atlas/TextureAtlas.java index 9b0f1b97..678d3c8c 100644 --- a/vtm/src/org/oscim/renderer/atlas/TextureAtlas.java +++ b/vtm/src/org/oscim/renderer/atlas/TextureAtlas.java @@ -251,10 +251,10 @@ public class TextureAtlas extends Inlist { return new TextureAtlas(width, height); } - // /// FIXME - // @Override - // protected void finalize(){ - // if (texture != null) - // TextureItem.releaseTexture(texture); - // } + // /// FIXME + // @Override + // protected void finalize(){ + // if (texture != null) + // TextureItem.releaseTexture(texture); + // } } diff --git a/vtm/src/org/oscim/renderer/bucket/BitmapBucket.java b/vtm/src/org/oscim/renderer/bucket/BitmapBucket.java index 77d7f9ca..8999b93a 100644 --- a/vtm/src/org/oscim/renderer/bucket/BitmapBucket.java +++ b/vtm/src/org/oscim/renderer/bucket/BitmapBucket.java @@ -36,7 +36,7 @@ import static org.oscim.renderer.MapRenderer.bindQuadIndicesVBO; public class BitmapBucket extends TextureBucket { // TODO share layers.vbo() between BitmapTileLayers - // static final Logger log = LoggerFactory.getLogger(BitmapLayer.class); + // static final Logger log = LoggerFactory.getLogger(BitmapLayer.class); private Bitmap mBitmap; private final boolean mReuseBitmap; private final short[] mVertices; @@ -90,7 +90,7 @@ public class BitmapBucket extends TextureBucket { short texMin = 0; short texMax = 1; - // putSprite(buf, pos, tx, ty, x1, y1, x2, y2, u1, v1, u2, v2); + // putSprite(buf, pos, tx, ty, x1, y1, x2, y2, u1, v1, u2, v2); int pos = 0; // top-left diff --git a/vtm/src/org/oscim/renderer/bucket/ExtrusionBucket.java b/vtm/src/org/oscim/renderer/bucket/ExtrusionBucket.java index 417aa1ea..137cb9a3 100644 --- a/vtm/src/org/oscim/renderer/bucket/ExtrusionBucket.java +++ b/vtm/src/org/oscim/renderer/bucket/ExtrusionBucket.java @@ -170,7 +170,7 @@ public class ExtrusionBucket extends RenderBucket { if (index[k] < 0) break; - /* FIXME: workaround: dont overflow max index id. */ + /* FIXME: workaround: dont overflow max index id. */ if (vertexCnt >= 1 << 16) break; @@ -205,9 +205,9 @@ public class ExtrusionBucket extends RenderBucket { double len = Math.sqrt(cx * cx + cy * cy + cz * cz); // packing the normal in two bytes - // int mx = FastMath.clamp(127 + (int) ((cx / len) * 128), 0, 0xff); - // int my = FastMath.clamp(127 + (int) ((cy / len) * 128), 0, 0xff); - // short normal = (short) ((my << 8) | (mx & NORMAL_DIR_MASK) | (cz > 0 ? 1 : 0)); + // int mx = FastMath.clamp(127 + (int) ((cx / len) * 128), 0, 0xff); + // int my = FastMath.clamp(127 + (int) ((cy / len) * 128), 0, 0xff); + // short normal = (short) ((my << 8) | (mx & NORMAL_DIR_MASK) | (cz > 0 ? 1 : 0)); double p = Math.sqrt((cz / len) * 8.0 + 8.0); int mx = FastMath.clamp(127 + (int) ((cx / len / p) * 128), 0, 255); @@ -278,66 +278,66 @@ public class ExtrusionBucket extends RenderBucket { numIndices++; } - // private void encodeNormal(float v[], int offset) { - // var p = Math.sqrt(cartesian.z * 8.0 + 8.0); - // var result = new Cartesian2(); - // result.x = cartesian.x / p + 0.5; - // result.y = cartesian.y / p + 0.5; - // return result; - // } + // private void encodeNormal(float v[], int offset) { + // var p = Math.sqrt(cartesian.z * 8.0 + 8.0); + // var result = new Cartesian2(); + // result.x = cartesian.x / p + 0.5; + // result.y = cartesian.y / p + 0.5; + // return result; + // } // //public void addNoNormal(MapElement element) { - // if (element.type != GeometryType.TRIS) - // return; + // if (element.type != GeometryType.TRIS) + // return; // - // short[] index = element.index; - // float[] points = element.points; + // short[] index = element.index; + // float[] points = element.points; // - // /* current vertex id */ - // int startVertex = sumVertices; + // /* current vertex id */ + // int startVertex = sumVertices; // - // /* roof indices for convex shapes */ - // int i = mCurIndices[IND_MESH].used; - // short[] indices = mCurIndices[IND_MESH].vertices; + // /* roof indices for convex shapes */ + // int i = mCurIndices[IND_MESH].used; + // short[] indices = mCurIndices[IND_MESH].vertices; // - // int first = startVertex; + // int first = startVertex; // - // for (int k = 0, n = index.length; k < n;) { - // if (index[k] < 0) - // break; + // for (int k = 0, n = index.length; k < n;) { + // if (index[k] < 0) + // break; // - // if (i == VertexItem.SIZE) { - // mCurIndices[IND_MESH] = VertexItem.getNext(mCurIndices[IND_MESH]); - // indices = mCurIndices[IND_MESH].vertices; - // i = 0; - // } - // indices[i++] = (short) (first + index[k++]); - // indices[i++] = (short) (first + index[k++]); - // indices[i++] = (short) (first + index[k++]); - // } - // mCurIndices[IND_MESH].used = i; + // if (i == VertexItem.SIZE) { + // mCurIndices[IND_MESH] = VertexItem.getNext(mCurIndices[IND_MESH]); + // indices = mCurIndices[IND_MESH].vertices; + // i = 0; + // } + // indices[i++] = (short) (first + index[k++]); + // indices[i++] = (short) (first + index[k++]); + // indices[i++] = (short) (first + index[k++]); + // } + // mCurIndices[IND_MESH].used = i; // - // short[] vertices = mCurVertices.vertices; - // int v = mCurVertices.used; + // short[] vertices = mCurVertices.vertices; + // int v = mCurVertices.used; // - // int vertexCnt = element.pointPos; + // int vertexCnt = element.pointPos; // - // for (int j = 0; j < vertexCnt;) { - // /* add bottom and top vertex for each point */ - // if (v == VertexItem.SIZE) { - // mCurVertices = VertexItem.getNext(mCurVertices); - // vertices = mCurVertices.vertices; - // v = 0; - // } - // /* set coordinate */ - // vertices[v++] = (short) (points[j++] * S); - // vertices[v++] = (short) (points[j++] * S); - // vertices[v++] = (short) (points[j++] * S); - // v++; - // } + // for (int j = 0; j < vertexCnt;) { + // /* add bottom and top vertex for each point */ + // if (v == VertexItem.SIZE) { + // mCurVertices = VertexItem.getNext(mCurVertices); + // vertices = mCurVertices.vertices; + // v = 0; + // } + // /* set coordinate */ + // vertices[v++] = (short) (points[j++] * S); + // vertices[v++] = (short) (points[j++] * S); + // vertices[v++] = (short) (points[j++] * S); + // v++; + // } // - // mCurVertices.used = v; - // sumVertices += (vertexCnt / 3); + // mCurVertices.used = v; + // sumVertices += (vertexCnt / 3); //} public void add(MapElement element, float height, float minHeight) { @@ -345,30 +345,30 @@ public class ExtrusionBucket extends RenderBucket { int[] index = element.index; float[] points = element.points; - /* 10 cm steps */ + /* 10 cm steps */ float sfactor = 1 / 10f; height *= sfactor; minHeight *= sfactor; - /* match height with ground resultion (meter per pixel) */ + /* match height with ground resultion (meter per pixel) */ height /= mGroundResolution; minHeight /= mGroundResolution; boolean complexOutline = false; boolean simpleOutline = true; - /* current vertex id */ + /* current vertex id */ int startVertex = numVertices; int length = 0, ipos = 0, ppos = 0; for (int n = index.length; ipos < n; ipos++, ppos += length) { length = index[ipos]; - /* end marker */ + /* end marker */ if (length < 0) break; - /* start next polygon */ + /* start next polygon */ if (length == 0) { startVertex = numVertices; simpleOutline = true; @@ -376,7 +376,7 @@ public class ExtrusionBucket extends RenderBucket { continue; } - /* check: drop last point from explicitly closed rings */ + /* check: drop last point from explicitly closed rings */ int len = length; if (points[ppos] == points[ppos + len - 2] && points[ppos + 1] == points[ppos + len - 1]) { @@ -384,11 +384,11 @@ public class ExtrusionBucket extends RenderBucket { log.debug("explicit closed poly " + len); } - /* need at least three points */ + /* need at least three points */ if (len < 6) continue; - /* check if polygon contains inner rings */ + /* check if polygon contains inner rings */ if (simpleOutline && (ipos < n - 1) && (index[ipos + 1] > 0)) simpleOutline = false; @@ -429,7 +429,7 @@ public class ExtrusionBucket extends RenderBucket { int numPoints = 0; int numRings = 0; - /* get sum of points in polygon */ + /* get sum of points in polygon */ for (int i = ipos, n = index.length; i < n && index[i] > 0; i++) { numPoints += index[i]; numRings++; @@ -444,7 +444,7 @@ public class ExtrusionBucket extends RenderBucket { private boolean extrudeOutline(float[] points, int pos, int len, float minHeight, float height, boolean convex) { - /* add two vertices for last face to make zigzag indices work */ + /* add two vertices for last face to make zigzag indices work */ boolean addFace = (len % 4 != 0); int vertexCnt = len + (addFace ? 2 : 0); @@ -453,7 +453,7 @@ public class ExtrusionBucket extends RenderBucket { float nx = points[pos + 0]; float ny = points[pos + 1]; - /* vector to next point */ + /* vector to next point */ float vx = nx - cx; float vy = ny - cy; /* vector from previous point */ @@ -469,7 +469,7 @@ public class ExtrusionBucket extends RenderBucket { int even = 0; int changeX = 0, changeY = 0, angleSign = 0; - /* vertex offset for all vertices in layer */ + /* vertex offset for all vertices in layer */ int vOffset = numVertices; mClipper.clipStart((int) nx, (int) ny); @@ -481,7 +481,7 @@ public class ExtrusionBucket extends RenderBucket { ux = vx; uy = vy; - /* get direction to next point */ + /* get direction to next point */ if (i < len) { nx = points[pos + i + 0]; ny = points[pos + i + 1]; @@ -501,7 +501,7 @@ public class ExtrusionBucket extends RenderBucket { vx = nx - cx; vy = ny - cy; - /* set lighting (by direction) */ + /* set lighting (by direction) */ a = (float) Math.sqrt(vx * vx + vy * vy); color2 = (short) ((1 + vx / a) * 127); @@ -511,16 +511,16 @@ public class ExtrusionBucket extends RenderBucket { else c = (short) (color2 | color1 << 8); - /* add bottom and top vertex for each point */ + /* add bottom and top vertex for each point */ vertexItems.add((short) (cx * S), (short) (cy * S), mh, c); vertexItems.add((short) (cx * S), (short) (cy * S), h, c); color1 = color2; - /* check if polygon is convex */ + /* check if polygon is convex */ if (convex) { - /* TODO simple polys with only one concave arc - * could be handled without special triangulation */ + /* TODO simple polys with only one concave arc + * could be handled without special triangulation */ if ((ux < 0 ? 1 : -1) != (vx < 0 ? 1 : -1)) changeX++; if ((uy < 0 ? 1 : -1) != (vy < 0 ? 1 : -1)) @@ -542,20 +542,20 @@ public class ExtrusionBucket extends RenderBucket { } } - /* check if face is within tile */ + /* check if face is within tile */ if (mClipper.clipNext((int) nx, (int) ny) == 0) { even = ++even % 2; continue; } - /* add ZigZagQuadIndices(tm) for sides */ + /* add ZigZagQuadIndices(tm) for sides */ short vert = (short) (vOffset + (i - 2)); short s0 = vert++; short s1 = vert++; short s2 = vert++; short s3 = vert++; - /* connect last to first (when number of faces is even) */ + /* connect last to first (when number of faces is even) */ if (!addFace && i == len) { s2 -= len; s3 -= len; @@ -565,10 +565,10 @@ public class ExtrusionBucket extends RenderBucket { mIndices[even].add(s1, s2, s3); numIndices += 6; - /* flipp even-odd */ + /* flipp even-odd */ even = ++even % 2; - /* add roof outline indices */ + /* add roof outline indices */ mIndices[IND_OUTLINE].add(s1, s3); numIndices += 2; } diff --git a/vtm/src/org/oscim/renderer/bucket/LineBucket.java b/vtm/src/org/oscim/renderer/bucket/LineBucket.java index 63df08ae..6d2208f0 100644 --- a/vtm/src/org/oscim/renderer/bucket/LineBucket.java +++ b/vtm/src/org/oscim/renderer/bucket/LineBucket.java @@ -126,7 +126,7 @@ public final class LineBucket extends RenderBucket { else if (line.cap == Cap.SQUARE) squared = true; - /* Note: just a hack to save some vertices, when there are + /* Note: just a hack to save some vertices, when there are * more than 200 lines per type. FIXME make optional! */ if (rounded && index != null) { int cnt = 0; @@ -159,24 +159,24 @@ public final class LineBucket extends RenderBucket { if (index != null) length = index[i]; - /* check end-marker in indices */ + /* check end-marker in indices */ if (length < 0) break; int ipos = pos; pos += length; - /* need at least two points */ + /* need at least two points */ if (length < 4) continue; - /* start an enpoint are equal */ + /* start an enpoint are equal */ if (length == 4 && points[ipos] == points[ipos + 2] && points[ipos + 1] == points[ipos + 3]) continue; - /* avoid simple 180 degree angles */ + /* avoid simple 180 degree angles */ if (length == 6 && points[ipos] == points[ipos + 4] && points[ipos + 1] == points[ipos + 5]) @@ -195,7 +195,7 @@ public final class LineBucket extends RenderBucket { float ux = vNextX + vPrevX; float uy = vNextY + vPrevY; - /* vPrev times perpendicular of sum(vNext, vPrev) */ + /* vPrev times perpendicular of sum(vNext, vPrev) */ double a = uy * vPrevX - ux * vPrevY; if (a < 0.01 && a > -0.01) { @@ -231,10 +231,10 @@ public final class LineBucket extends RenderBucket { float nextX, nextY; double a; - /* amount of vertices used + /* amount of vertices used * + 2 for drawing triangle-strip - * + 4 for round caps - * + 2 for closing polygons */ + * + 4 for round caps + * + 2 for closing polygons */ numVertices += length + (rounded ? 6 : 2) + (closed ? 2 : 0); int ipos = start; @@ -244,28 +244,28 @@ public final class LineBucket extends RenderBucket { nextX = points[ipos++]; nextY = points[ipos++]; - /* Unit vector to next node */ + /* Unit vector to next node */ vPrevX = nextX - curX; vPrevY = nextY - curY; a = (float) Math.sqrt(vPrevX * vPrevX + vPrevY * vPrevY); vPrevX /= a; vPrevY /= a; - /* perpendicular on the first segment */ + /* perpendicular on the first segment */ ux = -vPrevY; uy = vPrevX; int ddx, ddy; - /* vertex point coordinate */ + /* vertex point coordinate */ short ox = (short) (curX * COORD_SCALE); short oy = (short) (curY * COORD_SCALE); - /* vertex extrusion vector, last two bit - * encode texture coord. */ + /* vertex extrusion vector, last two bit + * encode texture coord. */ short dx, dy; - /* when the endpoint is outside the tile region omit round caps. */ + /* when the endpoint is outside the tile region omit round caps. */ boolean outside = (curX < tmin || curX > tmax || curY < tmin || curY > tmax); if (rounded && !outside) { @@ -284,7 +284,7 @@ public final class LineBucket extends RenderBucket { (short) (2 | ddx & DIR_MASK), (short) (2 | ddy & DIR_MASK)); - /* Start of line */ + /* Start of line */ ddx = (int) (ux * DIR_SCALE); ddy = (int) (uy * DIR_SCALE); @@ -296,9 +296,9 @@ public final class LineBucket extends RenderBucket { (short) (2 | -ddx & DIR_MASK), (short) (1 | -ddy & DIR_MASK)); } else { - /* outside means line is probably clipped - * TODO should align ending with tile boundary - * for now, just extend the line a little */ + /* outside means line is probably clipped + * TODO should align ending with tile boundary + * for now, just extend the line a little */ float tx = vPrevX; float ty = vPrevY; @@ -313,7 +313,7 @@ public final class LineBucket extends RenderBucket { if (rounded) numVertices -= 2; - /* add first vertex twice */ + /* add first vertex twice */ ddx = (int) ((ux - tx) * DIR_SCALE); ddy = (int) ((uy - ty) * DIR_SCALE); dx = (short) (0 | ddx & DIR_MASK); @@ -333,11 +333,11 @@ public final class LineBucket extends RenderBucket { curX = nextX; curY = nextY; - /* Unit vector pointing back to previous node */ + /* Unit vector pointing back to previous node */ vPrevX *= -1; vPrevY *= -1; - // vertexItem.used = opos + 4; + // vertexItem.used = opos + 4; for (int end = start + length; ; ) { @@ -345,18 +345,18 @@ public final class LineBucket extends RenderBucket { nextX = points[ipos++]; nextY = points[ipos++]; } else if (closed && ipos < end + 2) { - /* add startpoint == endpoint */ + /* add startpoint == endpoint */ nextX = points[start]; nextY = points[start + 1]; ipos += 2; } else break; - /* unit vector pointing forward to next node */ + /* unit vector pointing forward to next node */ vNextX = nextX - curX; vNextY = nextY - curY; a = Math.sqrt(vNextX * vNextX + vNextY * vNextY); - /* skip too short segmets */ + /* skip too short segmets */ if (a < mMinDist) { numVertices -= 2; continue; @@ -368,7 +368,7 @@ public final class LineBucket extends RenderBucket { //log.debug("acos " + dotp); if (dotp > 0.65) { - /* add bevel join to avoid miter going to infinity */ + /* add bevel join to avoid miter going to infinity */ numVertices += 2; //dotp = FastMath.clamp(dotp, -1, 1); @@ -378,12 +378,12 @@ public final class LineBucket extends RenderBucket { float px, py; if (dotp > 0.999) { - /* 360 degree angle, set points aside */ + /* 360 degree angle, set points aside */ ux = vPrevX + vNextX; uy = vPrevY + vNextY; a = vNextX * uy - vNextY * ux; if (a < 0.1 && a > -0.1) { - /* Almost straight */ + /* Almost straight */ ux = -vNextY; uy = vNextX; } else { @@ -397,15 +397,15 @@ public final class LineBucket extends RenderBucket { curY = curY + uy * BEVEL_MIN; } else { //log.debug("back"); - /* go back by min dist */ + /* go back by min dist */ px = curX + vPrevX * BEVEL_MIN; py = curY + vPrevY * BEVEL_MIN; - /* go forward by min dist */ + /* go forward by min dist */ curX = curX + vNextX * BEVEL_MIN; curY = curY + vNextY * BEVEL_MIN; } - /* unit vector pointing forward to next node */ + /* unit vector pointing forward to next node */ vNextX = curX - px; vNextY = curY - py; a = Math.sqrt(vNextX * vNextX + vNextY * vNextY); @@ -414,11 +414,11 @@ public final class LineBucket extends RenderBucket { addVertex(vertices, px, py, vPrevX, vPrevY, vNextX, vNextY); - /* flip unit vector to point back */ + /* flip unit vector to point back */ vPrevX = -vNextX; vPrevY = -vNextY; - /* unit vector pointing forward to next node */ + /* unit vector pointing forward to next node */ vNextX = nextX - curX; vNextY = nextY - curY; a = Math.sqrt(vNextX * vNextX + vNextY * vNextY); @@ -431,7 +431,7 @@ public final class LineBucket extends RenderBucket { curX = nextX; curY = nextY; - /* flip vector to point back */ + /* flip vector to point back */ vPrevX = -vNextX; vPrevY = -vNextY; } @@ -456,7 +456,7 @@ public final class LineBucket extends RenderBucket { (short) (2 | -ddx & DIR_MASK), (short) (1 | -ddy & DIR_MASK)); - /* For rounded line edges */ + /* For rounded line edges */ ddx = (int) ((ux - vPrevX) * DIR_SCALE); ddy = (int) ((uy - vPrevY) * DIR_SCALE); @@ -464,7 +464,7 @@ public final class LineBucket extends RenderBucket { (short) (0 | ddx & DIR_MASK), (short) (0 | ddy & DIR_MASK)); - /* last vertex */ + /* last vertex */ ddx = (int) (-(ux + vPrevX) * DIR_SCALE); ddy = (int) (-(uy + vPrevY) * DIR_SCALE); dx = (short) (2 | ddx & DIR_MASK); @@ -489,14 +489,14 @@ public final class LineBucket extends RenderBucket { (short) (0 | ddx & DIR_MASK), (short) (1 | ddy & DIR_MASK)); - /* last vertex */ + /* last vertex */ ddx = (int) (-(ux + vPrevX) * DIR_SCALE); ddy = (int) (-(uy + vPrevY) * DIR_SCALE); dx = (short) (2 | ddx & DIR_MASK); dy = (short) (1 | ddy & DIR_MASK); } - /* add last vertex twice */ + /* add last vertex twice */ vertices.add(ox, oy, (short) dx, (short) dy); vertices.add(ox, oy, (short) dx, (short) dy); } @@ -527,8 +527,8 @@ public final class LineBucket extends RenderBucket { } public static final class Renderer { - /* TODO: - * http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter22.html */ + /* TODO: + * http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter22.html */ /* factor to normalize extrusion vector and scale to coord scale */ private final static float COORD_SCALE_BY_DIR_SCALE = @@ -549,8 +549,8 @@ public final class LineBucket extends RenderBucket { shaders[0] = new Shader("line_aa_proj"); shaders[1] = new Shader("line_aa"); - /* create lookup table as texture for 'length(0..1,0..1)' - * using mirrored wrap mode for 'length(-1..1,-1..1)' */ + /* create lookup table as texture for 'length(0..1,0..1)' + * using mirrored wrap mode for 'length(-1..1,-1..1)' */ byte[] pixel = new byte[128 * 128]; for (int x = 0; x < 128; x++) { @@ -574,8 +574,8 @@ public final class LineBucket extends RenderBucket { public static RenderBucket draw(RenderBucket b, GLViewport v, float scale, RenderBuckets buckets) { - /* simple line shader does not take forward shortening into - * account. only used when tilt is 0. */ + /* simple line shader does not take forward shortening into + * account. only used when tilt is 0. */ int mode = v.pos.tilt < 1 ? 1 : 0; Shader s = shaders[mode]; @@ -583,10 +583,10 @@ public final class LineBucket extends RenderBucket { GLState.blend(true); - /* Somehow we loose the texture after an indefinite - * time, when label/symbol textures are used. - * Debugging gl on Desktop is most fun imaginable, - * so for now: */ + /* Somehow we loose the texture after an indefinite + * time, when label/symbol textures are used. + * Debugging gl on Desktop is most fun imaginable, + * so for now: */ if (!GLAdapter.GDX_DESKTOP_QUIRKS) GLState.bindTex2D(mTexID); @@ -601,14 +601,14 @@ public final class LineBucket extends RenderBucket { v.mvp.setAsUniform(s.uMVP); - /* Line scale factor for non fixed lines: Within a zoom- - * level lines would be scaled by the factor 2 by view-matrix. - * Though lines should only scale by sqrt(2). This is achieved - * by inverting scaling of extrusion vector with: width/sqrt(s). */ + /* Line scale factor for non fixed lines: Within a zoom- + * level lines would be scaled by the factor 2 by view-matrix. + * Though lines should only scale by sqrt(2). This is achieved + * by inverting scaling of extrusion vector with: width/sqrt(s). */ double variableScale = Math.sqrt(scale); - /* scale factor to map one pixel on tile to one pixel on screen: - * used with orthographic projection, (shader mode == 1) */ + /* scale factor to map one pixel on tile to one pixel on screen: + * used with orthographic projection, (shader mode == 1) */ double pixel = (mode == SHADER_PROJ) ? 0.0001 : 1.5 / scale; gl.uniform1f(uLineFade, (float) pixel); @@ -647,10 +647,10 @@ public final class LineBucket extends RenderBucket { blur = false; } - /* draw LineLayer */ + /* draw LineLayer */ if (!line.outline) { - /* invert scaling of extrusion vectors so that line - * width stays the same. */ + /* invert scaling of extrusion vectors so that line + * width stays the same. */ if (line.fixed) { width = Math.max(line.width, 1) / scale; } else { @@ -660,7 +660,7 @@ public final class LineBucket extends RenderBucket { gl.uniform1f(uLineWidth, (float) (width * COORD_SCALE_BY_DIR_SCALE)); - /* Line-edge fade */ + /* Line-edge fade */ if (line.blur > 0) { gl.uniform1f(uLineFade, line.blur); blur = true; @@ -669,7 +669,7 @@ public final class LineBucket extends RenderBucket { //GL.uniform1f(uLineScale, (float)(pixel / (ll.width / s))); } - /* Cap mode */ + /* Cap mode */ if (lb.scale < 1.5 /* || ll.line.fixed */) { if (capMode != CAP_THIN) { @@ -692,7 +692,7 @@ public final class LineBucket extends RenderBucket { continue; } - /* draw LineLayers references by this outline */ + /* draw LineLayers references by this outline */ for (LineBucket ref = lb.outlines; ref != null; ref = ref.outlines) { LineStyle core = ref.line.current(); @@ -713,7 +713,7 @@ public final class LineBucket extends RenderBucket { gl.uniform1f(uLineWidth, (float) (width * COORD_SCALE_BY_DIR_SCALE)); - /* Line-edge fade */ + /* Line-edge fade */ if (line.blur > 0) { gl.uniform1f(uLineFade, line.blur); blur = true; @@ -721,7 +721,7 @@ public final class LineBucket extends RenderBucket { gl.uniform1f(uLineFade, (float) (pixel / width)); } - /* Cap mode */ + /* Cap mode */ if (ref.roundCap) { if (capMode != CAP_ROUND) { diff --git a/vtm/src/org/oscim/renderer/bucket/LineTexBucket.java b/vtm/src/org/oscim/renderer/bucket/LineTexBucket.java index 478597a3..257325d9 100644 --- a/vtm/src/org/oscim/renderer/bucket/LineTexBucket.java +++ b/vtm/src/org/oscim/renderer/bucket/LineTexBucket.java @@ -114,19 +114,19 @@ public final class LineTexBucket extends RenderBucket { if (vertexItems.empty()) { /* HACK add one vertex offset when compiling * buffer otherwise one cant use the full - * VertexItem (see Layers.compile) - * add the two 'x' at front and end */ + * VertexItem (see Layers.compile) + * add the two 'x' at front and end */ //numVertices = 2; - /* the additional end vertex to make sure - * not to read outside allocated memory */ + /* the additional end vertex to make sure + * not to read outside allocated memory */ numVertices = 1; } VertexData vi = vertexItems; boolean even = evenSegment; - /* reset offset to last written position */ + /* reset offset to last written position */ if (!even) vi.seek(-12); @@ -144,11 +144,11 @@ public final class LineTexBucket extends RenderBucket { if (index != null) length = index[i]; - /* check end-marker in indices */ + /* check end-marker in indices */ if (length < 0) break; - /* need at least two points */ + /* need at least two points */ if (length < 4) { pos += length; continue; @@ -158,24 +158,24 @@ public final class LineTexBucket extends RenderBucket { float x = points[pos++] * COORD_SCALE; float y = points[pos++] * COORD_SCALE; - /* randomize a bit */ + /* randomize a bit */ float lineLength = mRandomizeOffset ? (x * x + y * y) % 80 : 0; while (pos < end) { float nx = points[pos++] * COORD_SCALE; float ny = points[pos++] * COORD_SCALE; - /* Calculate triangle corners for the given width */ + /* Calculate triangle corners for the given width */ float vx = nx - x; float vy = ny - y; float a = (float) Math.sqrt(vx * vx + vy * vy); - /* normal vector */ + /* normal vector */ vx /= a; vy /= a; - /* perpendicular to line segment */ + /* perpendicular to line segment */ float ux = -vy; float uy = vx; @@ -201,18 +201,18 @@ public final class LineTexBucket extends RenderBucket { y = ny; if (even) { - /* go to second segment */ + /* go to second segment */ vi.seek(-12); even = false; - /* vertex 0 and 2 were added */ + /* vertex 0 and 2 were added */ numVertices += 3; evenQuads++; } else { - /* go to next block */ + /* go to next block */ even = true; - /* vertex 1 and 3 were added */ + /* vertex 1 and 3 were added */ numVertices += 1; oddQuads++; } @@ -221,7 +221,7 @@ public final class LineTexBucket extends RenderBucket { evenSegment = even; - /* advance offset to last written position */ + /* advance offset to last written position */ if (!even) vi.seek(12); } @@ -229,7 +229,7 @@ public final class LineTexBucket extends RenderBucket { @Override protected void compile(ShortBuffer vboData, ShortBuffer iboData) { compileVertexItems(vboData); - /* add additional vertex for interleaving, see TexLineLayer. */ + /* add additional vertex for interleaving, see TexLineLayer. */ vboData.position(vboData.position() + 6); } @@ -276,7 +276,7 @@ public final class LineTexBucket extends RenderBucket { int[] vboIds = GLUtils.glGenBuffers(1); mVertexFlipID = vboIds[0]; - /* bytes: 0, 1, 0, 1, 0, ... */ + /* bytes: 0, 1, 0, 1, 0, ... */ byte[] flip = new byte[MapRenderer.MAX_QUADS * 4]; for (int i = 0; i < flip.length; i++) flip[i] = (byte) (i % 2); @@ -294,11 +294,11 @@ public final class LineTexBucket extends RenderBucket { GL.STATIC_DRAW); GLState.bindVertexBuffer(0); - // mTexID = new int[10]; - // byte[] stipple = new byte[2]; - // stipple[0] = 32; - // stipple[1] = 32; - // mTexID[0] = GlUtils.loadStippleTexture(stipple); + // mTexID = new int[10]; + // byte[] stipple = new byte[2]; + // stipple[0] = 32; + // stipple[1] = 32; + // mTexID[0] = GlUtils.loadStippleTexture(stipple); } private final static int STRIDE = 12; @@ -308,7 +308,7 @@ public final class LineTexBucket extends RenderBucket { float div, RenderBuckets buckets) { //if (shader == 0) - // return curLayer.next; + // return curLayer.next; GLState.blend(true); //GLState.useProgram(shader); @@ -361,21 +361,21 @@ public final class LineTexBucket extends RenderBucket { gl.uniform1f(shader.uPatternWidth, line.stippleWidth); //GL.uniform1f(hScale, scale); - /* keep line width fixed */ + /* keep line width fixed */ gl.uniform1f(shader.uWidth, lb.width / s * COORD_SCALE_BY_DIR_SCALE); - /* add offset vertex */ + /* add offset vertex */ int vOffset = -STRIDE; // TODO interleave 1. and 2. pass to improve vertex cache usage? - /* first pass */ + /* first pass */ int allIndices = (lb.evenQuads * 6); for (int i = 0; i < allIndices; i += MAX_INDICES) { int numIndices = allIndices - i; if (numIndices > MAX_INDICES) numIndices = MAX_INDICES; - /* i / 6 * (24 shorts per block * 2 short bytes) */ + /* i / 6 * (24 shorts per block * 2 short bytes) */ int add = (b.vertexOffset + i * 8) + vOffset; gl.vertexAttribPointer(aPos0, 4, GL.SHORT, false, STRIDE, @@ -394,13 +394,13 @@ public final class LineTexBucket extends RenderBucket { GL.UNSIGNED_SHORT, 0); } - /* second pass */ + /* second pass */ allIndices = (lb.oddQuads * 6); for (int i = 0; i < allIndices; i += MAX_INDICES) { int numIndices = allIndices - i; if (numIndices > MAX_INDICES) numIndices = MAX_INDICES; - /* i / 6 * (24 shorts per block * 2 short bytes) */ + /* i / 6 * (24 shorts per block * 2 short bytes) */ int add = (b.vertexOffset + i * 8) + vOffset; gl.vertexAttribPointer(aPos0, 4, GL.SHORT, false, STRIDE, diff --git a/vtm/src/org/oscim/renderer/bucket/PolygonBucket.java b/vtm/src/org/oscim/renderer/bucket/PolygonBucket.java index 12b32503..ce3014de 100644 --- a/vtm/src/org/oscim/renderer/bucket/PolygonBucket.java +++ b/vtm/src/org/oscim/renderer/bucket/PolygonBucket.java @@ -82,7 +82,7 @@ public final class PolygonBucket extends RenderBucket { if (length < 0) break; - /* need at least three points */ + /* need at least three points */ if (length < 6) { pos += length; continue; @@ -176,10 +176,10 @@ public final class PolygonBucket extends RenderBucket { private static void fillPolygons(GLViewport v, int start, int end, MapPosition pos, float div) { - /* draw to framebuffer */ + /* draw to framebuffer */ gl.colorMask(true, true, true, true); - /* do not modify stencil buffer */ + /* do not modify stencil buffer */ gl.stencilMask(0x00); Shader s; @@ -222,12 +222,12 @@ public final class PolygonBucket extends RenderBucket { GLState.blend(blend); - /* set stencil buffer mask used to draw this layer - * also check that clip bit is set to avoid overdraw - * of other tiles */ + /* set stencil buffer mask used to draw this layer + * also check that clip bit is set to avoid overdraw + * of other tiles */ gl.stencilFunc(GL.EQUAL, 0xff, CLIP_BIT | 1 << i); - /* draw tile fill coordinates */ + /* draw tile fill coordinates */ gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4); if (a.strokeWidth <= 0) @@ -258,7 +258,7 @@ public final class PolygonBucket extends RenderBucket { ///* disable texture shader */ //if (s != polyShader) - // s = setShader(polyShader, v.mvp, false); + // s = setShader(polyShader, v.mvp, false); } } @@ -312,10 +312,10 @@ public final class PolygonBucket extends RenderBucket { int cur = mCount; int start = mCount; - /* draw to stencil buffer */ + /* draw to stencil buffer */ gl.colorMask(false, false, false, false); - /* op for stencil method polygon drawing */ + /* op for stencil method polygon drawing */ gl.stencilOp(GL.KEEP, GL.KEEP, GL.INVERT); boolean drawn = false; @@ -329,12 +329,12 @@ public final class PolygonBucket extends RenderBucket { PolygonBucket pb = (PolygonBucket) b; AreaStyle area = pb.area.current(); - /* fade out polygon bucket (set in RenderTheme) */ + /* fade out polygon bucket (set in RenderTheme) */ if (area.fadeScale > 0 && area.fadeScale > zoom) continue; if (div > 0.5) { - /* project bbox of polygon to screen */ + /* project bbox of polygon to screen */ v.mvp.prj2D(pb.bbox, 0, box, 0, 4); int out = 0; @@ -342,16 +342,16 @@ public final class PolygonBucket extends RenderBucket { int o = mScreenClip.outcode(box[i], box[i + 1]); if (o == 0) { - /* at least one corner is inside */ + /* at least one corner is inside */ out = 0; break; } out |= o; } - /* Check if any polygon-bucket edge intersects the screen. - * Also check the very unlikely case where the view might - * be - * completly contained within box */ + /* Check if any polygon-bucket edge intersects the screen. + * Also check the very unlikely case where the view might + * be + * completly contained within box */ if ((out != 0) && (out != 0xF)) { mScreenClip.clipStart(box[6], box[7]); out = 0; @@ -361,16 +361,16 @@ public final class PolygonBucket extends RenderBucket { if (out == 0) { //log.debug("out {}\n {}\n {}", out, Arrays.toString(pb.bbox), Arrays.toString(box)); - // log.debug("outside {} {} {}", out, - // Arrays.toString(box), - // Arrays.toString(pb.bbox)); + // log.debug("outside {} {} {}", out, + // Arrays.toString(box), + // Arrays.toString(pb.bbox)); continue; } } } if (mClear) { clearStencilRegion(); - /* op for stencil method polygon drawing */ + /* op for stencil method polygon drawing */ gl.stencilOp(GL.KEEP, GL.KEEP, GL.INVERT); start = cur = 0; @@ -378,7 +378,7 @@ public final class PolygonBucket extends RenderBucket { mAreaLayer[cur] = pb; - /* set stencil mask to draw to */ + /* set stencil mask to draw to */ int stencil = 1 << cur++; if (area.hasAlpha(zoom)) { @@ -391,7 +391,7 @@ public final class PolygonBucket extends RenderBucket { gl.drawArrays(GL.TRIANGLE_FAN, b.vertexOffset, b.numVertices); - /* draw up to 7 buckets into stencil buffer */ + /* draw up to 7 buckets into stencil buffer */ if (cur == STENCIL_BITS - 1) { fillPolygons(v, start, cur, v.pos, div); drawn = true; @@ -412,9 +412,9 @@ public final class PolygonBucket extends RenderBucket { } if (!drawn) { - /* fillPolygons would re-enable color-mask - * but it's possible that all polygon buckets - * were skipped */ + /* fillPolygons would re-enable color-mask + * but it's possible that all polygon buckets + * were skipped */ gl.colorMask(true, true, true, true); gl.stencilMask(0x00); } @@ -428,10 +428,10 @@ public final class PolygonBucket extends RenderBucket { drawStencilRegion(clipMode); - /* disable writes to stencil buffer */ + /* disable writes to stencil buffer */ gl.stencilMask(0x00); - /* enable writes to color buffer */ + /* enable writes to color buffer */ gl.colorMask(true, true, true, true); } @@ -447,38 +447,38 @@ public final class PolygonBucket extends RenderBucket { mCount = 0; mClear = false; - /* disable drawing to color buffer */ + /* disable drawing to color buffer */ gl.colorMask(false, false, false, false); - /* write to all stencil bits */ + /* write to all stencil bits */ gl.stencilMask(0xFF); - /* Draw clip-region into depth and stencil buffer. - * This is used for tile line and polygon buckets. - * - * Together with depth test (GL20.LESS) this ensures to - * only draw where no other tile has drawn yet. */ + /* Draw clip-region into depth and stencil buffer. + * This is used for tile line and polygon buckets. + * + * Together with depth test (GL20.LESS) this ensures to + * only draw where no other tile has drawn yet. */ if (clipMode == CLIP_DEPTH) { - /* tests GL20.LESS/GL20.ALWAYS and */ - /* write tile region to depth buffer */ + /* tests GL20.LESS/GL20.ALWAYS and */ + /* write tile region to depth buffer */ GLState.test(true, true); gl.depthMask(true); } else { GLState.test(false, true); } - /* always pass stencil test and set clip bit */ + /* always pass stencil test and set clip bit */ gl.stencilFunc(GL.ALWAYS, CLIP_BIT, 0x00); - /* set clip bit (0x80) for draw region */ + /* set clip bit (0x80) for draw region */ gl.stencilOp(GL.KEEP, GL.KEEP, GL.REPLACE); - /* draw a quad for the tile region */ + /* draw a quad for the tile region */ gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4); if (clipMode == CLIP_DEPTH) { - /* dont modify depth buffer */ + /* dont modify depth buffer */ gl.depthMask(false); GLState.test(false, true); } @@ -490,20 +490,20 @@ public final class PolygonBucket extends RenderBucket { mCount = 0; mClear = false; - /* disable drawing to color buffer */ + /* disable drawing to color buffer */ gl.colorMask(false, false, false, false); - /* write to all stencil bits except clip bit */ + /* write to all stencil bits except clip bit */ gl.stencilMask(0xFF); - /* use clip bit from stencil buffer to clear stencil - * 'layer-bits' (0x7f) */ + /* use clip bit from stencil buffer to clear stencil + * 'layer-bits' (0x7f) */ gl.stencilFunc(GL.EQUAL, CLIP_BIT, CLIP_BIT); - /* set clip bit (0x80) for draw region */ + /* set clip bit (0x80) for draw region */ gl.stencilOp(GL.KEEP, GL.KEEP, GL.REPLACE); - /* draw a quad for the tile region */ + /* draw a quad for the tile region */ gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4); } @@ -513,7 +513,7 @@ public final class PolygonBucket extends RenderBucket { * and 'alpha' to fake a fade effect. */ public static void drawOver(GLMatrix mvp, int color, float alpha) { - /* TODO true could be avoided when same shader and vbo */ + /* TODO true could be avoided when same shader and vbo */ setShader(polyShader, mvp, true); if (color == 0) { @@ -528,13 +528,13 @@ public final class PolygonBucket extends RenderBucket { gl.stencilFunc(GL.EQUAL, CLIP_BIT, CLIP_BIT); - /* write to all bits */ + /* write to all bits */ gl.stencilMask(0xFF); // FIXME uneeded probably GLState.test(false, true); - /* zero out area to draw to */ + /* zero out area to draw to */ gl.stencilOp(GL.KEEP, GL.KEEP, GL.ZERO); gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4); @@ -544,7 +544,7 @@ public final class PolygonBucket extends RenderBucket { } private Renderer() { - /* Singleton */ + /* Singleton */ } } } diff --git a/vtm/src/org/oscim/renderer/bucket/RenderBuckets.java b/vtm/src/org/oscim/renderer/bucket/RenderBuckets.java index 1165e953..b9b557f3 100644 --- a/vtm/src/org/oscim/renderer/bucket/RenderBuckets.java +++ b/vtm/src/org/oscim/renderer/bucket/RenderBuckets.java @@ -205,7 +205,7 @@ public class RenderBuckets extends TileData { bucket = b; break; } - /* insert bucket between current and next bucket */ + /* insert bucket between current and next bucket */ if (b.next == null || b.next.level > level) break; @@ -214,7 +214,7 @@ public class RenderBuckets extends TileData { } if (bucket == null) { - /* add a new RenderElement */ + /* add a new RenderElement */ if (type == LINE) bucket = new LineBucket(level); else if (type == POLYGON) @@ -239,7 +239,7 @@ public class RenderBuckets extends TileData { } } - /* check if found buckets matches requested type */ + /* check if found buckets matches requested type */ if (bucket.type != type) { log.error("BUG wrong bucket {} {} on level {}", Integer.valueOf(bucket.type), @@ -287,7 +287,7 @@ public class RenderBuckets extends TileData { * cleanup only when buckets are not used by tile or bucket anymore! */ public void clear() { - /* NB: set null calls clear() on each bucket! */ + /* NB: set null calls clear() on each bucket! */ set(null); mCurBucket = null; @@ -299,7 +299,7 @@ public class RenderBuckets extends TileData { * cleanup only when buckets are not used by tile or bucket anymore! */ public void clearBuckets() { - /* NB: set null calls clear() on each bucket! */ + /* NB: set null calls clear() on each bucket! */ for (RenderBucket l = buckets; l != null; l = l.next) l.clear(); diff --git a/vtm/src/org/oscim/renderer/bucket/SymbolBucket.java b/vtm/src/org/oscim/renderer/bucket/SymbolBucket.java index 61c849c5..7833d995 100644 --- a/vtm/src/org/oscim/renderer/bucket/SymbolBucket.java +++ b/vtm/src/org/oscim/renderer/bucket/SymbolBucket.java @@ -43,7 +43,7 @@ public final class SymbolBucket extends TextureBucket { /* TODO move sorting items to 'prepare' */ public void addSymbol(SymbolItem item) { - /* needed to calculate 'sbuf' size for compile */ + /* needed to calculate 'sbuf' size for compile */ numVertices += VERTICES_PER_SPRITE; for (SymbolItem it : mSymbols) { @@ -65,7 +65,7 @@ public final class SymbolBucket extends TextureBucket { @Override protected void compile(ShortBuffer vboData, ShortBuffer iboData) { - /* offset of layer data in vbo */ + /* offset of layer data in vbo */ this.vertexOffset = vboData.position() * 2; //SHORT_BYTES; int numIndices = 0; @@ -80,10 +80,10 @@ public final class SymbolBucket extends TextureBucket { int y = 0; if (it.texRegion != null) { - /* FIXME this work only with one TextureAtlas per SymbolLayer */ + /* FIXME this work only with one TextureAtlas per SymbolLayer */ if (textures == null) { - /* clone TextureItem to use same texID with - * multiple TextureItem */ + /* clone TextureItem to use same texID with + * multiple TextureItem */ t = TextureItem.clone(it.texRegion.texture); textures = Inlist.appendItem(textures, t); } @@ -119,7 +119,7 @@ public final class SymbolBucket extends TextureBucket { PointF prevOffset = null; short x1 = 0, y1 = 0, x2 = 0, y2 = 0; - /* add symbol items referencing the same bitmap */ + /* add symbol items referencing the same bitmap */ for (SymbolItem prev = it; it != null; it = it.next) { if (prev.bitmap != null && prev.bitmap != it.bitmap) @@ -148,7 +148,7 @@ public final class SymbolBucket extends TextureBucket { } } - /* add vertices */ + /* add vertices */ short tx = (short) ((int) (SCALE * it.x) & LBIT_MASK | (it.billboard ? 1 : 0)); @@ -159,7 +159,7 @@ public final class SymbolBucket extends TextureBucket { vertexItems.add(tx, ty, x2, y1, u2, v2); vertexItems.add(tx, ty, x2, y2, u2, v1); - /* six elements used to draw the four vertices */ + /* six elements used to draw the four vertices */ t.indices += TextureBucket.INDICES_PER_SPRITE; } numIndices += t.indices; diff --git a/vtm/src/org/oscim/renderer/bucket/TextBucket.java b/vtm/src/org/oscim/renderer/bucket/TextBucket.java index b7dd718a..cf71ee15 100644 --- a/vtm/src/org/oscim/renderer/bucket/TextBucket.java +++ b/vtm/src/org/oscim/renderer/bucket/TextBucket.java @@ -60,17 +60,17 @@ public class TextBucket extends TextureBucket { && item.text == it.next.text /* check same string instance */ && item.string != it.string - /* check same string */ + /* check same string */ && !item.string.equals(it.string)) it = it.next; - /* unify duplicate string - * // Note: this is required for 'packing test' in prepare to - * work! */ + /* unify duplicate string + * // Note: this is required for 'packing test' in prepare to + * work! */ if (item.string != it.string && item.string.equals(it.string)) item.string = it.string; - /* insert after text of same type and/or before same string */ + /* insert after text of same type and/or before same string */ item.next = it.next; it.next = item; return; @@ -138,7 +138,7 @@ public class TextBucket extends TextureBucket { while (it != null) { addItem(it, width, height, x, y); - /* six indices to draw the four vertices */ + /* six indices to draw the four vertices */ numIndices += TextureBucket.INDICES_PER_SPRITE; numVertices += 4; @@ -160,7 +160,7 @@ public class TextBucket extends TextureBucket { protected void addItem(TextItem it, float width, float height, float x, float y) { - /* texture coordinates */ + /* texture coordinates */ short u1 = (short) (COORD_SCALE * x); short v1 = (short) (COORD_SCALE * y); short u2 = (short) (COORD_SCALE * (x + width)); @@ -190,21 +190,21 @@ public class TextBucket extends TextureBucket { vx *= hw; vy *= hw; - /* top-left */ + /* top-left */ x1 = (short) (COORD_SCALE * (vx - ux)); y1 = (short) (COORD_SCALE * (vy - uy)); - /* top-right */ + /* top-right */ x2 = (short) (COORD_SCALE * (-vx - ux)); y2 = (short) (COORD_SCALE * (-vy - uy)); - /* bot-right */ + /* bot-right */ x4 = (short) (COORD_SCALE * (-vx + ux2)); y4 = (short) (COORD_SCALE * (-vy + uy2)); - /* bot-left */ + /* bot-left */ x3 = (short) (COORD_SCALE * (vx + ux2)); y3 = (short) (COORD_SCALE * (vy + uy2)); } - /* add vertices */ + /* add vertices */ int tmp = (int) (COORD_SCALE * it.x) & LBIT_MASK; short tx = (short) (tmp | (it.text.caption ? 1 : 0)); short ty = (short) (COORD_SCALE * it.y); diff --git a/vtm/src/org/oscim/renderer/bucket/TextureBucket.java b/vtm/src/org/oscim/renderer/bucket/TextureBucket.java index fd5eab78..99818201 100644 --- a/vtm/src/org/oscim/renderer/bucket/TextureBucket.java +++ b/vtm/src/org/oscim/renderer/bucket/TextureBucket.java @@ -70,7 +70,7 @@ public class TextureBucket extends RenderBucket { for (TextureItem t = textures; t != null; t = t.next) t.upload(); - /* add vertices to vbo */ + /* add vertices to vbo */ compileVertexItems(vboData); } @@ -112,7 +112,7 @@ public class TextureBucket extends RenderBucket { static void init() { shader = new Shader(); - /* FIXME pool should be disposed on exit... */ + /* FIXME pool should be disposed on exit... */ pool.init(0); } @@ -137,7 +137,7 @@ public class TextureBucket extends RenderBucket { 1f / (t.height * COORD_SCALE)); t.bind(); - /* draw up to maxVertices in each iteration */ + /* draw up to maxVertices in each iteration */ for (int i = 0; i < t.indices; i += MAX_INDICES) { /* to.offset * (24(shorts) * 2(short-bytes) * / 6(indices) == 8) */ diff --git a/vtm/src/org/oscim/renderer/bucket/TextureItem.java b/vtm/src/org/oscim/renderer/bucket/TextureItem.java index 599feeb1..c76dfbe1 100644 --- a/vtm/src/org/oscim/renderer/bucket/TextureItem.java +++ b/vtm/src/org/oscim/renderer/bucket/TextureItem.java @@ -225,7 +225,7 @@ public class TextureItem extends Inlist { return false; if (t.ref != null) { - /* dispose texture if this clone holds the last handle */ + /* dispose texture if this clone holds the last handle */ if (t.ref.used == 0) { t.ref.dispose(); return false; @@ -287,7 +287,7 @@ public class TextureItem extends Inlist { } else { GLState.bindTex2D(t.id); - /* use faster subimage upload */ + /* use faster subimage upload */ t.bitmap.uploadToTexture(true); } diff --git a/vtm/src/org/oscim/theme/MatchingCacheKey.java b/vtm/src/org/oscim/theme/MatchingCacheKey.java index f04a446a..c888d5c1 100644 --- a/vtm/src/org/oscim/theme/MatchingCacheKey.java +++ b/vtm/src/org/oscim/theme/MatchingCacheKey.java @@ -37,7 +37,7 @@ class MatchingCacheKey { boolean set(TagSet tags, MatchingCacheKey compare) { int numTags = tags.numTags; - /* Test if tags are equal to previous query */ + /* Test if tags are equal to previous query */ if (compare != null && numTags == compare.mTags.length) { int i = 0; for (; i < numTags; i++) { @@ -51,9 +51,9 @@ class MatchingCacheKey { return true; } - /* Clone tags as they belong to TileDataSource. + /* Clone tags as they belong to TileDataSource. * Also needed for comparison if previous tags - * were equal. */ + * were equal. */ mTags = new Tag[numTags]; int result = 7; diff --git a/vtm/src/org/oscim/theme/RenderTheme.java b/vtm/src/org/oscim/theme/RenderTheme.java index 4aa27986..67a2da19 100644 --- a/vtm/src/org/oscim/theme/RenderTheme.java +++ b/vtm/src/org/oscim/theme/RenderTheme.java @@ -114,10 +114,10 @@ public class RenderTheme implements IRenderTheme { @Override public RenderStyle[] matchElement(GeometryType geometryType, TagSet tags, int zoomLevel) { - /* list of items in cache */ + /* list of items in cache */ RenderStyleItem ris = null; - /* the item matching tags and zoomlevel */ + /* the item matching tags and zoomlevel */ RenderStyleItem ri = null; int type = geometryType.nativeInt; @@ -128,7 +128,7 @@ public class RenderTheme implements IRenderTheme { RenderStyleCache cache = mStyleCache[type - 1]; - /* NOTE: maximum zoom level supported is 32 */ + /* NOTE: maximum zoom level supported is 32 */ int zoomMask = 1 << zoomLevel; synchronized (cache) { @@ -146,12 +146,12 @@ public class RenderTheme implements IRenderTheme { } if (ri == null) { - /* get instruction for current cacheKey */ + /* get instruction for current cacheKey */ ris = cache.getRenderInstructions(); for (ri = ris; ri != null; ri = ri.next) { if ((ri.zoom & zoomMask) != 0) { - /* cache hit */ + /* cache hit */ //log.debug(hitCount.incrementAndGet() // + "/" + sameCount + "/" + missCount @@ -162,7 +162,7 @@ public class RenderTheme implements IRenderTheme { } if (ri == null) { - /* cache miss */ + /* cache miss */ //missCount.incrementAndGet(); List matches = cache.instructionList; @@ -187,13 +187,13 @@ public class RenderTheme implements IRenderTheme { } } } - /* check if same instructions are used in another level */ + /* check if same instructions are used in another level */ for (ri = ris; ri != null; ri = ri.next) { if (size == 0) { if (ri.list != null) continue; - /* both matchinglists are empty */ + /* both matchinglists are empty */ break; } @@ -210,20 +210,20 @@ public class RenderTheme implements IRenderTheme { i++; } if (i == size) - /* both matching lists contain the same items */ + /* both matching lists contain the same items */ break; } if (ri != null) { - /* we found a same matchting list on another zoomlevel add - * this zoom level to the existing RenderInstructionItem. */ + /* we found a same matchting list on another zoomlevel add + * this zoom level to the existing RenderInstructionItem. */ ri.zoom |= zoomMask; //log.debug(zoomLevel + " same instructions " + size + " " - // + Arrays.deepToString(tags)); + // + Arrays.deepToString(tags)); } else { //log.debug(zoomLevel + " new instructions " + size + " " - // + Arrays.deepToString(tags)); + // + Arrays.deepToString(tags)); ri = new RenderStyleItem(); ri.zoom = zoomMask; @@ -233,7 +233,7 @@ public class RenderTheme implements IRenderTheme { matches.toArray(ri.list); } - /* attach this list to the one found for MatchingKey */ + /* attach this list to the one found for MatchingKey */ if (ris != null) { ri.next = ris.next; ri.key = ris.key; diff --git a/vtm/src/org/oscim/theme/XmlThemeBuilder.java b/vtm/src/org/oscim/theme/XmlThemeBuilder.java index 1b8eab67..1655f609 100644 --- a/vtm/src/org/oscim/theme/XmlThemeBuilder.java +++ b/vtm/src/org/oscim/theme/XmlThemeBuilder.java @@ -407,7 +407,7 @@ public class XmlThemeBuilder extends DefaultHandler { if (!isOutline) validateNonNegative("width", b.strokeWidth); } else { - /* use stroke width relative to 'line' */ + /* use stroke width relative to 'line' */ b.strokeWidth += line.width; if (b.strokeWidth <= 0) b.strokeWidth = 1; diff --git a/vtm/src/org/oscim/theme/rule/Rule.java b/vtm/src/org/oscim/theme/rule/Rule.java index 68f2fdcc..d9212acf 100644 --- a/vtm/src/org/oscim/theme/rule/Rule.java +++ b/vtm/src/org/oscim/theme/rule/Rule.java @@ -79,7 +79,7 @@ public class Rule { /* only add first matching rule and when-matched rules iff a * previous rule matched */ for (Rule r : subRules) { - /* continue if matched xor selectWhenMatch */ + /* continue if matched xor selectWhenMatch */ if (matched ^ r.selectWhenMatched) continue; @@ -87,8 +87,8 @@ public class Rule { matched = true; } } else { - /* add all rules and when-matched rules iff a previous rule - * matched */ + /* add all rules and when-matched rules iff a previous rule + * matched */ for (Rule r : subRules) { if (r.selectWhenMatched && !matched) continue; @@ -100,14 +100,14 @@ public class Rule { } if (styles == EMPTY_STYLE) - /* matched if styles where added */ + /* matched if styles where added */ return matched; - /* add instructions for this rule */ + /* add instructions for this rule */ for (RenderStyle ri : styles) result.add(ri); - /* this rule did match */ + /* this rule did match */ return true; } @@ -283,15 +283,15 @@ public class Rule { public final String[] keys; public final String[] values; - /* (-) 'exclusive negation' matches when either KEY is not present - * or KEY is present and any VALUE is NOT present - * - * (\) 'except negation' matches when KEY is present - * none items of VALUE is present (TODO). - * (can be emulated by ...) - * - * (~) 'non-exclusive negation' matches when either KEY is not present - * or KEY is present and any VALUE is present */ + /* (-) 'exclusive negation' matches when either KEY is not present + * or KEY is present and any VALUE is NOT present + * + * (\) 'except negation' matches when KEY is present + * none items of VALUE is present (TODO). + * (can be emulated by ...) + * + * (~) 'non-exclusive negation' matches when either KEY is not present + * or KEY is present and any VALUE is present */ public final boolean exclusive; diff --git a/vtm/src/org/oscim/tiling/TileSource.java b/vtm/src/org/oscim/tiling/TileSource.java index b9099129..56a820ea 100644 --- a/vtm/src/org/oscim/tiling/TileSource.java +++ b/vtm/src/org/oscim/tiling/TileSource.java @@ -116,7 +116,7 @@ public abstract class TileSource { return false; //if (this.db != ((MapOptions) other).db) - // return false; + // return false; // FIXME test if this is correct! if (!this.entrySet().equals(((Options) other).entrySet())) diff --git a/vtm/src/org/oscim/tiling/source/LwHttp.java b/vtm/src/org/oscim/tiling/source/LwHttp.java index 6a9066bb..1bd217e2 100644 --- a/vtm/src/org/oscim/tiling/source/LwHttp.java +++ b/vtm/src/org/oscim/tiling/source/LwHttp.java @@ -106,7 +106,7 @@ public class LwHttp implements HttpEngine { String key = l.getKey(); String val = l.getValue(); //if ("Accept-Encoding".equals(key) && "gzip".equals(val)) - // mUseGZIP = true; + // mUseGZIP = true; sb.append('\n').append(key).append(": ").append(val); } sb.append("\n\n"); @@ -169,7 +169,7 @@ public class LwHttp implements HttpEngine { public synchronized long skip(long n) throws IOException { /* Android(4.1.2) image decoder *requires* skip to * actually skip the requested amount. - * https://code.google.com/p/android/issues/detail?id=6066 */ + * https://code.google.com/p/android/issues/detail?id=6066 */ long sumSkipped = 0L; while (sumSkipped < n) { long skipped = super.skip(n - sumSkipped); @@ -181,7 +181,7 @@ public class LwHttp implements HttpEngine { break; // EOF sumSkipped += 1; - /* was incremented by read() */ + /* was incremented by read() */ bytesRead -= 1; } @@ -200,7 +200,7 @@ public class LwHttp implements HttpEngine { if (marked >= 0) bytesRead = marked; - /* TODO could check if the mark is already invalid */ + /* TODO could check if the mark is already invalid */ super.reset(); } @@ -272,12 +272,12 @@ public class LwHttp implements HttpEngine { int contentLength = -1; - /* header may not be larger than BUFFER_SIZE for this to work */ + /* header may not be larger than BUFFER_SIZE for this to work */ for (; (pos < read) || ((read < BUFFER_SIZE) && (len = is.read(buf, read, BUFFER_SIZE - read)) >= 0); len = 0) { read += len; - /* end of header lines */ + /* end of header lines */ while (end < read && (buf[end] != '\n')) end++; @@ -288,7 +288,7 @@ public class LwHttp implements HttpEngine { if (buf[end] != '\n') continue; - /* empty line (header end) */ + /* empty line (header end) */ if (end - pos == 1) { end += 1; break; @@ -296,13 +296,13 @@ public class LwHttp implements HttpEngine { if (first) { first = false; - /* check only for OK ("HTTP/1.? ".length == 9) */ + /* check only for OK ("HTTP/1.? ".length == 9) */ if (!check(HEADER_HTTP_OK, buf, pos + 9, end)) { throw new IOException("HTTP Error: " + new String(buf, pos, end - pos - 1)); } } else if (check(HEADER_CONTENT_LENGTH, buf, pos, end)) { - /* parse Content-Length */ + /* parse Content-Length */ contentLength = parseInt(buf, pos + HEADER_CONTENT_LENGTH.length + 2, end - 1); } else if (check(HEADER_ENCODING_GZIP, buf, pos, end)) { @@ -320,7 +320,7 @@ public class LwHttp implements HttpEngine { end = pos; } - /* back to start of content */ + /* back to start of content */ is.reset(); is.mark(0); is.skip(end); @@ -355,10 +355,10 @@ public class LwHttp implements HttpEngine { } if (mSocket == null) { - /* might throw IOException */ + /* might throw IOException */ lwHttpConnect(); - /* TODO parse from header */ + /* TODO parse from header */ mMaxRequests = RESPONSE_EXPECTED_LIVES; } @@ -532,7 +532,7 @@ public class LwHttp implements HttpEngine { if (tileSource.getUrlFormatter() != UrlTileSource.URL_FORMATTER) return new LwHttp(tileSource, null); - /* use optimized formatter replacing the default */ + /* use optimized formatter replacing the default */ if (mTilePath == null) { String[] path = tileSource.getTilePath(); mTilePath = new byte[path.length][]; diff --git a/vtm/src/org/oscim/tiling/source/PbfDecoder.java b/vtm/src/org/oscim/tiling/source/PbfDecoder.java index 424f6ef0..a51ed4e6 100644 --- a/vtm/src/org/oscim/tiling/source/PbfDecoder.java +++ b/vtm/src/org/oscim/tiling/source/PbfDecoder.java @@ -462,7 +462,7 @@ public abstract class PbfDecoder implements ITileDecoder { public boolean hasData() throws IOException { //if (mBufferOffset + bufferPos >= mMsgEnd) - // return false; + // return false; return fillBuffer(1) > 0; } diff --git a/vtm/src/org/oscim/tiling/source/mapfile/MapDatabase.java b/vtm/src/org/oscim/tiling/source/mapfile/MapDatabase.java index 3fe25af2..7363f814 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/MapDatabase.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/MapDatabase.java @@ -231,16 +231,16 @@ public class MapDatabase implements ITileDataSource { mTileProjection.setTile(tile); //mTile = tile; - /* size of tile in map coordinates; */ + /* size of tile in map coordinates; */ double size = 1.0 / (1 << tile.zoomLevel); - /* simplification tolerance */ + /* simplification tolerance */ int pixel = (tile.zoomLevel > 11) ? 1 : 2; int simplify = Tile.SIZE / pixel; - /* translate screen pixel for tile to latitude and longitude - * tolerance for point reduction before projection. */ + /* translate screen pixel for tile to latitude and longitude + * tolerance for point reduction before projection. */ minDeltaLat = (int) (Math.abs(MercatorProjection.toLatitude(tile.y + size) - MercatorProjection.toLatitude(tile.y)) * 1e6) / simplify; minDeltaLon = (int) (Math.abs(MercatorProjection.toLongitude(tile.x + size) @@ -250,7 +250,7 @@ public class MapDatabase implements ITileDataSource { queryParameters.queryZoomLevel = mTileSource.fileHeader.getQueryZoomLevel(tile.zoomLevel); - /* get and check the sub-file for the query zoom level */ + /* get and check the sub-file for the query zoom level */ SubFileParameter subFileParameter = mTileSource.fileHeader.getSubFileParameter(queryParameters.queryZoomLevel); @@ -325,7 +325,7 @@ public class MapDatabase implements ITileDataSource { int poisOnQueryZoomLevel = zoomTable[zoomTableRow][0]; int waysOnQueryZoomLevel = zoomTable[zoomTableRow][1]; - /* get the relative offset to the first stored way in the block */ + /* get the relative offset to the first stored way in the block */ int firstWayOffset = mReadBuffer.readUnsignedInt(); if (firstWayOffset < 0) { log.warn(INVALID_FIRST_WAY_OFFSET + firstWayOffset); @@ -335,7 +335,7 @@ public class MapDatabase implements ITileDataSource { return; } - /* add the current buffer position to the relative first way offset */ + /* add the current buffer position to the relative first way offset */ firstWayOffset += mReadBuffer.getBufferPosition(); if (firstWayOffset > mReadBuffer.getBufferSize()) { log.warn(INVALID_FIRST_WAY_OFFSET + firstWayOffset); @@ -349,7 +349,7 @@ public class MapDatabase implements ITileDataSource { return; } - /* finished reading POIs, check if the current buffer position is valid */ + /* finished reading POIs, check if the current buffer position is valid */ if (mReadBuffer.getBufferPosition() > firstWayOffset) { log.warn("invalid buffer position: " + mReadBuffer.getBufferPosition()); if (mDebugFile) { @@ -358,7 +358,7 @@ public class MapDatabase implements ITileDataSource { return; } - /* move the pointer to the first way */ + /* move the pointer to the first way */ mReadBuffer.setBufferPosition(firstWayOffset); if (!processWays(queryParameters, mapDataSink, waysOnQueryZoomLevel)) { @@ -367,8 +367,8 @@ public class MapDatabase implements ITileDataSource { } - // private long mCurrentRow; - // private long mCurrentCol; + // private long mCurrentRow; + // private long mCurrentCol; private int xmin, ymin, xmax, ymax; @@ -406,7 +406,7 @@ public class MapDatabase implements ITileDataSource { private void processBlocks(ITileDataSink mapDataSink, QueryParameters queryParams, SubFileParameter subFileParameter) throws IOException { - /* read and process all blocks from top to bottom and from left to right */ + /* read and process all blocks from top to bottom and from left to right */ for (long row = queryParams.fromBlockY; row <= queryParams.toBlockY; row++) { for (long column = queryParams.fromBlockX; column <= queryParams.toBlockX; column++) { //mCurrentCol = column - queryParameters.fromBlockX; @@ -416,30 +416,30 @@ public class MapDatabase implements ITileDataSource { row - queryParams.fromBlockY, column - queryParams.fromBlockX); - /* calculate the actual block number of the needed block in the - * file */ + /* calculate the actual block number of the needed block in the + * file */ long blockNumber = row * subFileParameter.blocksWidth + column; - /* get the current index entry */ + /* get the current index entry */ long blockIndexEntry = mTileSource.databaseIndexCache.getIndexEntry(subFileParameter, blockNumber); - /* check the water flag of the block in its index entry */ + /* check the water flag of the block in its index entry */ if ((blockIndexEntry & BITMASK_INDEX_WATER) != 0) { // Deprecate water tiles rendering - /*MapElement e = mElem; - e.clear(); - e.tags.clear(); - e.tags.add(mWaterTag); - e.startPolygon(); - e.addPoint(xmin, ymin); - e.addPoint(xmax, ymin); - e.addPoint(xmax, ymax); - e.addPoint(xmin, ymax); - mapDataSink.process(e);*/ + /*MapElement e = mElem; + e.clear(); + e.tags.clear(); + e.tags.add(mWaterTag); + e.startPolygon(); + e.addPoint(xmin, ymin); + e.addPoint(xmax, ymin); + e.addPoint(xmax, ymax); + e.addPoint(xmin, ymax); + mapDataSink.process(e);*/ } - /* get and check the current block pointer */ + /* get and check the current block pointer */ long blockPointer = blockIndexEntry & BITMASK_INDEX_OFFSET; if (blockPointer < 1 || blockPointer > subFileParameter.subFileSize) { log.warn("invalid current block pointer: " + blockPointer); @@ -448,12 +448,12 @@ public class MapDatabase implements ITileDataSource { } long nextBlockPointer; - /* check if the current block is the last block in the file */ + /* check if the current block is the last block in the file */ if (blockNumber + 1 == subFileParameter.numberOfBlocks) { - /* set the next block pointer to the end of the file */ + /* set the next block pointer to the end of the file */ nextBlockPointer = subFileParameter.subFileSize; } else { - /* get and check the next block pointer */ + /* get and check the next block pointer */ nextBlockPointer = mTileSource.databaseIndexCache.getIndexEntry(subFileParameter, blockNumber + 1); nextBlockPointer &= BITMASK_INDEX_OFFSET; @@ -465,18 +465,18 @@ public class MapDatabase implements ITileDataSource { } } - /* calculate the size of the current block */ + /* calculate the size of the current block */ int blockSize = (int) (nextBlockPointer - blockPointer); if (blockSize < 0) { log.warn("current block size must not be negative: " + blockSize); return; } else if (blockSize == 0) { - /* the current block is empty, continue with the next block */ + /* the current block is empty, continue with the next block */ continue; } else if (blockSize > ReadBuffer.MAXIMUM_BUFFER_SIZE) { - /* the current block is too large, continue with the next - * block */ + /* the current block is too large, continue with the next + * block */ log.warn("current block size too large: " + blockSize); continue; } else if (blockPointer + blockSize > mFileSize) { @@ -485,17 +485,17 @@ public class MapDatabase implements ITileDataSource { return; } - /* seek to the current block in the map file */ + /* seek to the current block in the map file */ mInputFile.seek(subFileParameter.startAddress + blockPointer); - /* read the current block into the buffer */ + /* read the current block into the buffer */ if (!mReadBuffer.readFromFile(blockSize)) { - /* skip the current block */ + /* skip the current block */ log.warn("reading current block has failed: " + blockSize); return; } - /* calculate the top-left coordinates of the underlying tile */ + /* calculate the top-left coordinates of the underlying tile */ double tileLatitudeDeg = Projection.tileYToLatitude(subFileParameter.boundaryTileTop + row, subFileParameter.baseZoomLevel); @@ -519,7 +519,7 @@ public class MapDatabase implements ITileDataSource { */ private boolean processBlockSignature() { if (mDebugFile) { - /* get and check the block signature */ + /* get and check the block signature */ mSignatureBlock = mReadBuffer.readUTF8EncodedString(SIGNATURE_LENGTH_BLOCK); if (!mSignatureBlock.startsWith("###TileStart")) { log.warn("invalid block signature: " + mSignatureBlock); @@ -545,7 +545,7 @@ public class MapDatabase implements ITileDataSource { for (int elementCounter = numberOfPois; elementCounter != 0; --elementCounter) { if (mDebugFile) { - /* get and check the POI signature */ + /* get and check the POI signature */ mSignaturePoi = mReadBuffer.readUTF8EncodedString(SIGNATURE_LENGTH_POI); if (!mSignaturePoi.startsWith("***POIStart")) { log.warn("invalid POI signature: " + mSignaturePoi); @@ -554,18 +554,18 @@ public class MapDatabase implements ITileDataSource { } } - /* get the POI latitude offset (VBE-S) */ + /* get the POI latitude offset (VBE-S) */ int latitude = mTileLatitude + mReadBuffer.readSignedInt(); - /* get the POI longitude offset (VBE-S) */ + /* get the POI longitude offset (VBE-S) */ int longitude = mTileLongitude + mReadBuffer.readSignedInt(); - /* get the special byte which encodes multiple flags */ + /* get the special byte which encodes multiple flags */ byte specialByte = mReadBuffer.readByte(); - /* bit 1-4 represent the layer */ + /* bit 1-4 represent the layer */ byte layer = (byte) ((specialByte & POI_LAYER_BITMASK) >>> POI_LAYER_SHIFT); - /* bit 5-8 represent the number of tag IDs */ + /* bit 5-8 represent the number of tag IDs */ byte numberOfTags = (byte) (specialByte & POI_NUMBER_OF_TAGS_BITMASK); if (numberOfTags != 0) { @@ -575,26 +575,26 @@ public class MapDatabase implements ITileDataSource { numTags = numberOfTags; } - /* reset to common tag position */ + /* reset to common tag position */ e.tags.numTags = numTags; - /* get the feature bitmask (1 byte) */ + /* get the feature bitmask (1 byte) */ byte featureByte = mReadBuffer.readByte(); - /* bit 1-3 enable optional features - * check if the POI has a name */ + /* bit 1-3 enable optional features + * check if the POI has a name */ if ((featureByte & POI_FEATURE_NAME) != 0) { String str = mTileSource.extractLocalized(mReadBuffer.readUTF8EncodedString()); e.tags.add(new Tag(Tag.KEY_NAME, str, false)); } - /* check if the POI has a house number */ + /* check if the POI has a house number */ if ((featureByte & POI_FEATURE_HOUSE_NUMBER) != 0) { String str = mReadBuffer.readUTF8EncodedString(); e.tags.add(new Tag(Tag.KEY_HOUSE_NUMBER, str, false)); } - /* check if the POI has an elevation */ + /* check if the POI has an elevation */ if ((featureByte & POI_FEATURE_ELEVATION) != 0) { String str = Integer.toString(mReadBuffer.readSignedInt()); e.tags.add(new Tag(Tag.KEY_ELE, str, false)); @@ -610,7 +610,7 @@ public class MapDatabase implements ITileDataSource { } private boolean processWayDataBlock(MapElement e, boolean doubleDeltaEncoding, boolean isLine) { - /* get and check the number of way coordinate blocks (VBE-U) */ + /* get and check the number of way coordinate blocks (VBE-U) */ int numBlocks = mReadBuffer.readUnsignedInt(); if (numBlocks < 1 || numBlocks > Short.MAX_VALUE) { log.warn("invalid number of way coordinate blocks: " + numBlocks); @@ -621,7 +621,7 @@ public class MapDatabase implements ITileDataSource { if (wayLengths.length > numBlocks) wayLengths[numBlocks] = -1; - /* read the way coordinate blocks */ + /* read the way coordinate blocks */ for (int coordinateBlock = 0; coordinateBlock < numBlocks; ++coordinateBlock) { int numWayNodes = mReadBuffer.readUnsignedInt(); @@ -631,7 +631,7 @@ public class MapDatabase implements ITileDataSource { return false; } - /* each way node consists of latitude and longitude */ + /* each way node consists of latitude and longitude */ int len = numWayNodes * 2; wayLengths[coordinateBlock] = decodeWayNodes(doubleDeltaEncoding, @@ -649,7 +649,7 @@ public class MapDatabase implements ITileDataSource { int outPos = e.pointPos; int lat, lon; - /* first node latitude single-delta offset */ + /* first node latitude single-delta offset */ int firstLat = lat = mTileLatitude + buffer[0]; int firstLon = lon = mTileLongitude + buffer[1]; @@ -775,16 +775,16 @@ public class MapDatabase implements ITileDataSource { return false; } - /* ignore the way tile bitmask (2 bytes) */ + /* ignore the way tile bitmask (2 bytes) */ mReadBuffer.skipBytes(2); } - /* get the special byte which encodes multiple flags */ + /* get the special byte which encodes multiple flags */ byte specialByte = mReadBuffer.readByte(); - /* bit 1-4 represent the layer */ + /* bit 1-4 represent the layer */ byte layer = (byte) ((specialByte & WAY_LAYER_BITMASK) >>> WAY_LAYER_SHIFT); - /* bit 5-8 represent the number of tag IDs */ + /* bit 5-8 represent the number of tag IDs */ byte numberOfTags = (byte) (specialByte & WAY_NUMBER_OF_TAGS_BITMASK); if (numberOfTags != 0) { @@ -795,10 +795,10 @@ public class MapDatabase implements ITileDataSource { numTags = numberOfTags; } - /* get the feature bitmask (1 byte) */ + /* get the feature bitmask (1 byte) */ byte featureByte = mReadBuffer.readByte(); - /* bit 1-6 enable optional features */ + /* bit 1-6 enable optional features */ boolean featureWayDoubleDeltaEncoding = (featureByte & WAY_FEATURE_DOUBLE_DELTA_ENCODING) != 0; @@ -854,7 +854,7 @@ public class MapDatabase implements ITileDataSource { wayDataBlocks = 1; } - /* some guessing if feature is a line or a polygon */ + /* some guessing if feature is a line or a polygon */ boolean linearFeature = !OSMUtils.isArea(e); for (int wayDataBlock = 0; wayDataBlock < wayDataBlocks; wayDataBlock++) { @@ -863,7 +863,7 @@ public class MapDatabase implements ITileDataSource { if (!processWayDataBlock(e, featureWayDoubleDeltaEncoding, linearFeature)) return false; - /* drop invalid outer ring */ + /* drop invalid outer ring */ if (e.isPoly() && e.index[0] < 6) { continue; } @@ -887,10 +887,10 @@ public class MapDatabase implements ITileDataSource { private float[] readOptionalLabelPosition() { float[] labelPosition = new float[2]; - /* get the label position latitude offset (VBE-S) */ + /* get the label position latitude offset (VBE-S) */ labelPosition[1] = mTileLatitude + mReadBuffer.readSignedInt(); - /* get the label position longitude offset (VBE-S) */ + /* get the label position longitude offset (VBE-S) */ labelPosition[0] = mTileLongitude + mReadBuffer.readSignedInt(); return labelPosition; @@ -939,21 +939,21 @@ public class MapDatabase implements ITileDataSource { double divx, divy; void setTile(Tile tile) { - /* tile position in pixels at tile zoom */ + /* tile position in pixels at tile zoom */ long x = tile.tileX * Tile.SIZE; long y = tile.tileY * Tile.SIZE + Tile.SIZE; - /* size of the map in pixel at tile zoom */ + /* size of the map in pixel at tile zoom */ long mapExtents = Tile.SIZE << tile.zoomLevel; - /* offset relative to lat/lon == 0 */ + /* offset relative to lat/lon == 0 */ dx = (x - (mapExtents >> 1)); dy = (y - (mapExtents >> 1)); - /* scales longitude(1e6) to map-pixel */ + /* scales longitude(1e6) to map-pixel */ divx = (180.0 * COORD_SCALE) / (mapExtents >> 1); - /* scale latidute to map-pixel */ + /* scale latidute to map-pixel */ divy = (Math.PI * 2.0) / (mapExtents >> 1); } @@ -999,7 +999,7 @@ public class MapDatabase implements ITileDataSource { lat = projectLat(coords[inPos + 1]); if (cnt != 0) { - /* drop small distance intermediate nodes */ + /* drop small distance intermediate nodes */ if (lat == pLat && lon == pLon) { //log.debug("drop zero delta "); continue; @@ -1011,7 +1011,7 @@ public class MapDatabase implements ITileDataSource { } if (isPoly && coords[first] == pLon && coords[first + 1] == pLat) { - /* remove identical start/end point */ + /* remove identical start/end point */ //log.debug("drop closing point {}", e); indices[idx] = (short) (cnt - 2); outPos -= 2; diff --git a/vtm/src/org/oscim/utils/KeyMap.java b/vtm/src/org/oscim/utils/KeyMap.java index 5bb28540..810b93f0 100644 --- a/vtm/src/org/oscim/utils/KeyMap.java +++ b/vtm/src/org/oscim/utils/KeyMap.java @@ -165,9 +165,9 @@ public class KeyMap extends Inlist> { throw new IllegalArgumentException("Load factor: " + loadFactor); } - /* Note that this implementation ignores loadFactor; it always uses + /* Note that this implementation ignores loadFactor; it always uses * a load factor of 3/4. This simplifies the code and generally - * improves performance. */ + * improves performance. */ } /** @@ -352,7 +352,7 @@ public class KeyMap extends Inlist> { for (int j = 0; j < oldCapacity; j++) { /* Rehash the bucket using the minimum number of field writes. - * This is the most subtle and delicate code in the class. */ + * This is the most subtle and delicate code in the class. */ HashItem e = oldTable[j]; if (e == null) { continue; @@ -482,110 +482,110 @@ public class KeyMap extends Inlist> { return i + 1; } - // public K put(K key) { - // // if (key == null) { - // // return putValueForNullKey(value); - // // } + // public K put(K key) { + // // if (key == null) { + // // return putValueForNullKey(value); + // // } // - // int hash = secondaryHash(key.hashCode()); - // HashItem[] tab = table; - // int index = hash & (tab.length - 1); - // for (HashItem e = tab[index]; e != null; e = e.next) { - // if (e.hash == hash && key.equals(e.key)) { - // preModify(e); - // //V oldValue = e.value; - // //e.value = value; - // return e.key; //oldValue; - // } - // } + // int hash = secondaryHash(key.hashCode()); + // HashItem[] tab = table; + // int index = hash & (tab.length - 1); + // for (HashItem e = tab[index]; e != null; e = e.next) { + // if (e.hash == hash && key.equals(e.key)) { + // preModify(e); + // //V oldValue = e.value; + // //e.value = value; + // return e.key; //oldValue; + // } + // } // - // // No entry for (non-null) key is present; create one - // modCount++; - // if (size++ > threshold) { - // tab = doubleCapacity(); - // index = hash & (tab.length - 1); - // } - // addNewEntry(key, hash, index); - // return null; - // } + // // No entry for (non-null) key is present; create one + // modCount++; + // if (size++ > threshold) { + // tab = doubleCapacity(); + // index = hash & (tab.length - 1); + // } + // addNewEntry(key, hash, index); + // return null; + // } - // private V putValueForNullKey(V value) { - // HashMapEntry entry = entryForNullKey; - // if (entry == null) { - // addNewEntryForNullKey(value); - // size++; - // modCount++; - // return null; - // } else { - // preModify(entry); - // V oldValue = entry.value; - // entry.value = value; - // return oldValue; - // } - // } + // private V putValueForNullKey(V value) { + // HashMapEntry entry = entryForNullKey; + // if (entry == null) { + // addNewEntryForNullKey(value); + // size++; + // modCount++; + // return null; + // } else { + // preModify(entry); + // V oldValue = entry.value; + // entry.value = value; + // return oldValue; + // } + // } - // /** - // * Returns whether this map contains the specified key. - // * - // * @param key - // * the key to search for. - // * @return {@code true} if this map contains the specified key, - // * {@code false} otherwise. - // */ - // //@Override - // public boolean containsKey(Object key) { - // if (key == null) { - // return entryForNullKey != null; - // } + // /** + // * Returns whether this map contains the specified key. + // * + // * @param key + // * the key to search for. + // * @return {@code true} if this map contains the specified key, + // * {@code false} otherwise. + // */ + // //@Override + // public boolean containsKey(Object key) { + // if (key == null) { + // return entryForNullKey != null; + // } // - // // Doug Lea's supplemental secondaryHash function (inlined) - // int hash = key.hashCode(); - // hash ^= (hash >>> 20) ^ (hash >>> 12); - // hash ^= (hash >>> 7) ^ (hash >>> 4); + // // Doug Lea's supplemental secondaryHash function (inlined) + // int hash = key.hashCode(); + // hash ^= (hash >>> 20) ^ (hash >>> 12); + // hash ^= (hash >>> 7) ^ (hash >>> 4); // - // HashItem[] tab = table; - // for (HashItem e = tab[hash & (tab.length - 1)]; e != null; e = e.next) { - // K eKey = e.key; - // if (eKey == key || (e.hash == hash && key.equals(eKey))) { - // return true; - // } - // } - // return false; - // } + // HashItem[] tab = table; + // for (HashItem e = tab[hash & (tab.length - 1)]; e != null; e = e.next) { + // K eKey = e.key; + // if (eKey == key || (e.hash == hash && key.equals(eKey))) { + // return true; + // } + // } + // return false; + // } - // /** - // * Returns whether this map contains the specified value. - // * - // * @param value - // * the value to search for. - // * @return {@code true} if this map contains the specified value, - // * {@code false} otherwise. - // */ - // @Override - // public boolean containsValue(Object value) { - // HashMapEntry[] tab = table; - // int len = tab.length; - // if (value == null) { - // for (int i = 0; i < len; i++) { - // for (HashMapEntry e = tab[i]; e != null; e = e.next) { - // if (e.value == null) { - // return true; - // } - // } - // } - // return entryForNullKey != null && entryForNullKey.value == null; - // } + // /** + // * Returns whether this map contains the specified value. + // * + // * @param value + // * the value to search for. + // * @return {@code true} if this map contains the specified value, + // * {@code false} otherwise. + // */ + // @Override + // public boolean containsValue(Object value) { + // HashMapEntry[] tab = table; + // int len = tab.length; + // if (value == null) { + // for (int i = 0; i < len; i++) { + // for (HashMapEntry e = tab[i]; e != null; e = e.next) { + // if (e.value == null) { + // return true; + // } + // } + // } + // return entryForNullKey != null && entryForNullKey.value == null; + // } // - // // value is non-null - // for (int i = 0; i < len; i++) { - // for (HashMapEntry e = tab[i]; e != null; e = e.next) { - // if (value.equals(e.value)) { - // return true; - // } - // } - // } - // return entryForNullKey != null && value.equals(entryForNullKey.value); - // } + // // value is non-null + // for (int i = 0; i < len; i++) { + // for (HashMapEntry e = tab[i]; e != null; e = e.next) { + // if (value.equals(e.value)) { + // return true; + // } + // } + // } + // return entryForNullKey != null && value.equals(entryForNullKey.value); + // } ///** // * Ensures that the hash table has sufficient capacity to store the @@ -599,32 +599,32 @@ public class KeyMap extends Inlist> { // * This method is called only by putAll. // */ //private void ensureCapacity(int numMappings) { - // int newCapacity = roundUpToPowerOfTwo(capacityForInitSize(numMappings)); - // HashItem[] oldTable = table; - // int oldCapacity = oldTable.length; - // if (newCapacity <= oldCapacity) { - // return; - // } - // if (newCapacity == oldCapacity * 2) { - // doubleCapacity(); - // return; - // } + // int newCapacity = roundUpToPowerOfTwo(capacityForInitSize(numMappings)); + // HashItem[] oldTable = table; + // int oldCapacity = oldTable.length; + // if (newCapacity <= oldCapacity) { + // return; + // } + // if (newCapacity == oldCapacity * 2) { + // doubleCapacity(); + // return; + // } // - // // We're growing by at least 4x, rehash in the obvious way - // HashItem[] newTable = makeTable(newCapacity); - // if (size != 0) { - // int newMask = newCapacity - 1; - // for (int i = 0; i < oldCapacity; i++) { - // for (HashItem e = oldTable[i]; e != null;) { - // HashItem oldNext = e.next; - // int newIndex = e.hash & newMask; - // HashItem newNext = newTable[newIndex]; - // newTable[newIndex] = e; - // e.next = newNext; - // e = oldNext; - // } - // } - // } + // // We're growing by at least 4x, rehash in the obvious way + // HashItem[] newTable = makeTable(newCapacity); + // if (size != 0) { + // int newMask = newCapacity - 1; + // for (int i = 0; i < oldCapacity; i++) { + // for (HashItem e = oldTable[i]; e != null;) { + // HashItem oldNext = e.next; + // int newIndex = e.hash & newMask; + // HashItem newNext = newTable[newIndex]; + // newTable[newIndex] = e; + // e.next = newNext; + // e = oldNext; + // } + // } + // } //} } diff --git a/vtm/src/org/oscim/utils/RTree.java b/vtm/src/org/oscim/utils/RTree.java index 9137376b..3e926420 100644 --- a/vtm/src/org/oscim/utils/RTree.java +++ b/vtm/src/org/oscim/utils/RTree.java @@ -383,7 +383,7 @@ public class RTree implements SpatialIndex, Iterable { return; } - /* not a leaf node */ + /* not a leaf node */ Branch[] children = node.children(); for (int idx = 0; idx < node.count; idx++) { countRec(children[idx].node, count); @@ -411,7 +411,7 @@ public class RTree implements SpatialIndex, Iterable { if (!node.isLeaf()) { Branch[] children = node.children(); - /* This is an internal node in the tree */ + /* This is an internal node in the tree */ for (int idx = 0; idx < node.count; idx++) { removeAllRec(children[idx].node); } @@ -457,13 +457,13 @@ public class RTree implements SpatialIndex, Iterable { //assert (level >= 0 && level <= node.level); if (node.level > level) { - /* Still above level for insertion, go down tree recursively */ + /* Still above level for insertion, go down tree recursively */ int idx = pickBranch(node, rect); Branch[] children = node.children(); Node newNode = insertRectRec(rect, item, children[idx].node, level); if (newNode != null) { - /* Child was split */ + /* Child was split */ node.branch[idx].setCover(children[idx].node); Branch branch = new Branch(); branch.node = newNode; @@ -473,19 +473,19 @@ public class RTree implements SpatialIndex, Iterable { } return null; } else { - /* Child was not split */ + /* Child was not split */ node.branch[idx].add(rect); return null; } } - /* Have reached level for insertion. Add rect, split if necessary */ + /* Have reached level for insertion. Add rect, split if necessary */ assert (node.level == level); Branch branch = new Branch(); branch.set(rect); branch.node = item; - /* Child field of leaves contains id of data record */ + /* Child field of leaves contains id of data record */ if (node.addBranch(branch)) { return splitNode(node, branch); } @@ -541,16 +541,16 @@ public class RTree implements SpatialIndex, Iterable { * InsertRect2 does the recursion. */ public boolean insertRect(Rect rect, T item, int level) { - // if (DEBUG) { - // assert (rect != null && root != null); - // assert (level >= 0 && level <= root.level); - // } + // if (DEBUG) { + // assert (rect != null && root != null); + // assert (level >= 0 && level <= root.level); + // } Node root = mRoot; Node newNode = insertRectRec(rect, item, root, level); if (newNode != null) { - /* Root split, Grow tree taller and new root */ + /* Root split, Grow tree taller and new root */ Node newRoot = allocNode(); newRoot.level = root.level + 1; @@ -581,8 +581,8 @@ public class RTree implements SpatialIndex, Iterable { assert (node != null && (idx >= 0) && (idx < MAXNODES)); assert (node.count > 0); - /* Remove element by swapping with the last element to - * prevent gaps in array */ + /* Remove element by swapping with the last element to + * prevent gaps in array */ node.count--; if (node.count != idx) { @@ -603,15 +603,15 @@ public class RTree implements SpatialIndex, Iterable { Partition partition = mLocalVars.clear(); - /* Load all the branches into a buffer, initialize old node */ + /* Load all the branches into a buffer, initialize old node */ int level = node.level; partition.getBranches(node, branch); - /* Find partition */ + /* Find partition */ partition.choosePartition(); - /* Put branches from buffer into 2 nodes according to - * chosen partition */ + /* Put branches from buffer into 2 nodes according to + * chosen partition */ Node newNode = allocNode(); newNode.level = node.level = level; partition.loadNodes(node, newNode); @@ -645,8 +645,8 @@ public class RTree implements SpatialIndex, Iterable { ArrayList reInsertList = mReinsertNodes; if (removeRectRec(rect, item, root, reInsertList)) { - /* Found and deleted a data item - * Reinsert any branches from eliminated nodes */ + /* Found and deleted a data item + * Reinsert any branches from eliminated nodes */ for (Node node : reInsertList) { for (int idx = 0; idx < node.count; idx++) { insertRect((node.branch[idx]), @@ -657,7 +657,7 @@ public class RTree implements SpatialIndex, Iterable { } reInsertList.clear(); - /* Check for redundant root (not leaf, 1 child) and eliminate */ + /* Check for redundant root (not leaf, 1 child) and eliminate */ if (root.count == 1 && !root.isLeaf()) { Node tempNode = root.children()[0].node; @@ -685,7 +685,7 @@ public class RTree implements SpatialIndex, Iterable { if (node.isLeaf()) { for (int idx = 0; idx < node.count; idx++) { if (node.branch[idx].node == item) { - /* Must return after this call as count has changed */ + /* Must return after this call as count has changed */ disconnectBranch(node, idx); return true; } @@ -693,7 +693,7 @@ public class RTree implements SpatialIndex, Iterable { return false; } - /* not a leaf node */ + /* not a leaf node */ for (int idx = 0; idx < node.count; idx++) { if (!rect.overlap(node.branch[idx])) @@ -702,14 +702,14 @@ public class RTree implements SpatialIndex, Iterable { Branch[] children = node.children(); if (removeRectRec(rect, item, children[idx].node, removed)) { if (children[idx].node.count >= MINNODES) { - /* child removed, just resize parent rect */ + /* child removed, just resize parent rect */ children[idx].setCover(children[idx].node); } else { - /* child removed, not enough entries in node, - * eliminate node */ + /* child removed, not enough entries in node, + * eliminate node */ removed.add(children[idx].node); - /* Must return after this call as count has changed */ + /* Must return after this call as count has changed */ disconnectBranch(node, idx); } return true; @@ -718,90 +718,90 @@ public class RTree implements SpatialIndex, Iterable { return false; } - // /** - // * Search in an index tree or subtree for all data retangles that overlap - // * the argument rectangle. - // */ - // public boolean search(Node node, Rect rect, int[] found, SearchCallback cb, - // Object context) { - // if (DEBUG) { - // assert (node != null); - // assert (node.level >= 0); - // assert (rect != null); - // } + // /** + // * Search in an index tree or subtree for all data retangles that overlap + // * the argument rectangle. + // */ + // public boolean search(Node node, Rect rect, int[] found, SearchCallback cb, + // Object context) { + // if (DEBUG) { + // assert (node != null); + // assert (node.level >= 0); + // assert (rect != null); + // } // - // if (!node.isLeaf()) { - // Branch[] children = node.children(); - // /* This is an internal node in the tree */ - // for (int idx = 0; idx < node.count; idx++) { + // if (!node.isLeaf()) { + // Branch[] children = node.children(); + // /* This is an internal node in the tree */ + // for (int idx = 0; idx < node.count; idx++) { // - // if (rect.overlap(children[idx])) { - // if (!search(children[idx].node, rect, found, cb, context)) { - // /* Stop searching */ - // return false; - // } - // } - // } - // /* Continue searching */ - // return true; - // } + // if (rect.overlap(children[idx])) { + // if (!search(children[idx].node, rect, found, cb, context)) { + // /* Stop searching */ + // return false; + // } + // } + // } + // /* Continue searching */ + // return true; + // } // - // /* This is a leaf node */ - // for (int idx = 0; idx < node.count; idx++) { - // if (rect.overlap(node.branch[idx])) { - // @SuppressWarnings("unchecked") - // T item = (T) node.branch[idx].node; + // /* This is a leaf node */ + // for (int idx = 0; idx < node.count; idx++) { + // if (rect.overlap(node.branch[idx])) { + // @SuppressWarnings("unchecked") + // T item = (T) node.branch[idx].node; // - // /* NOTE: There are different ways to return results. Here's - // * where to modify */ - // found[0]++; - // if (!cb.call(item, context)) { - // /* Stop searching */ - // return false; - // } - // } - // } + // /* NOTE: There are different ways to return results. Here's + // * where to modify */ + // found[0]++; + // if (!cb.call(item, context)) { + // /* Stop searching */ + // return false; + // } + // } + // } // - // /* Continue searching */ - // return true; - // } + // /* Continue searching */ + // return true; + // } // - // public boolean search(Node node, Rect rect, List results) { - // if (DEBUG) { - // assert (node != null); - // assert (node.level >= 0); - // assert (rect != null); - // } + // public boolean search(Node node, Rect rect, List results) { + // if (DEBUG) { + // assert (node != null); + // assert (node.level >= 0); + // assert (rect != null); + // } // - // if (!node.isLeaf()) { - // Branch[] children = node.children(); - // /* This is an internal node in the tree */ - // for (int idx = 0; idx < node.count; idx++) { + // if (!node.isLeaf()) { + // Branch[] children = node.children(); + // /* This is an internal node in the tree */ + // for (int idx = 0; idx < node.count; idx++) { // - // if (rect.overlap(children[idx])) { - // if (!search(children[idx].node, rect, results)) { - // /* Stop searching */ - // return false; - // } - // } - // } - // /* Continue searching */ - // return true; - // } + // if (rect.overlap(children[idx])) { + // if (!search(children[idx].node, rect, results)) { + // /* Stop searching */ + // return false; + // } + // } + // } + // /* Continue searching */ + // return true; + // } // - // /* This is a leaf node */ - // for (int idx = 0; idx < node.count; idx++) { - // if (rect.overlap(node.branch[idx])) { - // @SuppressWarnings("unchecked") - // T item = (T) node.branch[idx].node; + // /* This is a leaf node */ + // for (int idx = 0; idx < node.count; idx++) { + // if (rect.overlap(node.branch[idx])) { + // @SuppressWarnings("unchecked") + // T item = (T) node.branch[idx].node; // - // results.add(item); - // } - // } + // results.add(item); + // } + // } // - // /* Continue searching */ - // return true; - // } + // /* Continue searching */ + // return true; + // } public void searchStack(Rect rect, SearchCb cb, Object context) { Stack stack = stackPool.get(); @@ -813,7 +813,7 @@ public class RTree implements SpatialIndex, Iterable { Node node = stack.node(); if (node.level == 0) { - /* is leaf node */ + /* is leaf node */ for (int idx = 0; idx < node.count; idx++) { @SuppressWarnings("unchecked") Branch branch[] = (Branch[]) node.branch; @@ -826,9 +826,9 @@ public class RTree implements SpatialIndex, Iterable { } else { int idx = stack.branchIndex(); - /* Push sibling on stack for future tree walk. - * This is the 'fall back' node when we finish with - * the current level */ + /* Push sibling on stack for future tree walk. + * This is the 'fall back' node when we finish with + * the current level */ for (int i = idx + 1; i < node.count; i++) { if (rect.overlap(node.branch[i])) { stack.push(node, i); @@ -836,8 +836,8 @@ public class RTree implements SpatialIndex, Iterable { } } - /* Push first of next level to get deeper into - * the tree */ + /* Push first of next level to get deeper into + * the tree */ node = (Node) node.branch[idx].node; for (int i = 0; i < node.count; i++) { if (rect.overlap(node.branch[i])) { @@ -863,7 +863,7 @@ public class RTree implements SpatialIndex, Iterable { Node node = stack.node(); if (node.level == 0) { - /* is leaf node */ + /* is leaf node */ for (int idx = 0; idx < node.count; idx++) { if (rect.overlap(node.branch[idx])) { out.add(node.branch[idx].node); @@ -871,9 +871,9 @@ public class RTree implements SpatialIndex, Iterable { } } else { int idx = stack.branchIndex(); - /* Push sibling on stack for future tree walk. - * This is the 'fall back' node when we finish with - * the current level */ + /* Push sibling on stack for future tree walk. + * This is the 'fall back' node when we finish with + * the current level */ for (int i = idx + 1; i < node.count; i++) { if (rect.overlap(node.branch[i])) { stack.push(node, i); @@ -881,8 +881,8 @@ public class RTree implements SpatialIndex, Iterable { } } - /* Push first of next level* to get deeper into - * the tree */ + /* Push first of next level* to get deeper into + * the tree */ node = (Node) node.branch[idx].node; for (int i = 0; i < node.count; i++) { if (rect.overlap(node.branch[i])) { @@ -1024,36 +1024,36 @@ public class RTree implements SpatialIndex, Iterable { if (tos <= 0) return false; - /* Copy stack top cause it may change as we use it */ + /* Copy stack top cause it may change as we use it */ StackElement curTos = pop(); if (curTos.node.isLeaf()) { - /* Keep walking through data while we can */ + /* Keep walking through data while we can */ if (curTos.branchIndex < curTos.node.count) { - /* There is more data, just point to the next one */ + /* There is more data, just point to the next one */ push(curTos.node, curTos.branchIndex); return true; } continue; } int idx = curTos.branchIndex; - /* No more data, so it will fall back to previous level */ + /* No more data, so it will fall back to previous level */ if (idx + 1 < curTos.node.count) { - /* Push sibling on stack for future tree walk. - * This is the 'fall back' node when we finish with - * the current level */ + /* Push sibling on stack for future tree walk. + * This is the 'fall back' node when we finish with + * the current level */ push(curTos.node, idx + 1); } - /* Since cur node is not a leaf, push first of next level - * to get deeper into the tree */ + /* Since cur node is not a leaf, push first of next level + * to get deeper into the tree */ Node nextLevelnode = (Node) curTos.node.branch[idx].node; push(nextLevelnode, 0); - /* If we pushed on a new leaf, exit as the data is ready - * at TOS */ + /* If we pushed on a new leaf, exit as the data is ready + * at TOS */ if (nextLevelnode.isLeaf()) return true; } @@ -1178,20 +1178,20 @@ class Partition { assert (branch != null); assert (node.count == node.branch.length); - /* Load the branch buffer */ + /* Load the branch buffer */ for (int idx = 0; idx < node.count; idx++) branchBuf[idx] = (Branch) node.branch[idx]; branchBuf[node.count] = (Branch) branch; - /* Calculate rect containing all in the set */ + /* Calculate rect containing all in the set */ coverSplit.set(branchBuf[0]); for (int idx = 1, n = branchBuf.length; idx < n; idx++) { coverSplit.add(branchBuf[idx]); } coverSplitArea = coverSplit.calcRectVolume(); - /* init node - FIXME needed? */ + /* init node - FIXME needed? */ node.count = 0; node.level = -1; } @@ -1297,7 +1297,7 @@ class Partition { classify(chosen, betterGroup); } - /* If one group too full, put remaining rects in the other */ + /* If one group too full, put remaining rects in the other */ if ((count[0] + count[1]) < total) { if (count[0] >= total - minFill) { group = 1; @@ -1317,94 +1317,94 @@ class Partition { } -// /** Minimal bounding rectangle (n-dimensional) */ -// static class Rect { +// /** Minimal bounding rectangle (n-dimensional) */ +// static class Rect { // -// /** dimensions of bounding box */ -// double bounds[] = new double[NUMDIMS * 2]; +// /** dimensions of bounding box */ +// double bounds[] = new double[NUMDIMS * 2]; // -// //double xmin, ymin, xmax, ymax; +// //double xmin, ymin, xmax, ymax; // -// public Rect() { -// } +// public Rect() { +// } // -// public Rect(double[] min, double[] max) { +// public Rect(double[] min, double[] max) { // -// if (DEBUG) { -// for (int index = 0; index < NUMDIMS; index++) { -// assert (min[index] <= max[index]); -// } -// } +// if (DEBUG) { +// for (int index = 0; index < NUMDIMS; index++) { +// assert (min[index] <= max[index]); +// } +// } // -// for (int axis = 0; axis < NUMDIMS; axis++) { -// this.bounds[axis] = min[axis]; -// this.bounds[NUMDIMS + axis] = max[axis]; -// } -// } +// for (int axis = 0; axis < NUMDIMS; axis++) { +// this.bounds[axis] = min[axis]; +// this.bounds[NUMDIMS + axis] = max[axis]; +// } +// } // -// /** -// * Calculate the n-dimensional volume of a rectangle -// */ -// public double calcRectVolume() { -// double volume = (double) 1; +// /** +// * Calculate the n-dimensional volume of a rectangle +// */ +// public double calcRectVolume() { +// double volume = (double) 1; // -// for (int idx = 0; idx < NUMDIMS; idx++) { -// volume *= bounds[NUMDIMS + idx] - bounds[idx]; -// } +// for (int idx = 0; idx < NUMDIMS; idx++) { +// volume *= bounds[NUMDIMS + idx] - bounds[idx]; +// } // -// assert (volume >= 0); -// return volume; -// } +// assert (volume >= 0); +// return volume; +// } // -// /** -// * Decide whether two rectangles overlap. -// */ -// public boolean overlap(Rect other) { -// assert (other != null); +// /** +// * Decide whether two rectangles overlap. +// */ +// public boolean overlap(Rect other) { +// assert (other != null); // -// for (int idx = 0; idx < NUMDIMS; idx++) { -// if (bounds[idx] > other.bounds[NUMDIMS + idx] || -// other.bounds[idx] > bounds[NUMDIMS + idx]) { -// return false; -// } -// } -// return true; -// } +// for (int idx = 0; idx < NUMDIMS; idx++) { +// if (bounds[idx] > other.bounds[NUMDIMS + idx] || +// other.bounds[idx] > bounds[NUMDIMS + idx]) { +// return false; +// } +// } +// return true; +// } // -// /** -// * Combine two rectangles into larger one containing both -// */ -// public Rect(Rect rectA, Rect rectB) { -// assert (rectA != null && rectB != null); -// for (int min = 0, max = NUMDIMS; min < NUMDIMS; min++, max++) { -// bounds[min] = Math.min(rectA.bounds[min], rectB.bounds[min]); -// bounds[max] = Math.max(rectA.bounds[max], rectB.bounds[max]); -// } -// } +// /** +// * Combine two rectangles into larger one containing both +// */ +// public Rect(Rect rectA, Rect rectB) { +// assert (rectA != null && rectB != null); +// for (int min = 0, max = NUMDIMS; min < NUMDIMS; min++, max++) { +// bounds[min] = Math.min(rectA.bounds[min], rectB.bounds[min]); +// bounds[max] = Math.max(rectA.bounds[max], rectB.bounds[max]); +// } +// } // -// public void add(Rect rect) { -// for (int min = 0, max = NUMDIMS; min < NUMDIMS; min++, max++) { -// bounds[min] = Math.min(bounds[min], rect.bounds[min]); -// bounds[max] = Math.max(bounds[max], rect.bounds[max]); -// } -// } +// public void add(Rect rect) { +// for (int min = 0, max = NUMDIMS; min < NUMDIMS; min++, max++) { +// bounds[min] = Math.min(bounds[min], rect.bounds[min]); +// bounds[max] = Math.max(bounds[max], rect.bounds[max]); +// } +// } // -// public void set(Rect rect) { -// for (int idx = 0; idx < NUMDIMS * 2; idx++) { -// bounds[idx] = rect.bounds[idx]; -// } -// } +// public void set(Rect rect) { +// for (int idx = 0; idx < NUMDIMS * 2; idx++) { +// bounds[idx] = rect.bounds[idx]; +// } +// } // -// /** -// * Find the smallest rectangle that includes all rectangles in branches -// * of a node. -// */ -// void setCover(Node node) { -// assert (node != null); +// /** +// * Find the smallest rectangle that includes all rectangles in branches +// * of a node. +// */ +// void setCover(Node node) { +// assert (node != null); // -// set(node.branch[0]); -// for (int idx = 1; idx < node.count; idx++) { -// add(node.branch[idx]); -// } -// } -// } \ No newline at end of file +// set(node.branch[0]); +// for (int idx = 1; idx < node.count; idx++) { +// add(node.branch[idx]); +// } +// } +// } \ No newline at end of file diff --git a/vtm/src/org/oscim/utils/ScanBox.java b/vtm/src/org/oscim/utils/ScanBox.java index 3b998039..c801e556 100644 --- a/vtm/src/org/oscim/utils/ScanBox.java +++ b/vtm/src/org/oscim/utils/ScanBox.java @@ -28,7 +28,7 @@ import org.oscim.core.Tile; *

*

  * Viewport.getMapViewProjection(box)
- * 	ScanBox sb = new ScanBox(){
+ *     ScanBox sb = new ScanBox(){
  *          protected void setVisible(int y, int x1, int x2) {
  *          }
  *    };
@@ -58,7 +58,7 @@ public abstract class ScanBox {
         return mBox;
     }
 
-	/* ported from Polymaps: Layer.js */
+    /* ported from Polymaps: Layer.js */
 
     static class Edge {
         float x0, y0, x1, y1, dx, dy;
diff --git a/vtm/src/org/oscim/utils/TessJNI.java b/vtm/src/org/oscim/utils/TessJNI.java
index 9a081fe8..de5d4bd2 100644
--- a/vtm/src/org/oscim/utils/TessJNI.java
+++ b/vtm/src/org/oscim/utils/TessJNI.java
@@ -113,45 +113,45 @@ public class TessJNI {
     // @formatter:off
     /*JNI
     #include 
-	#include 
-	#include 
-	void* heapAlloc( void* userData, unsigned int size ){
-		TESS_NOTUSED( userData );
-		return malloc( size );
-	}
-	void* heapRealloc( void *userData, void* ptr, unsigned int size ){
-		TESS_NOTUSED( userData );
-		return realloc( ptr, size );
-	}
-	void heapFree( void* userData, void* ptr ){
-		TESS_NOTUSED( userData );
-		free( ptr );
-	}
-	 */
+    #include 
+    #include 
+    void* heapAlloc( void* userData, unsigned int size ){
+        TESS_NOTUSED( userData );
+        return malloc( size );
+    }
+    void* heapRealloc( void *userData, void* ptr, unsigned int size ){
+        TESS_NOTUSED( userData );
+        return realloc( ptr, size );
+    }
+    void heapFree( void* userData, void* ptr ){
+        TESS_NOTUSED( userData );
+        free( ptr );
+    }
+     */
     static native long newTess(int size); /* {
-		if (size <= 0)
-		   return (long)tessNewTess(0);
-		if (size > 10)
-			size = 10;
-		TESSalloc ma;
-		memset(&ma, 0, sizeof(ma));
-	    ma.memalloc = heapAlloc;
-	    ma.memfree = heapFree;
-	    ma.memrealloc = heapRealloc;
-	    //ma.userData = (void*)&allocated;
-	    ma.meshEdgeBucketSize = 2 << size;   // 512
-		ma.meshVertexBucketSize = 2 << size; // 512
-		ma.meshFaceBucketSize = 1 << size;	 // 256
-		ma.dictNodeBucketSize = 2 << size;	 // 512
-		ma.regionBucketSize = 1 << size;	 // 256
-		ma.extraVertices = 8;
-	    //ma.extraVertices = 256;
-	    return (long)tessNewTess(&ma);
-	} */
+        if (size <= 0)
+           return (long)tessNewTess(0);
+        if (size > 10)
+            size = 10;
+        TESSalloc ma;
+        memset(&ma, 0, sizeof(ma));
+        ma.memalloc = heapAlloc;
+        ma.memfree = heapFree;
+        ma.memrealloc = heapRealloc;
+        //ma.userData = (void*)&allocated;
+        ma.meshEdgeBucketSize = 2 << size;   // 512
+        ma.meshVertexBucketSize = 2 << size; // 512
+        ma.meshFaceBucketSize = 1 << size;     // 256
+        ma.dictNodeBucketSize = 2 << size;     // 512
+        ma.regionBucketSize = 1 << size;     // 256
+        ma.extraVertices = 8;
+        //ma.extraVertices = 256;
+        return (long)tessNewTess(&ma);
+    } */
 
     static native void freeTess(long inst); /* {
-		tessDeleteTess((TESStesselator*) inst);
-	} */
+        tessDeleteTess((TESStesselator*) inst);
+    } */
 
     /**
      * Adds a contour to be tesselated.
@@ -164,25 +164,25 @@ public class TessJNI {
      * @param count   - number of vertices in contour.
      */
     static native void addContour(long inst, int size, float[] contour, int stride, int offset, int count);/* {
-		tessAddContour((TESStesselator*) inst, size, contour + (offset * stride), stride, count);
-	} */
+        tessAddContour((TESStesselator*) inst, size, contour + (offset * stride), stride, count);
+    } */
 
     static native void addMultiContour2D(long inst, int[] index, float[] contour, int idxStart, int idxCount);/* {
-		TESStesselator* tess = (TESStesselator*) inst;
-		int offset = 0;
-		// start at 0 to get the correct offset in contour..
-		for (int i = 0; i < idxStart + idxCount; i++){
-			int len = index[i];
-			if ((len % 2 != 0) || (len < 0))
-				break;
-			if (len < 6 || i < idxStart) {
-				offset += len;
-				continue;
-			}
-			tessAddContour(tess, 2, contour + offset, 8, len >> 1);
-			offset += len;
-		}
-	} */
+        TESStesselator* tess = (TESStesselator*) inst;
+        int offset = 0;
+        // start at 0 to get the correct offset in contour..
+        for (int i = 0; i < idxStart + idxCount; i++){
+            int len = index[i];
+            if ((len % 2 != 0) || (len < 0))
+                break;
+            if (len < 6 || i < idxStart) {
+                offset += len;
+                continue;
+            }
+            tessAddContour(tess, 2, contour + offset, 8, len >> 1);
+            offset += len;
+        }
+    } */
 
     /**
      * Tesselate contours.
@@ -196,32 +196,32 @@ public class TessJNI {
      * @return 1 if succeed, 0 if failed.
      */
     static native int tessContour2D(long inst, int windingRule, int elementType, int polySize, int vertexSize);/*{
-		return tessTesselate((TESStesselator*) inst, windingRule, elementType, polySize, vertexSize, 0);
-	} */
+        return tessTesselate((TESStesselator*) inst, windingRule, elementType, polySize, vertexSize, 0);
+    } */
 
     static native int getVertexCount(long inst); /*{
-		return tessGetVertexCount((TESStesselator*) inst);
-	}*/
+        return tessGetVertexCount((TESStesselator*) inst);
+    }*/
 
     /**
      * Returns pointer to first coordinate of first vertex.
      */
     static native boolean getVertices(long inst, float[] out, int offset, int length);/*{
-		const TESSreal* vertices = tessGetVertices((TESStesselator*) inst);
-		if (!vertices)
-			return 0;
-		memcpy(out, vertices + offset, length * sizeof(TESSreal));
-		return 1;
-	}*/
+        const TESSreal* vertices = tessGetVertices((TESStesselator*) inst);
+        if (!vertices)
+            return 0;
+        memcpy(out, vertices + offset, length * sizeof(TESSreal));
+        return 1;
+    }*/
 
     /**
      * Returns pointer to first coordinate of first vertex.
      */
     static native void getVerticesS(long inst, short[] out, int offset, int length, float scale);/*{
-		const TESSreal* vertices = tessGetVertices((TESStesselator*) inst);
-		for(int i = 0; i < length; i++)
-			out[i] = (short)(vertices[offset++] * scale + 0.5f);
-	}*/
+        const TESSreal* vertices = tessGetVertices((TESStesselator*) inst);
+        for(int i = 0; i < length; i++)
+            out[i] = (short)(vertices[offset++] * scale + 0.5f);
+    }*/
 
     /**
      * Returns pointer to first vertex index.
@@ -231,47 +231,47 @@ public class TessJNI {
      * New vertices generated at the intersections of segments are assigned value TESS_UNDEF.
      */
     static native boolean getVertexIndices(long inst, int[] out, int offset, int length);/* {
-		const TESSindex* indices = tessGetVertexIndices((TESStesselator*) inst);
-		if (!indices)
-			return 0;
-		memcpy(out, indices + offset, length * sizeof(TESSindex));
-		return 1;
-	} */
+        const TESSindex* indices = tessGetVertexIndices((TESStesselator*) inst);
+        if (!indices)
+            return 0;
+        memcpy(out, indices + offset, length * sizeof(TESSindex));
+        return 1;
+    } */
 
     /**
      * Returns number of elements in the the tesselated output.
      */
     static native int getElementCount(long inst);/*{
-		return tessGetElementCount((TESStesselator*) inst);
-	}*/
+        return tessGetElementCount((TESStesselator*) inst);
+    }*/
 
     /**
      * Returns pointer to the first element.
      */
     static native boolean getElements(long inst, int[] out, int offset, int length);/*{
-		const TESSindex* elements = tessGetElements((TESStesselator*) inst);
-		if (!elements)
-			return 0;
-		memcpy(out, elements + offset, length * sizeof(TESSindex));
-		return 1;
-	}*/
+        const TESSindex* elements = tessGetElements((TESStesselator*) inst);
+        if (!elements)
+            return 0;
+        memcpy(out, elements + offset, length * sizeof(TESSindex));
+        return 1;
+    }*/
 
     /**
      * Returns pointer to the first element.
      */
     static native void getElementsS(long inst, short[] out, int offset, int length);/*{
-		const TESSindex* elements = tessGetElements((TESStesselator*) inst);
-		for(int i = 0; i < length; i++)
-			out[i] = (short)elements[offset++];
-	}*/
+        const TESSindex* elements = tessGetElements((TESStesselator*) inst);
+        for(int i = 0; i < length; i++)
+            out[i] = (short)elements[offset++];
+    }*/
 
     /**
      * Returns list of triangles indices (or to the first element of convex polygons).
      */
     static native void getElementsWithInputVertexIds(long inst, short[] out, int dstOffset, int offset, int length);/*{
-		const TESSindex* elements = tessGetElements((TESStesselator*) inst);
-		const TESSindex* indices = tessGetVertexIndices((TESStesselator*) inst);
-		for(int i = 0; i < length; i++)
-			out[dstOffset++] = (short)(indices[elements[offset++]]);
-	}*/
+        const TESSindex* elements = tessGetElements((TESStesselator*) inst);
+        const TESSindex* indices = tessGetVertexIndices((TESStesselator*) inst);
+        for(int i = 0; i < length; i++)
+            out[dstOffset++] = (short)(indices[elements[offset++]]);
+    }*/
 }
\ No newline at end of file
diff --git a/vtm/src/org/oscim/utils/Tessellator.java b/vtm/src/org/oscim/utils/Tessellator.java
index 2f516808..8978f85b 100644
--- a/vtm/src/org/oscim/utils/Tessellator.java
+++ b/vtm/src/org/oscim/utils/Tessellator.java
@@ -87,12 +87,12 @@ public class Tessellator {
             }
             /* when a ring has an odd number of points one (or rather two)
              * additional vertices will be added. so the following rings
-			 * needs extra offset */
+             * needs extra offset */
             int shift = 0;
             for (int i = 0, m = numRings - 1; i < m; i++) {
                 shift += (index[ipos + i]);
 
-				/* even number of points? */
+                /* even number of points? */
                 if (((index[ipos + i] >> 1) & 1) == 0)
                     continue;
 
@@ -103,7 +103,7 @@ public class Tessellator {
                 shift += 2;
             }
 
-			/* shift by vertexOffset */
+            /* shift by vertexOffset */
             for (int i = start; i < end; i++)
                 indices[i] += vertexOffset;
 
@@ -119,251 +119,251 @@ public class Tessellator {
 
         return sumIndices;
     }
-    //	private static final int RESULT_VERTICES = 0;
-    //	private static final int RESULT_TRIANGLES = 1;
+    //    private static final int RESULT_VERTICES = 0;
+    //    private static final int RESULT_TRIANGLES = 1;
     //
-    //	/**
-    //	 * Special version for ExtrusionLayer to match indices with vertex
-    //	 * positions.
-    //	 */
-    //	public static int tessellate(float[] points, int ppos, int plen, int[] index,
-    //	        int ipos, int rings, int vertexOffset, VertexData outTris) {
+    //    /**
+    //     * Special version for ExtrusionLayer to match indices with vertex
+    //     * positions.
+    //     */
+    //    public static int tessellate(float[] points, int ppos, int plen, int[] index,
+    //            int ipos, int rings, int vertexOffset, VertexData outTris) {
     //
-    //		int[] result = new int[2];
+    //        int[] result = new int[2];
     //
-    //		int numPoints = 0;
-    //		for (int i = 0; i < rings; i++)
-    //			numPoints += index[ipos + i];
+    //        int numPoints = 0;
+    //        for (int i = 0; i < rings; i++)
+    //            numPoints += index[ipos + i];
     //
-    //		long ctx = Tessellator.tessellate(points, ppos, index, ipos, rings, result);
-    //		if ((numPoints / 2) < result[RESULT_VERTICES]) {
-    //			log.debug("skip poly: " + Arrays.toString(result) + " " + numPoints);
-    //			Tessellator.tessFinish(ctx);
-    //			return 0;
-    //		}
+    //        long ctx = Tessellator.tessellate(points, ppos, index, ipos, rings, result);
+    //        if ((numPoints / 2) < result[RESULT_VERTICES]) {
+    //            log.debug("skip poly: " + Arrays.toString(result) + " " + numPoints);
+    //            Tessellator.tessFinish(ctx);
+    //            return 0;
+    //        }
     //
-    //		int cnt;
-    //		int sumIndices = 0;
+    //        int cnt;
+    //        int sumIndices = 0;
     //
-    //		VertexData.Chunk vd = outTris.obtainChunk();
+    //        VertexData.Chunk vd = outTris.obtainChunk();
     //
-    //		while ((cnt = Tessellator.tessGetIndicesWO(ctx, vd.vertices, vd.used)) > 0) {
-    //			int start = vd.used;
-    //			int end = start + cnt;
-    //			short[] v = vd.vertices;
+    //        while ((cnt = Tessellator.tessGetIndicesWO(ctx, vd.vertices, vd.used)) > 0) {
+    //            int start = vd.used;
+    //            int end = start + cnt;
+    //            short[] v = vd.vertices;
     //
-    //			for (int i = start; i < end; i++)
-    //				v[i] *= 2;
+    //            for (int i = start; i < end; i++)
+    //                v[i] *= 2;
     //
-    //			/* when a ring has an odd number of points one (or rather two)
-    //			 * additional vertices will be added. so the following rings
-    //			 * needs extra offset */
-    //			int shift = 0;
-    //			for (int i = 0, m = rings - 1; i < m; i++) {
-    //				shift += (index[ipos + i]);
+    //            /* when a ring has an odd number of points one (or rather two)
+    //             * additional vertices will be added. so the following rings
+    //             * needs extra offset */
+    //            int shift = 0;
+    //            for (int i = 0, m = rings - 1; i < m; i++) {
+    //                shift += (index[ipos + i]);
     //
-    //				/* even number of points? */
-    //				if (((index[ipos + i] >> 1) & 1) == 0)
-    //					continue;
+    //                /* even number of points? */
+    //                if (((index[ipos + i] >> 1) & 1) == 0)
+    //                    continue;
     //
-    //				for (int j = start; j < end; j++)
-    //					if (v[j] >= shift)
-    //						v[j] += 2;
+    //                for (int j = start; j < end; j++)
+    //                    if (v[j] >= shift)
+    //                        v[j] += 2;
     //
-    //				shift += 2;
-    //			}
+    //                shift += 2;
+    //            }
     //
-    //			/* shift by vertexOffset */
-    //			for (int i = start; i < end; i++)
-    //				v[i] += vertexOffset;
+    //            /* shift by vertexOffset */
+    //            for (int i = start; i < end; i++)
+    //                v[i] += vertexOffset;
     //
-    //			sumIndices += cnt;
+    //            sumIndices += cnt;
     //
-    //			vd.used += cnt;
-    //			outTris.releaseChunk();
+    //            vd.used += cnt;
+    //            outTris.releaseChunk();
     //
-    //			if (vd.used == VertexData.SIZE) {
-    //				/* gets next item since this one is full */
-    //				vd = outTris.obtainChunk();
-    //				continue;
-    //			}
-    //			/* no more indices to get. */
-    //			break;
-    //		}
+    //            if (vd.used == VertexData.SIZE) {
+    //                /* gets next item since this one is full */
+    //                vd = outTris.obtainChunk();
+    //                continue;
+    //            }
+    //            /* no more indices to get. */
+    //            break;
+    //        }
     //
-    //		Tessellator.tessFinish(ctx);
+    //        Tessellator.tessFinish(ctx);
     //
-    //		return sumIndices;
-    //	}
+    //        return sumIndices;
+    //    }
     //
-    //	/**
-    //	 * Untested!
-    //	 */
-    //	public static int tessellate(GeometryBuffer geom, GeometryBuffer out) {
+    //    /**
+    //     * Untested!
+    //     */
+    //    public static int tessellate(GeometryBuffer geom, GeometryBuffer out) {
     //
-    //		int[] result = new int[2];
+    //        int[] result = new int[2];
     //
-    //		int numRings = 0;
-    //		int numPoints = 0;
+    //        int numRings = 0;
+    //        int numPoints = 0;
     //
-    //		for (int i = 0; i < geom.indexPos; i++) {
-    //			if (geom.index[i] > 0) {
-    //				numRings++;
-    //				numPoints += geom.index[i];
-    //			} else
-    //				break;
-    //		}
+    //        for (int i = 0; i < geom.indexPos; i++) {
+    //            if (geom.index[i] > 0) {
+    //                numRings++;
+    //                numPoints += geom.index[i];
+    //            } else
+    //                break;
+    //        }
     //
-    //		long ctx = Tessellator.tessellate(geom.points, 0,
-    //		                                  geom.index, 0,
-    //		                                  numRings, result);
+    //        long ctx = Tessellator.tessellate(geom.points, 0,
+    //                                          geom.index, 0,
+    //                                          numRings, result);
     //
-    //		boolean verticesAdded = false;
-    //		if (numPoints < result[RESULT_VERTICES] * 2) {
-    //			//log.debug("grow vertices" + geom.pointPos);
-    //			verticesAdded = true;
-    //		}
+    //        boolean verticesAdded = false;
+    //        if (numPoints < result[RESULT_VERTICES] * 2) {
+    //            //log.debug("grow vertices" + geom.pointPos);
+    //            verticesAdded = true;
+    //        }
     //
-    //		if (out == null) {
-    //			/* overwrite geom contents */
-    //			out = geom;
-    //			if (verticesAdded) {
-    //				out.ensurePointSize(result[RESULT_VERTICES], false);
-    //				Tessellator.tessGetVerticesFloat(ctx, out.points);
-    //			}
-    //		} else {
-    //			out.ensurePointSize(result[RESULT_VERTICES], false);
+    //        if (out == null) {
+    //            /* overwrite geom contents */
+    //            out = geom;
+    //            if (verticesAdded) {
+    //                out.ensurePointSize(result[RESULT_VERTICES], false);
+    //                Tessellator.tessGetVerticesFloat(ctx, out.points);
+    //            }
+    //        } else {
+    //            out.ensurePointSize(result[RESULT_VERTICES], false);
     //
-    //			if (verticesAdded) {
-    //				Tessellator.tessGetVerticesFloat(ctx, out.points);
-    //			} else {
-    //				System.arraycopy(geom.points, 0, out.points, 0, numPoints);
-    //			}
-    //		}
+    //            if (verticesAdded) {
+    //                Tessellator.tessGetVerticesFloat(ctx, out.points);
+    //            } else {
+    //                System.arraycopy(geom.points, 0, out.points, 0, numPoints);
+    //            }
+    //        }
     //
-    //		out.ensureIndexSize(result[RESULT_TRIANGLES * 3], false);
-    //		Tessellator.tessGetIndices(ctx, out.index);
+    //        out.ensureIndexSize(result[RESULT_TRIANGLES * 3], false);
+    //        Tessellator.tessGetIndices(ctx, out.index);
     //
-    //		Tessellator.tessFinish(ctx);
+    //        Tessellator.tessFinish(ctx);
     //
-    //		return 1;
-    //	}
+    //        return 1;
+    //    }
     //
-    //	/* FIXME This modifies geom ?! */
-    //	public static int tessellate(GeometryBuffer geom, float scale,
-    //	        VertexData outPoints, VertexData outTris, int vertexOffset) {
+    //    /* FIXME This modifies geom ?! */
+    //    public static int tessellate(GeometryBuffer geom, float scale,
+    //            VertexData outPoints, VertexData outTris, int vertexOffset) {
     //
-    //		int numIndices = 0;
-    //		int indexPos = 0;
-    //		int pointPos = 0;
-    //		int indexEnd = geom.index.length;
+    //        int numIndices = 0;
+    //        int indexPos = 0;
+    //        int pointPos = 0;
+    //        int indexEnd = geom.index.length;
     //
-    //		int[] result = new int[2];
+    //        int[] result = new int[2];
     //
-    //		float s = scale;
-    //		scale = 1;
+    //        float s = scale;
+    //        scale = 1;
     //
-    //		for (int idx = 0; idx < indexEnd && geom.index[idx] > 0; idx++) {
-    //			indexPos = idx;
+    //        for (int idx = 0; idx < indexEnd && geom.index[idx] > 0; idx++) {
+    //            indexPos = idx;
     //
-    //			int numRings = 1;
-    //			int numPoints = geom.index[idx++];
+    //            int numRings = 1;
+    //            int numPoints = geom.index[idx++];
     //
-    //			for (; idx < indexEnd && geom.index[idx] > 0; idx++) {
-    //				numRings++;
-    //				numPoints += geom.index[idx];
-    //			}
+    //            for (; idx < indexEnd && geom.index[idx] > 0; idx++) {
+    //                numRings++;
+    //                numPoints += geom.index[idx];
+    //            }
     //
-    //			/* FIXME !!! */
-    //			for (int i = pointPos; i < pointPos + numPoints; i += 2) {
-    //				geom.points[i + 0] = (int) (geom.points[i + 0] * s);
-    //				geom.points[i + 1] = (int) (geom.points[i + 1] * s);
-    //			}
+    //            /* FIXME !!! */
+    //            for (int i = pointPos; i < pointPos + numPoints; i += 2) {
+    //                geom.points[i + 0] = (int) (geom.points[i + 0] * s);
+    //                geom.points[i + 1] = (int) (geom.points[i + 1] * s);
+    //            }
     //
-    //			long ctx = Tessellator.tessellate(geom.points, pointPos,
-    //			                                  geom.index, indexPos,
-    //			                                  numRings, result);
+    //            long ctx = Tessellator.tessellate(geom.points, pointPos,
+    //                                              geom.index, indexPos,
+    //                                              numRings, result);
     //
-    //			if (result[RESULT_VERTICES] == 0 || result[RESULT_TRIANGLES] == 0) {
-    //				log.debug("ppos " + pointPos + " ipos:" + indexPos +
-    //				        " rings:" + numRings + " " + Arrays.toString(geom.index));
-    //				continue;
-    //			}
+    //            if (result[RESULT_VERTICES] == 0 || result[RESULT_TRIANGLES] == 0) {
+    //                log.debug("ppos " + pointPos + " ipos:" + indexPos +
+    //                        " rings:" + numRings + " " + Arrays.toString(geom.index));
+    //                continue;
+    //            }
     //
-    //			pointPos += numPoints;
+    //            pointPos += numPoints;
     //
-    //			while (true) {
-    //				VertexData.Chunk vd = outTris.obtainChunk();
+    //            while (true) {
+    //                VertexData.Chunk vd = outTris.obtainChunk();
     //
-    //				int cnt = Tessellator.tessGetIndicesWO(ctx, vd.vertices, vd.used);
-    //				if (cnt <= 0)
-    //					break;
+    //                int cnt = Tessellator.tessGetIndicesWO(ctx, vd.vertices, vd.used);
+    //                if (cnt <= 0)
+    //                    break;
     //
-    //				/* shift by vertexOffset */
-    //				for (int pos = vd.used, end = pos + cnt; pos < end; pos++)
-    //					vd.vertices[pos] += vertexOffset;
+    //                /* shift by vertexOffset */
+    //                for (int pos = vd.used, end = pos + cnt; pos < end; pos++)
+    //                    vd.vertices[pos] += vertexOffset;
     //
-    //				numIndices += cnt;
+    //                numIndices += cnt;
     //
-    //				vd.used += cnt;
-    //				outTris.releaseChunk();
+    //                vd.used += cnt;
+    //                outTris.releaseChunk();
     //
-    //				if (vd.used < VertexData.SIZE)
-    //					break;
-    //			}
+    //                if (vd.used < VertexData.SIZE)
+    //                    break;
+    //            }
     //
-    //			while (true) {
-    //				VertexData.Chunk vd = outPoints.obtainChunk();
+    //            while (true) {
+    //                VertexData.Chunk vd = outPoints.obtainChunk();
     //
-    //				int cnt = Tessellator.tessGetVerticesWO(ctx, vd.vertices, vd.used, scale);
-    //				if (cnt <= 0)
-    //					break;
+    //                int cnt = Tessellator.tessGetVerticesWO(ctx, vd.vertices, vd.used, scale);
+    //                if (cnt <= 0)
+    //                    break;
     //
-    //				vertexOffset += cnt >> 1;
+    //                vertexOffset += cnt >> 1;
     //
-    //				vd.used += cnt;
-    //				outPoints.releaseChunk();
+    //                vd.used += cnt;
+    //                outPoints.releaseChunk();
     //
-    //				if (vd.used < VertexData.SIZE)
-    //					break;
-    //			}
+    //                if (vd.used < VertexData.SIZE)
+    //                    break;
+    //            }
     //
-    //			Tessellator.tessFinish(ctx);
+    //            Tessellator.tessFinish(ctx);
     //
-    //			if (idx >= indexEnd || geom.index[idx] < 0)
-    //				break;
-    //		}
+    //            if (idx >= indexEnd || geom.index[idx] < 0)
+    //                break;
+    //        }
     //
-    //		if (vertexOffset > Short.MAX_VALUE) {
-    //			log.debug("too much !!!" + Arrays.toString(geom.index));
-    //			return 0;
-    //		}
+    //        if (vertexOffset > Short.MAX_VALUE) {
+    //            log.debug("too much !!!" + Arrays.toString(geom.index));
+    //            return 0;
+    //        }
     //
-    //		return numIndices;
-    //	}
+    //        return numIndices;
+    //    }
     //
-    //	/**
-    //	 * @param points an array of x,y coordinates
-    //	 * @param pos position in points array
-    //	 * @param index geom indices
-    //	 * @param ipos position in index array
-    //	 * @param numRings number of rings in polygon == outer(1) + inner rings
-    //	 * @param result contains number of vertices and number of triangles
-    //	 * @return context - must be freed with tessFinish()
-    //	 */
-    //	protected static native long tessellate(float[] points, int pos,
-    //	        int[] index, int ipos, int numRings, int[] result);
+    //    /**
+    //     * @param points an array of x,y coordinates
+    //     * @param pos position in points array
+    //     * @param index geom indices
+    //     * @param ipos position in index array
+    //     * @param numRings number of rings in polygon == outer(1) + inner rings
+    //     * @param result contains number of vertices and number of triangles
+    //     * @return context - must be freed with tessFinish()
+    //     */
+    //    protected static native long tessellate(float[] points, int pos,
+    //            int[] index, int ipos, int numRings, int[] result);
     //
-    //	protected static native void tessFinish(long ctx);
+    //    protected static native void tessFinish(long ctx);
     //
-    //	protected static native int tessGetVertices(long ctx, short[] coordinates, float scale);
+    //    protected static native int tessGetVertices(long ctx, short[] coordinates, float scale);
     //
-    //	protected static native int tessGetVerticesWO(long ctx, short[] coordinates,
-    //	        int offset, float scale);
+    //    protected static native int tessGetVerticesWO(long ctx, short[] coordinates,
+    //            int offset, float scale);
     //
-    //	protected static native int tessGetVerticesFloat(long ctx, float[] coordinates);
+    //    protected static native int tessGetVerticesFloat(long ctx, float[] coordinates);
     //
-    //	protected static native int tessGetIndices(long ctx, int[] indices);
+    //    protected static native int tessGetIndices(long ctx, int[] indices);
     //
-    //	protected static native int tessGetIndicesWO(long ctx, short[] indices, int offset);
+    //    protected static native int tessGetIndicesWO(long ctx, short[] indices, int offset);
 }
diff --git a/vtm/src/org/oscim/utils/TimSort.java b/vtm/src/org/oscim/utils/TimSort.java
index bff942e9..907498f2 100644
--- a/vtm/src/org/oscim/utils/TimSort.java
+++ b/vtm/src/org/oscim/utils/TimSort.java
@@ -211,28 +211,28 @@ public class TimSort {
                 : INITIAL_TMP_STORAGE_LENGTH];
         tmp = newArray;
 
-		/*
+        /*
          * Allocate runs-to-be-merged stack (which cannot be expanded). The
-		 * stack length requirements are described in listsort.txt.
-		 * The C version always uses the same stack length (85), but this was
-		 * measured to be too expensive when sorting "mid-sized"
-		 * arrays (e.g., 100 elements) in Java. Therefore, we use smaller (but
-		 * sufficiently large) stack lengths for smaller arrays.
-		 * The "magic numbers" in the computation below must be changed if
-		 * MIN_MERGE is decreased. See the MIN_MERGE declaration
-		 * above for more information.
-		 */
+         * stack length requirements are described in listsort.txt.
+         * The C version always uses the same stack length (85), but this was
+         * measured to be too expensive when sorting "mid-sized"
+         * arrays (e.g., 100 elements) in Java. Therefore, we use smaller (but
+         * sufficiently large) stack lengths for smaller arrays.
+         * The "magic numbers" in the computation below must be changed if
+         * MIN_MERGE is decreased. See the MIN_MERGE declaration
+         * above for more information.
+         */
         int stackLen = (len < 120 ? 5 : len < 1542 ? 10 : len < 119151 ? 19 : 40);
         runBase = new int[stackLen];
         runLen = new int[stackLen];
     }
 
-	/*
+    /*
      * The next two methods (which are package private and static) constitute
-	 * the entire API of this class. Each of these methods
-	 * obeys the contract of the public method with the same signature in
-	 * java.util.Arrays.
-	 */
+     * the entire API of this class. Each of these methods
+     * obeys the contract of the public method with the same signature in
+     * java.util.Arrays.
+     */
 
     static  void sort(T[] a, Comparator c) {
         sort(a, 0, a.length, c);
@@ -324,10 +324,10 @@ public class TimSort {
             int right = start;
             if (DEBUG)
                 assert left <= right;
-			/*
-			 * Invariants: pivot >= all in [lo, left). pivot < all in [right,
-			 * start).
-			 */
+            /*
+             * Invariants: pivot >= all in [lo, left). pivot < all in [right,
+             * start).
+             */
             while (left < right) {
                 int mid = (left + right) >>> 1;
                 if (c.compare(pivot, a[mid]) < 0)
@@ -338,13 +338,13 @@ public class TimSort {
             if (DEBUG)
                 assert left == right;
 
-			/*
-			 * The invariants still hold: pivot >= all in [lo, left) and pivot <
-			 * all in [left, start), so pivot belongs at left. Note
-			 * that if there are elements equal to pivot, left points to the
-			 * first slot after them -- that's why this sort is stable.
-			 * Slide elements over to make room to make room for pivot.
-			 */
+            /*
+             * The invariants still hold: pivot >= all in [lo, left) and pivot <
+             * all in [left, start), so pivot belongs at left. Note
+             * that if there are elements equal to pivot, left points to the
+             * first slot after them -- that's why this sort is stable.
+             * Slide elements over to make room to make room for pivot.
+             */
             int n = start - left; // The number of elements to move
             // Switch is just an optimization for arraycopy in default case
             switch (n) {
@@ -526,11 +526,11 @@ public class TimSort {
         if (DEBUG)
             assert base1 + len1 == base2;
 
-		/*
-		 * Record the length of the combined runs; if i is the 3rd-last run now,
-		 * also slide over the last run (which isn't involved
-		 * in this merge). The current run (i+1) goes away in any case.
-		 */
+        /*
+         * Record the length of the combined runs; if i is the 3rd-last run now,
+         * also slide over the last run (which isn't involved
+         * in this merge). The current run (i+1) goes away in any case.
+         */
         runLen[i] = len1 + len2;
         if (i == stackSize - 3) {
             runBase[i + 1] = runBase[i + 2];
@@ -538,11 +538,11 @@ public class TimSort {
         }
         stackSize--;
 
-		/*
-		 * Find where the first element of run2 goes in run1. Prior elements in
-		 * run1 can be ignored (because they're already in
-		 * place).
-		 */
+        /*
+         * Find where the first element of run2 goes in run1. Prior elements in
+         * run1 can be ignored (because they're already in
+         * place).
+         */
         int k = gallopRight(a[base2], a, base1, len1, 0, c);
         if (DEBUG)
             assert k >= 0;
@@ -551,11 +551,11 @@ public class TimSort {
         if (len1 == 0)
             return;
 
-		/*
-		 * Find where the last element of run1 goes in run2. Subsequent elements
-		 * in run2 can be ignored (because they're already in
-		 * place).
-		 */
+        /*
+         * Find where the last element of run1 goes in run2. Subsequent elements
+         * in run2 can be ignored (because they're already in
+         * place).
+         */
         len2 = gallopLeft(a[base1 + len1 - 1], a, base2, len2, len2 - 1, c);
         if (DEBUG)
             assert len2 >= 0;
@@ -629,12 +629,12 @@ public class TimSort {
         if (DEBUG)
             assert -1 <= lastOfs && lastOfs < ofs && ofs <= len;
 
-		/*
-		 * Now a[base+lastOfs] < key <= a[base+ofs], so key belongs somewhere to
-		 * the right of lastOfs but no farther right than ofs.
-		 * Do a binary search, with invariant a[base + lastOfs - 1] < key <=
-		 * a[base + ofs].
-		 */
+        /*
+         * Now a[base+lastOfs] < key <= a[base+ofs], so key belongs somewhere to
+         * the right of lastOfs but no farther right than ofs.
+         * Do a binary search, with invariant a[base + lastOfs - 1] < key <=
+         * a[base + ofs].
+         */
         lastOfs++;
         while (lastOfs < ofs) {
             int m = lastOfs + ((ofs - lastOfs) >>> 1);
@@ -706,12 +706,12 @@ public class TimSort {
         if (DEBUG)
             assert -1 <= lastOfs && lastOfs < ofs && ofs <= len;
 
-		/*
-		 * Now a[b + lastOfs] <= key < a[b + ofs], so key belongs somewhere to
-		 * the right of lastOfs but no farther right than ofs.
-		 * Do a binary search, with invariant a[b + lastOfs - 1] <= key < a[b +
-		 * ofs].
-		 */
+        /*
+         * Now a[b + lastOfs] <= key < a[b + ofs], so key belongs somewhere to
+         * the right of lastOfs but no farther right than ofs.
+         * Do a binary search, with invariant a[b + lastOfs - 1] <= key < a[b +
+         * ofs].
+         */
         lastOfs++;
         while (lastOfs < ofs) {
             int m = lastOfs + ((ofs - lastOfs) >>> 1);
@@ -775,10 +775,10 @@ public class TimSort {
             int count1 = 0; // Number of times in a row that first run won
             int count2 = 0; // Number of times in a row that second run won
 
-			/*
-			 * Do the straightforward thing until (if ever) one run starts
-			 * winning consistently.
-			 */
+            /*
+             * Do the straightforward thing until (if ever) one run starts
+             * winning consistently.
+             */
             do {
                 if (DEBUG)
                     assert len1 > 1 && len2 > 0;
@@ -797,11 +797,11 @@ public class TimSort {
                 }
             } while ((count1 | count2) < minGallop);
 
-			/*
-			 * One run is winning so consistently that galloping may be a huge
-			 * win. So try that, and continue galloping until (if
-			 * ever) neither run appears to be winning consistently anymore.
-			 */
+            /*
+             * One run is winning so consistently that galloping may be a huge
+             * win. So try that, and continue galloping until (if
+             * ever) neither run appears to be winning consistently anymore.
+             */
             do {
                 if (DEBUG)
                     assert len1 > 1 && len2 > 0;
@@ -899,10 +899,10 @@ public class TimSort {
             int count1 = 0; // Number of times in a row that first run won
             int count2 = 0; // Number of times in a row that second run won
 
-			/*
-			 * Do the straightforward thing until (if ever) one run appears to
-			 * win consistently.
-			 */
+            /*
+             * Do the straightforward thing until (if ever) one run appears to
+             * win consistently.
+             */
             do {
                 if (DEBUG)
                     assert len1 > 0 && len2 > 1;
@@ -921,11 +921,11 @@ public class TimSort {
                 }
             } while ((count1 | count2) < minGallop);
 
-			/*
-			 * One run is winning so consistently that galloping may be a huge
-			 * win. So try that, and continue galloping until (if
-			 * ever) neither run appears to be winning consistently anymore.
-			 */
+            /*
+             * One run is winning so consistently that galloping may be a huge
+             * win. So try that, and continue galloping until (if
+             * ever) neither run appears to be winning consistently anymore.
+             */
             do {
                 if (DEBUG)
                     assert len1 > 0 && len2 > 1;
diff --git a/vtm/src/org/oscim/utils/async/AsyncTask.java b/vtm/src/org/oscim/utils/async/AsyncTask.java
index 5362240a..278f49f0 100644
--- a/vtm/src/org/oscim/utils/async/AsyncTask.java
+++ b/vtm/src/org/oscim/utils/async/AsyncTask.java
@@ -38,7 +38,7 @@ public abstract class AsyncTask extends Task {
             else
                 mainloop.post(this);
         } else {
-			/* post result on main-loop */
+            /* post result on main-loop */
             onPostExecute(state);
         }
     }
diff --git a/vtm/src/org/oscim/utils/geom/LineClipper.java b/vtm/src/org/oscim/utils/geom/LineClipper.java
index 2dba7645..15399d62 100644
--- a/vtm/src/org/oscim/utils/geom/LineClipper.java
+++ b/vtm/src/org/oscim/utils/geom/LineClipper.java
@@ -143,30 +143,30 @@ public class LineClipper {
                 /* Bitwise AND is not 0. Trivially reject and get out of loop */
                 break;
             } else {
-				/* failed both tests, so calculate the line segment to clip
-				 * from an outside point to an intersection with clip edge */
+                /* failed both tests, so calculate the line segment to clip
+                 * from an outside point to an intersection with clip edge */
                 float x = 0;
                 float y = 0;
 
-				/* At least one endpoint is outside the clip rectangle; pick it. */
+                /* At least one endpoint is outside the clip rectangle; pick it. */
                 int outcodeOut = (outcode0 == 0) ? outcode1 : outcode0;
-				/* Now find the intersection point;
-				 * use formulas y = y0 + slope * (x - x0), x = x0 + (1 / slope)
-				 * * (y - y0) */
+                /* Now find the intersection point;
+                 * use formulas y = y0 + slope * (x - x0), x = x0 + (1 / slope)
+                 * * (y - y0) */
                 if ((outcodeOut & TOP) != 0) {
-					/* point is above the clip rectangle */
+                    /* point is above the clip rectangle */
                     x = x0 + (x1 - x0) * (ymax - y0) / (y1 - y0);
                     y = ymax;
                 } else if ((outcodeOut & BOTTOM) != 0) {
-					/* point is below the clip rectangle */
+                    /* point is below the clip rectangle */
                     x = x0 + (x1 - x0) * (ymin - y0) / (y1 - y0);
                     y = ymin;
                 } else if ((outcodeOut & RIGHT) != 0) {
-					/* point is to the right of clip rectangle */
+                    /* point is to the right of clip rectangle */
                     y = y0 + (y1 - y0) * (xmax - x0) / (x1 - x0);
                     x = xmax;
                 } else if ((outcodeOut & LEFT) != 0) {
-					/* point is to the left of clip rectangle */
+                    /* point is to the left of clip rectangle */
                     y = y0 + (y1 - y0) * (xmin - x0) / (x1 - x0);
                     x = xmin;
                 }
@@ -181,8 +181,8 @@ public class LineClipper {
                 else if (y > ymax)
                     outcode |= TOP;
 
-				/* Now we move outside point to intersection point to clip
-				 * and get ready for next pass. */
+                /* Now we move outside point to intersection point to clip
+                 * and get ready for next pass. */
                 if (outcodeOut == outcode0) {
                     x0 = x;
                     y0 = y;
@@ -248,23 +248,23 @@ public class LineClipper {
             }
 
             while (inPos < end) {
-				/* get the current way point coordinates */
+                /* get the current way point coordinates */
                 x = in.points[inPos++];
                 y = in.points[inPos++];
 
                 int clip = clipNext(x, y);
                 if (clip == 0) {
-					/* current segment is fully outside */
+                    /* current segment is fully outside */
                     inside = false; // needed?
                 } else if (clip == 1) {
-					/* current segment is fully within */
+                    /* current segment is fully within */
                     out.addPoint(x, y);
                 } else { /* clip == -1 */
                     if (inside) {
-						/* previous was inside */
+                        /* previous was inside */
                         out.addPoint(outX2, outY2);
                     } else {
-						/* previous was outside */
+                        /* previous was outside */
                         out.startLine();
                         numLines++;
                         out.addPoint(outX1, outY1);
diff --git a/vtm/src/org/oscim/utils/geom/OBB2D.java b/vtm/src/org/oscim/utils/geom/OBB2D.java
index 5274e95d..f3fa80df 100644
--- a/vtm/src/org/oscim/utils/geom/OBB2D.java
+++ b/vtm/src/org/oscim/utils/geom/OBB2D.java
@@ -163,29 +163,29 @@ public class OBB2D {
         originY = Vec2.dot(vec, CORNER_0, AXIS_2);
     }
 
-    //	public OBB2D(float cx, float cy, float w, float h, float angle) {
-    //		float rcos = (float) Math.cos(angle);
-    //		float rsin = (float) Math.sin(angle);
+    //    public OBB2D(float cx, float cy, float w, float h, float angle) {
+    //        float rcos = (float) Math.cos(angle);
+    //        float rsin = (float) Math.sin(angle);
     //
-    //		float[] tmp = new float[4 * 2];
-    //		Vec2.set(tmp, 0, rcos, rsin);
-    //		Vec2.set(tmp, 1, -rsin, rcos);
+    //        float[] tmp = new float[4 * 2];
+    //        Vec2.set(tmp, 0, rcos, rsin);
+    //        Vec2.set(tmp, 1, -rsin, rcos);
     //
-    //		Vec2.mul(tmp, 0, w / 2);
-    //		Vec2.mul(tmp, 1, h / 2);
+    //        Vec2.mul(tmp, 0, w / 2);
+    //        Vec2.mul(tmp, 1, h / 2);
     //
-    //		Vec2.add(tmp, 2, tmp, 0, tmp, 1);
-    //		Vec2.sub(tmp, 3, tmp, 0, tmp, 1);
+    //        Vec2.add(tmp, 2, tmp, 0, tmp, 1);
+    //        Vec2.sub(tmp, 3, tmp, 0, tmp, 1);
     //
-    //		Vec2.set(tmp, 0, cx, cy);
+    //        Vec2.set(tmp, 0, cx, cy);
     //
-    //		Vec2.sub(origin, CORNER_X + 0, tmp, 0, tmp, 3);
-    //		Vec2.add(origin, CORNER_X + 2, tmp, 0, tmp, 3);
-    //		Vec2.add(origin, CORNER_X + 4, tmp, 0, tmp, 2);
-    //		Vec2.sub(origin, CORNER_X + 6, tmp, 0, tmp, 2);
+    //        Vec2.sub(origin, CORNER_X + 0, tmp, 0, tmp, 3);
+    //        Vec2.add(origin, CORNER_X + 2, tmp, 0, tmp, 3);
+    //        Vec2.add(origin, CORNER_X + 4, tmp, 0, tmp, 2);
+    //        Vec2.sub(origin, CORNER_X + 6, tmp, 0, tmp, 2);
     //
-    //		computeAxes();
-    //	}
+    //        computeAxes();
+    //    }
     //
     public OBB2D() {
 
diff --git a/vtm/src/org/oscim/utils/geom/SimplifyDP.java b/vtm/src/org/oscim/utils/geom/SimplifyDP.java
index 0e38d2cb..afffdc29 100644
--- a/vtm/src/org/oscim/utils/geom/SimplifyDP.java
+++ b/vtm/src/org/oscim/utils/geom/SimplifyDP.java
@@ -66,7 +66,7 @@ public class SimplifyDP {
         if ((length >> 1) >= markers.length)
             markers = new boolean[length >> 1];
         //else
-        //	Arrays.fill(markers, false);
+        //    Arrays.fill(markers, false);
 
         int first = inPos;
         int last = inPos + length - 2;
diff --git a/vtm/src/org/oscim/utils/geom/SimplifyVW.java b/vtm/src/org/oscim/utils/geom/SimplifyVW.java
index 4dc4eeaa..e37a3e30 100644
--- a/vtm/src/org/oscim/utils/geom/SimplifyVW.java
+++ b/vtm/src/org/oscim/utils/geom/SimplifyVW.java
@@ -69,9 +69,9 @@ public class SimplifyVW {
 
         Item last = push(geom.pointPos - 2, Float.MAX_VALUE);
 
-        //		sorter.doSort(heap, DistanceComparator, 0, size);
-        //		for (int i = 0; i < size; i++)
-        //			heap[i].index = i;
+        //        sorter.doSort(heap, DistanceComparator, 0, size);
+        //        for (int i = 0; i < size; i++)
+        //            heap[i].index = i;
 
         last.prev = prev;
         prev.next = last;
@@ -186,11 +186,11 @@ public class SimplifyVW {
         Item obj = heap[--size];
         heap[size] = null;
 
-		/* if min obj was popped */
+        /* if min obj was popped */
         if (i == size)
             return i;
 
-		/* else put min obj in place of the removed item */
+        /* else put min obj in place of the removed item */
         obj.index = i;
         heap[i] = obj;
 
diff --git a/vtm/src/org/oscim/utils/geom/TileClipper.java b/vtm/src/org/oscim/utils/geom/TileClipper.java
index f9dbae4b..68ffebfa 100644
--- a/vtm/src/org/oscim/utils/geom/TileClipper.java
+++ b/vtm/src/org/oscim/utils/geom/TileClipper.java
@@ -134,10 +134,10 @@ public class TileClipper {
             }
 
             //if (out.index[i] < 6) {
-            //	out.index[i] = 0;
-            //	//if (out.indexPos > 0)
-            //	//	out.indexPos--;
-            //	// TODO if outer skip holes
+            //    out.index[i] = 0;
+            //    //if (out.indexPos > 0)
+            //    //    out.indexPos--;
+            //    // TODO if outer skip holes
             //}
 
             pointPos += len;
@@ -161,16 +161,16 @@ public class TileClipper {
                     /* previous was inside */
                     out.addPoint(cx, cy);
                 } else {
-					/* previous was outside, add edge point */
+                    /* previous was outside, add edge point */
                     out.addPoint(xmin, py + (cy - py) * (xmin - px) / (cx - px));
                     out.addPoint(cx, cy);
                 }
             } else {
                 if (px > xmin) {
-					/* previous was inside, add edge point */
+                    /* previous was inside, add edge point */
                     out.addPoint(xmin, py + (cy - py) * (xmin - px) / (cx - px));
                 }
-				/* else skip point */
+                /* else skip point */
             }
             px = cx;
             py = cy;
diff --git a/vtm/src/org/oscim/utils/pool/Inlist.java b/vtm/src/org/oscim/utils/pool/Inlist.java
index dcfb3fae..d7994bff 100644
--- a/vtm/src/org/oscim/utils/pool/Inlist.java
+++ b/vtm/src/org/oscim/utils/pool/Inlist.java
@@ -72,7 +72,7 @@ public class Inlist> {
                 /* keep next */
                 tmp = itr.next;
 
-				/* push itr onto new list */
+                /* push itr onto new list */
                 itr.next = head;
                 head = itr;
 
@@ -311,7 +311,7 @@ public class Inlist> {
                 break;
             }
             //else if (it.next == other) {
-            //	throw new IllegalArgumentException("'other' already in 'list'");
+            //    throw new IllegalArgumentException("'other' already in 'list'");
             //}
         }
 
diff --git a/vtm/src/org/oscim/utils/quadtree/BoxTree.java b/vtm/src/org/oscim/utils/quadtree/BoxTree.java
index b2c00ac9..08ce3482 100644
--- a/vtm/src/org/oscim/utils/quadtree/BoxTree.java
+++ b/vtm/src/org/oscim/utils/quadtree/BoxTree.java
@@ -65,7 +65,7 @@ public class BoxTree, E> extends TileIndex, T> {
         // TODO this is redundant - use tile ids
         public int x1, x2, y1, y2;
 
-		/* inherits BoxItem item; */
+        /* inherits BoxItem item; */
 
         @Override
         public String toString() {
@@ -160,7 +160,7 @@ public class BoxTree, E> extends TileIndex, T> {
         if (!isPowerOfTwo(extents))
             throw new IllegalArgumentException("Extents must be power of two!");
 
-		/* size is -extents to +extents */
+        /* size is -extents to +extents */
         this.root.x1 = -extents;
         this.root.y1 = -extents;
         this.root.x2 = extents;
@@ -210,7 +210,7 @@ public class BoxTree, E> extends TileIndex, T> {
 
             n = stack.pop();
 
-			/* process overlapping items from cur node */
+            /* process overlapping items from cur node */
             for (BoxItem it = n.item; it != null; it = it.next) {
                 if (it.overlaps(box)) {
                     if (!cb.call(it.item, ctxt)) {
@@ -222,7 +222,7 @@ public class BoxTree, E> extends TileIndex, T> {
 
             BoxNode p = n.parent;
 
-			/* push next node on same level onto stack */
+            /* push next node on same level onto stack */
             switch (n.id) {
                 case 0:
                     if (overlaps(p.child01, box)) {
@@ -275,7 +275,7 @@ public class BoxTree, E> extends TileIndex, T> {
         while (!stack.empty()) {
             n = stack.pop();
 
-			/* process overlapping items from cur node */
+            /* process overlapping items from cur node */
             for (BoxItem it = n.item; it != null; it = it.next) {
                 if (it.overlaps(box)) {
                     @SuppressWarnings("unchecked")
@@ -289,7 +289,7 @@ public class BoxTree, E> extends TileIndex, T> {
 
             BoxNode p = n.parent;
 
-			/* push next node on same level onto stack */
+            /* push next node on same level onto stack */
             switch (n.id) {
                 case 0:
                     if (overlaps(p.child01, box)) {
@@ -310,7 +310,7 @@ public class BoxTree, E> extends TileIndex, T> {
                     break;
             }
 
-			/* push next level child onto stack */
+            /* push next level child onto stack */
             if (overlaps(n.child00, box))
                 stack.push(n.child00);
 
@@ -346,12 +346,12 @@ public class BoxTree, E> extends TileIndex, T> {
         while (!stack.empty()) {
             n = stack.pop();
 
-			/* process overlapping items from cur node */
+            /* process overlapping items from cur node */
             cb.call(n);
 
             BoxNode p = n.parent;
 
-			/* push next node on same level onto stack */
+            /* push next node on same level onto stack */
             switch (n.id) {
                 case 0:
                     if (p.child01 != null) {
@@ -372,7 +372,7 @@ public class BoxTree, E> extends TileIndex, T> {
                     break;
             }
 
-			/* push next level child onto stack */
+            /* push next level child onto stack */
             if (n.child00 != null)
                 stack.push(n.child00);
             else if (n.child01 != null)
@@ -439,10 +439,10 @@ public class BoxTree, E> extends TileIndex, T> {
         for (int level = 0; level <= maxDepth; level++) {
             cur.refs++;
 
-			/* half size of tile at current level */
+            /* half size of tile at current level */
             int hsize = (cur.x2 - cur.x1) >> 1;
 
-			/* center of tile */
+            /* center of tile */
             int cx = cur.x1 + hsize;
             int cy = cur.y1 + hsize;
 
@@ -497,10 +497,10 @@ public class BoxTree, E> extends TileIndex, T> {
         int y2 = box.y2;
 
         for (int level = 0; level <= maxDepth; level++) {
-			/* half size of tile at current level */
+            /* half size of tile at current level */
             int hsize = (cur.x2 - cur.x1) >> 1;
 
-			/* center of tile */
+            /* center of tile */
             int cx = cur.x1 + hsize;
             int cy = cur.y1 + hsize;
 
@@ -569,10 +569,10 @@ public class BoxTree, E> extends TileIndex, T> {
         for (int level = 0; level <= maxDepth; level++) {
             cur.refs++;
 
-			/* half size of tile at current z */
+            /* half size of tile at current z */
             int hsize = (cur.x2 - cur.x1) >> 1;
 
-			/* center of tile (shift by -extents) */
+            /* center of tile (shift by -extents) */
             int cx = cur.x1 + hsize;
             int cy = cur.y1 + hsize;
 
@@ -618,7 +618,7 @@ public class BoxTree, E> extends TileIndex, T> {
         BoxNode node = root;
 
         while (true) {
-			/* traverse down */
+            /* traverse down */
             if (node.child00 != null) {
                 node = node.child00;
                 continue;
@@ -639,10 +639,10 @@ public class BoxTree, E> extends TileIndex, T> {
             if (node == root)
                 break;
 
-			/* traverse up */
+            /* traverse up */
             BoxNode parent = node.parent;
 
-			/* unlink from parent */
+            /* unlink from parent */
             switch (node.id) {
                 case 0:
                     parent.child00 = null;
@@ -658,15 +658,15 @@ public class BoxTree, E> extends TileIndex, T> {
                     break;
             }
 
-			/* release items */
+            /* release items */
             node.item = null;
             node.refs = 0;
 
-			/* add n back to pool */
+            /* add n back to pool */
             node.parent = pool;
             pool = node;
 
-			/* continue with parent node */
+            /* continue with parent node */
             node = parent;
         }
 
diff --git a/vtm/src/org/oscim/utils/quadtree/TileIndex.java b/vtm/src/org/oscim/utils/quadtree/TileIndex.java
index 847fecbf..0d87dec6 100644
--- a/vtm/src/org/oscim/utils/quadtree/TileIndex.java
+++ b/vtm/src/org/oscim/utils/quadtree/TileIndex.java
@@ -157,11 +157,11 @@ public abstract class TileIndex, E> {
             if (cur == null)
                 throw new IllegalStateException("Item not in index");
 
-			/* keep pointer to parent */
+            /* keep pointer to parent */
             T next = cur.parent;
             cur.refs--;
 
-			/* if current node has no children */
+            /* if current node has no children */
             if (cur.refs == 0) {
                 /* unhook from parent */
                 switch (cur.id) {
@@ -179,7 +179,7 @@ public abstract class TileIndex, E> {
                         break;
                 }
 
-				/* add item back to pool */
+                /* add item back to pool */
                 cur.parent = pool;
                 pool = cur;
             }