diff --git a/vtm-android/src/org/oscim/android/AndroidAssetAdapter.java b/vtm-android/src/org/oscim/android/AndroidAssetAdapter.java index 5b88fcc7..d3a8bd1a 100644 --- a/vtm-android/src/org/oscim/android/AndroidAssetAdapter.java +++ b/vtm-android/src/org/oscim/android/AndroidAssetAdapter.java @@ -23,11 +23,13 @@ import android.content.Context; public class AndroidAssetAdapter extends AssetAdapter { Context mContext; + public AndroidAssetAdapter(Context ctx) { mContext = ctx; } + @Override - public InputStream openFileAsStream(String fileName) { + public InputStream openFileAsStream(String fileName) { try { return mContext.getAssets().open(fileName); } catch (IOException e) { diff --git a/vtm-android/src/org/oscim/android/AndroidLog.java b/vtm-android/src/org/oscim/android/AndroidLog.java index 1c785507..77b92b16 100644 --- a/vtm-android/src/org/oscim/android/AndroidLog.java +++ b/vtm-android/src/org/oscim/android/AndroidLog.java @@ -16,8 +16,7 @@ package org.oscim.android; import android.util.Log; - -public class AndroidLog implements org.oscim.backend.Log.Logger{ +public class AndroidLog implements org.oscim.backend.Log.Logger { @Override public void d(String tag, String msg) { diff --git a/vtm-android/src/org/oscim/android/Compass.java b/vtm-android/src/org/oscim/android/Compass.java index 447b20e4..e2a8d18d 100644 --- a/vtm-android/src/org/oscim/android/Compass.java +++ b/vtm-android/src/org/oscim/android/Compass.java @@ -51,14 +51,14 @@ public class Compass { public Compass(MapActivity mapActivity, Map map) { mMap = map; mSensorManager = (SensorManager) mapActivity - .getSystemService(Context.SENSOR_SERVICE); + .getSystemService(Context.SENSOR_SERVICE); mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION); } public void enable() { mSensorManager.registerListener(mListener, mSensor, - SensorManager.SENSOR_DELAY_UI); + SensorManager.SENSOR_DELAY_UI); } public void disable() { diff --git a/vtm-android/src/org/oscim/android/GLView.java b/vtm-android/src/org/oscim/android/GLView.java index 8526c99b..d6cc7a6f 100644 --- a/vtm-android/src/org/oscim/android/GLView.java +++ b/vtm-android/src/org/oscim/android/GLView.java @@ -24,7 +24,7 @@ import android.opengl.GLSurfaceView; public class GLView extends GLSurfaceView { - class GLRenderer extends org.oscim.renderer.MapRenderer implements GLSurfaceView.Renderer{ + class GLRenderer extends org.oscim.renderer.MapRenderer implements GLSurfaceView.Renderer { public GLRenderer(Map map) { super(map); @@ -47,7 +47,6 @@ public class GLView extends GLSurfaceView { } } - public GLView(Context context, Map map) { super(context); setEGLConfigChooser(new GlConfigChooser()); diff --git a/vtm-android/src/org/oscim/android/GlConfigChooser.java b/vtm-android/src/org/oscim/android/GlConfigChooser.java index f3680aec..163059f8 100644 --- a/vtm-android/src/org/oscim/android/GlConfigChooser.java +++ b/vtm-android/src/org/oscim/android/GlConfigChooser.java @@ -25,15 +25,15 @@ public class GlConfigChooser implements GLSurfaceView.EGLConfigChooser { // Try to find a normal multisample configuration first. int[] configSpec = { - EGL10.EGL_RED_SIZE, 5, - EGL10.EGL_GREEN_SIZE, 6, - EGL10.EGL_BLUE_SIZE, 5, - EGL10.EGL_ALPHA_SIZE, 8, - EGL10.EGL_DEPTH_SIZE, 16, - // Requires that setEGLContextClientVersion(2) is called on the view. - EGL10.EGL_RENDERABLE_TYPE, 4 /* EGL_OPENGL_ES2_BIT */, - EGL10.EGL_STENCIL_SIZE, 8, - EGL10.EGL_NONE }; + EGL10.EGL_RED_SIZE, 5, + EGL10.EGL_GREEN_SIZE, 6, + EGL10.EGL_BLUE_SIZE, 5, + EGL10.EGL_ALPHA_SIZE, 8, + EGL10.EGL_DEPTH_SIZE, 16, + // Requires that setEGLContextClientVersion(2) is called on the view. + EGL10.EGL_RENDERABLE_TYPE, 4 /* EGL_OPENGL_ES2_BIT */, + EGL10.EGL_STENCIL_SIZE, 8, + EGL10.EGL_NONE }; if (!egl.eglChooseConfig(display, configSpec, null, 0, mValue)) { throw new IllegalArgumentException("eglChooseConfig failed"); @@ -44,15 +44,15 @@ public class GlConfigChooser implements GLSurfaceView.EGLConfigChooser { stencilSize = 4; configSpec = new int[] { - // EGL10.EGL_RENDERABLE_TYPE, 4, EGL10.EGL_NONE }; - EGL10.EGL_RED_SIZE, 8, - EGL10.EGL_GREEN_SIZE, 8, - EGL10.EGL_BLUE_SIZE, 8, - EGL10.EGL_ALPHA_SIZE, 8, - EGL10.EGL_DEPTH_SIZE, 16, - EGL10.EGL_RENDERABLE_TYPE, 4 /* EGL_OPENGL_ES2_BIT */, - EGL10.EGL_STENCIL_SIZE, 8, - EGL10.EGL_NONE }; + // EGL10.EGL_RENDERABLE_TYPE, 4, EGL10.EGL_NONE }; + EGL10.EGL_RED_SIZE, 8, + EGL10.EGL_GREEN_SIZE, 8, + EGL10.EGL_BLUE_SIZE, 8, + EGL10.EGL_ALPHA_SIZE, 8, + EGL10.EGL_DEPTH_SIZE, 16, + EGL10.EGL_RENDERABLE_TYPE, 4 /* EGL_OPENGL_ES2_BIT */, + EGL10.EGL_STENCIL_SIZE, 8, + EGL10.EGL_NONE }; if (!egl.eglChooseConfig(display, configSpec, null, 0, mValue)) { throw new IllegalArgumentException("eglChooseConfig failed"); @@ -116,7 +116,7 @@ public class GlConfigChooser implements GLSurfaceView.EGLConfigChooser { // from quake2android private String printConfig(EGL10 egl, EGLDisplay display, - EGLConfig config) { + EGLConfig config) { int r = findConfigAttrib(egl, display, config, EGL10.EGL_RED_SIZE, 0); int g = findConfigAttrib(egl, display, config, EGL10.EGL_GREEN_SIZE, 0); @@ -132,22 +132,22 @@ public class GlConfigChooser implements GLSurfaceView.EGLConfigChooser { */ return String.format("EGLConfig rgba=%d%d%d%d depth=%d stencil=%d", - Integer.valueOf(r), Integer.valueOf(g), - Integer.valueOf(b), Integer.valueOf(a), Integer.valueOf(d), - Integer.valueOf(s)) - + " native=" - + findConfigAttrib(egl, display, config, EGL10.EGL_NATIVE_RENDERABLE, 0) - + " buffer=" - + findConfigAttrib(egl, display, config, EGL10.EGL_BUFFER_SIZE, 0) - + String.format( - " caveat=0x%04x", - Integer.valueOf(findConfigAttrib(egl, display, config, - EGL10.EGL_CONFIG_CAVEAT, 0))); + Integer.valueOf(r), Integer.valueOf(g), + Integer.valueOf(b), Integer.valueOf(a), Integer.valueOf(d), + Integer.valueOf(s)) + + " native=" + + findConfigAttrib(egl, display, config, EGL10.EGL_NATIVE_RENDERABLE, 0) + + " buffer=" + + findConfigAttrib(egl, display, config, EGL10.EGL_BUFFER_SIZE, 0) + + String.format( + " caveat=0x%04x", + Integer.valueOf(findConfigAttrib(egl, display, config, + EGL10.EGL_CONFIG_CAVEAT, 0))); } private int findConfigAttrib(EGL10 egl, EGLDisplay display, EGLConfig config, - int attribute, int defaultValue) { + int attribute, int defaultValue) { if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) { return mValue[0]; } diff --git a/vtm-android/src/org/oscim/android/MapActivity.java b/vtm-android/src/org/oscim/android/MapActivity.java index d6e2d964..e66c7d83 100644 --- a/vtm-android/src/org/oscim/android/MapActivity.java +++ b/vtm-android/src/org/oscim/android/MapActivity.java @@ -41,12 +41,13 @@ public abstract class MapActivity extends Activity { private static final String KEY_MAP_SCALE = "map_scale"; private static final String PREFERENCES_FILE = "MapActivity"; + //private static final String KEY_THEME = "Theme"; private static boolean containsViewport(SharedPreferences sharedPreferences) { return sharedPreferences.contains(KEY_LATITUDE) - && sharedPreferences.contains(KEY_LONGITUDE) - && sharedPreferences.contains(KEY_MAP_SCALE); + && sharedPreferences.contains(KEY_LONGITUDE) + && sharedPreferences.contains(KEY_MAP_SCALE); } protected Map mMap; @@ -73,7 +74,7 @@ public abstract class MapActivity extends Activity { editor.putInt(KEY_LATITUDE, geoPoint.latitudeE6); editor.putInt(KEY_LONGITUDE, geoPoint.longitudeE6); - editor.putFloat(KEY_MAP_SCALE, (float)mapPosition.scale); + editor.putFloat(KEY_MAP_SCALE, (float) mapPosition.scale); //editor.putString(KEY_THEME, mMap.getRenderTheme()); @@ -92,7 +93,7 @@ public abstract class MapActivity extends Activity { /** * This method is called once by each MapView during its setup process. - * + * * @param map * the calling MapView. */ @@ -100,7 +101,7 @@ public abstract class MapActivity extends Activity { mMap = map; SharedPreferences sharedPreferences = getSharedPreferences(PREFERENCES_FILE, - MODE_PRIVATE); + MODE_PRIVATE); if (containsViewport(sharedPreferences)) { // get and set the map position and zoom level @@ -108,7 +109,6 @@ public abstract class MapActivity extends Activity { int longitudeE6 = sharedPreferences.getInt(KEY_LONGITUDE, 0); float scale = sharedPreferences.getFloat(KEY_MAP_SCALE, 1); - MapPosition mapPosition = new MapPosition(); mapPosition.setPosition(latitudeE6 / 1E6, longitudeE6 / 1E6); mapPosition.setScale(scale); @@ -119,18 +119,18 @@ public abstract class MapActivity extends Activity { //String theme = sharedPreferences.getString(KEY_THEME, // InternalRenderTheme.DEFAULT.name()); -// if (theme.startsWith("/")) { -// try { -// map.setRenderTheme(theme); -// } catch (FileNotFoundException e) { -// map.setRenderTheme(InternalRenderTheme.DEFAULT); -// } -// } else { -// try { -// map.setRenderTheme(InternalRenderTheme.valueOf(theme)); -// } catch (IllegalArgumentException e) { -// map.setRenderTheme(InternalRenderTheme.DEFAULT); -// } -// } + // if (theme.startsWith("/")) { + // try { + // map.setRenderTheme(theme); + // } catch (FileNotFoundException e) { + // map.setRenderTheme(InternalRenderTheme.DEFAULT); + // } + // } else { + // try { + // map.setRenderTheme(InternalRenderTheme.valueOf(theme)); + // } catch (IllegalArgumentException e) { + // map.setRenderTheme(InternalRenderTheme.DEFAULT); + // } + // } } } diff --git a/vtm-android/src/org/oscim/android/MapScaleBar.java b/vtm-android/src/org/oscim/android/MapScaleBar.java index 93ec0478..c09ecfab 100644 --- a/vtm-android/src/org/oscim/android/MapScaleBar.java +++ b/vtm-android/src/org/oscim/android/MapScaleBar.java @@ -1,4 +1,5 @@ package org.oscim.android; + ///* // * Copyright 2010, 2011, 2012 mapsforge.org // * Copyright 2013 Hannes Janetzek diff --git a/vtm-android/src/org/oscim/android/MapView.java b/vtm-android/src/org/oscim/android/MapView.java index e3e36d31..9f56e4a5 100644 --- a/vtm-android/src/org/oscim/android/MapView.java +++ b/vtm-android/src/org/oscim/android/MapView.java @@ -51,7 +51,6 @@ public class MapView extends RelativeLayout { private int mWidth; private int mHeight; - private final Map mMap; final GLView mGLView; @@ -89,7 +88,7 @@ public class MapView extends RelativeLayout { if (!(context instanceof MapActivity)) { throw new IllegalArgumentException( - "context is not an instance of MapActivity"); + "context is not an instance of MapActivity"); } Log.logger = new AndroidLog(); @@ -100,7 +99,7 @@ public class MapView extends RelativeLayout { this.setWillNotDraw(true); DisplayMetrics metrics = getResources().getDisplayMetrics(); - CanvasAdapter.dpi = (int)Math.max(metrics.xdpi, metrics.ydpi); + CanvasAdapter.dpi = (int) Math.max(metrics.xdpi, metrics.ydpi); // TODO make this dpi dependent Tile.SIZE = 400; @@ -109,7 +108,7 @@ public class MapView extends RelativeLayout { final MapView m = this; - mMap = new Map(){ + mMap = new Map() { boolean mWaitRedraw; @@ -181,8 +180,8 @@ public class MapView extends RelativeLayout { mapActivity.registerMapView(mMap); LayoutParams params = new LayoutParams( - android.view.ViewGroup.LayoutParams.MATCH_PARENT, - android.view.ViewGroup.LayoutParams.MATCH_PARENT); + android.view.ViewGroup.LayoutParams.MATCH_PARENT, + android.view.ViewGroup.LayoutParams.MATCH_PARENT); addView(mGLView, params); @@ -190,7 +189,7 @@ public class MapView extends RelativeLayout { mMap.updateMap(false); } - View getView(){ + View getView() { return this; } @@ -203,7 +202,6 @@ public class MapView extends RelativeLayout { //mMap.destroy(); } - void onPause() { mPausing = true; @@ -236,7 +234,7 @@ public class MapView extends RelativeLayout { // synchronized ??? @Override protected void onSizeChanged(int width, int height, - int oldWidth, int oldHeight) { + int oldWidth, int oldHeight) { Log.d(TAG, "onSizeChanged: " + width + "x" + height); super.onSizeChanged(width, height, oldWidth, oldHeight); @@ -250,7 +248,6 @@ public class MapView extends RelativeLayout { mMap.getViewport().setViewport(width, height); } - public void enableRotation(boolean enable) { mRotationEnabled = enable; diff --git a/vtm-android/src/org/oscim/android/MapZoomControls.java b/vtm-android/src/org/oscim/android/MapZoomControls.java index a74c4dd0..b44bf874 100644 --- a/vtm-android/src/org/oscim/android/MapZoomControls.java +++ b/vtm-android/src/org/oscim/android/MapZoomControls.java @@ -1,4 +1,5 @@ package org.oscim.android; + ///* // * Copyright 2010, 2011, 2012 mapsforge.org // * diff --git a/vtm-android/src/org/oscim/android/canvas/AndroidBitmap.java b/vtm-android/src/org/oscim/android/canvas/AndroidBitmap.java index ffd6f174..c5a7424b 100644 --- a/vtm-android/src/org/oscim/android/canvas/AndroidBitmap.java +++ b/vtm-android/src/org/oscim/android/canvas/AndroidBitmap.java @@ -31,11 +31,12 @@ public class AndroidBitmap implements org.oscim.backend.canvas.Bitmap { /** * @param format ignored always ARGB8888 */ - public AndroidBitmap(int width, int height, int format){ + public AndroidBitmap(int width, int height, int format) { mBitmap = android.graphics.Bitmap - .createBitmap(width, height, android.graphics.Bitmap.Config.ARGB_8888); + .createBitmap(width, height, android.graphics.Bitmap.Config.ARGB_8888); } - AndroidBitmap(android.graphics.Bitmap bitmap){ + + AndroidBitmap(android.graphics.Bitmap bitmap) { mBitmap = bitmap; } @@ -72,7 +73,7 @@ public class AndroidBitmap implements org.oscim.backend.canvas.Bitmap { if (replace) GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, mBitmap, format, - type); + type); else GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, format, mBitmap, type, 0); diff --git a/vtm-android/src/org/oscim/android/canvas/AndroidCanvas.java b/vtm-android/src/org/oscim/android/canvas/AndroidCanvas.java index ac93ceac..50adc742 100644 --- a/vtm-android/src/org/oscim/android/canvas/AndroidCanvas.java +++ b/vtm-android/src/org/oscim/android/canvas/AndroidCanvas.java @@ -10,19 +10,21 @@ public class AndroidCanvas implements Canvas { public AndroidCanvas() { this.canvas = new android.graphics.Canvas(); } + @Override public void setBitmap(Bitmap bitmap) { - this.canvas.setBitmap(((AndroidBitmap)bitmap).mBitmap); + this.canvas.setBitmap(((AndroidBitmap) bitmap).mBitmap); } @Override public void drawText(String string, float x, float y, Paint stroke) { - this.canvas.drawText(string, x, y, ((AndroidPaint)stroke).mPaint); + this.canvas.drawText(string, x, y, ((AndroidPaint) stroke).mPaint); } + @Override public void drawBitmap(Bitmap bitmap, float x, float y) { - this.canvas.drawBitmap(((AndroidBitmap)bitmap).mBitmap, x, y, null); + this.canvas.drawBitmap(((AndroidBitmap) bitmap).mBitmap, x, y, null); } diff --git a/vtm-android/src/org/oscim/android/canvas/AndroidGraphics.java b/vtm-android/src/org/oscim/android/canvas/AndroidGraphics.java index 13face3a..1edb748d 100644 --- a/vtm-android/src/org/oscim/android/canvas/AndroidGraphics.java +++ b/vtm-android/src/org/oscim/android/canvas/AndroidGraphics.java @@ -100,10 +100,10 @@ public final class AndroidGraphics extends CanvasAdapter { return new AndroidBitmap(((BitmapDrawable) drawable).getBitmap()); } - android.graphics.Bitmap bitmap = android.graphics.Bitmap.createBitmap( - drawable.getIntrinsicWidth(), - drawable.getIntrinsicHeight(), - Config.ARGB_8888); + android.graphics.Bitmap bitmap = android.graphics.Bitmap + .createBitmap(drawable.getIntrinsicWidth(), + drawable.getIntrinsicHeight(), + Config.ARGB_8888); android.graphics.Canvas canvas = new android.graphics.Canvas(bitmap); drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); diff --git a/vtm-android/src/org/oscim/android/canvas/AndroidPaint.java b/vtm-android/src/org/oscim/android/canvas/AndroidPaint.java index 0840eca4..b72adb93 100644 --- a/vtm-android/src/org/oscim/android/canvas/AndroidPaint.java +++ b/vtm-android/src/org/oscim/android/canvas/AndroidPaint.java @@ -63,7 +63,7 @@ class AndroidPaint implements Paint { AndroidPaint() { mPaint = new android.graphics.Paint( - android.graphics.Paint.ANTI_ALIAS_FLAG); + android.graphics.Paint.ANTI_ALIAS_FLAG); } @Override @@ -92,10 +92,12 @@ class AndroidPaint implements Paint { } android.graphics.Bitmap androidBitmap = android.graphics.Bitmap - .createBitmap(bitmap.getPixels(), bitmap.getWidth(), - bitmap.getHeight(), Config.ARGB_8888); + .createBitmap(bitmap.getPixels(), + bitmap.getWidth(), + bitmap.getHeight(), + Config.ARGB_8888); Shader shader = new BitmapShader(androidBitmap, TileMode.REPEAT, - TileMode.REPEAT); + TileMode.REPEAT); mPaint.setShader(shader); } @@ -113,7 +115,7 @@ class AndroidPaint implements Paint { @Override public void setStrokeCap(Cap cap) { android.graphics.Paint.Cap androidCap = android.graphics.Paint.Cap - .valueOf(cap.name()); + .valueOf(cap.name()); mPaint.setStrokeCap(androidCap); } @@ -140,7 +142,7 @@ class AndroidPaint implements Paint { @Override public void setTypeface(FontFamily fontFamily, FontStyle fontStyle) { Typeface typeface = Typeface.create(getTypeface(fontFamily), - getStyle(fontStyle)); + getStyle(fontStyle)); mPaint.setTypeface(typeface); } diff --git a/vtm-android/src/org/oscim/android/gl/AndroidGL.java b/vtm-android/src/org/oscim/android/gl/AndroidGL.java index 92b3cb87..a7eff6c7 100644 --- a/vtm-android/src/org/oscim/android/gl/AndroidGL.java +++ b/vtm-android/src/org/oscim/android/gl/AndroidGL.java @@ -24,7 +24,6 @@ import android.opengl.GLES20; public class AndroidGL implements GL20 { - @Override public void glAttachShader(int program, int shader) { GLES20.glAttachShader(program, shader); @@ -147,13 +146,13 @@ public class AndroidGL implements GL20 { @Override public void glFramebufferRenderbuffer(int target, int attachment, int renderbuffertarget, - int renderbuffer) { + int renderbuffer) { GLES20.glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); } @Override public void glFramebufferTexture2D(int target, int attachment, int textarget, int texture, - int level) { + int level) { GLES20.glFramebufferTexture2D(target, attachment, textarget, texture, level); } @@ -219,7 +218,7 @@ public class AndroidGL implements GL20 { @Override public void glGetFramebufferAttachmentParameteriv(int target, int attachment, int pname, - IntBuffer params) { + IntBuffer params) { GLES20.glGetFramebufferAttachmentParameteriv(target, attachment, pname, params); } @@ -253,7 +252,7 @@ public class AndroidGL implements GL20 { @Override public void glGetShaderPrecisionFormat(int shadertype, int precisiontype, IntBuffer range, - IntBuffer precision) { + IntBuffer precision) { GLES20.glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision); } @@ -590,13 +589,13 @@ public class AndroidGL implements GL20 { @Override public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, - Buffer ptr) { + Buffer ptr) { GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, ptr); } @Override public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, - int offset) { + int offset) { // FIXME check implementation! GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, offset); //throw new UnsupportedOperationException("missing implementation"); @@ -652,27 +651,27 @@ public class AndroidGL implements GL20 { @Override public void glCompressedTexImage2D(int target, int level, int internalformat, int width, - int height, int border, int imageSize, Buffer data) { + int height, int border, int imageSize, Buffer data) { throw new UnsupportedOperationException("missing implementation"); } @Override public void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset, - int width, int height, int format, int imageSize, Buffer data) { + int width, int height, int format, int imageSize, Buffer data) { throw new UnsupportedOperationException("missing implementation"); } @Override public void glCopyTexImage2D(int target, int level, int internalformat, int x, int y, - int width, int height, int border) { + int width, int height, int border) { GLES20.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); } @Override public void glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y, - int width, int height) { + int width, int height) { GLES20.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); } @@ -795,7 +794,7 @@ public class AndroidGL implements GL20 { @Override public void glReadPixels(int x, int y, int width, int height, int format, int type, - Buffer pixels) { + Buffer pixels) { GLES20.glReadPixels(x, y, width, height, format, type, pixels); } @@ -821,9 +820,9 @@ public class AndroidGL implements GL20 { @Override public void glTexImage2D(int target, int level, int internalformat, int width, int height, - int border, int format, int type, Buffer pixels) { + int border, int format, int type, Buffer pixels) { GLES20.glTexImage2D(target, level, internalformat, width, height, border, format, type, - pixels); + pixels); } @Override @@ -833,7 +832,7 @@ public class AndroidGL implements GL20 { @Override public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, - int height, int format, int type, Buffer pixels) { + int height, int format, int type, Buffer pixels) { GLES20.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); } diff --git a/vtm-android/src/org/oscim/android/input/AndroidMotionEvent.java b/vtm-android/src/org/oscim/android/input/AndroidMotionEvent.java index 7715510b..8ad606bf 100644 --- a/vtm-android/src/org/oscim/android/input/AndroidMotionEvent.java +++ b/vtm-android/src/org/oscim/android/input/AndroidMotionEvent.java @@ -13,6 +13,7 @@ * this program. If not, see . */ package org.oscim.android.input; + import org.oscim.event.MotionEvent; public class AndroidMotionEvent extends MotionEvent { @@ -28,7 +29,7 @@ public class AndroidMotionEvent extends MotionEvent { android.view.MotionEvent mEvent; - public void wrap(android.view.MotionEvent e){ + public void wrap(android.view.MotionEvent e) { mEvent = e; } @@ -36,6 +37,7 @@ public class AndroidMotionEvent extends MotionEvent { public int getAction() { return mEvent.getAction(); } + @Override public float getX() { return mEvent.getX(); @@ -66,5 +68,4 @@ public class AndroidMotionEvent extends MotionEvent { return mEvent.getEventTime(); } - } diff --git a/vtm-extras/src/org/oscim/utils/Triangulator.java b/vtm-extras/src/org/oscim/utils/Triangulator.java index 083e5bb0..01c1b21c 100644 --- a/vtm-extras/src/org/oscim/utils/Triangulator.java +++ b/vtm-extras/src/org/oscim/utils/Triangulator.java @@ -5,7 +5,7 @@ import java.util.ArrayList; /** * Triangulates a polygon into triangles - duh. Doesn't handle * holes in polys - * + * * @author Public Source from FlipCode */ public class Triangulator { @@ -26,7 +26,7 @@ public class Triangulator { /** * Add a point describing the polygon to be triangulated - * + * * @param x The x coordinate of the point * @param y the y coordinate of the point */ @@ -36,7 +36,7 @@ public class Triangulator { /** * Cause the triangulator to split the polygon - * + * * @return True if we managed the task */ public boolean triangulate() { @@ -48,7 +48,7 @@ public class Triangulator { /** * Get a count of the number of triangles produced - * + * * @return The number of triangles produced */ public int getTriangleCount() { @@ -60,7 +60,7 @@ public class Triangulator { /** * Get a point on a specified generated triangle - * + * * @param tri The index of the triangle to interegate * @param i The index of the point within the triangle to retrieve * (0 - 2) @@ -76,7 +76,7 @@ public class Triangulator { /** * Find the area of a polygon defined by the series of points * in the list - * + * * @param contour The list of points defined the contour of the polygon * (Vector2f) * @return The area of the polygon defined @@ -91,7 +91,7 @@ public class Triangulator { Point contourQ = contour.get(q); A += contourP.getX() * contourQ.getY() - contourQ.getX() - * contourP.getY(); + * contourP.getY(); } return A * 0.5f; } @@ -99,7 +99,7 @@ public class Triangulator { /** * Check if the point P is inside the triangle defined by * the points A,B,C - * + * * @param Ax Point A x-coordinate * @param Ay Point A y-coordinate * @param Bx Point B x-coordinate @@ -111,7 +111,7 @@ public class Triangulator { * @return True if the point specified is within the triangle */ private static boolean insideTriangle(float Ax, float Ay, float Bx, - float By, float Cx, float Cy, float Px, float Py) { + float By, float Cx, float Cy, float Px, float Py) { float ax, ay, bx, by, cx, cy, apx, apy, bpx, bpy, cpx, cpy; float cCROSSap, bCROSScp, aCROSSbp; @@ -138,7 +138,7 @@ public class Triangulator { /** * Cut a the contour and add a triangle into V to describe the * location of the cut - * + * * @param contour The list of points defining the polygon * @param u The index of the first point * @param v The index of the second point @@ -148,7 +148,7 @@ public class Triangulator { * @return True if a triangle was found */ private static boolean snip(PointList contour, int u, int v, int w, int n, - int[] V) { + int[] V) { int p; float Ax, Ay, Bx, By, Cx, Cy, Px, Py; @@ -183,7 +183,7 @@ public class Triangulator { /** * Process a list of points defining a polygon - * + * * @param contour The list of points describing the polygon * @param result The list of points describing the triangles. Groups * of 3 describe each triangle @@ -263,7 +263,7 @@ public class Triangulator { /** * A single point handled by the triangulator - * + * * @author Kevin Glass */ private class Point { @@ -274,7 +274,7 @@ public class Triangulator { /** * Create a new point - * + * * @param x The x coordindate of the point * @param y The y coordindate of the point */ @@ -285,7 +285,7 @@ public class Triangulator { /** * Get the x coordinate of the point - * + * * @return The x coordinate of the point */ public float getX() { @@ -294,7 +294,7 @@ public class Triangulator { /** * Get the y coordinate of the point - * + * * @return The y coordinate of the point */ public float getY() { @@ -303,7 +303,7 @@ public class Triangulator { /** * Convert this point into a float array - * + * * @return The contents of this point as a float array */ public float[] toArray() { @@ -313,7 +313,7 @@ public class Triangulator { /** * A list of type Point - * + * * @author Kevin Glass */ private class PointList { @@ -328,7 +328,7 @@ public class Triangulator { /** * Add a point to the list - * + * * @param point The point to add */ public void add(Point point) { @@ -346,7 +346,7 @@ public class Triangulator { /** * Get the size of the list - * + * * @return The size of the list */ public int size() { @@ -355,7 +355,7 @@ public class Triangulator { /** * Get a point a specific index in the list - * + * * @param i The index of the point to retrieve * @return The point */ diff --git a/vtm-extras/src/org/oscim/utils/osm/OSMData.java b/vtm-extras/src/org/oscim/utils/osm/OSMData.java index 4cb31ce2..9615ebb8 100644 --- a/vtm-extras/src/org/oscim/utils/osm/OSMData.java +++ b/vtm-extras/src/org/oscim/utils/osm/OSMData.java @@ -27,7 +27,7 @@ public class OSMData { private final Collection relations; public OSMData(Collection bounds, Collection nodes, - Collection ways, Collection relations) { + Collection ways, Collection relations) { this.bounds = bounds; this.nodes = nodes; diff --git a/vtm-extras/src/org/oscim/utils/osm/OSMMember.java b/vtm-extras/src/org/oscim/utils/osm/OSMMember.java index 25a89ce2..55dbee80 100644 --- a/vtm-extras/src/org/oscim/utils/osm/OSMMember.java +++ b/vtm-extras/src/org/oscim/utils/osm/OSMMember.java @@ -15,11 +15,12 @@ package org.oscim.utils.osm; public class OSMMember { - public enum MemberType{ + public enum MemberType { NODE, WAY, RELATIOM } + static final boolean useDebugLabels = true; public final String role; diff --git a/vtm-extras/src/org/oscim/utils/osm/OSMRelation.java b/vtm-extras/src/org/oscim/utils/osm/OSMRelation.java index 40d5347d..89b51ad4 100644 --- a/vtm-extras/src/org/oscim/utils/osm/OSMRelation.java +++ b/vtm-extras/src/org/oscim/utils/osm/OSMRelation.java @@ -28,7 +28,7 @@ public class OSMRelation extends OSMElement { public OSMRelation(TagSet tags, long id, int initialMemberSize) { super(tags, id); this.relationMembers = - new ArrayList(initialMemberSize); + new ArrayList(initialMemberSize); } @Override diff --git a/vtm-extras/src/org/oscim/utils/osm/OSMWay.java b/vtm-extras/src/org/oscim/utils/osm/OSMWay.java index 7ffe1e39..8a8db838 100644 --- a/vtm-extras/src/org/oscim/utils/osm/OSMWay.java +++ b/vtm-extras/src/org/oscim/utils/osm/OSMWay.java @@ -29,7 +29,7 @@ public class OSMWay extends OSMElement { public boolean isClosed() { return nodes.size() > 0 && - nodes.get(0).equals(nodes.get(nodes.size() - 1)); + nodes.get(0).equals(nodes.get(nodes.size() - 1)); } @Override diff --git a/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfParser.java b/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfParser.java index 4c7326b3..698061e1 100644 --- a/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfParser.java +++ b/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfParser.java @@ -16,9 +16,6 @@ import org.oscim.utils.osm.OSMNode; import org.oscim.utils.osm.OSMRelation; import org.oscim.utils.osm.OSMWay; - - - /** * Class that reads and parses binary files and sends the contained entities to * the sink. @@ -205,32 +202,31 @@ public class OsmPbfParser extends BinaryParser { for (int j = 0; j < tagCnt; j++) tags.add(new Tag(getStringById(i.getKeys(j)), getStringById(i.getVals(j)))); - long id = i.getId(); long lastMid = 0; 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)); -// -// 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? -// } -// -// nodes.add(new OSMMember(mid, etype, role)); -// } + // 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); + // + // 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)); + // } // long id, int version, TimestampContainer timestampContainer, // OsmUser user, @@ -246,7 +242,7 @@ public class OsmPbfParser extends BinaryParser { // tmp = new Relation(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE, // NOCHANGESET, tags), nodes); // } -// sink.process(new RelationContainer(tmp)); + // sink.process(new RelationContainer(tmp)); } } @@ -281,43 +277,42 @@ public class OsmPbfParser extends BinaryParser { public OSMData getData() { -// for (Entry> entry : relationMembersForRelation -// .entrySet()) { -// -// OSMRelation relation = entry.getKey(); -// -// for (TmpRelation member : entry.getValue()) { -// -// 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 (memberObject != null) { -// OSMMember ownMember = new OSMMember(member.role, -// memberObject); -// -// relation.relationMembers.add(ownMember); -// } -// } -// } - + // for (Entry> entry : relationMembersForRelation + // .entrySet()) { + // + // OSMRelation relation = entry.getKey(); + // + // for (TmpRelation member : entry.getValue()) { + // + // 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 (memberObject != null) { + // OSMMember ownMember = new OSMMember(member.role, + // memberObject); + // + // relation.relationMembers.add(ownMember); + // } + // } + // } // give up references to original collections - ArrayList ways = new ArrayList (mWayMap.values()); - ArrayList nodes= new ArrayList (mNodeMap.values()); + ArrayList ways = new ArrayList(mWayMap.values()); + ArrayList nodes = new ArrayList(mNodeMap.values()); Log.d("..", "nodes: " + nodes.size() + " ways: " + ways.size()); - return new OSMData(null, nodes, ways, null); + return new OSMData(null, nodes, ways, null); } } diff --git a/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfReader.java b/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfReader.java index 3b530404..d8f39504 100644 --- a/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfReader.java +++ b/vtm-extras/src/org/oscim/utils/osmpbf/OsmPbfReader.java @@ -22,7 +22,7 @@ import org.oscim.utils.osm.OSMData; public class OsmPbfReader { - public static OSMData process(InputStream is){ + public static OSMData process(InputStream is) { OsmPbfParser parser = new OsmPbfParser(); try { diff --git a/vtm-extras/src/org/oscim/utils/overpass/OverpassAPIReader.java b/vtm-extras/src/org/oscim/utils/overpass/OverpassAPIReader.java index 6ceba44d..921c509d 100644 --- a/vtm-extras/src/org/oscim/utils/overpass/OverpassAPIReader.java +++ b/vtm-extras/src/org/oscim/utils/overpass/OverpassAPIReader.java @@ -46,7 +46,7 @@ import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; -public class OverpassAPIReader { +public class OverpassAPIReader { private static final String OVERPASS_API = "http://city.informatik.uni-bremen.de/oapi/interpreter"; private static final int RESPONSECODE_OK = 200; @@ -75,7 +75,7 @@ public class OverpassAPIReader { /** * Creates a new instance with the specified geographical coordinates. - * + * * @param left * The longitude marking the left edge of the bounding box. * @param right @@ -89,12 +89,12 @@ public class OverpassAPIReader { * http://www.openstreetmap.org/api/0.5). */ public OverpassAPIReader(final double left, final double right, - final double top, final double bottom, final String baseUrl, - final String query) { + final double top, final double bottom, final String baseUrl, + final String query) { String bbox = "(" + Math.min(top, bottom) + "," + Math.min(left, right) - + "," + Math.max(top, bottom) + "," + Math.max(left, right) - + ")"; + + "," + Math.max(top, bottom) + "," + Math.max(left, right) + + ")"; this.query = query.replaceAll("\\{\\{bbox\\}\\}", bbox); @@ -103,7 +103,7 @@ public class OverpassAPIReader { /** * Open a connection to the given url and return a reader on the input * stream from that connection. - * + * * @param pUrlStr * The exact url to connect to. * @return An reader reading the input stream (servers answer) or @@ -120,7 +120,7 @@ public class OverpassAPIReader { myActiveConnection = (HttpURLConnection) url.openConnection(); myActiveConnection.setRequestProperty("Accept-Encoding", - "gzip, deflate"); + "gzip, deflate"); responseCode = myActiveConnection.getResponseCode(); @@ -132,11 +132,11 @@ public class OverpassAPIReader { if (apiErrorMessage != null) { message = "Received API HTTP response code " + responseCode - + " with message \"" + apiErrorMessage - + "\" for URL \"" + pUrlStr + "\"."; + + " with message \"" + apiErrorMessage + + "\" for URL \"" + pUrlStr + "\"."; } else { message = "Received API HTTP response code " + responseCode - + " for URL \"" + pUrlStr + "\"."; + + " for URL \"" + pUrlStr + "\"."; } throw new IOException(message); @@ -151,7 +151,7 @@ public class OverpassAPIReader { responseStream = new GZIPInputStream(responseStream); } else if (encoding != null && encoding.equalsIgnoreCase("deflate")) { responseStream = new InflaterInputStream(responseStream, - new Inflater(true)); + new Inflater(true)); } return responseStream; @@ -168,12 +168,12 @@ public class OverpassAPIReader { private Map waysById = new HashMap(); private Map relationsById = new HashMap(); private Map> relationMembersForRelation = - new HashMap>(); + new HashMap>(); private final Collection ownNodes = new ArrayList(10000); private final Collection ownWays = new ArrayList(1000); private final Collection ownRelations = new ArrayList( - 100); + 100); public void parse(InputStream in) throws IOException { JsonFactory jsonFactory = new JsonFactory(); @@ -208,7 +208,7 @@ public class OverpassAPIReader { } private void parseNode(JsonParser jp) throws JsonParseException, - IOException { + IOException { long id = 0; double lat = 0, lon = 0; @@ -274,7 +274,7 @@ public class OverpassAPIReader { } private void parseRelation(JsonParser jp) throws JsonParseException, - IOException { + IOException { long id = 0; TagSet tags = TagSet.EMPTY_TAG_SET; @@ -318,22 +318,21 @@ public class OverpassAPIReader { } private static TagSet parseTags(JsonParser jp) throws JsonParseException, - IOException { + IOException { TagSet tags = null; - while (jp.nextToken() != JsonToken.END_OBJECT) { String key = jp.getCurrentName(); jp.nextToken(); String val = jp.getText(); - if (tags== null) - tags= new TagSet(4); + if (tags == null) + tags = new TagSet(4); tags.add(new Tag(key, val, false)); } - if (tags== null) + if (tags == null) return TagSet.EMPTY_TAG_SET; return tags; @@ -343,7 +342,6 @@ public class OverpassAPIReader { System.out.println(msg); } - public OSMData getData() { String encoded; @@ -374,7 +372,7 @@ public class OverpassAPIReader { } for (Entry> entry : relationMembersForRelation - .entrySet()) { + .entrySet()) { OSMRelation relation = entry.getKey(); @@ -395,14 +393,14 @@ public class OverpassAPIReader { if (memberObject != null) { OSMMember ownMember = new OSMMember(member.role, - memberObject); + memberObject); relation.relationMembers.add(ownMember); } } } log("nodes: " + ownNodes.size() + " ways: " + ownWays.size() - + " relations: " + ownRelations.size()); + + " relations: " + ownRelations.size()); // give up references to original collections nodesById = null; diff --git a/vtm-extras/src/org/oscim/utils/wkb/Geometry.java b/vtm-extras/src/org/oscim/utils/wkb/Geometry.java index 2833c197..fd315f23 100644 --- a/vtm-extras/src/org/oscim/utils/wkb/Geometry.java +++ b/vtm-extras/src/org/oscim/utils/wkb/Geometry.java @@ -75,14 +75,14 @@ abstract class Geometry implements Serializable { static final int GEOMETRYCOLLECTION = 7; static final String[] ALLTYPES = new String[] { - "", // internally used LinearRing does not have any text in front of - // it - "POINT", "LINESTRING", "POLYGON", "MULTIPOINT", "MULTILINESTRING", - "MULTIPOLYGON", "GEOMETRYCOLLECTION" }; + "", // internally used LinearRing does not have any text in front of + // it + "POINT", "LINESTRING", "POLYGON", "MULTIPOINT", "MULTILINESTRING", + "MULTIPOLYGON", "GEOMETRYCOLLECTION" }; /** * The Text representations of the geometry types - * + * * @param type * ... * @return ... @@ -125,7 +125,7 @@ abstract class Geometry implements Serializable { /** * Parse a SRID value, anything <= 0 is unknown - * + * * @param srid * ... * @return ... @@ -140,7 +140,7 @@ abstract class Geometry implements Serializable { /** * Constructor for subclasses - * + * * @param type * has to be given by all subclasses. */ @@ -162,30 +162,30 @@ abstract class Geometry implements Serializable { @Override public boolean equals(Object other) { return (other != null) && (other instanceof Geometry) - && equals((Geometry) other); + && equals((Geometry) other); } /** * geometry specific equals implementation - only defined for non-null * values - * + * * @param other * ... * @return ... */ public boolean equals(Geometry other) { return (other != null) && (this.dimension == other.dimension) - && (this.type == other.type) && (this.srid == other.srid) - && (this.haveMeasure == other.haveMeasure) - && other.getClass().equals(this.getClass()) - && this.equalsintern(other); + && (this.type == other.type) && (this.srid == other.srid) + && (this.haveMeasure == other.haveMeasure) + && other.getClass().equals(this.getClass()) + && this.equalsintern(other); } /** * Whether test coordinates for geometry - subclass specific code * Implementors can assume that dimensin, type, srid * and haveMeasure are equal, other != null and other is the same subclass. - * + * * @param other * ... * @return ... @@ -194,14 +194,14 @@ abstract class Geometry implements Serializable { /** * Return the number of Points of the geometry - * + * * @return ... */ abstract int numPoints(); /** * Get the nth Point of the geometry - * + * * @param n * the index of the point, from 0 to numPoints()-1; * @throws ArrayIndexOutOfBoundsException @@ -222,7 +222,7 @@ abstract class Geometry implements Serializable { /** * The OGIS geometry type number of this geometry. - * + * * @return ... */ int getType() { @@ -231,7 +231,7 @@ abstract class Geometry implements Serializable { /** * Return the Type as String - * + * * @return ... */ String getTypeString() { @@ -240,7 +240,7 @@ abstract class Geometry implements Serializable { /** * Returns whether we have a measure - * + * * @return .... */ boolean isMeasured() { @@ -251,7 +251,7 @@ abstract class Geometry implements Serializable { * Queries the number of geometric dimensions of this geometry. This does * not include measures, as opposed to the * server. - * + * * @return The dimensionality (eg, 2D or 3D) of this geometry. */ int getDimension() { @@ -260,7 +260,7 @@ abstract class Geometry implements Serializable { /** * The OGIS geometry type number of this geometry. - * + * * @return ... */ int getSrid() { @@ -270,7 +270,7 @@ abstract class Geometry implements Serializable { /** * Recursively sets the srid on this geometry and all contained * subgeometries - * + * * @param srid * ... */ @@ -293,7 +293,7 @@ abstract class Geometry implements Serializable { /** * Render the WKT version of this Geometry (without SRID) into the given * StringBuffer. - * + * * @param sb * ... * @param putM @@ -314,7 +314,7 @@ abstract class Geometry implements Serializable { /** * Render the WKT without the type name, but including the brackets into the * StringBuffer - * + * * @param sb * ... */ @@ -327,7 +327,7 @@ abstract class Geometry implements Serializable { /** * Render the "inner" part of the WKT (inside the brackets) into the * StringBuffer. - * + * * @param SB * ... */ @@ -335,7 +335,7 @@ abstract class Geometry implements Serializable { /** * backwards compatibility method - * + * * @return ... */ String getValue() { @@ -354,7 +354,7 @@ abstract class Geometry implements Serializable { * NULL or inconsistent subgeometries. BinaryParser and WKTParser should * only generate consistent geometries. * BinaryWriter may produce invalid results on inconsistent geometries. - * + * * @return true if all checks are passed. */ boolean checkConsistency() { @@ -363,7 +363,7 @@ abstract class Geometry implements Serializable { /** * Splits the SRID=4711; part of a EWKT rep if present and sets the srid. - * + * * @param value * ... * @return value without the SRID=4711; part @@ -374,7 +374,7 @@ abstract class Geometry implements Serializable { int index = v.indexOf(';', 5); // sridprefix length is 5 if (index == -1) { throw new IllegalArgumentException( - "Error parsing Geometry - SRID not delimited with ';' "); + "Error parsing Geometry - SRID not delimited with ';' "); } this.srid = Integer.parseInt(v.substring(5, index)); return v.substring(index + 1).trim(); diff --git a/vtm-extras/src/org/oscim/utils/wkb/ValueGetter.java b/vtm-extras/src/org/oscim/utils/wkb/ValueGetter.java index bc45cd8c..37284bbf 100644 --- a/vtm-extras/src/org/oscim/utils/wkb/ValueGetter.java +++ b/vtm-extras/src/org/oscim/utils/wkb/ValueGetter.java @@ -37,7 +37,7 @@ abstract class ValueGetter { /** * Get a byte, should be equal for all endians - * + * * @return ... */ byte getByte() { @@ -58,7 +58,7 @@ abstract class ValueGetter { /** * Get a 32-Bit integer - * + * * @param index * ... * @return ... @@ -68,7 +68,7 @@ abstract class ValueGetter { /** * Get a long value. This is not needed directly, but as a nice side-effect * from GetDouble. - * + * * @param index * ... * @return ... @@ -77,7 +77,7 @@ abstract class ValueGetter { /** * Get a double. - * + * * @return ... */ double getDouble() { @@ -95,19 +95,19 @@ abstract class ValueGetter { @Override protected int getInt(int index) { return ((data[index] & 0xFF) << 24) + ((data[index + 1] & 0xFF) << 16) - + ((data[index + 2] & 0xFF) << 8) + (data[index + 3] & 0xFF); + + ((data[index + 2] & 0xFF) << 8) + (data[index + 3] & 0xFF); } @Override protected long getLong(int index) { return ((long) (data[index] & 0xFF) << 56) | ((long) (data[index + 1] & 0xFF) << 48) - | ((long) (data[index + 2] & 0xFF) << 40) - | ((long) (data[index + 3] & 0xFF) << 32) - | ((long) (data[index + 4] & 0xFF) << 24) - | ((long) (data[index + 5] & 0xFF) << 16) - | ((long) (data[index + 6] & 0xFF) << 8) - | ((long) (data[index + 7] & 0xFF) << 0); + | ((long) (data[index + 2] & 0xFF) << 40) + | ((long) (data[index + 3] & 0xFF) << 32) + | ((long) (data[index + 4] & 0xFF) << 24) + | ((long) (data[index + 5] & 0xFF) << 16) + | ((long) (data[index + 6] & 0xFF) << 8) + | ((long) (data[index + 7] & 0xFF) << 0); } } @@ -121,18 +121,18 @@ abstract class ValueGetter { @Override protected int getInt(int index) { return ((data[index + 3] & 0xFF) << 24) + ((data[index + 2] & 0xFF) << 16) - + ((data[index + 1] & 0xFF) << 8) + (data[index] & 0xFF); + + ((data[index + 1] & 0xFF) << 8) + (data[index] & 0xFF); } @Override protected long getLong(int index) { return ((long) (data[index + 7] & 0xFF) << 56) - | ((long) (data[index + 6] & 0xFF) << 48) - | ((long) (data[index + 5] & 0xFF) << 40) - | ((long) (data[index + 4] & 0xFF) << 32) - | ((long) (data[index + 3] & 0xFF) << 24) - | ((long) (data[index + 2] & 0xFF) << 16) - | ((long) (data[index + 1] & 0xFF) << 8) | ((long) (data[index] & 0xFF) << 0); + | ((long) (data[index + 6] & 0xFF) << 48) + | ((long) (data[index + 5] & 0xFF) << 40) + | ((long) (data[index + 4] & 0xFF) << 32) + | ((long) (data[index + 3] & 0xFF) << 24) + | ((long) (data[index + 2] & 0xFF) << 16) + | ((long) (data[index + 1] & 0xFF) << 8) | ((long) (data[index] & 0xFF) << 0); } } diff --git a/vtm-extras/src/org/oscim/utils/wkb/WKBReader.java b/vtm-extras/src/org/oscim/utils/wkb/WKBReader.java index efda7a99..ea1d8f46 100644 --- a/vtm-extras/src/org/oscim/utils/wkb/WKBReader.java +++ b/vtm-extras/src/org/oscim/utils/wkb/WKBReader.java @@ -73,35 +73,35 @@ public class WKBReader { data.getInt(); } switch (realtype) { - case Geometry.POINT: - mGeom.startPoints(); - parsePoint(data, haveZ, haveM); - break; - case Geometry.LINESTRING: - mGeom.startLine(); - parseLineString(data, haveZ, haveM); - break; - case Geometry.POLYGON: - mGeom.startPolygon(); - parsePolygon(data, haveZ, haveM); - break; - case Geometry.MULTIPOINT: - mGeom.startPoints(); - parseMultiPoint(data); - break; - case Geometry.MULTILINESTRING: - mGeom.startLine(); - parseMultiLineString(data); - break; - case Geometry.MULTIPOLYGON: - mGeom.startPolygon(); - parseMultiPolygon(data); - break; - case Geometry.GEOMETRYCOLLECTION: - parseCollection(data); - break; - default: - throw new IllegalArgumentException("Unknown Geometry Type: " + realtype); + case Geometry.POINT: + mGeom.startPoints(); + parsePoint(data, haveZ, haveM); + break; + case Geometry.LINESTRING: + mGeom.startLine(); + parseLineString(data, haveZ, haveM); + break; + case Geometry.POLYGON: + mGeom.startPolygon(); + parsePolygon(data, haveZ, haveM); + break; + case Geometry.MULTIPOINT: + mGeom.startPoints(); + parseMultiPoint(data); + break; + case Geometry.MULTILINESTRING: + mGeom.startLine(); + parseMultiLineString(data); + break; + case Geometry.MULTIPOLYGON: + mGeom.startPolygon(); + parseMultiPolygon(data); + break; + case Geometry.GEOMETRYCOLLECTION: + parseCollection(data); + break; + default: + throw new IllegalArgumentException("Unknown Geometry Type: " + realtype); } if (count == 0) { @@ -132,7 +132,7 @@ public class WKBReader { /** * Parse an Array of "full" Geometries - * + * * @param data * ... * @param count @@ -193,7 +193,6 @@ public class WKBReader { if (i > 0) mGeom.startHole(); - int points = data.getInt(); for (int j = 0; j < points; j++) { @@ -254,7 +253,7 @@ public class WKBReader { /** * Converting a string of hex character to bytes - * + * * from http://stackoverflow.com/questions/140131/convert-a-string- * representation-of-a-hex-dump-to-a-byte-array-using-java */ diff --git a/vtm-gdx-android/src/org/oscim/android/AndroidLog.java b/vtm-gdx-android/src/org/oscim/android/AndroidLog.java index 1c785507..77b92b16 100644 --- a/vtm-gdx-android/src/org/oscim/android/AndroidLog.java +++ b/vtm-gdx-android/src/org/oscim/android/AndroidLog.java @@ -16,8 +16,7 @@ package org.oscim.android; import android.util.Log; - -public class AndroidLog implements org.oscim.backend.Log.Logger{ +public class AndroidLog implements org.oscim.backend.Log.Logger { @Override public void d(String tag, String msg) { diff --git a/vtm-gdx-android/src/org/oscim/android/canvas/AndroidBitmap.java b/vtm-gdx-android/src/org/oscim/android/canvas/AndroidBitmap.java index ffd6f174..c5a7424b 100644 --- a/vtm-gdx-android/src/org/oscim/android/canvas/AndroidBitmap.java +++ b/vtm-gdx-android/src/org/oscim/android/canvas/AndroidBitmap.java @@ -31,11 +31,12 @@ public class AndroidBitmap implements org.oscim.backend.canvas.Bitmap { /** * @param format ignored always ARGB8888 */ - public AndroidBitmap(int width, int height, int format){ + public AndroidBitmap(int width, int height, int format) { mBitmap = android.graphics.Bitmap - .createBitmap(width, height, android.graphics.Bitmap.Config.ARGB_8888); + .createBitmap(width, height, android.graphics.Bitmap.Config.ARGB_8888); } - AndroidBitmap(android.graphics.Bitmap bitmap){ + + AndroidBitmap(android.graphics.Bitmap bitmap) { mBitmap = bitmap; } @@ -72,7 +73,7 @@ public class AndroidBitmap implements org.oscim.backend.canvas.Bitmap { if (replace) GLUtils.texSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, mBitmap, format, - type); + type); else GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, format, mBitmap, type, 0); diff --git a/vtm-gdx-android/src/org/oscim/android/canvas/AndroidCanvas.java b/vtm-gdx-android/src/org/oscim/android/canvas/AndroidCanvas.java index ac93ceac..50adc742 100644 --- a/vtm-gdx-android/src/org/oscim/android/canvas/AndroidCanvas.java +++ b/vtm-gdx-android/src/org/oscim/android/canvas/AndroidCanvas.java @@ -10,19 +10,21 @@ public class AndroidCanvas implements Canvas { public AndroidCanvas() { this.canvas = new android.graphics.Canvas(); } + @Override public void setBitmap(Bitmap bitmap) { - this.canvas.setBitmap(((AndroidBitmap)bitmap).mBitmap); + this.canvas.setBitmap(((AndroidBitmap) bitmap).mBitmap); } @Override public void drawText(String string, float x, float y, Paint stroke) { - this.canvas.drawText(string, x, y, ((AndroidPaint)stroke).mPaint); + this.canvas.drawText(string, x, y, ((AndroidPaint) stroke).mPaint); } + @Override public void drawBitmap(Bitmap bitmap, float x, float y) { - this.canvas.drawBitmap(((AndroidBitmap)bitmap).mBitmap, x, y, null); + this.canvas.drawBitmap(((AndroidBitmap) bitmap).mBitmap, x, y, null); } diff --git a/vtm-gdx-android/src/org/oscim/android/canvas/AndroidGraphics.java b/vtm-gdx-android/src/org/oscim/android/canvas/AndroidGraphics.java index 52e17098..77fbc795 100644 --- a/vtm-gdx-android/src/org/oscim/android/canvas/AndroidGraphics.java +++ b/vtm-gdx-android/src/org/oscim/android/canvas/AndroidGraphics.java @@ -94,10 +94,10 @@ public final class AndroidGraphics extends CanvasAdapter { return new AndroidBitmap(((BitmapDrawable) drawable).getBitmap()); } - android.graphics.Bitmap bitmap = android.graphics.Bitmap.createBitmap( - drawable.getIntrinsicWidth(), - drawable.getIntrinsicHeight(), - Config.ARGB_8888); + android.graphics.Bitmap bitmap = android.graphics.Bitmap + .createBitmap(drawable.getIntrinsicWidth(), + drawable.getIntrinsicHeight(), + Config.ARGB_8888); android.graphics.Canvas canvas = new android.graphics.Canvas(bitmap); drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); diff --git a/vtm-gdx-android/src/org/oscim/android/canvas/AndroidPaint.java b/vtm-gdx-android/src/org/oscim/android/canvas/AndroidPaint.java index 1b87ce03..925ab2a0 100644 --- a/vtm-gdx-android/src/org/oscim/android/canvas/AndroidPaint.java +++ b/vtm-gdx-android/src/org/oscim/android/canvas/AndroidPaint.java @@ -62,8 +62,7 @@ class AndroidPaint implements Paint { final android.graphics.Paint mPaint; AndroidPaint() { - mPaint = new android.graphics.Paint( - android.graphics.Paint.ANTI_ALIAS_FLAG); + mPaint = new android.graphics.Paint(android.graphics.Paint.ANTI_ALIAS_FLAG); } @Override @@ -92,10 +91,10 @@ class AndroidPaint implements Paint { } android.graphics.Bitmap androidBitmap = android.graphics.Bitmap - .createBitmap(bitmap.getPixels(), bitmap.getWidth(), - bitmap.getHeight(), Config.ARGB_8888); + .createBitmap(bitmap.getPixels(), bitmap.getWidth(), + bitmap.getHeight(), Config.ARGB_8888); Shader shader = new BitmapShader(androidBitmap, TileMode.REPEAT, - TileMode.REPEAT); + TileMode.REPEAT); mPaint.setShader(shader); } @@ -113,7 +112,7 @@ class AndroidPaint implements Paint { @Override public void setStrokeCap(Cap cap) { android.graphics.Paint.Cap androidCap = android.graphics.Paint.Cap - .valueOf(cap.name()); + .valueOf(cap.name()); mPaint.setStrokeCap(androidCap); } @@ -141,7 +140,7 @@ class AndroidPaint implements Paint { @Override public void setTypeface(FontFamily fontFamily, FontStyle fontStyle) { Typeface typeface = Typeface.create(getTypeface(fontFamily), - getStyle(fontStyle)); + getStyle(fontStyle)); mPaint.setTypeface(typeface); } diff --git a/vtm-gdx-android/src/org/oscim/gdx/MainActivity.java b/vtm-gdx-android/src/org/oscim/gdx/MainActivity.java index d699ba5d..d65c88de 100644 --- a/vtm-gdx-android/src/org/oscim/gdx/MainActivity.java +++ b/vtm-gdx-android/src/org/oscim/gdx/MainActivity.java @@ -56,4 +56,4 @@ public class MainActivity extends AndroidApplication { initDefaultLayers(ts, true, true, true); } } -} \ No newline at end of file +} diff --git a/vtm-gdx-desktop/src/org/oscim/awt/AwtBitmap.java b/vtm-gdx-desktop/src/org/oscim/awt/AwtBitmap.java index 643fe8de..1d564821 100644 --- a/vtm-gdx-desktop/src/org/oscim/awt/AwtBitmap.java +++ b/vtm-gdx-desktop/src/org/oscim/awt/AwtBitmap.java @@ -37,7 +37,7 @@ public class AwtBitmap implements Bitmap { this.width = this.bitmap.getWidth(); this.height = this.bitmap.getHeight(); if (!this.bitmap.isAlphaPremultiplied() - && this.bitmap.getType() == BufferedImage.TYPE_INT_ARGB) + && this.bitmap.getType() == BufferedImage.TYPE_INT_ARGB) this.bitmap.coerceData(true); } @@ -97,13 +97,13 @@ public class AwtBitmap implements Bitmap { for (int i = 0, n = width * height; i < n; i++) { int c = pixels[i]; //if (internal) { - float alpha = (c >>> 24) / 255f; - int r = (int) ((c & 0x000000ff) * alpha); - int b = (int) (((c & 0x00ff0000) >>> 16) * alpha); - int g = (int) (((c & 0x0000ff00) >>> 8) * alpha); - pixels[i] = (c & 0xff000000) | r << 16 | g << 8 | b; + float alpha = (c >>> 24) / 255f; + int r = (int) ((c & 0x000000ff) * alpha); + int b = (int) (((c & 0x00ff0000) >>> 16) * alpha); + int g = (int) (((c & 0x0000ff00) >>> 8) * alpha); + pixels[i] = (c & 0xff000000) | r << 16 | g << 8 | b; //} else { - // flip blue with red - silly Java + // flip blue with red - silly Java // pixels[i] = (c & 0xff00ff00) | (c & 0x00ff0000) >>> 16 | (c & 0x000000ff) << 16; //} } diff --git a/vtm-gdx-desktop/src/org/oscim/awt/AwtCanvas.java b/vtm-gdx-desktop/src/org/oscim/awt/AwtCanvas.java index 6a6c0254..f45ee1e7 100644 --- a/vtm-gdx-desktop/src/org/oscim/awt/AwtCanvas.java +++ b/vtm-gdx-desktop/src/org/oscim/awt/AwtCanvas.java @@ -39,7 +39,7 @@ public class AwtCanvas implements Canvas { if (canvas != null) canvas.dispose(); - AwtBitmap awtBitamp = (AwtBitmap)bitmap; + AwtBitmap awtBitamp = (AwtBitmap) bitmap; canvas = awtBitamp.bitmap.createGraphics(); @@ -48,22 +48,22 @@ public class AwtCanvas implements Canvas { canvas.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f)); - canvas.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON ); + canvas.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); //canvas.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); canvas.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); canvas.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - - } + @Override public void drawText(String text, float x, float y, Paint paint) { -// if (paint.isTransparent()) { -// return; -// } + // if (paint.isTransparent()) { + // return; + // } - AwtPaint awtPaint = (AwtPaint)paint; + AwtPaint awtPaint = (AwtPaint) paint; //AwtPaint awtPaint = AwtGraphicFactory.getAwtPaint(paint); @@ -73,7 +73,9 @@ public class AwtCanvas implements Canvas { canvas.drawString(text, x + 2, y); } else { setColorAndStroke(awtPaint); - TextLayout textLayout = new TextLayout(text, awtPaint.font, canvas.getFontRenderContext()); + TextLayout textLayout = new TextLayout(text, + awtPaint.font, + canvas.getFontRenderContext()); AffineTransform affineTransform = new AffineTransform(); affineTransform.translate(x + 2, y); canvas.draw(textLayout.getOutline(affineTransform)); @@ -87,19 +89,19 @@ public class AwtCanvas implements Canvas { } } -// @Override -// public void drawText(String string, float x, float y, Paint stroke) { -// AwtPaint p = (AwtPaint)stroke; -// -// canvas.setFont(p.font); -// canvas.setColor(p.color); -// -// canvas.drawString(string, (int)x, (int)y); -// } + // @Override + // public void drawText(String string, float x, float y, Paint stroke) { + // AwtPaint p = (AwtPaint)stroke; + // + // canvas.setFont(p.font); + // canvas.setColor(p.color); + // + // canvas.drawString(string, (int)x, (int)y); + // } @Override - public void drawBitmap(Bitmap bitmap, float x, float y) { - // TODO Auto-generated method stub - throw new UnknownError("not implemented"); - } + public void drawBitmap(Bitmap bitmap, float x, float y) { + // TODO Auto-generated method stub + throw new UnknownError("not implemented"); + } } diff --git a/vtm-gdx-desktop/src/org/oscim/awt/AwtGraphics.java b/vtm-gdx-desktop/src/org/oscim/awt/AwtGraphics.java index a987dbfe..388ec68a 100644 --- a/vtm-gdx-desktop/src/org/oscim/awt/AwtGraphics.java +++ b/vtm-gdx-desktop/src/org/oscim/awt/AwtGraphics.java @@ -52,12 +52,14 @@ public class AwtGraphics extends CanvasAdapter { static final Graphics2D canvas; static { - image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); + image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); canvas = image.createGraphics(); - canvas.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON ); + canvas.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); //canvas.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); //canvas.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); } + static synchronized FontMetrics getFontMetrics(Font font) { canvas.setFont(font); // get character measurements @@ -77,13 +79,13 @@ public class AwtGraphics extends CanvasAdapter { } @Override - public Bitmap decodeBitmap(InputStream inputStream) { + public Bitmap decodeBitmap(InputStream inputStream) { try { - return new AwtBitmap(inputStream); - } catch (IOException e) { - e.printStackTrace(); - return null; - } + return new AwtBitmap(inputStream); + } catch (IOException e) { + e.printStackTrace(); + return null; + } } @Override diff --git a/vtm-gdx-desktop/src/org/oscim/awt/AwtPaint.java b/vtm-gdx-desktop/src/org/oscim/awt/AwtPaint.java index 4b0be66c..57b39e1d 100644 --- a/vtm-gdx-desktop/src/org/oscim/awt/AwtPaint.java +++ b/vtm-gdx-desktop/src/org/oscim/awt/AwtPaint.java @@ -32,12 +32,12 @@ public class AwtPaint implements Paint { private static int getCap(Cap cap) { switch (cap) { - case BUTT: - return BasicStroke.CAP_BUTT; - case ROUND: - return BasicStroke.CAP_ROUND; - case SQUARE: - return BasicStroke.CAP_SQUARE; + case BUTT: + return BasicStroke.CAP_BUTT; + case ROUND: + return BasicStroke.CAP_ROUND; + case SQUARE: + return BasicStroke.CAP_SQUARE; } throw new IllegalArgumentException("unknown cap: " + cap); @@ -60,6 +60,7 @@ public class AwtPaint implements Paint { private int cap; private float strokeWidth; + //private Align mAlign; @Override diff --git a/vtm-gdx-desktop/src/org/oscim/gdx/GdxGL20.java b/vtm-gdx-desktop/src/org/oscim/gdx/GdxGL20.java new file mode 100644 index 00000000..67d3757e --- /dev/null +++ b/vtm-gdx-desktop/src/org/oscim/gdx/GdxGL20.java @@ -0,0 +1,890 @@ +/******************************************************************************* + * Copyright 2011 See AUTHORS file. + * + * 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. + ******************************************************************************/ + +package org.oscim.gdx; + +import java.nio.Buffer; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import java.nio.ShortBuffer; + +import org.lwjgl.BufferUtils; +import org.lwjgl.opengl.EXTFramebufferObject; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL13; +import org.lwjgl.opengl.GL14; +import org.lwjgl.opengl.GL15; +import org.lwjgl.opengl.GL20; + +import com.badlogic.gdx.graphics.GL10; +import com.badlogic.gdx.utils.GdxRuntimeException; + +/** + * An implementation of the {@link GL20} interface based on LWJGL. Note that + * LWJGL shaders and OpenGL ES shaders will not be 100% + * compatible. Some glGetXXX methods are not implemented. + * + * @author mzechner + */ +public final class GdxGL20 implements org.oscim.backend.GL20 { + public void glActiveTexture(int texture) { + GL13.glActiveTexture(texture); + } + + public void glAttachShader(int program, int shader) { + GL20.glAttachShader(program, shader); + } + + public void glBindAttribLocation(int program, int index, String name) { + GL20.glBindAttribLocation(program, index, name); + } + + public void glBindBuffer(int target, int buffer) { + GL15.glBindBuffer(target, buffer); + } + + public void glBindFramebuffer(int target, int framebuffer) { + EXTFramebufferObject.glBindFramebufferEXT(target, framebuffer); + } + + public void glBindRenderbuffer(int target, int renderbuffer) { + EXTFramebufferObject.glBindRenderbufferEXT(target, renderbuffer); + } + + public void glBindTexture(int target, int texture) { + GL11.glBindTexture(target, texture); + } + + public void glBlendColor(float red, float green, float blue, float alpha) { + GL14.glBlendColor(red, green, blue, alpha); + } + + public void glBlendEquation(int mode) { + GL14.glBlendEquation(mode); + } + + public void glBlendEquationSeparate(int modeRGB, int modeAlpha) { + GL20.glBlendEquationSeparate(modeRGB, modeAlpha); + } + + public void glBlendFunc(int sfactor, int dfactor) { + GL11.glBlendFunc(sfactor, dfactor); + } + + public void glBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) { + GL14.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); + } + + public void glBufferData(int target, int size, Buffer data, int usage) { + if (data == null) + throw new GdxRuntimeException("Using null for the data not possible, blame LWJGL"); + else if (data instanceof ByteBuffer) + GL15.glBufferData(target, (ByteBuffer) data, usage); + else if (data instanceof IntBuffer) + GL15.glBufferData(target, (IntBuffer) data, usage); + else if (data instanceof FloatBuffer) + GL15.glBufferData(target, (FloatBuffer) data, usage); + else if (data instanceof DoubleBuffer) + GL15.glBufferData(target, (DoubleBuffer) data, usage); + else if (data instanceof ShortBuffer) // + GL15.glBufferData(target, (ShortBuffer) data, usage); + } + + public void glBufferSubData(int target, int offset, int size, Buffer data) { + if (data == null) + throw new GdxRuntimeException("Using null for the data not possible, blame LWJGL"); + else if (data instanceof ByteBuffer) + GL15.glBufferSubData(target, offset, (ByteBuffer) data); + else if (data instanceof IntBuffer) + GL15.glBufferSubData(target, offset, (IntBuffer) data); + else if (data instanceof FloatBuffer) + GL15.glBufferSubData(target, offset, (FloatBuffer) data); + else if (data instanceof DoubleBuffer) + GL15.glBufferSubData(target, offset, (DoubleBuffer) data); + else if (data instanceof ShortBuffer) // + GL15.glBufferSubData(target, offset, (ShortBuffer) data); + } + + public int glCheckFramebufferStatus(int target) { + return EXTFramebufferObject.glCheckFramebufferStatusEXT(target); + } + + public void glClear(int mask) { + GL11.glClear(mask); + } + + public void glClearColor(float red, float green, float blue, float alpha) { + GL11.glClearColor(red, green, blue, alpha); + } + + public void glClearDepthf(float depth) { + GL11.glClearDepth(depth); + } + + public void glClearStencil(int s) { + GL11.glClearStencil(s); + } + + public void glColorMask(boolean red, boolean green, boolean blue, boolean alpha) { + GL11.glColorMask(red, green, blue, alpha); + } + + public void glCompileShader(int shader) { + GL20.glCompileShader(shader); + } + + public void glCompressedTexImage2D(int target, int level, int internalformat, int width, + int height, int border, + int imageSize, Buffer data) { + if (data instanceof ByteBuffer) { + GL13.glCompressedTexImage2D(target, + level, + internalformat, + width, + height, + border, + (ByteBuffer) data); + } else { + throw new GdxRuntimeException("Can't use " + data.getClass().getName() + + " with this method. Use ByteBuffer instead."); + } + } + + public void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset, + int width, int height, int format, + int imageSize, Buffer data) { + throw new GdxRuntimeException("not implemented"); + } + + public void glCopyTexImage2D(int target, int level, int internalformat, int x, int y, + int width, int height, int border) { + GL11.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); + } + + public void glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y, + int width, int height) { + GL11.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); + } + + public int glCreateProgram() { + return GL20.glCreateProgram(); + } + + public int glCreateShader(int type) { + return GL20.glCreateShader(type); + } + + public void glCullFace(int mode) { + GL11.glCullFace(mode); + } + + public void glDeleteBuffers(int n, IntBuffer buffers) { + GL15.glDeleteBuffers(buffers); + } + + public void glDeleteFramebuffers(int n, IntBuffer framebuffers) { + EXTFramebufferObject.glDeleteFramebuffersEXT(framebuffers); + } + + public void glDeleteProgram(int program) { + GL20.glDeleteProgram(program); + } + + public void glDeleteRenderbuffers(int n, IntBuffer renderbuffers) { + EXTFramebufferObject.glDeleteRenderbuffersEXT(renderbuffers); + } + + public void glDeleteShader(int shader) { + GL20.glDeleteShader(shader); + } + + public void glDeleteTextures(int n, IntBuffer textures) { + GL11.glDeleteTextures(textures); + } + + public void glDepthFunc(int func) { + GL11.glDepthFunc(func); + } + + public void glDepthMask(boolean flag) { + GL11.glDepthMask(flag); + } + + public void glDepthRangef(float zNear, float zFar) { + GL11.glDepthRange(zNear, zFar); + } + + public void glDetachShader(int program, int shader) { + GL20.glDetachShader(program, shader); + } + + public void glDisable(int cap) { + GL11.glDisable(cap); + } + + public void glDisableVertexAttribArray(int index) { + GL20.glDisableVertexAttribArray(index); + } + + public void glDrawArrays(int mode, int first, int count) { + GL11.glDrawArrays(mode, first, count); + } + + public void glDrawElements(int mode, int count, int type, Buffer indices) { + if (indices instanceof ShortBuffer && type == GL10.GL_UNSIGNED_SHORT) + GL11.glDrawElements(mode, (ShortBuffer) indices); + else if (indices instanceof ByteBuffer && type == GL10.GL_UNSIGNED_SHORT) + GL11.glDrawElements(mode, ((ByteBuffer) indices).asShortBuffer()); // FIXME yay... + else if (indices instanceof ByteBuffer && type == GL10.GL_UNSIGNED_BYTE) + GL11.glDrawElements(mode, (ByteBuffer) indices); + else + throw new GdxRuntimeException("Can't use " + indices.getClass().getName() + + " with this method. Use ShortBuffer or ByteBuffer instead. Blame LWJGL"); + } + + public void glEnable(int cap) { + GL11.glEnable(cap); + } + + public void glEnableVertexAttribArray(int index) { + GL20.glEnableVertexAttribArray(index); + } + + public void glFinish() { + GL11.glFinish(); + } + + public void glFlush() { + GL11.glFlush(); + } + + public void glFramebufferRenderbuffer(int target, int attachment, int renderbuffertarget, + int renderbuffer) { + EXTFramebufferObject.glFramebufferRenderbufferEXT(target, + attachment, + renderbuffertarget, + renderbuffer); + } + + public void glFramebufferTexture2D(int target, int attachment, int textarget, int texture, + int level) { + EXTFramebufferObject.glFramebufferTexture2DEXT(target, + attachment, + textarget, + texture, + level); + } + + public void glFrontFace(int mode) { + GL11.glFrontFace(mode); + } + + public void glGenBuffers(int n, IntBuffer buffers) { + GL15.glGenBuffers(buffers); + } + + public void glGenFramebuffers(int n, IntBuffer framebuffers) { + EXTFramebufferObject.glGenFramebuffersEXT(framebuffers); + } + + public void glGenRenderbuffers(int n, IntBuffer renderbuffers) { + EXTFramebufferObject.glGenRenderbuffersEXT(renderbuffers); + } + + public void glGenTextures(int n, IntBuffer textures) { + GL11.glGenTextures(textures); + } + + public void glGenerateMipmap(int target) { + EXTFramebufferObject.glGenerateMipmapEXT(target); + } + + public String glGetActiveAttrib(int program, int index, IntBuffer size, Buffer type) { + // FIXME this is less than ideal of course... + IntBuffer typeTmp = BufferUtils.createIntBuffer(2); + String name = GL20.glGetActiveAttrib(program, index, 256, typeTmp); + if (type instanceof IntBuffer) + ((IntBuffer) type).put(typeTmp.get(0)); + return name; + } + + public String glGetActiveUniform(int program, int index, IntBuffer size, Buffer type) { + // FIXME this is less than ideal of course... + IntBuffer typeTmp = BufferUtils.createIntBuffer(2); + String name = GL20.glGetActiveUniform(program, index, 256, typeTmp); + if (type instanceof IntBuffer) + ((IntBuffer) type).put(typeTmp.get(0)); + return name; + } + + public void glGetAttachedShaders(int program, int maxcount, Buffer count, IntBuffer shaders) { + GL20.glGetAttachedShaders(program, (IntBuffer) count, shaders); + } + + public int glGetAttribLocation(int program, String name) { + return GL20.glGetAttribLocation(program, name); + } + + public void glGetBooleanv(int pname, Buffer params) { + GL11.glGetBoolean(pname, (ByteBuffer) params); + } + + public void glGetBufferParameteriv(int target, int pname, IntBuffer params) { + GL15.glGetBufferParameter(target, pname, params); + } + + public int glGetError() { + return GL11.glGetError(); + } + + public void glGetFloatv(int pname, FloatBuffer params) { + GL11.glGetFloat(pname, params); + } + + public void glGetFramebufferAttachmentParameteriv(int target, int attachment, int pname, + IntBuffer params) { + EXTFramebufferObject.glGetFramebufferAttachmentParameterEXT(target, + attachment, + pname, + params); + } + + public void glGetIntegerv(int pname, IntBuffer params) { + GL11.glGetInteger(pname, params); + } + + public String glGetProgramInfoLog(int program) { + ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10); + buffer.order(ByteOrder.nativeOrder()); + ByteBuffer tmp = ByteBuffer.allocateDirect(4); + tmp.order(ByteOrder.nativeOrder()); + IntBuffer intBuffer = tmp.asIntBuffer(); + + GL20.glGetProgramInfoLog(program, intBuffer, buffer); + int numBytes = intBuffer.get(0); + byte[] bytes = new byte[numBytes]; + buffer.get(bytes); + return new String(bytes); + } + + public void glGetProgramiv(int program, int pname, IntBuffer params) { + GL20.glGetProgram(program, pname, params); + } + + public void glGetRenderbufferParameteriv(int target, int pname, IntBuffer params) { + EXTFramebufferObject.glGetRenderbufferParameterEXT(target, pname, params); + } + + public String glGetShaderInfoLog(int shader) { + ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10); + buffer.order(ByteOrder.nativeOrder()); + ByteBuffer tmp = ByteBuffer.allocateDirect(4); + tmp.order(ByteOrder.nativeOrder()); + IntBuffer intBuffer = tmp.asIntBuffer(); + + GL20.glGetShaderInfoLog(shader, intBuffer, buffer); + int numBytes = intBuffer.get(0); + byte[] bytes = new byte[numBytes]; + buffer.get(bytes); + return new String(bytes); + } + + public void glGetShaderPrecisionFormat(int shadertype, int precisiontype, IntBuffer range, + IntBuffer precision) { + throw new UnsupportedOperationException("unsupported, won't implement"); + } + + public void glGetShaderSource(int shader, int bufsize, Buffer length, String source) { + throw new UnsupportedOperationException("unsupported, won't implement."); + } + + public void glGetShaderiv(int shader, int pname, IntBuffer params) { + GL20.glGetShader(shader, pname, params); + } + + public String glGetString(int name) { + return GL11.glGetString(name); + } + + public void glGetTexParameterfv(int target, int pname, FloatBuffer params) { + GL11.glGetTexParameter(target, pname, params); + } + + public void glGetTexParameteriv(int target, int pname, IntBuffer params) { + GL11.glGetTexParameter(target, pname, params); + } + + public int glGetUniformLocation(int program, String name) { + return GL20.glGetUniformLocation(program, name); + } + + public void glGetUniformfv(int program, int location, FloatBuffer params) { + GL20.glGetUniform(program, location, params); + } + + public void glGetUniformiv(int program, int location, IntBuffer params) { + GL20.glGetUniform(program, location, params); + } + + public void glGetVertexAttribPointerv(int index, int pname, Buffer pointer) { + throw new UnsupportedOperationException("unsupported, won't implement"); + } + + public void glGetVertexAttribfv(int index, int pname, FloatBuffer params) { + GL20.glGetVertexAttrib(index, pname, params); + } + + public void glGetVertexAttribiv(int index, int pname, IntBuffer params) { + GL20.glGetVertexAttrib(index, pname, params); + } + + public void glHint(int target, int mode) { + GL11.glHint(target, mode); + } + + public boolean glIsBuffer(int buffer) { + return GL15.glIsBuffer(buffer); + } + + public boolean glIsEnabled(int cap) { + return GL11.glIsEnabled(cap); + } + + public boolean glIsFramebuffer(int framebuffer) { + return EXTFramebufferObject.glIsFramebufferEXT(framebuffer); + } + + public boolean glIsProgram(int program) { + return GL20.glIsProgram(program); + } + + public boolean glIsRenderbuffer(int renderbuffer) { + return EXTFramebufferObject.glIsRenderbufferEXT(renderbuffer); + } + + public boolean glIsShader(int shader) { + return GL20.glIsShader(shader); + } + + public boolean glIsTexture(int texture) { + return GL11.glIsTexture(texture); + } + + public void glLineWidth(float width) { + GL11.glLineWidth(width); + } + + public void glLinkProgram(int program) { + GL20.glLinkProgram(program); + } + + public void glPixelStorei(int pname, int param) { + GL11.glPixelStorei(pname, param); + } + + public void glPolygonOffset(float factor, float units) { + GL11.glPolygonOffset(factor, units); + } + + public void glReadPixels(int x, int y, int width, int height, int format, int type, + Buffer pixels) { + if (pixels instanceof ByteBuffer) + GL11.glReadPixels(x, y, width, height, format, type, (ByteBuffer) pixels); + else if (pixels instanceof ShortBuffer) + GL11.glReadPixels(x, y, width, height, format, type, (ShortBuffer) pixels); + else if (pixels instanceof IntBuffer) + GL11.glReadPixels(x, y, width, height, format, type, (IntBuffer) pixels); + else if (pixels instanceof FloatBuffer) + GL11.glReadPixels(x, y, width, height, format, type, (FloatBuffer) pixels); + else + throw new GdxRuntimeException("Can't use " + + pixels.getClass().getName() + + " with this method. Use ByteBuffer, ShortBuffer, IntBuffer or FloatBuffer instead. Blame LWJGL"); + } + + public void glReleaseShaderCompiler() { + // nothing to do here + } + + public void glRenderbufferStorage(int target, int internalformat, int width, int height) { + EXTFramebufferObject.glRenderbufferStorageEXT(target, internalformat, width, height); + } + + public void glSampleCoverage(float value, boolean invert) { + GL13.glSampleCoverage(value, invert); + } + + public void glScissor(int x, int y, int width, int height) { + GL11.glScissor(x, y, width, height); + } + + public void glShaderBinary(int n, IntBuffer shaders, int binaryformat, Buffer binary, int length) { + throw new UnsupportedOperationException("unsupported, won't implement"); + } + + public void glShaderSource(int shader, String string) { + GL20.glShaderSource(shader, string); + } + + public void glStencilFunc(int func, int ref, int mask) { + GL11.glStencilFunc(func, ref, mask); + } + + public void glStencilFuncSeparate(int face, int func, int ref, int mask) { + GL20.glStencilFuncSeparate(face, func, ref, mask); + } + + public void glStencilMask(int mask) { + GL11.glStencilMask(mask); + } + + public void glStencilMaskSeparate(int face, int mask) { + GL20.glStencilMaskSeparate(face, mask); + } + + public void glStencilOp(int fail, int zfail, int zpass) { + GL11.glStencilOp(fail, zfail, zpass); + } + + public void glStencilOpSeparate(int face, int fail, int zfail, int zpass) { + GL20.glStencilOpSeparate(face, fail, zfail, zpass); + } + + public void glTexImage2D(int target, int level, int internalformat, int width, int height, + int border, int format, int type, + Buffer pixels) { + if (pixels == null) + GL11.glTexImage2D(target, + level, + internalformat, + width, + height, + border, + format, + type, + (ByteBuffer) null); + else if (pixels instanceof ByteBuffer) + GL11.glTexImage2D(target, + level, + internalformat, + width, + height, + border, + format, + type, + (ByteBuffer) pixels); + else if (pixels instanceof ShortBuffer) + GL11.glTexImage2D(target, + level, + internalformat, + width, + height, + border, + format, + type, + (ShortBuffer) pixels); + else if (pixels instanceof IntBuffer) + GL11.glTexImage2D(target, + level, + internalformat, + width, + height, + border, + format, + type, + (IntBuffer) pixels); + else if (pixels instanceof FloatBuffer) + GL11.glTexImage2D(target, + level, + internalformat, + width, + height, + border, + format, + type, + (FloatBuffer) pixels); + else if (pixels instanceof DoubleBuffer) + GL11.glTexImage2D(target, + level, + internalformat, + width, + height, + border, + format, + type, + (DoubleBuffer) pixels); + else + throw new GdxRuntimeException("Can't use " + + pixels.getClass().getName() + + " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL"); + } + + public void glTexParameterf(int target, int pname, float param) { + GL11.glTexParameterf(target, pname, param); + } + + public void glTexParameterfv(int target, int pname, FloatBuffer params) { + GL11.glTexParameter(target, pname, params); + } + + public void glTexParameteri(int target, int pname, int param) { + GL11.glTexParameteri(target, pname, param); + } + + public void glTexParameteriv(int target, int pname, IntBuffer params) { + GL11.glTexParameter(target, pname, params); + } + + public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, + int height, int format, int type, + Buffer pixels) { + if (pixels instanceof ByteBuffer) + GL11.glTexSubImage2D(target, + level, + xoffset, + yoffset, + width, + height, + format, + type, + (ByteBuffer) pixels); + else if (pixels instanceof ShortBuffer) + GL11.glTexSubImage2D(target, + level, + xoffset, + yoffset, + width, + height, + format, + type, + (ShortBuffer) pixels); + else if (pixels instanceof IntBuffer) + GL11.glTexSubImage2D(target, + level, + xoffset, + yoffset, + width, + height, + format, + type, + (IntBuffer) pixels); + else if (pixels instanceof FloatBuffer) + GL11.glTexSubImage2D(target, + level, + xoffset, + yoffset, + width, + height, + format, + type, + (FloatBuffer) pixels); + else if (pixels instanceof DoubleBuffer) + GL11.glTexSubImage2D(target, + level, + xoffset, + yoffset, + width, + height, + format, + type, + (DoubleBuffer) pixels); + else + throw new GdxRuntimeException("Can't use " + + pixels.getClass().getName() + + " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL"); + } + + public void glUniform1f(int location, float x) { + GL20.glUniform1f(location, x); + } + + public void glUniform1fv(int location, int count, FloatBuffer v) { + GL20.glUniform1(location, v); + } + + public void glUniform1i(int location, int x) { + GL20.glUniform1i(location, x); + } + + public void glUniform1iv(int location, int count, IntBuffer v) { + GL20.glUniform1(location, v); + } + + public void glUniform2f(int location, float x, float y) { + GL20.glUniform2f(location, x, y); + } + + public void glUniform2fv(int location, int count, FloatBuffer v) { + GL20.glUniform2(location, v); + } + + public void glUniform2i(int location, int x, int y) { + GL20.glUniform2i(location, x, y); + } + + public void glUniform2iv(int location, int count, IntBuffer v) { + GL20.glUniform2(location, v); + } + + public void glUniform3f(int location, float x, float y, float z) { + GL20.glUniform3f(location, x, y, z); + } + + public void glUniform3fv(int location, int count, FloatBuffer v) { + GL20.glUniform3(location, v); + } + + public void glUniform3i(int location, int x, int y, int z) { + GL20.glUniform3i(location, x, y, z); + } + + public void glUniform3iv(int location, int count, IntBuffer v) { + GL20.glUniform3(location, v); + } + + public void glUniform4f(int location, float x, float y, float z, float w) { + GL20.glUniform4f(location, x, y, z, w); + } + + public void glUniform4fv(int location, int count, FloatBuffer v) { + GL20.glUniform4(location, v); + } + + public void glUniform4i(int location, int x, int y, int z, int w) { + GL20.glUniform4i(location, x, y, z, w); + } + + public void glUniform4iv(int location, int count, IntBuffer v) { + GL20.glUniform4(location, v); + } + + public void glUniformMatrix2fv(int location, int count, boolean transpose, FloatBuffer value) { + GL20.glUniformMatrix2(location, transpose, value); + } + + public void glUniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value) { + GL20.glUniformMatrix3(location, transpose, value); + } + + public void glUniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value) { + GL20.glUniformMatrix4(location, transpose, value); + } + + public void glUseProgram(int program) { + GL20.glUseProgram(program); + } + + public void glValidateProgram(int program) { + GL20.glValidateProgram(program); + } + + public void glVertexAttrib1f(int indx, float x) { + GL20.glVertexAttrib1f(indx, x); + } + + public void glVertexAttrib1fv(int indx, FloatBuffer values) { + GL20.glVertexAttrib1f(indx, values.get()); + } + + public void glVertexAttrib2f(int indx, float x, float y) { + GL20.glVertexAttrib2f(indx, x, y); + } + + public void glVertexAttrib2fv(int indx, FloatBuffer values) { + GL20.glVertexAttrib2f(indx, values.get(), values.get()); + } + + public void glVertexAttrib3f(int indx, float x, float y, float z) { + GL20.glVertexAttrib3f(indx, x, y, z); + } + + public void glVertexAttrib3fv(int indx, FloatBuffer values) { + GL20.glVertexAttrib3f(indx, values.get(), values.get(), values.get()); + } + + public void glVertexAttrib4f(int indx, float x, float y, float z, float w) { + GL20.glVertexAttrib4f(indx, x, y, z, w); + } + + public void glVertexAttrib4fv(int indx, FloatBuffer values) { + GL20.glVertexAttrib4f(indx, values.get(), values.get(), values.get(), values.get()); + } + + public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, + Buffer buffer) { + if (buffer instanceof ByteBuffer) { + if (type == GL_BYTE) + GL20.glVertexAttribPointer(indx, + size, + false, + normalized, + stride, + (ByteBuffer) buffer); + else if (type == GL_UNSIGNED_BYTE) + GL20.glVertexAttribPointer(indx, + size, + true, + normalized, + stride, + (ByteBuffer) buffer); + else if (type == GL_SHORT) + GL20.glVertexAttribPointer(indx, + size, + false, + normalized, + stride, + ((ByteBuffer) buffer).asShortBuffer()); + else if (type == GL_UNSIGNED_SHORT) + GL20.glVertexAttribPointer(indx, + size, + true, + normalized, + stride, + ((ByteBuffer) buffer).asShortBuffer()); + else if (type == GL_FLOAT) + GL20.glVertexAttribPointer(indx, + size, + normalized, + stride, + ((ByteBuffer) buffer).asFloatBuffer()); + else + throw new GdxRuntimeException("Can't use " + + buffer.getClass().getName() + + " with type " + + type + + " with this method. Use ByteBuffer and one of GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT or GL_FLOAT for type. Blame LWJGL"); + } else + throw new GdxRuntimeException("Can't use " + buffer.getClass().getName() + + " with this method. Use ByteBuffer instead. Blame LWJGL"); + } + + public void glViewport(int x, int y, int width, int height) { + GL11.glViewport(x, y, width, height); + } + + public void glDrawElements(int mode, int count, int type, int indices) { + GL11.glDrawElements(mode, count, type, indices); + } + + public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, + int ptr) { + GL20.glVertexAttribPointer(indx, size, type, normalized, stride, ptr); + } + +} diff --git a/vtm-gdx-desktop/src/org/oscim/gdx/GdxGLAdapter.java b/vtm-gdx-desktop/src/org/oscim/gdx/GdxGLAdapter.java deleted file mode 100644 index ed024ede..00000000 --- a/vtm-gdx-desktop/src/org/oscim/gdx/GdxGLAdapter.java +++ /dev/null @@ -1,742 +0,0 @@ -/******************************************************************************* - * Copyright 2011 See AUTHORS file. - * - * 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. - ******************************************************************************/ - -package org.oscim.gdx; - -import java.nio.Buffer; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.DoubleBuffer; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; -import java.nio.ShortBuffer; - -import org.lwjgl.BufferUtils; -import org.lwjgl.opengl.EXTFramebufferObject; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL13; -import org.lwjgl.opengl.GL14; -import org.lwjgl.opengl.GL15; -import org.lwjgl.opengl.GL20; - -import com.badlogic.gdx.graphics.GL10; -import com.badlogic.gdx.utils.GdxRuntimeException; - -/** An implementation of the {@link GL20} interface based on LWJGL. Note that LWJGL shaders and OpenGL ES shaders will not be 100% - * compatible. Some glGetXXX methods are not implemented. - * - * @author mzechner */ -public final class GdxGLAdapter implements org.oscim.backend.GL20 { - public void glActiveTexture (int texture) { - GL13.glActiveTexture(texture); - } - - public void glAttachShader (int program, int shader) { - GL20.glAttachShader(program, shader); - } - - public void glBindAttribLocation (int program, int index, String name) { - GL20.glBindAttribLocation(program, index, name); - } - - public void glBindBuffer (int target, int buffer) { - GL15.glBindBuffer(target, buffer); - } - - public void glBindFramebuffer (int target, int framebuffer) { - EXTFramebufferObject.glBindFramebufferEXT(target, framebuffer); - } - - public void glBindRenderbuffer (int target, int renderbuffer) { - EXTFramebufferObject.glBindRenderbufferEXT(target, renderbuffer); - } - - public void glBindTexture (int target, int texture) { - GL11.glBindTexture(target, texture); - } - - public void glBlendColor (float red, float green, float blue, float alpha) { - GL14.glBlendColor(red, green, blue, alpha); - } - - public void glBlendEquation (int mode) { - GL14.glBlendEquation(mode); - } - - public void glBlendEquationSeparate (int modeRGB, int modeAlpha) { - GL20.glBlendEquationSeparate(modeRGB, modeAlpha); - } - - public void glBlendFunc (int sfactor, int dfactor) { - GL11.glBlendFunc(sfactor, dfactor); - } - - public void glBlendFuncSeparate (int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) { - GL14.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); - } - - public void glBufferData (int target, int size, Buffer data, int usage) { - if(data == null) - throw new GdxRuntimeException("Using null for the data not possible, blame LWJGL"); - else if (data instanceof ByteBuffer) - GL15.glBufferData(target, (ByteBuffer)data, usage); - else if (data instanceof IntBuffer) - GL15.glBufferData(target, (IntBuffer)data, usage); - else if (data instanceof FloatBuffer) - GL15.glBufferData(target, (FloatBuffer)data, usage); - else if (data instanceof DoubleBuffer) - GL15.glBufferData(target, (DoubleBuffer)data, usage); - else if (data instanceof ShortBuffer) // - GL15.glBufferData(target, (ShortBuffer)data, usage); - } - - public void glBufferSubData (int target, int offset, int size, Buffer data) { - if(data == null) - throw new GdxRuntimeException("Using null for the data not possible, blame LWJGL"); - else if (data instanceof ByteBuffer) - GL15.glBufferSubData(target, offset, (ByteBuffer)data); - else if (data instanceof IntBuffer) - GL15.glBufferSubData(target, offset, (IntBuffer)data); - else if (data instanceof FloatBuffer) - GL15.glBufferSubData(target, offset, (FloatBuffer)data); - else if (data instanceof DoubleBuffer) - GL15.glBufferSubData(target, offset, (DoubleBuffer)data); - else if (data instanceof ShortBuffer) // - GL15.glBufferSubData(target, offset, (ShortBuffer)data); - } - - public int glCheckFramebufferStatus (int target) { - return EXTFramebufferObject.glCheckFramebufferStatusEXT(target); - } - - public void glClear (int mask) { - GL11.glClear(mask); - } - - public void glClearColor (float red, float green, float blue, float alpha) { - GL11.glClearColor(red, green, blue, alpha); - } - - public void glClearDepthf (float depth) { - GL11.glClearDepth(depth); - } - - public void glClearStencil (int s) { - GL11.glClearStencil(s); - } - - public void glColorMask (boolean red, boolean green, boolean blue, boolean alpha) { - GL11.glColorMask(red, green, blue, alpha); - } - - public void glCompileShader (int shader) { - GL20.glCompileShader(shader); - } - - public void glCompressedTexImage2D (int target, int level, int internalformat, int width, int height, int border, - int imageSize, Buffer data) { - if (data instanceof ByteBuffer) { - GL13.glCompressedTexImage2D(target, level, internalformat, width, height, border, (ByteBuffer)data); - } else { - throw new GdxRuntimeException("Can't use " + data.getClass().getName() - + " with this method. Use ByteBuffer instead."); - } - } - - public void glCompressedTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, - int imageSize, Buffer data) { - throw new GdxRuntimeException("not implemented"); - } - - public void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) { - GL11.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); - } - - public void glCopyTexSubImage2D (int target, int level, int xoffset, int yoffset, int x, int y, int width, int height) { - GL11.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); - } - - public int glCreateProgram () { - return GL20.glCreateProgram(); - } - - public int glCreateShader (int type) { - return GL20.glCreateShader(type); - } - - public void glCullFace (int mode) { - GL11.glCullFace(mode); - } - - public void glDeleteBuffers (int n, IntBuffer buffers) { - GL15.glDeleteBuffers(buffers); - } - - public void glDeleteFramebuffers (int n, IntBuffer framebuffers) { - EXTFramebufferObject.glDeleteFramebuffersEXT(framebuffers); - } - - public void glDeleteProgram (int program) { - GL20.glDeleteProgram(program); - } - - public void glDeleteRenderbuffers (int n, IntBuffer renderbuffers) { - EXTFramebufferObject.glDeleteRenderbuffersEXT(renderbuffers); - } - - public void glDeleteShader (int shader) { - GL20.glDeleteShader(shader); - } - - public void glDeleteTextures (int n, IntBuffer textures) { - GL11.glDeleteTextures(textures); - } - - public void glDepthFunc (int func) { - GL11.glDepthFunc(func); - } - - public void glDepthMask (boolean flag) { - GL11.glDepthMask(flag); - } - - public void glDepthRangef (float zNear, float zFar) { - GL11.glDepthRange(zNear, zFar); - } - - public void glDetachShader (int program, int shader) { - GL20.glDetachShader(program, shader); - } - - public void glDisable (int cap) { - GL11.glDisable(cap); - } - - public void glDisableVertexAttribArray (int index) { - GL20.glDisableVertexAttribArray(index); - } - - public void glDrawArrays (int mode, int first, int count) { - GL11.glDrawArrays(mode, first, count); - } - - public void glDrawElements (int mode, int count, int type, Buffer indices) { - if (indices instanceof ShortBuffer && type == GL10.GL_UNSIGNED_SHORT) - GL11.glDrawElements(mode, (ShortBuffer)indices); - else if (indices instanceof ByteBuffer && type == GL10.GL_UNSIGNED_SHORT) - GL11.glDrawElements(mode, ((ByteBuffer)indices).asShortBuffer()); // FIXME yay... - else if (indices instanceof ByteBuffer && type == GL10.GL_UNSIGNED_BYTE) - GL11.glDrawElements(mode, (ByteBuffer)indices); - else - throw new GdxRuntimeException("Can't use " + indices.getClass().getName() - + " with this method. Use ShortBuffer or ByteBuffer instead. Blame LWJGL"); - } - - public void glEnable (int cap) { - GL11.glEnable(cap); - } - - public void glEnableVertexAttribArray (int index) { - GL20.glEnableVertexAttribArray(index); - } - - public void glFinish () { - GL11.glFinish(); - } - - public void glFlush () { - GL11.glFlush(); - } - - public void glFramebufferRenderbuffer (int target, int attachment, int renderbuffertarget, int renderbuffer) { - EXTFramebufferObject.glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer); - } - - public void glFramebufferTexture2D (int target, int attachment, int textarget, int texture, int level) { - EXTFramebufferObject.glFramebufferTexture2DEXT(target, attachment, textarget, texture, level); - } - - public void glFrontFace (int mode) { - GL11.glFrontFace(mode); - } - - public void glGenBuffers (int n, IntBuffer buffers) { - GL15.glGenBuffers(buffers); - } - - public void glGenFramebuffers (int n, IntBuffer framebuffers) { - EXTFramebufferObject.glGenFramebuffersEXT(framebuffers); - } - - public void glGenRenderbuffers (int n, IntBuffer renderbuffers) { - EXTFramebufferObject.glGenRenderbuffersEXT(renderbuffers); - } - - public void glGenTextures (int n, IntBuffer textures) { - GL11.glGenTextures(textures); - } - - public void glGenerateMipmap (int target) { - EXTFramebufferObject.glGenerateMipmapEXT(target); - } - - public String glGetActiveAttrib (int program, int index, IntBuffer size, Buffer type) { - // FIXME this is less than ideal of course... - IntBuffer typeTmp = BufferUtils.createIntBuffer(2); - String name = GL20.glGetActiveAttrib(program, index, 256, typeTmp); - if (type instanceof IntBuffer) ((IntBuffer)type).put(typeTmp.get(0)); - return name; - } - - public String glGetActiveUniform (int program, int index, IntBuffer size, Buffer type) { - // FIXME this is less than ideal of course... - IntBuffer typeTmp = BufferUtils.createIntBuffer(2); - String name = GL20.glGetActiveUniform(program, index, 256, typeTmp); - if (type instanceof IntBuffer) ((IntBuffer)type).put(typeTmp.get(0)); - return name; - } - - public void glGetAttachedShaders (int program, int maxcount, Buffer count, IntBuffer shaders) { - GL20.glGetAttachedShaders(program, (IntBuffer)count, shaders); - } - - public int glGetAttribLocation (int program, String name) { - return GL20.glGetAttribLocation(program, name); - } - - public void glGetBooleanv (int pname, Buffer params) { - GL11.glGetBoolean(pname, (ByteBuffer)params); - } - - public void glGetBufferParameteriv (int target, int pname, IntBuffer params) { - GL15.glGetBufferParameter(target, pname, params); - } - - public int glGetError () { - return GL11.glGetError(); - } - - public void glGetFloatv (int pname, FloatBuffer params) { - GL11.glGetFloat(pname, params); - } - - public void glGetFramebufferAttachmentParameteriv (int target, int attachment, int pname, IntBuffer params) { - EXTFramebufferObject.glGetFramebufferAttachmentParameterEXT(target, attachment, pname, params); - } - - public void glGetIntegerv (int pname, IntBuffer params) { - GL11.glGetInteger(pname, params); - } - - public String glGetProgramInfoLog (int program) { - ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10); - buffer.order(ByteOrder.nativeOrder()); - ByteBuffer tmp = ByteBuffer.allocateDirect(4); - tmp.order(ByteOrder.nativeOrder()); - IntBuffer intBuffer = tmp.asIntBuffer(); - - GL20.glGetProgramInfoLog(program, intBuffer, buffer); - int numBytes = intBuffer.get(0); - byte[] bytes = new byte[numBytes]; - buffer.get(bytes); - return new String(bytes); - } - - public void glGetProgramiv (int program, int pname, IntBuffer params) { - GL20.glGetProgram(program, pname, params); - } - - public void glGetRenderbufferParameteriv (int target, int pname, IntBuffer params) { - EXTFramebufferObject.glGetRenderbufferParameterEXT(target, pname, params); - } - - public String glGetShaderInfoLog (int shader) { - ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10); - buffer.order(ByteOrder.nativeOrder()); - ByteBuffer tmp = ByteBuffer.allocateDirect(4); - tmp.order(ByteOrder.nativeOrder()); - IntBuffer intBuffer = tmp.asIntBuffer(); - - GL20.glGetShaderInfoLog(shader, intBuffer, buffer); - int numBytes = intBuffer.get(0); - byte[] bytes = new byte[numBytes]; - buffer.get(bytes); - return new String(bytes); - } - - public void glGetShaderPrecisionFormat (int shadertype, int precisiontype, IntBuffer range, IntBuffer precision) { - throw new UnsupportedOperationException("unsupported, won't implement"); - } - - public void glGetShaderSource (int shader, int bufsize, Buffer length, String source) { - throw new UnsupportedOperationException("unsupported, won't implement."); - } - - public void glGetShaderiv (int shader, int pname, IntBuffer params) { - GL20.glGetShader(shader, pname, params); - } - - public String glGetString (int name) { - return GL11.glGetString(name); - } - - public void glGetTexParameterfv (int target, int pname, FloatBuffer params) { - GL11.glGetTexParameter(target, pname, params); - } - - public void glGetTexParameteriv (int target, int pname, IntBuffer params) { - GL11.glGetTexParameter(target, pname, params); - } - - public int glGetUniformLocation (int program, String name) { - return GL20.glGetUniformLocation(program, name); - } - - public void glGetUniformfv (int program, int location, FloatBuffer params) { - GL20.glGetUniform(program, location, params); - } - - public void glGetUniformiv (int program, int location, IntBuffer params) { - GL20.glGetUniform(program, location, params); - } - - public void glGetVertexAttribPointerv (int index, int pname, Buffer pointer) { - throw new UnsupportedOperationException("unsupported, won't implement"); - } - - public void glGetVertexAttribfv (int index, int pname, FloatBuffer params) { - GL20.glGetVertexAttrib(index, pname, params); - } - - public void glGetVertexAttribiv (int index, int pname, IntBuffer params) { - GL20.glGetVertexAttrib(index, pname, params); - } - - public void glHint (int target, int mode) { - GL11.glHint(target, mode); - } - - public boolean glIsBuffer (int buffer) { - return GL15.glIsBuffer(buffer); - } - - public boolean glIsEnabled (int cap) { - return GL11.glIsEnabled(cap); - } - - public boolean glIsFramebuffer (int framebuffer) { - return EXTFramebufferObject.glIsFramebufferEXT(framebuffer); - } - - public boolean glIsProgram (int program) { - return GL20.glIsProgram(program); - } - - public boolean glIsRenderbuffer (int renderbuffer) { - return EXTFramebufferObject.glIsRenderbufferEXT(renderbuffer); - } - - public boolean glIsShader (int shader) { - return GL20.glIsShader(shader); - } - - public boolean glIsTexture (int texture) { - return GL11.glIsTexture(texture); - } - - public void glLineWidth (float width) { - GL11.glLineWidth(width); - } - - public void glLinkProgram (int program) { - GL20.glLinkProgram(program); - } - - public void glPixelStorei (int pname, int param) { - GL11.glPixelStorei(pname, param); - } - - public void glPolygonOffset (float factor, float units) { - GL11.glPolygonOffset(factor, units); - } - - public void glReadPixels (int x, int y, int width, int height, int format, int type, Buffer pixels) { - if (pixels instanceof ByteBuffer) - GL11.glReadPixels(x, y, width, height, format, type, (ByteBuffer)pixels); - else if (pixels instanceof ShortBuffer) - GL11.glReadPixels(x, y, width, height, format, type, (ShortBuffer)pixels); - else if (pixels instanceof IntBuffer) - GL11.glReadPixels(x, y, width, height, format, type, (IntBuffer)pixels); - else if (pixels instanceof FloatBuffer) - GL11.glReadPixels(x, y, width, height, format, type, (FloatBuffer)pixels); - else - throw new GdxRuntimeException("Can't use " + pixels.getClass().getName() - + " with this method. Use ByteBuffer, ShortBuffer, IntBuffer or FloatBuffer instead. Blame LWJGL"); - } - - public void glReleaseShaderCompiler () { - // nothing to do here - } - - public void glRenderbufferStorage (int target, int internalformat, int width, int height) { - EXTFramebufferObject.glRenderbufferStorageEXT(target, internalformat, width, height); - } - - public void glSampleCoverage (float value, boolean invert) { - GL13.glSampleCoverage(value, invert); - } - - public void glScissor (int x, int y, int width, int height) { - GL11.glScissor(x, y, width, height); - } - - public void glShaderBinary (int n, IntBuffer shaders, int binaryformat, Buffer binary, int length) { - throw new UnsupportedOperationException("unsupported, won't implement"); - } - - public void glShaderSource (int shader, String string) { - GL20.glShaderSource(shader, string); - } - - public void glStencilFunc (int func, int ref, int mask) { - GL11.glStencilFunc(func, ref, mask); - } - - public void glStencilFuncSeparate (int face, int func, int ref, int mask) { - GL20.glStencilFuncSeparate(face, func, ref, mask); - } - - public void glStencilMask (int mask) { - GL11.glStencilMask(mask); - } - - public void glStencilMaskSeparate (int face, int mask) { - GL20.glStencilMaskSeparate(face, mask); - } - - public void glStencilOp (int fail, int zfail, int zpass) { - GL11.glStencilOp(fail, zfail, zpass); - } - - public void glStencilOpSeparate (int face, int fail, int zfail, int zpass) { - GL20.glStencilOpSeparate(face, fail, zfail, zpass); - } - - public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, - Buffer pixels) { - if (pixels == null) - GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ByteBuffer)null); - else if (pixels instanceof ByteBuffer) - GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ByteBuffer)pixels); - else if (pixels instanceof ShortBuffer) - GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ShortBuffer)pixels); - else if (pixels instanceof IntBuffer) - GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (IntBuffer)pixels); - else if (pixels instanceof FloatBuffer) - GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (FloatBuffer)pixels); - else if (pixels instanceof DoubleBuffer) - GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (DoubleBuffer)pixels); - else - throw new GdxRuntimeException("Can't use " + pixels.getClass().getName() - + " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL"); - } - - public void glTexParameterf (int target, int pname, float param) { - GL11.glTexParameterf(target, pname, param); - } - - public void glTexParameterfv (int target, int pname, FloatBuffer params) { - GL11.glTexParameter(target, pname, params); - } - - public void glTexParameteri (int target, int pname, int param) { - GL11.glTexParameteri(target, pname, param); - } - - public void glTexParameteriv (int target, int pname, IntBuffer params) { - GL11.glTexParameter(target, pname, params); - } - - public void glTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, - Buffer pixels) { - if (pixels instanceof ByteBuffer) - GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (ByteBuffer)pixels); - else if (pixels instanceof ShortBuffer) - GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (ShortBuffer)pixels); - else if (pixels instanceof IntBuffer) - GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (IntBuffer)pixels); - else if (pixels instanceof FloatBuffer) - GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (FloatBuffer)pixels); - else if (pixels instanceof DoubleBuffer) - GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (DoubleBuffer)pixels); - else - throw new GdxRuntimeException("Can't use " + pixels.getClass().getName() - + " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL"); - } - - public void glUniform1f (int location, float x) { - GL20.glUniform1f(location, x); - } - - public void glUniform1fv (int location, int count, FloatBuffer v) { - GL20.glUniform1(location, v); - } - - public void glUniform1i (int location, int x) { - GL20.glUniform1i(location, x); - } - - public void glUniform1iv (int location, int count, IntBuffer v) { - GL20.glUniform1(location, v); - } - - public void glUniform2f (int location, float x, float y) { - GL20.glUniform2f(location, x, y); - } - - public void glUniform2fv (int location, int count, FloatBuffer v) { - GL20.glUniform2(location, v); - } - - public void glUniform2i (int location, int x, int y) { - GL20.glUniform2i(location, x, y); - } - - public void glUniform2iv (int location, int count, IntBuffer v) { - GL20.glUniform2(location, v); - } - - public void glUniform3f (int location, float x, float y, float z) { - GL20.glUniform3f(location, x, y, z); - } - - public void glUniform3fv (int location, int count, FloatBuffer v) { - GL20.glUniform3(location, v); - } - - public void glUniform3i (int location, int x, int y, int z) { - GL20.glUniform3i(location, x, y, z); - } - - public void glUniform3iv (int location, int count, IntBuffer v) { - GL20.glUniform3(location, v); - } - - public void glUniform4f (int location, float x, float y, float z, float w) { - GL20.glUniform4f(location, x, y, z, w); - } - - public void glUniform4fv (int location, int count, FloatBuffer v) { - GL20.glUniform4(location, v); - } - - public void glUniform4i (int location, int x, int y, int z, int w) { - GL20.glUniform4i(location, x, y, z, w); - } - - public void glUniform4iv (int location, int count, IntBuffer v) { - GL20.glUniform4(location, v); - } - - public void glUniformMatrix2fv (int location, int count, boolean transpose, FloatBuffer value) { - GL20.glUniformMatrix2(location, transpose, value); - } - - public void glUniformMatrix3fv (int location, int count, boolean transpose, FloatBuffer value) { - GL20.glUniformMatrix3(location, transpose, value); - } - - public void glUniformMatrix4fv (int location, int count, boolean transpose, FloatBuffer value) { - GL20.glUniformMatrix4(location, transpose, value); - } - - public void glUseProgram (int program) { - GL20.glUseProgram(program); - } - - public void glValidateProgram (int program) { - GL20.glValidateProgram(program); - } - - public void glVertexAttrib1f (int indx, float x) { - GL20.glVertexAttrib1f(indx, x); - } - - public void glVertexAttrib1fv (int indx, FloatBuffer values) { - GL20.glVertexAttrib1f(indx, values.get()); - } - - public void glVertexAttrib2f (int indx, float x, float y) { - GL20.glVertexAttrib2f(indx, x, y); - } - - public void glVertexAttrib2fv (int indx, FloatBuffer values) { - GL20.glVertexAttrib2f(indx, values.get(), values.get()); - } - - public void glVertexAttrib3f (int indx, float x, float y, float z) { - GL20.glVertexAttrib3f(indx, x, y, z); - } - - public void glVertexAttrib3fv (int indx, FloatBuffer values) { - GL20.glVertexAttrib3f(indx, values.get(), values.get(), values.get()); - } - - public void glVertexAttrib4f (int indx, float x, float y, float z, float w) { - GL20.glVertexAttrib4f(indx, x, y, z, w); - } - - public void glVertexAttrib4fv (int indx, FloatBuffer values) { - GL20.glVertexAttrib4f(indx, values.get(), values.get(), values.get(), values.get()); - } - - public void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, Buffer buffer) { - if (buffer instanceof ByteBuffer) { - if (type == GL_BYTE) - GL20.glVertexAttribPointer(indx, size, false, normalized, stride, (ByteBuffer)buffer); - else if (type == GL_UNSIGNED_BYTE) - GL20.glVertexAttribPointer(indx, size, true, normalized, stride, (ByteBuffer)buffer); - else if (type == GL_SHORT) - GL20.glVertexAttribPointer(indx, size, false, normalized, stride, ((ByteBuffer)buffer).asShortBuffer()); - else if (type == GL_UNSIGNED_SHORT) - GL20.glVertexAttribPointer(indx, size, true, normalized, stride, ((ByteBuffer)buffer).asShortBuffer()); - else if (type == GL_FLOAT) - GL20.glVertexAttribPointer(indx, size, normalized, stride, ((ByteBuffer)buffer).asFloatBuffer()); - else - throw new GdxRuntimeException( - "Can't use " - + buffer.getClass().getName() - + " with type " - + type - + " with this method. Use ByteBuffer and one of GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT or GL_FLOAT for type. Blame LWJGL"); - } else - throw new GdxRuntimeException("Can't use " + buffer.getClass().getName() - + " with this method. Use ByteBuffer instead. Blame LWJGL"); - } - - public void glViewport (int x, int y, int width, int height) { - GL11.glViewport(x, y, width, height); - } - - public void glDrawElements (int mode, int count, int type, int indices) { - GL11.glDrawElements(mode, count, type, indices); - } - - public void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, int ptr) { - GL20.glVertexAttribPointer(indx, size, type, normalized, stride, ptr); - } - -} diff --git a/vtm-gdx-desktop/src/org/oscim/gdx/GdxMapApp.java b/vtm-gdx-desktop/src/org/oscim/gdx/GdxMapApp.java index 2ef7b145..758f4062 100644 --- a/vtm-gdx-desktop/src/org/oscim/gdx/GdxMapApp.java +++ b/vtm-gdx-desktop/src/org/oscim/gdx/GdxMapApp.java @@ -18,7 +18,7 @@ public class GdxMapApp extends GdxMap { // set our globals new SharedLibraryLoader().load("vtm-jni"); CanvasAdapter.g = AwtGraphics.INSTANCE; - GLAdapter.g = new GdxGLAdapter(); + GLAdapter.g = new GdxGL20(); GLAdapter.GDX_DESKTOP_QUIRKS = true; } diff --git a/vtm-gdx-html/src/org/oscim/gdx/client/GwtBitmap.java b/vtm-gdx-html/src/org/oscim/gdx/client/GwtBitmap.java index c4fd57cf..29568219 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/client/GwtBitmap.java +++ b/vtm-gdx-html/src/org/oscim/gdx/client/GwtBitmap.java @@ -15,6 +15,7 @@ public class GwtBitmap implements Bitmap { Pixmap pixmap; Image image; boolean disposable; + public GwtBitmap(Image data) { ImageElement imageElement = ImageElement.as(data.getElement()); pixmap = new Pixmap(imageElement); @@ -60,12 +61,11 @@ public class GwtBitmap implements Bitmap { public int uploadToTexture(boolean replace) { Gdx.gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, pixmap.getGLInternalFormat(), pixmap.getWidth(), - pixmap.getHeight(), 0, - pixmap.getGLFormat(), pixmap.getGLType(), pixmap.getPixels()); + pixmap.getHeight(), 0, + pixmap.getGLFormat(), pixmap.getGLType(), pixmap.getPixels()); - - if (disposable || image != null){ - Log.d("", "dispose pixmap " +getWidth() +"/" + getHeight()); + if (disposable || image != null) { + Log.d("", "dispose pixmap " + getWidth() + "/" + getHeight()); pixmap.dispose(); if (image != null) diff --git a/vtm-gdx-html/src/org/oscim/gdx/client/GwtGdxMap.java b/vtm-gdx-html/src/org/oscim/gdx/client/GwtGdxMap.java index 0adf3f0a..f8dddafb 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/client/GwtGdxMap.java +++ b/vtm-gdx-html/src/org/oscim/gdx/client/GwtGdxMap.java @@ -119,7 +119,7 @@ class GwtGdxMap extends GdxMap { //rot = rot < 0 ? -rot : rot; if (curZoom != pos.zoomLevel || curLat != lat || curLon != lon - || curTilt != rot || curRot != (int) (pos.angle)) { + || curTilt != rot || curRot != (int) (pos.angle)) { curLat = lat; curLon = lon; @@ -128,11 +128,11 @@ class GwtGdxMap extends GdxMap { curRot = rot; String newURL = Window.Location - .createUrlBuilder() - .setHash("scale=" + pos.zoomLevel + ",rot=" + curRot - + ",tilt=" + curTilt + ",lat=" + (curLat / 1000f) - + ",lon=" + (curLon / 1000f)) - .buildString(); + .createUrlBuilder() + .setHash("scale=" + pos.zoomLevel + ",rot=" + curRot + + ",tilt=" + curTilt + ",lat=" + (curLat / 1000f) + + ",lon=" + (curLon / 1000f)) + .buildString(); Window.Location.replace(newURL); } } diff --git a/vtm-gdx-html/src/org/oscim/gdx/client/GwtLauncher.java b/vtm-gdx-html/src/org/oscim/gdx/client/GwtLauncher.java index c4f3c2c5..7fb3876c 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/client/GwtLauncher.java +++ b/vtm-gdx-html/src/org/oscim/gdx/client/GwtLauncher.java @@ -19,9 +19,9 @@ public class GwtLauncher extends GwtApplication { @Override public GwtApplicationConfiguration getConfig() { - GwtApplicationConfiguration cfg = new GwtApplicationConfiguration( - GwtGraphics.getWindowWidthJSNI(), - GwtGraphics.getWindowHeightJSNI()); + GwtApplicationConfiguration cfg = + new GwtApplicationConfiguration(GwtGraphics.getWindowWidthJSNI(), + GwtGraphics.getWindowHeightJSNI()); DockLayoutPanel p = new DockLayoutPanel(Unit.EM); p.setHeight("100%"); diff --git a/vtm-gdx-html/src/org/oscim/gdx/client/GwtPaint.java b/vtm-gdx-html/src/org/oscim/gdx/client/GwtPaint.java index bad031fb..8253c83f 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/client/GwtPaint.java +++ b/vtm-gdx-html/src/org/oscim/gdx/client/GwtPaint.java @@ -47,7 +47,7 @@ public class GwtPaint implements Paint { float a = ((color >>> 24) & 0xff) / 255f; int r = (color >>> 16) & 0xff; int g = (color >>> 8) & 0xff; - int b = (color & 0xff) ; + int b = (color & 0xff); this.color = Pixmap.make(r, g, b, a); } @@ -105,7 +105,7 @@ public class GwtPaint implements Paint { return 4 + strokeWidth; } - void buildFont(){ + void buildFont() { StringBuilder sb = new StringBuilder(); if (this.fontStyle == FontStyle.BOLD) diff --git a/vtm-gdx-html/src/org/oscim/gdx/client/MapConfig.java b/vtm-gdx-html/src/org/oscim/gdx/client/MapConfig.java index c4593880..b14b5a42 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/client/MapConfig.java +++ b/vtm-gdx-html/src/org/oscim/gdx/client/MapConfig.java @@ -34,4 +34,3 @@ class MapConfig extends JavaScriptObject { return this.background; }-*/; } - diff --git a/vtm-gdx-html/src/org/oscim/gdx/client/SearchBox.java b/vtm-gdx-html/src/org/oscim/gdx/client/SearchBox.java index 64ab87f3..6fbeb100 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/client/SearchBox.java +++ b/vtm-gdx-html/src/org/oscim/gdx/client/SearchBox.java @@ -66,7 +66,7 @@ public class SearchBox { } final static class NominatimData extends JavaScriptObject implements - PoiData { + PoiData { protected NominatimData() { } @@ -83,7 +83,8 @@ public class SearchBox { } @Override - public final native String getId() /*-{ + public final native String getId() + /*-{ return this.osm_id; }-*/; @@ -155,7 +156,7 @@ public class SearchBox { @Override public void render(com.google.gwt.cell.client.Cell.Context context, - PoiData value, SafeHtmlBuilder sb) { + PoiData value, SafeHtmlBuilder sb) { // Value can be null, so do a null check.. if (value == null) { @@ -203,10 +204,10 @@ public class SearchBox { // Create a CellList that uses the cell. final CellList cellList = new CellList(poiCell, - PoiData.KEY_PROVIDER); + PoiData.KEY_PROVIDER); final SingleSelectionModel selectionModel = new SingleSelectionModel( - PoiData.KEY_PROVIDER); + PoiData.KEY_PROVIDER); cellList.setSelectionModel(selectionModel); final ScrollPanel scroller = new ScrollPanel(cellList); @@ -235,7 +236,7 @@ public class SearchBox { BoundingBox b = d.getBoundingBox(); if (b != null) { if (b.maxLatitudeE6 - b.minLatitudeE6 < 100 && - b.maxLongitudeE6 - b.minLongitudeE6 < 100) + b.maxLongitudeE6 - b.minLongitudeE6 < 100) // for small bbox use zoom=16 to get an overview map.getAnimator().animateTo(500, b.getCenterPoint(), 1 << 16, false); else @@ -311,8 +312,8 @@ public class SearchBox { searchButton.setEnabled(false); String url = URL - .encode(NOMINATIM_GLOBAL - + textToServer); + .encode(NOMINATIM_GLOBAL + + textToServer); JsonpRequestBuilder builder = new JsonpRequestBuilder(); builder.setCallbackParam("json_callback"); diff --git a/vtm-gdx-html/src/org/oscim/gdx/client/WKTReader.java b/vtm-gdx-html/src/org/oscim/gdx/client/WKTReader.java index f1f05a3d..553adf96 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/client/WKTReader.java +++ b/vtm-gdx-html/src/org/oscim/gdx/client/WKTReader.java @@ -88,7 +88,7 @@ public class WKTReader { } private static void parsePoly(GeometryBuffer geom, String wkt, int len, int[] adv) - throws Exception { + throws Exception { // outer ring ensure(wkt, adv, '('); parseLine(geom, wkt, len, adv); @@ -102,7 +102,7 @@ public class WKTReader { } private static void parseLine(GeometryBuffer geom, String wkt, int len, int[] adv) - throws Exception { + throws Exception { ensure(wkt, adv, '('); parsePoint(geom, wkt, len, adv); @@ -204,21 +204,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-gdx-html/src/org/oscim/gdx/emu/java/net/MalformedURLException.java b/vtm-gdx-html/src/org/oscim/gdx/emu/java/net/MalformedURLException.java index b02bbf12..839be0aa 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/java/net/MalformedURLException.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/java/net/MalformedURLException.java @@ -5,7 +5,6 @@ public class MalformedURLException extends Exception { /** * */ - private static final long serialVersionUID = 1L; - + private static final long serialVersionUID = 1L; } diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/java/util/concurrent/CopyOnWriteArrayList.java b/vtm-gdx-html/src/org/oscim/gdx/emu/java/util/concurrent/CopyOnWriteArrayList.java index a4acffd2..a5cac2f6 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/java/util/concurrent/CopyOnWriteArrayList.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/java/util/concurrent/CopyOnWriteArrayList.java @@ -7,6 +7,6 @@ public class CopyOnWriteArrayList extends ArrayList { /** * */ - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; } diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/backend/MyAttributes.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/backend/MyAttributes.java index 34f26fdb..31bda356 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/backend/MyAttributes.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/backend/MyAttributes.java @@ -5,10 +5,10 @@ import org.xml.sax.Attributes; import com.google.gwt.xml.client.NamedNodeMap; import com.google.gwt.xml.client.Node; -public class MyAttributes implements Attributes{ +public class MyAttributes implements Attributes { private NamedNodeMap map; - public MyAttributes(Node n){ + public MyAttributes(Node n) { map = n.getAttributes(); } diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/backend/XMLReaderAdapter.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/backend/XMLReaderAdapter.java index 363597fe..87470794 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/backend/XMLReaderAdapter.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/backend/XMLReaderAdapter.java @@ -7,10 +7,10 @@ import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class XMLReaderAdapter { - public void parse(DefaultHandler handler, InputStream is) throws IOException, SAXException { + public void parse(DefaultHandler handler, InputStream is) throws IOException, SAXException { - MyXMLReader xmlReader = new MyXMLReader(); - xmlReader.setContentHandler(handler); - xmlReader.parse(is); + MyXMLReader xmlReader = new MyXMLReader(); + xmlReader.setContentHandler(handler); + xmlReader.parse(is); } } diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/layers/tile/vector/VectorTileLoader.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/layers/tile/vector/VectorTileLoader.java index 8b3175aa..eef9eb96 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/layers/tile/vector/VectorTileLoader.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/layers/tile/vector/VectorTileLoader.java @@ -137,8 +137,8 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac mLatScaleFactor = 0.4f + 0.6f * ((float) Math.sin(Math.abs(latitude) * (Math.PI / 180))); mGroundResolution = (float) (Math.cos(latitude * (Math.PI / 180)) - * MercatorProjection.EARTH_CIRCUMFERENCE - / ((long) Tile.SIZE << mTile.zoomLevel)); + * MercatorProjection.EARTH_CIRCUMFERENCE + / ((long) Tile.SIZE << mTile.zoomLevel)); mTile.layers = new ElementLayers(); @@ -173,7 +173,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac /** * Sets the scale stroke factor for the given zoom level. - * + * * @param zoomLevel * the zoom level for which the scale stroke factor should be * set. @@ -327,7 +327,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac } lineLayer.addLine(mElement.points, mElement.index, - mElement.type == GeometryType.POLY); + mElement.type == GeometryType.POLY); // keep reference for outline layer mCurLineLayer = lineLayer; @@ -431,7 +431,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac break; WayDecorator.renderText(mClipper, mElement.points, value, text, - offset, length, mTile); + offset, length, mTile); offset += length; } } diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/renderer/GLMatrix.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/renderer/GLMatrix.java index 3c1caaa6..bbcafcc9 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/renderer/GLMatrix.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/renderer/GLMatrix.java @@ -21,7 +21,6 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; - public class GLMatrix { public static final int M00 = 0;// 0; @@ -41,21 +40,27 @@ public class GLMatrix { public static final int M32 = 11;// 14; public static final int M33 = 15;// 15; - private final FloatBuffer buffer = ByteBuffer.allocateDirect(16 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); - + private final FloatBuffer buffer = ByteBuffer.allocateDirect(16 * 4) + .order(ByteOrder.nativeOrder()) + .asFloatBuffer(); private final static String INVALID_INPUT = "Bad Array!"; public final float tmp[] = new float[16]; public final float val[] = new float[16]; - /** Sets the matrix to the given matrix as a float array. The float array must have at least 16 elements; the first 16 will be + /** + * Sets the matrix to the given matrix as a float array. The float array + * must have at least 16 elements; the first 16 will be * copied. - * - * @param values The matrix, in float form, that is to be copied. Remember that this matrix is in column major order. - * @return This matrix for the purpose of chaining methods together. */ - public void set (float[] values) { + * + * @param values The matrix, in float form, that is to be copied. Remember + * that this matrix is in column + * major order. + * @return This matrix for the purpose of chaining methods together. + */ + public void set(float[] values) { val[M00] = values[M00]; val[M10] = values[M10]; val[M20] = values[M20]; @@ -73,9 +78,10 @@ public class GLMatrix { val[M23] = values[M23]; val[M33] = values[M33]; } + /** * Get the Matrix as float array - * + * * @param m float array to store Matrix */ public void get(float[] m) { @@ -88,7 +94,7 @@ public class GLMatrix { /** * Copy values from mat - * + * * @param mat Matrix to copy */ public void copy(GLMatrix m) { @@ -100,7 +106,7 @@ public class GLMatrix { /** * Project Vector with Matrix - * + * * @param vec3 Vector to project */ public void prj(float[] vec3) { @@ -110,7 +116,7 @@ public class GLMatrix { matrix4_proj(val, vec3); } - static void matrix4_proj (float[] mat, float[] vec) { + static void matrix4_proj(float[] mat, float[] vec) { float inv_w = 1.0f / (vec[0] * mat[M30] + vec[1] * mat[M31] + vec[2] * mat[M32] + mat[M33]); float x = (vec[0] * mat[M00] + vec[1] * mat[M01] + vec[2] * mat[M02] + mat[M03]) * inv_w; float y = (vec[0] * mat[M10] + vec[1] * mat[M11] + vec[2] * mat[M12] + mat[M13]) * inv_w; @@ -122,7 +128,7 @@ public class GLMatrix { /** * Multiply rhs onto Matrix. - * + * * @param rhs right hand side */ public void multiplyRhs(GLMatrix rhs) { @@ -131,7 +137,7 @@ public class GLMatrix { /** * Use this matrix as rhs, multiply it on lhs and store result. - * + * * @param lhs right hand side */ public void multiplyLhs(GLMatrix lhs) { @@ -142,12 +148,12 @@ public class GLMatrix { /** * Multiply rhs onto lhs and store result in Matrix. - * + * * This matrix MUST be different from lhs and rhs! - * + * * As you know, when combining matrices for vector projection * this has the same effect first as applying rhs then lhs. - * + * * @param lhs left hand side * @param rhs right hand side */ @@ -159,7 +165,7 @@ public class GLMatrix { /** * Transpose mat and store result in Matrix - * + * * @param mat to transpose */ public void transposeM(GLMatrix mat) { @@ -183,7 +189,7 @@ public class GLMatrix { /** * Set rotation - * + * * @param a angle in degree * @param x around x-axis * @param y around y-axis @@ -195,7 +201,7 @@ public class GLMatrix { /** * Set translation - * + * * @param x along x-axis * @param y along y-axis * @param z along z-axis @@ -209,7 +215,7 @@ public class GLMatrix { /** * Set scale factor - * + * * @param x axis * @param y axis * @param z axis @@ -223,7 +229,7 @@ public class GLMatrix { /** * Set translation and x,y scale - * + * * @param tx translate x * @param ty translate y * @param scale factor x,y @@ -239,7 +245,7 @@ public class GLMatrix { /** * Set Matrix with glUniformMatrix - * + * * @param location GL location id */ public void setAsUniform(int location) { @@ -251,21 +257,23 @@ public class GLMatrix { /** * Set single value - * + * * @param pos at position * @param value value to set */ public void setValue(int pos, float value) { val[pos] = value; } + static float PiTimesThumb = 1.0f / (1 << 11); + /** * add some offset (similar to glDepthOffset) - * + * * @param delta offset */ public void addDepthOffset(int delta) { - val[10] *= 1.0f + PiTimesThumb * delta; + val[10] *= 1.0f + PiTimesThumb * delta; } /** @@ -290,42 +298,58 @@ public class GLMatrix { val[M33] = 1; } - static void matrix4_mul (float[] mata, float[] matb) { + static void matrix4_mul(float[] mata, float[] matb) { float tmp[] = new float[16]; - tmp[M00] = mata[M00] * matb[M00] + mata[M01] * matb[M10] + mata[M02] * matb[M20] + mata[M03] * matb[M30]; - tmp[M01] = mata[M00] * matb[M01] + mata[M01] * matb[M11] + mata[M02] * matb[M21] + mata[M03] * matb[M31]; - tmp[M02] = mata[M00] * matb[M02] + mata[M01] * matb[M12] + mata[M02] * matb[M22] + mata[M03] * matb[M32]; - tmp[M03] = mata[M00] * matb[M03] + mata[M01] * matb[M13] + mata[M02] * matb[M23] + mata[M03] * matb[M33]; - tmp[M10] = mata[M10] * matb[M00] + mata[M11] * matb[M10] + mata[M12] * matb[M20] + mata[M13] * matb[M30]; - tmp[M11] = mata[M10] * matb[M01] + mata[M11] * matb[M11] + mata[M12] * matb[M21] + mata[M13] * matb[M31]; - tmp[M12] = mata[M10] * matb[M02] + mata[M11] * matb[M12] + mata[M12] * matb[M22] + mata[M13] * matb[M32]; - tmp[M13] = mata[M10] * matb[M03] + mata[M11] * matb[M13] + mata[M12] * matb[M23] + mata[M13] * matb[M33]; - tmp[M20] = mata[M20] * matb[M00] + mata[M21] * matb[M10] + mata[M22] * matb[M20] + mata[M23] * matb[M30]; - tmp[M21] = mata[M20] * matb[M01] + mata[M21] * matb[M11] + mata[M22] * matb[M21] + mata[M23] * matb[M31]; - tmp[M22] = mata[M20] * matb[M02] + mata[M21] * matb[M12] + mata[M22] * matb[M22] + mata[M23] * matb[M32]; - tmp[M23] = mata[M20] * matb[M03] + mata[M21] * matb[M13] + mata[M22] * matb[M23] + mata[M23] * matb[M33]; - tmp[M30] = mata[M30] * matb[M00] + mata[M31] * matb[M10] + mata[M32] * matb[M20] + mata[M33] * matb[M30]; - tmp[M31] = mata[M30] * matb[M01] + mata[M31] * matb[M11] + mata[M32] * matb[M21] + mata[M33] * matb[M31]; - tmp[M32] = mata[M30] * matb[M02] + mata[M31] * matb[M12] + mata[M32] * matb[M22] + mata[M33] * matb[M32]; - tmp[M33] = mata[M30] * matb[M03] + mata[M31] * matb[M13] + mata[M32] * matb[M23] + mata[M33] * matb[M33]; + tmp[M00] = mata[M00] * matb[M00] + mata[M01] * matb[M10] + mata[M02] * matb[M20] + + mata[M03] * matb[M30]; + tmp[M01] = mata[M00] * matb[M01] + mata[M01] * matb[M11] + mata[M02] * matb[M21] + + mata[M03] * matb[M31]; + tmp[M02] = mata[M00] * matb[M02] + mata[M01] * matb[M12] + mata[M02] * matb[M22] + + mata[M03] * matb[M32]; + tmp[M03] = mata[M00] * matb[M03] + mata[M01] * matb[M13] + mata[M02] * matb[M23] + + mata[M03] * matb[M33]; + tmp[M10] = mata[M10] * matb[M00] + mata[M11] * matb[M10] + mata[M12] * matb[M20] + + mata[M13] * matb[M30]; + tmp[M11] = mata[M10] * matb[M01] + mata[M11] * matb[M11] + mata[M12] * matb[M21] + + mata[M13] * matb[M31]; + tmp[M12] = mata[M10] * matb[M02] + mata[M11] * matb[M12] + mata[M12] * matb[M22] + + mata[M13] * matb[M32]; + tmp[M13] = mata[M10] * matb[M03] + mata[M11] * matb[M13] + mata[M12] * matb[M23] + + mata[M13] * matb[M33]; + tmp[M20] = mata[M20] * matb[M00] + mata[M21] * matb[M10] + mata[M22] * matb[M20] + + mata[M23] * matb[M30]; + tmp[M21] = mata[M20] * matb[M01] + mata[M21] * matb[M11] + mata[M22] * matb[M21] + + mata[M23] * matb[M31]; + tmp[M22] = mata[M20] * matb[M02] + mata[M21] * matb[M12] + mata[M22] * matb[M22] + + mata[M23] * matb[M32]; + tmp[M23] = mata[M20] * matb[M03] + mata[M21] * matb[M13] + mata[M22] * matb[M23] + + mata[M23] * matb[M33]; + tmp[M30] = mata[M30] * matb[M00] + mata[M31] * matb[M10] + mata[M32] * matb[M20] + + mata[M33] * matb[M30]; + tmp[M31] = mata[M30] * matb[M01] + mata[M31] * matb[M11] + mata[M32] * matb[M21] + + mata[M33] * matb[M31]; + tmp[M32] = mata[M30] * matb[M02] + mata[M31] * matb[M12] + mata[M32] * matb[M22] + + mata[M33] * matb[M32]; + tmp[M33] = mata[M30] * matb[M03] + mata[M31] * matb[M13] + mata[M32] * matb[M23] + + mata[M33] * matb[M33]; 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 - * + * * 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 - * + * + * 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. @@ -334,262 +358,263 @@ public class GLMatrix { */ /** - * Define a projection matrix in terms of six clip planes - * @param m the float array that holds the perspective matrix - * @param offset the offset into float array m where the perspective - * matrix data is written - */ - public static void frustumM(float[] m, int offset, - float left, float right, float bottom, float top, - float near, float far) { - if (left == right) { - throw new IllegalArgumentException("left == right"); - } - if (top == bottom) { - throw new IllegalArgumentException("top == bottom"); - } - if (near == far) { - throw new IllegalArgumentException("near == far"); - } - if (near <= 0.0f) { - throw new IllegalArgumentException("near <= 0.0f"); - } - if (far <= 0.0f) { - throw new IllegalArgumentException("far <= 0.0f"); - } - final float r_width = 1.0f / (right - left); - final float r_height = 1.0f / (top - bottom); - final float r_depth = 1.0f / (near - far); - final float x = 2.0f * (near * r_width); - final float y = 2.0f * (near * r_height); - final float A = (right + left) * r_width; - final float B = (top + bottom) * r_height; - final float C = (far + near) * r_depth; - final float D = 2.0f * (far * near * r_depth); - m[offset + 0] = x; - m[offset + 5] = y; - m[offset + 8] = A; - m[offset + 9] = B; - m[offset + 10] = C; - m[offset + 14] = D; - m[offset + 11] = -1.0f; - m[offset + 1] = 0.0f; - m[offset + 2] = 0.0f; - m[offset + 3] = 0.0f; - m[offset + 4] = 0.0f; - m[offset + 6] = 0.0f; - m[offset + 7] = 0.0f; - m[offset + 12] = 0.0f; - m[offset + 13] = 0.0f; - m[offset + 15] = 0.0f; - } + * Define a projection matrix in terms of six clip planes + * + * @param m the float array that holds the perspective matrix + * @param offset the offset into float array m where the perspective + * matrix data is written + */ + public static void frustumM(float[] m, int offset, + float left, float right, float bottom, float top, + float near, float far) { + if (left == right) { + throw new IllegalArgumentException("left == right"); + } + if (top == bottom) { + throw new IllegalArgumentException("top == bottom"); + } + if (near == far) { + throw new IllegalArgumentException("near == far"); + } + if (near <= 0.0f) { + throw new IllegalArgumentException("near <= 0.0f"); + } + if (far <= 0.0f) { + throw new IllegalArgumentException("far <= 0.0f"); + } + final float r_width = 1.0f / (right - left); + final float r_height = 1.0f / (top - bottom); + final float r_depth = 1.0f / (near - far); + final float x = 2.0f * (near * r_width); + final float y = 2.0f * (near * r_height); + final float A = (right + left) * r_width; + final float B = (top + bottom) * r_height; + final float C = (far + near) * r_depth; + final float D = 2.0f * (far * near * r_depth); + m[offset + 0] = x; + m[offset + 5] = y; + m[offset + 8] = A; + m[offset + 9] = B; + m[offset + 10] = C; + m[offset + 14] = D; + m[offset + 11] = -1.0f; + m[offset + 1] = 0.0f; + m[offset + 2] = 0.0f; + m[offset + 3] = 0.0f; + m[offset + 4] = 0.0f; + m[offset + 6] = 0.0f; + m[offset + 7] = 0.0f; + m[offset + 12] = 0.0f; + m[offset + 13] = 0.0f; + m[offset + 15] = 0.0f; + } - /** - * Inverts a 4 x 4 matrix. - * - * @param mInv the array that holds the output inverted matrix - * @param mInvOffset an offset into mInv where the inverted matrix is - * stored. - * @param m the input array - * @param mOffset an offset into m where the matrix is stored. - * @return true if the matrix could be inverted, false if it could not. - */ - public static boolean invertM(float[] mInv, int mInvOffset, float[] m, - int mOffset) { - // Invert a 4 x 4 matrix using Cramer's Rule + /** + * Inverts a 4 x 4 matrix. + * + * @param mInv the array that holds the output inverted matrix + * @param mInvOffset an offset into mInv where the inverted matrix is + * stored. + * @param m the input array + * @param mOffset an offset into m where the matrix is stored. + * @return true if the matrix could be inverted, false if it could not. + */ + public static boolean invertM(float[] mInv, int mInvOffset, float[] m, + int mOffset) { + // Invert a 4 x 4 matrix using Cramer's Rule - // transpose matrix - final float src0 = m[mOffset + 0]; - final float src4 = m[mOffset + 1]; - final float src8 = m[mOffset + 2]; - final float src12 = m[mOffset + 3]; + // transpose matrix + final float src0 = m[mOffset + 0]; + final float src4 = m[mOffset + 1]; + final float src8 = m[mOffset + 2]; + final float src12 = m[mOffset + 3]; - final float src1 = m[mOffset + 4]; - final float src5 = m[mOffset + 5]; - final float src9 = m[mOffset + 6]; - final float src13 = m[mOffset + 7]; + final float src1 = m[mOffset + 4]; + final float src5 = m[mOffset + 5]; + final float src9 = m[mOffset + 6]; + final float src13 = m[mOffset + 7]; - final float src2 = m[mOffset + 8]; - final float src6 = m[mOffset + 9]; - final float src10 = m[mOffset + 10]; - final float src14 = m[mOffset + 11]; + final float src2 = m[mOffset + 8]; + final float src6 = m[mOffset + 9]; + final float src10 = m[mOffset + 10]; + final float src14 = m[mOffset + 11]; - final float src3 = m[mOffset + 12]; - final float src7 = m[mOffset + 13]; - final float src11 = m[mOffset + 14]; - final float src15 = m[mOffset + 15]; + final float src3 = m[mOffset + 12]; + final float src7 = m[mOffset + 13]; + final float src11 = m[mOffset + 14]; + final float src15 = m[mOffset + 15]; - // calculate pairs for first 8 elements (cofactors) - final float atmp0 = src10 * src15; - final float atmp1 = src11 * src14; - final float atmp2 = src9 * src15; - final float atmp3 = src11 * src13; - final float atmp4 = src9 * src14; - final float atmp5 = src10 * src13; - final float atmp6 = src8 * src15; - final float atmp7 = src11 * src12; - final float atmp8 = src8 * src14; - final float atmp9 = src10 * src12; - final float atmp10 = src8 * src13; - final float atmp11 = src9 * src12; + // calculate pairs for first 8 elements (cofactors) + final float atmp0 = src10 * src15; + final float atmp1 = src11 * src14; + final float atmp2 = src9 * src15; + final float atmp3 = src11 * src13; + final float atmp4 = src9 * src14; + final float atmp5 = src10 * src13; + final float atmp6 = src8 * src15; + final float atmp7 = src11 * src12; + final float atmp8 = src8 * src14; + final float atmp9 = src10 * src12; + final float atmp10 = src8 * src13; + final float atmp11 = src9 * src12; - // calculate first 8 elements (cofactors) - final float dst0 = (atmp0 * src5 + atmp3 * src6 + atmp4 * src7) - - (atmp1 * src5 + atmp2 * src6 + atmp5 * src7); - final float dst1 = (atmp1 * src4 + atmp6 * src6 + atmp9 * src7) - - (atmp0 * src4 + atmp7 * src6 + atmp8 * src7); - final float dst2 = (atmp2 * src4 + atmp7 * src5 + atmp10 * src7) - - (atmp3 * src4 + atmp6 * src5 + atmp11 * src7); - final float dst3 = (atmp5 * src4 + atmp8 * src5 + atmp11 * src6) - - (atmp4 * src4 + atmp9 * src5 + atmp10 * src6); - final float dst4 = (atmp1 * src1 + atmp2 * src2 + atmp5 * src3) - - (atmp0 * src1 + atmp3 * src2 + atmp4 * src3); - final float dst5 = (atmp0 * src0 + atmp7 * src2 + atmp8 * src3) - - (atmp1 * src0 + atmp6 * src2 + atmp9 * src3); - final float dst6 = (atmp3 * src0 + atmp6 * src1 + atmp11 * src3) - - (atmp2 * src0 + atmp7 * src1 + atmp10 * src3); - final float dst7 = (atmp4 * src0 + atmp9 * src1 + atmp10 * src2) - - (atmp5 * src0 + atmp8 * src1 + atmp11 * src2); + // calculate first 8 elements (cofactors) + final float dst0 = (atmp0 * src5 + atmp3 * src6 + atmp4 * src7) + - (atmp1 * src5 + atmp2 * src6 + atmp5 * src7); + final float dst1 = (atmp1 * src4 + atmp6 * src6 + atmp9 * src7) + - (atmp0 * src4 + atmp7 * src6 + atmp8 * src7); + final float dst2 = (atmp2 * src4 + atmp7 * src5 + atmp10 * src7) + - (atmp3 * src4 + atmp6 * src5 + atmp11 * src7); + final float dst3 = (atmp5 * src4 + atmp8 * src5 + atmp11 * src6) + - (atmp4 * src4 + atmp9 * src5 + atmp10 * src6); + final float dst4 = (atmp1 * src1 + atmp2 * src2 + atmp5 * src3) + - (atmp0 * src1 + atmp3 * src2 + atmp4 * src3); + final float dst5 = (atmp0 * src0 + atmp7 * src2 + atmp8 * src3) + - (atmp1 * src0 + atmp6 * src2 + atmp9 * src3); + final float dst6 = (atmp3 * src0 + atmp6 * src1 + atmp11 * src3) + - (atmp2 * src0 + atmp7 * src1 + atmp10 * src3); + final float dst7 = (atmp4 * src0 + atmp9 * src1 + atmp10 * src2) + - (atmp5 * src0 + atmp8 * src1 + atmp11 * src2); - // calculate pairs for second 8 elements (cofactors) - final float btmp0 = src2 * src7; - final float btmp1 = src3 * src6; - final float btmp2 = src1 * src7; - final float btmp3 = src3 * src5; - final float btmp4 = src1 * src6; - final float btmp5 = src2 * src5; - final float btmp6 = src0 * src7; - final float btmp7 = src3 * src4; - final float btmp8 = src0 * src6; - final float btmp9 = src2 * src4; - final float btmp10 = src0 * src5; - final float btmp11 = src1 * src4; + // calculate pairs for second 8 elements (cofactors) + final float btmp0 = src2 * src7; + final float btmp1 = src3 * src6; + final float btmp2 = src1 * src7; + final float btmp3 = src3 * src5; + final float btmp4 = src1 * src6; + final float btmp5 = src2 * src5; + final float btmp6 = src0 * src7; + final float btmp7 = src3 * src4; + final float btmp8 = src0 * src6; + final float btmp9 = src2 * src4; + final float btmp10 = src0 * src5; + final float btmp11 = src1 * src4; - // calculate second 8 elements (cofactors) - final float dst8 = (btmp0 * src13 + btmp3 * src14 + btmp4 * src15) - - (btmp1 * src13 + btmp2 * src14 + btmp5 * src15); - final float dst9 = (btmp1 * src12 + btmp6 * src14 + btmp9 * src15) - - (btmp0 * src12 + btmp7 * src14 + btmp8 * src15); - final float dst10 = (btmp2 * src12 + btmp7 * src13 + btmp10 * src15) - - (btmp3 * src12 + btmp6 * src13 + btmp11 * src15); - final float dst11 = (btmp5 * src12 + btmp8 * src13 + btmp11 * src14) - - (btmp4 * src12 + btmp9 * src13 + btmp10 * src14); - final float dst12 = (btmp2 * src10 + btmp5 * src11 + btmp1 * src9 ) - - (btmp4 * src11 + btmp0 * src9 + btmp3 * src10); - final float dst13 = (btmp8 * src11 + btmp0 * src8 + btmp7 * src10) - - (btmp6 * src10 + btmp9 * src11 + btmp1 * src8 ); - final float dst14 = (btmp6 * src9 + btmp11 * src11 + btmp3 * src8 ) - - (btmp10 * src11 + btmp2 * src8 + btmp7 * src9 ); - final float dst15 = (btmp10 * src10 + btmp4 * src8 + btmp9 * src9 ) - - (btmp8 * src9 + btmp11 * src10 + btmp5 * src8 ); + // calculate second 8 elements (cofactors) + final float dst8 = (btmp0 * src13 + btmp3 * src14 + btmp4 * src15) + - (btmp1 * src13 + btmp2 * src14 + btmp5 * src15); + final float dst9 = (btmp1 * src12 + btmp6 * src14 + btmp9 * src15) + - (btmp0 * src12 + btmp7 * src14 + btmp8 * src15); + final float dst10 = (btmp2 * src12 + btmp7 * src13 + btmp10 * src15) + - (btmp3 * src12 + btmp6 * src13 + btmp11 * src15); + final float dst11 = (btmp5 * src12 + btmp8 * src13 + btmp11 * src14) + - (btmp4 * src12 + btmp9 * src13 + btmp10 * src14); + final float dst12 = (btmp2 * src10 + btmp5 * src11 + btmp1 * src9) + - (btmp4 * src11 + btmp0 * src9 + btmp3 * src10); + final float dst13 = (btmp8 * src11 + btmp0 * src8 + btmp7 * src10) + - (btmp6 * src10 + btmp9 * src11 + btmp1 * src8); + final float dst14 = (btmp6 * src9 + btmp11 * src11 + btmp3 * src8) + - (btmp10 * src11 + btmp2 * src8 + btmp7 * src9); + final float dst15 = (btmp10 * src10 + btmp4 * src8 + btmp9 * src9) + - (btmp8 * src9 + btmp11 * src10 + btmp5 * src8); - // calculate determinant - final float det = - src0 * dst0 + src1 * dst1 + src2 * dst2 + src3 * dst3; + // calculate determinant + final float det = + src0 * dst0 + src1 * dst1 + src2 * dst2 + src3 * dst3; - if (det == 0.0f) { - return false; - } + if (det == 0.0f) { + return false; + } - // calculate matrix inverse - final float invdet = 1.0f / det; - mInv[ mInvOffset] = dst0 * invdet; - mInv[ 1 + mInvOffset] = dst1 * invdet; - mInv[ 2 + mInvOffset] = dst2 * invdet; - mInv[ 3 + mInvOffset] = dst3 * invdet; + // calculate matrix inverse + final float invdet = 1.0f / det; + mInv[mInvOffset] = dst0 * invdet; + mInv[1 + mInvOffset] = dst1 * invdet; + mInv[2 + mInvOffset] = dst2 * invdet; + mInv[3 + mInvOffset] = dst3 * invdet; - mInv[ 4 + mInvOffset] = dst4 * invdet; - mInv[ 5 + mInvOffset] = dst5 * invdet; - mInv[ 6 + mInvOffset] = dst6 * invdet; - mInv[ 7 + mInvOffset] = dst7 * invdet; + mInv[4 + mInvOffset] = dst4 * invdet; + mInv[5 + mInvOffset] = dst5 * invdet; + mInv[6 + mInvOffset] = dst6 * invdet; + mInv[7 + mInvOffset] = dst7 * invdet; - mInv[ 8 + mInvOffset] = dst8 * invdet; - mInv[ 9 + mInvOffset] = dst9 * invdet; - mInv[10 + mInvOffset] = dst10 * invdet; - mInv[11 + mInvOffset] = dst11 * invdet; + mInv[8 + mInvOffset] = dst8 * invdet; + mInv[9 + mInvOffset] = dst9 * invdet; + mInv[10 + mInvOffset] = dst10 * invdet; + mInv[11 + mInvOffset] = dst11 * invdet; - mInv[12 + mInvOffset] = dst12 * invdet; - mInv[13 + mInvOffset] = dst13 * invdet; - mInv[14 + mInvOffset] = dst14 * invdet; - mInv[15 + mInvOffset] = dst15 * invdet; + mInv[12 + mInvOffset] = dst12 * invdet; + mInv[13 + mInvOffset] = dst13 * invdet; + mInv[14 + mInvOffset] = dst14 * invdet; + mInv[15 + mInvOffset] = dst15 * invdet; - return true; - } + return true; + } - void setRotateM(float[] rm, int rmOffset, float a, float x, float y, float z) - { - rm[rmOffset + 3] = 0; - rm[rmOffset + 7] = 0; - rm[rmOffset + 11] = 0; - rm[rmOffset + 12] = 0; - rm[rmOffset + 13] = 0; - rm[rmOffset + 14] = 0; - rm[rmOffset + 15] = 1; - a *= (float) (Math.PI / 180.0f); - float s = (float) Math.sin(a); - float c = (float) Math.cos(a); - if (1.0f == x && 0.0f == y && 0.0f == z) - { - rm[rmOffset + 5] = c; - rm[rmOffset + 10] = c; - rm[rmOffset + 6] = s; - rm[rmOffset + 9] = -s; - rm[rmOffset + 1] = 0; - rm[rmOffset + 2] = 0; - rm[rmOffset + 4] = 0; - rm[rmOffset + 8] = 0; - rm[rmOffset + 0] = 1; - } - else if (0.0f == x && 1.0f == y && 0.0f == z) - { - rm[rmOffset + 0] = c; - rm[rmOffset + 10] = c; - rm[rmOffset + 8] = s; - rm[rmOffset + 2] = -s; - rm[rmOffset + 1] = 0; - rm[rmOffset + 4] = 0; - rm[rmOffset + 6] = 0; - rm[rmOffset + 9] = 0; - rm[rmOffset + 5] = 1; - } - else if (0.0f == x && 0.0f == y && 1.0f == z) - { - rm[rmOffset + 0] = c; - rm[rmOffset + 5] = c; - rm[rmOffset + 1] = s; - rm[rmOffset + 4] = -s; - rm[rmOffset + 2] = 0; - rm[rmOffset + 6] = 0; - rm[rmOffset + 8] = 0; - rm[rmOffset + 9] = 0; - rm[rmOffset + 10] = 1; - } - else - { - float len = (float) Math.sqrt(x * x + y * y + z * z); - if (1.0f != len) - { - float recipLen = 1.0f / len; - x *= recipLen; - y *= recipLen; - z *= recipLen; - } - float nc = 1.0f - c; - float xy = x * y; - float yz = y * z; - float zx = z * x; - float xs = x * s; - float ys = y * s; - float zs = z * s; - rm[rmOffset + 0] = x * x * nc + c; - rm[rmOffset + 4] = xy * nc - zs; - rm[rmOffset + 8] = zx * nc + ys; - rm[rmOffset + 1] = xy * nc + zs; - rm[rmOffset + 5] = y * y * nc + c; - rm[rmOffset + 9] = yz * nc - xs; - rm[rmOffset + 2] = zx * nc - ys; - rm[rmOffset + 6] = yz * nc + xs; - rm[rmOffset + 10] = z * z * nc + c; - } - } + void setRotateM(float[] rm, int rmOffset, float a, float x, float y, float z) + { + rm[rmOffset + 3] = 0; + rm[rmOffset + 7] = 0; + rm[rmOffset + 11] = 0; + rm[rmOffset + 12] = 0; + rm[rmOffset + 13] = 0; + rm[rmOffset + 14] = 0; + rm[rmOffset + 15] = 1; + a *= (float) (Math.PI / 180.0f); + float s = (float) Math.sin(a); + float c = (float) Math.cos(a); + if (1.0f == x && 0.0f == y && 0.0f == z) + { + rm[rmOffset + 5] = c; + rm[rmOffset + 10] = c; + rm[rmOffset + 6] = s; + rm[rmOffset + 9] = -s; + rm[rmOffset + 1] = 0; + rm[rmOffset + 2] = 0; + rm[rmOffset + 4] = 0; + rm[rmOffset + 8] = 0; + rm[rmOffset + 0] = 1; + } + else if (0.0f == x && 1.0f == y && 0.0f == z) + { + rm[rmOffset + 0] = c; + rm[rmOffset + 10] = c; + rm[rmOffset + 8] = s; + rm[rmOffset + 2] = -s; + rm[rmOffset + 1] = 0; + rm[rmOffset + 4] = 0; + rm[rmOffset + 6] = 0; + rm[rmOffset + 9] = 0; + rm[rmOffset + 5] = 1; + } + else if (0.0f == x && 0.0f == y && 1.0f == z) + { + rm[rmOffset + 0] = c; + rm[rmOffset + 5] = c; + rm[rmOffset + 1] = s; + rm[rmOffset + 4] = -s; + rm[rmOffset + 2] = 0; + rm[rmOffset + 6] = 0; + rm[rmOffset + 8] = 0; + rm[rmOffset + 9] = 0; + rm[rmOffset + 10] = 1; + } + else + { + float len = (float) Math.sqrt(x * x + y * y + z * z); + if (1.0f != len) + { + float recipLen = 1.0f / len; + x *= recipLen; + y *= recipLen; + z *= recipLen; + } + float nc = 1.0f - c; + float xy = x * y; + float yz = y * z; + float zx = z * x; + float xs = x * s; + float ys = y * s; + float zs = z * s; + rm[rmOffset + 0] = x * x * nc + c; + rm[rmOffset + 4] = xy * nc - zs; + rm[rmOffset + 8] = zx * nc + ys; + rm[rmOffset + 1] = xy * nc + zs; + rm[rmOffset + 5] = y * y * nc + c; + rm[rmOffset + 9] = yz * nc - xs; + rm[rmOffset + 2] = zx * nc - ys; + rm[rmOffset + 6] = yz * nc + xs; + rm[rmOffset + 10] = z * z * nc + c; + } + } } diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/theme/RenderThemeHandler2.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/theme/RenderThemeHandler2.java index 36ccb15a..79370280 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/theme/RenderThemeHandler2.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/theme/RenderThemeHandler2.java @@ -14,7 +14,7 @@ public class RenderThemeHandler2 { private final static int LINE_HIGHWAY = 2; private final static Tag TAG_WATER = new Tag("natural", "water"); private final static Tag TAG_WOOD = new Tag("natural", "wood"); - private final static Tag TAG_FOREST= new Tag("landuse", "forest"); + private final static Tag TAG_FOREST = new Tag("landuse", "forest"); private static RenderInstruction[][] instructions = { // water @@ -38,7 +38,7 @@ public class RenderThemeHandler2 { if (e.tags.contains(TAG_WATER)) return instructions[AREA_WATER]; - if (e.tags.contains(TAG_WOOD) ||e.tags.contains(TAG_FOREST)) + if (e.tags.contains(TAG_WOOD) || e.tags.contains(TAG_FOREST)) return instructions[AREA_WOOD]; } else if (e.isLine()) { diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/tiling/source/common/LwHttp.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/tiling/source/common/LwHttp.java index 9eec9b60..8c5ddd55 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/tiling/source/common/LwHttp.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/tiling/source/common/LwHttp.java @@ -172,7 +172,7 @@ public class LwHttp { /** * Write custom tile url - * + * * @param tile Tile * @param path to write url string * @param curPos current position diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/IOUtils.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/IOUtils.java index baa4375c..251d99e5 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/IOUtils.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/IOUtils.java @@ -54,6 +54,7 @@ public final class IOUtils { Log.d(IOUtils.class.getName(), e.getMessage() + " " + e); } } + private IOUtils() { } } diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/Tessellator.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/Tessellator.java index 3174cab4..e2f04c87 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/Tessellator.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/Tessellator.java @@ -12,14 +12,14 @@ import com.google.gwt.typedarrays.shared.Int32Array; public class Tessellator { public static synchronized int triangulate(float[] points, int ppos, int plen, short[] index, - int ipos, int rings, int vertexOffset, VertexItem outTris) { + int ipos, int rings, int vertexOffset, VertexItem outTris) { //JavaScriptObject o; Int32Array io; - try{ + try { io = tessellate(JsArrayUtils.readOnlyJsArray(points), ppos, plen, - JsArrayUtils.readOnlyJsArray(index), ipos, rings); - } catch(JavaScriptException e){ + JsArrayUtils.readOnlyJsArray(index), ipos, rings); + } catch (JavaScriptException e) { e.printStackTrace(); return 0; } @@ -27,22 +27,22 @@ public class Tessellator { //Float32Array vo = getPoints(o); //Int32Array io = getIndices(o); - if (io == null){ + if (io == null) { Log.d("Triangulator", "building tessellation failed"); return 0; } -// if (vo.length() != plen) { -// // TODO handle different output points -// Log.d("", "other points out" + plen + ":" + vo.length() + ", " + io.length()); -// -// //for (int i = 0; i < vo.length(); i += 2) -// // Log.d("<", vo.get(i) + " " + vo.get(i + 1)); -// //for (int i = ppos; i < ppos + plen; i += 2) -// // Log.d(">", points[i]+ " " + points[i + 1]); -// -// return 0; -// } + // if (vo.length() != plen) { + // // TODO handle different output points + // Log.d("", "other points out" + plen + ":" + vo.length() + ", " + io.length()); + // + // //for (int i = 0; i < vo.length(); i += 2) + // // Log.d("<", vo.get(i) + " " + vo.get(i + 1)); + // //for (int i = ppos; i < ppos + plen; i += 2) + // // Log.d(">", points[i]+ " " + points[i + 1]); + // + // return 0; + // } int numIndices = io.length(); @@ -58,7 +58,7 @@ public class Tessellator { if (k + cnt > numIndices) cnt = numIndices - k; - for (int i = 0; i < cnt; i++){ + for (int i = 0; i < cnt; i++) { int idx = (vertexOffset + io.get(k + i)); outTris.vertices[outTris.used + i] = (short) idx; } @@ -69,25 +69,25 @@ public class Tessellator { } static native Int32Array tessellate(JsArrayNumber points, int pOffset, int pLength, - JsArrayInteger bounds, int bOffset, int bLength)/*-{ + JsArrayInteger bounds, int bOffset, int bLength)/*-{ return $wnd.tessellate(points, pOffset, pOffset + pLength, bounds, bOffset, bOffset + bLength); }-*/; -// static native JavaScriptObject tessellate(JsArrayNumber points, int pOffset, int pLength, -// JsArrayInteger bounds, int bOffset, int bLength)/*-{ -// -// return $wnd.tessellate(points, pOffset, pOffset + pLength, bounds, -// bOffset, bOffset + bLength); -// }-*/; + // static native JavaScriptObject tessellate(JsArrayNumber points, int pOffset, int pLength, + // JsArrayInteger bounds, int bOffset, int bLength)/*-{ + // + // return $wnd.tessellate(points, pOffset, pOffset + pLength, bounds, + // bOffset, bOffset + bLength); + // }-*/; -// static native Float32Array getPoints(JavaScriptObject result)/*-{ -// return result.vertices; -// }-*/; + // static native Float32Array getPoints(JavaScriptObject result)/*-{ + // return result.vertices; + // }-*/; -// static native Int32Array getIndices(JavaScriptObject result)/*-{ -// return result.triangles; -// }-*/; + // static native Int32Array getIndices(JavaScriptObject result)/*-{ + // return result.triangles; + // }-*/; } diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/AsyncExecutor.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/AsyncExecutor.java index b7143ff7..1ff76065 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/AsyncExecutor.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/AsyncExecutor.java @@ -5,14 +5,16 @@ import com.badlogic.gdx.utils.Disposable; /** * GWT emulation of AsynchExecutor, will call tasks immediately :D + * * @author badlogic - * + * */ public class AsyncExecutor implements Disposable { /** - * Creates a new AsynchExecutor that allows maxConcurrent - * {@link Runnable} instances to run in parallel. + * Creates a new AsynchExecutor that allows maxConcurrent {@link Runnable} + * instances to run in parallel. + * * @param maxConcurrent */ public AsyncExecutor(int maxConcurrent) { @@ -23,6 +25,7 @@ public class AsyncExecutor implements Disposable { * Submits a {@link Runnable} to be executed asynchronously. If * maxConcurrent runnables are already running, the runnable * will be queued. + * * @param task the task to execute asynchronously */ @SuppressWarnings({ "unchecked", "rawtypes" }) @@ -33,7 +36,7 @@ public class AsyncExecutor implements Disposable { try { task.run(); result = task.getResult(); - } catch(Throwable t) { + } catch (Throwable t) { error = true; } if (error) @@ -46,17 +49,19 @@ public class AsyncExecutor implements Disposable { * Submits a {@link Runnable} to be executed asynchronously. If * maxConcurrent runnables are already running, the runnable * will be queued. + * * @param task the task to execute asynchronously */ public void post(Runnable task) { Gdx.app.postRunnable(task); } + /** * Waits for running {@link AsyncTask} instances to finish, * then destroys any resources like threads. Can not be used * after this method is called. */ @Override - public void dispose () { + public void dispose() { } } diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/AsyncResult.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/AsyncResult.java index cec51131..36f78fe5 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/AsyncResult.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/AsyncResult.java @@ -19,12 +19,12 @@ package org.oscim.utils.async; //import java.util.concurrent.ExecutionException; //import java.util.concurrent.Future; - /** * Returned by {@link AsyncExecutor#submit(AsyncTask)}, allows to poll * for the result of the asynch workload. + * * @author badlogic - * + * */ public class AsyncResult { private final T result; @@ -41,7 +41,8 @@ public class AsyncResult { } /** - * @return the result, or null if there was an error, no result, or the task is still running + * @return the result, or null if there was an error, no result, or the task + * is still running */ public T get() { return result; diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/AsyncTask.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/AsyncTask.java index ca307ed7..6709491f 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/AsyncTask.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/AsyncTask.java @@ -16,13 +16,15 @@ package org.oscim.utils.async; - /** - * Task to be submitted to an {@link AsyncExecutor}, returning a result of type T. + * Task to be submitted to an {@link AsyncExecutor}, returning a result of type + * T. + * * @author badlogic - * + * */ -public interface AsyncTask extends Runnable{ +public interface AsyncTask extends Runnable { public boolean cancel(); + public T getResult() throws Exception; -} \ No newline at end of file +} diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/ThreadUtils.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/ThreadUtils.java index 5852b928..fbc8c68a 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/ThreadUtils.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/utils/async/ThreadUtils.java @@ -18,8 +18,9 @@ package org.oscim.utils.async; /** * GWT emulation of ThreadUtils, does nothing. + * * @author badlogic - * + * */ public class ThreadUtils { public static void yield() { diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/Attributes.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/Attributes.java index 4b3271d8..f6fc653f 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/Attributes.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/Attributes.java @@ -1,6 +1,5 @@ package org.xml.sax; - public abstract interface Attributes { public abstract int getLength(); @@ -25,4 +24,4 @@ public abstract interface Attributes { public abstract String getValue(String paramString1, String paramString2); public abstract String getValue(String paramString); -} \ No newline at end of file +} diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/SAXException.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/SAXException.java index 12aececc..951b588f 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/SAXException.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/SAXException.java @@ -12,6 +12,7 @@ public class SAXException extends IOException { public SAXException(String str) { super(str); } + public SAXException(String str, Throwable throwable) { super(str); diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/SAXParseException.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/SAXParseException.java index a3855caa..890139b3 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/SAXParseException.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/SAXParseException.java @@ -10,6 +10,7 @@ public class SAXParseException extends SAXException { public SAXParseException(String str) { super(str); } + public SAXParseException(String str, Throwable throwable) { super(str); diff --git a/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/helpers/DefaultHandler.java b/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/helpers/DefaultHandler.java index b64ec455..ecbaee96 100644 --- a/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/helpers/DefaultHandler.java +++ b/vtm-gdx-html/src/org/oscim/gdx/emu/org/xml/sax/helpers/DefaultHandler.java @@ -12,12 +12,13 @@ public class DefaultHandler { public void error(SAXParseException exception) { } + public void warning(SAXParseException exception) { } public void startElement(String uri, String localName, String qName, - Attributes attributes) throws SAXException { + Attributes attributes) throws SAXException { } @@ -25,5 +26,4 @@ public class DefaultHandler { } - } diff --git a/vtm-gdx/src/org/oscim/gdx/GdxMap.java b/vtm-gdx/src/org/oscim/gdx/GdxMap.java index 7e55f751..2753c9b4 100644 --- a/vtm-gdx/src/org/oscim/gdx/GdxMap.java +++ b/vtm-gdx/src/org/oscim/gdx/GdxMap.java @@ -85,7 +85,7 @@ public abstract class GdxMap implements ApplicationListener { /** * Update all Layers on Main thread. - * + * * @param forceRedraw * also render frame FIXME (does nothing atm) */ @@ -116,24 +116,24 @@ public abstract class GdxMap implements ApplicationListener { } protected void initDefaultLayers(TileSource tileSource, boolean tileGrid, boolean labels, - boolean buildings) { + boolean buildings) { if (tileSource != null) { mMapLayer = mMap.setBaseMap(tileSource); mMap.setTheme(InternalRenderTheme.DEFAULT); if (buildings) - mMap.getLayers().add( - new BuildingLayer(mMap, mMapLayer.getTileLayer())); + mMap.getLayers() + .add(new BuildingLayer(mMap, mMapLayer.getTileLayer())); if (labels) - mMap.getLayers().add(new LabelLayer(mMap, - mMapLayer.getTileLayer())); + mMap.getLayers() + .add(new LabelLayer(mMap, mMapLayer.getTileLayer())); } if (tileGrid) - mMap.getLayers().add(new GenericLayer(mMap, - new GridRenderer())); + mMap.getLayers() + .add(new GenericLayer(mMap, new GridRenderer())); } // Stage ui; @@ -227,7 +227,6 @@ public abstract class GdxMap implements ApplicationListener { public void resume() { } - class TouchHandler implements InputProcessor { private Viewport mMapPosition; @@ -446,7 +445,7 @@ public abstract class GdxMap implements ApplicationListener { @Override public boolean fling(final float velocityX, final float velocityY, - int button) { + int button) { //Log.d("", "fling " + button + " " + velocityX + "/" + velocityY); if (mayFling && button == Buttons.LEFT) { int m = Tile.SIZE * 4; @@ -474,7 +473,7 @@ public abstract class GdxMap implements ApplicationListener { @Override public boolean pinch(Vector2 initialPointer1, Vector2 initialPointer2, - Vector2 pointer1, Vector2 pointer2) { + Vector2 pointer1, Vector2 pointer2) { mayFling = false; if (!mPinch) { @@ -533,13 +532,12 @@ public abstract class GdxMap implements ApplicationListener { // decrease change of scale by the change of rotation // * 20 is just arbitrary if (mBeginRotate) - scale = 1 + ((scale - 1) * Math.max( - (1 - (float) Math.abs(r) * 20), 0)); + scale = 1 + ((scale - 1) * Math.max((1 - (float) Math.abs(r) * 20), 0)); mSumScale *= scale; if ((mSumScale < 0.99 || mSumScale > 1.01) - && mSumRotate < Math.abs(0.02)) + && mSumRotate < Math.abs(0.02)) mBeginRotate = false; float fx = (x2 + x1) / 2 - mWidth / 2; @@ -557,14 +555,14 @@ public abstract class GdxMap implements ApplicationListener { // Log.d(TAG, r + " " + slope + " m1:" + my + " m2:" + my2); if ((my > threshold && my2 > threshold) - || (my < -threshold && my2 < -threshold)) { + || (my < -threshold && my2 < -threshold)) { mBeginTilt = true; changed = mMapPosition.tiltMap(my / 5); } } if (!mBeginTilt - && (mBeginRotate || (Math.abs(slope) > 1 && Math.abs(r) > PINCH_ROTATE_THRESHOLD))) { + && (mBeginRotate || (Math.abs(slope) > 1 && Math.abs(r) > PINCH_ROTATE_THRESHOLD))) { // Log.d(TAG, "rotate: " + mBeginRotate + " " + // Math.toDegrees(rad)); if (!mBeginRotate) { diff --git a/vtm-gdx/src/org/oscim/gdx/GdxMotionEvent.java b/vtm-gdx/src/org/oscim/gdx/GdxMotionEvent.java index 598c76fd..7bd878e2 100644 --- a/vtm-gdx/src/org/oscim/gdx/GdxMotionEvent.java +++ b/vtm-gdx/src/org/oscim/gdx/GdxMotionEvent.java @@ -4,7 +4,7 @@ import org.oscim.event.MotionEvent; import com.badlogic.gdx.InputProcessor; -public class GdxMotionEvent extends MotionEvent implements InputProcessor{ +public class GdxMotionEvent extends MotionEvent implements InputProcessor { private static final long serialVersionUID = 1L; diff --git a/vtm/src/org/oscim/backend/GL20.java b/vtm/src/org/oscim/backend/GL20.java index 8829e523..ee2cea48 100644 --- a/vtm/src/org/oscim/backend/GL20.java +++ b/vtm/src/org/oscim/backend/GL20.java @@ -20,9 +20,12 @@ import java.nio.Buffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; -/** Interface wrapping all the methods of OpenGL ES 2.0 - * @author mzechner */ -public interface GL20 { +/** + * Interface wrapping all the methods of OpenGL ES 2.0 + * + * @author mzechner + */ +public interface GL20 { public static final int GL_ES_VERSION_2_0 = 1; public static final int GL_DEPTH_BUFFER_BIT = 0x00000100; public static final int GL_STENCIL_BUFFER_BIT = 0x00000400; @@ -332,217 +335,222 @@ public interface GL20 { // Extensions public static final int GL_COVERAGE_BUFFER_BIT_NV = 0x8000; - public void glAttachShader (int program, int shader); + public void glAttachShader(int program, int shader); - public void glBindAttribLocation (int program, int index, String name); + public void glBindAttribLocation(int program, int index, String name); - public void glBindBuffer (int target, int buffer); + public void glBindBuffer(int target, int buffer); - public void glBindFramebuffer (int target, int framebuffer); + public void glBindFramebuffer(int target, int framebuffer); - public void glBindRenderbuffer (int target, int renderbuffer); + public void glBindRenderbuffer(int target, int renderbuffer); - public void glBlendColor (float red, float green, float blue, float alpha); + public void glBlendColor(float red, float green, float blue, float alpha); - public void glBlendEquation (int mode); + public void glBlendEquation(int mode); - public void glBlendEquationSeparate (int modeRGB, int modeAlpha); + public void glBlendEquationSeparate(int modeRGB, int modeAlpha); - public void glBlendFuncSeparate (int srcRGB, int dstRGB, int srcAlpha, int dstAlpha); + public void glBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha); - public void glBufferData (int target, int size, Buffer data, int usage); + public void glBufferData(int target, int size, Buffer data, int usage); - public void glBufferSubData (int target, int offset, int size, Buffer data); + public void glBufferSubData(int target, int offset, int size, Buffer data); - public int glCheckFramebufferStatus (int target); + public int glCheckFramebufferStatus(int target); - public void glCompileShader (int shader); + public void glCompileShader(int shader); - public int glCreateProgram (); + public int glCreateProgram(); - public int glCreateShader (int type); + public int glCreateShader(int type); - public void glDeleteBuffers (int n, IntBuffer buffers); + public void glDeleteBuffers(int n, IntBuffer buffers); - public void glDeleteFramebuffers (int n, IntBuffer framebuffers); + public void glDeleteFramebuffers(int n, IntBuffer framebuffers); - public void glDeleteProgram (int program); + public void glDeleteProgram(int program); - public void glDeleteRenderbuffers (int n, IntBuffer renderbuffers); + public void glDeleteRenderbuffers(int n, IntBuffer renderbuffers); - public void glDeleteShader (int shader); + public void glDeleteShader(int shader); - public void glDetachShader (int program, int shader); + public void glDetachShader(int program, int shader); - public void glDisableVertexAttribArray (int index); + public void glDisableVertexAttribArray(int index); - public void glDrawElements (int mode, int count, int type, int indices); + public void glDrawElements(int mode, int count, int type, int indices); - public void glEnableVertexAttribArray (int index); + public void glEnableVertexAttribArray(int index); - public void glFramebufferRenderbuffer (int target, int attachment, int renderbuffertarget, int renderbuffer); + public void glFramebufferRenderbuffer(int target, int attachment, int renderbuffertarget, + int renderbuffer); - public void glFramebufferTexture2D (int target, int attachment, int textarget, int texture, int level); + public void glFramebufferTexture2D(int target, int attachment, int textarget, int texture, + int level); - public void glGenBuffers (int n, IntBuffer buffers); + public void glGenBuffers(int n, IntBuffer buffers); - public void glGenerateMipmap (int target); + public void glGenerateMipmap(int target); - public void glGenFramebuffers (int n, IntBuffer framebuffers); + public void glGenFramebuffers(int n, IntBuffer framebuffers); - public void glGenRenderbuffers (int n, IntBuffer renderbuffers); + public void glGenRenderbuffers(int n, IntBuffer renderbuffers); // deviates - public String glGetActiveAttrib (int program, int index, IntBuffer size, Buffer type); + public String glGetActiveAttrib(int program, int index, IntBuffer size, Buffer type); // deviates - public String glGetActiveUniform (int program, int index, IntBuffer size, Buffer type); + public String glGetActiveUniform(int program, int index, IntBuffer size, Buffer type); - public void glGetAttachedShaders (int program, int maxcount, Buffer count, IntBuffer shaders); + public void glGetAttachedShaders(int program, int maxcount, Buffer count, IntBuffer shaders); - public int glGetAttribLocation (int program, String name); + public int glGetAttribLocation(int program, String name); - public void glGetBooleanv (int pname, Buffer params); + public void glGetBooleanv(int pname, Buffer params); - public void glGetBufferParameteriv (int target, int pname, IntBuffer params); + public void glGetBufferParameteriv(int target, int pname, IntBuffer params); - public void glGetFloatv (int pname, FloatBuffer params); + public void glGetFloatv(int pname, FloatBuffer params); - public void glGetFramebufferAttachmentParameteriv (int target, int attachment, int pname, IntBuffer params); + public void glGetFramebufferAttachmentParameteriv(int target, int attachment, int pname, + IntBuffer params); - public void glGetProgramiv (int program, int pname, IntBuffer params); + public void glGetProgramiv(int program, int pname, IntBuffer params); // deviates - public String glGetProgramInfoLog (int program); + public String glGetProgramInfoLog(int program); - public void glGetRenderbufferParameteriv (int target, int pname, IntBuffer params); + public void glGetRenderbufferParameteriv(int target, int pname, IntBuffer params); - public void glGetShaderiv (int shader, int pname, IntBuffer params); + public void glGetShaderiv(int shader, int pname, IntBuffer params); // deviates - public String glGetShaderInfoLog (int shader); + public String glGetShaderInfoLog(int shader); - public void glGetShaderPrecisionFormat (int shadertype, int precisiontype, IntBuffer range, IntBuffer precision); + public void glGetShaderPrecisionFormat(int shadertype, int precisiontype, IntBuffer range, + IntBuffer precision); - public void glGetShaderSource (int shader, int bufsize, Buffer length, String source); + public void glGetShaderSource(int shader, int bufsize, Buffer length, String source); - public void glGetTexParameterfv (int target, int pname, FloatBuffer params); + public void glGetTexParameterfv(int target, int pname, FloatBuffer params); - public void glGetTexParameteriv (int target, int pname, IntBuffer params); + public void glGetTexParameteriv(int target, int pname, IntBuffer params); - public void glGetUniformfv (int program, int location, FloatBuffer params); + public void glGetUniformfv(int program, int location, FloatBuffer params); - public void glGetUniformiv (int program, int location, IntBuffer params); + public void glGetUniformiv(int program, int location, IntBuffer params); - public int glGetUniformLocation (int program, String name); + public int glGetUniformLocation(int program, String name); - public void glGetVertexAttribfv (int index, int pname, FloatBuffer params); + public void glGetVertexAttribfv(int index, int pname, FloatBuffer params); - public void glGetVertexAttribiv (int index, int pname, IntBuffer params); + public void glGetVertexAttribiv(int index, int pname, IntBuffer params); - public void glGetVertexAttribPointerv (int index, int pname, Buffer pointer); + public void glGetVertexAttribPointerv(int index, int pname, Buffer pointer); - public boolean glIsBuffer (int buffer); + public boolean glIsBuffer(int buffer); - public boolean glIsEnabled (int cap); + public boolean glIsEnabled(int cap); - public boolean glIsFramebuffer (int framebuffer); + public boolean glIsFramebuffer(int framebuffer); - public boolean glIsProgram (int program); + public boolean glIsProgram(int program); - public boolean glIsRenderbuffer (int renderbuffer); + public boolean glIsRenderbuffer(int renderbuffer); - public boolean glIsShader (int shader); + public boolean glIsShader(int shader); - public boolean glIsTexture (int texture); + public boolean glIsTexture(int texture); - public void glLinkProgram (int program); + public void glLinkProgram(int program); - public void glReleaseShaderCompiler (); + public void glReleaseShaderCompiler(); - public void glRenderbufferStorage (int target, int internalformat, int width, int height); + public void glRenderbufferStorage(int target, int internalformat, int width, int height); - public void glSampleCoverage (float value, boolean invert); + public void glSampleCoverage(float value, boolean invert); - public void glShaderBinary (int n, IntBuffer shaders, int binaryformat, Buffer binary, int length); + public void glShaderBinary(int n, IntBuffer shaders, int binaryformat, Buffer binary, int length); // Deviates - public void glShaderSource (int shader, String string); + public void glShaderSource(int shader, String string); - public void glStencilFuncSeparate (int face, int func, int ref, int mask); + public void glStencilFuncSeparate(int face, int func, int ref, int mask); - public void glStencilMaskSeparate (int face, int mask); + public void glStencilMaskSeparate(int face, int mask); - public void glStencilOpSeparate (int face, int fail, int zfail, int zpass); + public void glStencilOpSeparate(int face, int fail, int zfail, int zpass); - public void glTexParameterfv (int target, int pname, FloatBuffer params); + public void glTexParameterfv(int target, int pname, FloatBuffer params); - public void glTexParameteri (int target, int pname, int param); + public void glTexParameteri(int target, int pname, int param); - public void glTexParameteriv (int target, int pname, IntBuffer params); + public void glTexParameteriv(int target, int pname, IntBuffer params); - public void glUniform1f (int location, float x); + public void glUniform1f(int location, float x); - public void glUniform1fv (int location, int count, FloatBuffer v); + public void glUniform1fv(int location, int count, FloatBuffer v); - public void glUniform1i (int location, int x); + public void glUniform1i(int location, int x); - public void glUniform1iv (int location, int count, IntBuffer v); + public void glUniform1iv(int location, int count, IntBuffer v); - public void glUniform2f (int location, float x, float y); + public void glUniform2f(int location, float x, float y); - public void glUniform2fv (int location, int count, FloatBuffer v); + public void glUniform2fv(int location, int count, FloatBuffer v); - public void glUniform2i (int location, int x, int y); + public void glUniform2i(int location, int x, int y); - public void glUniform2iv (int location, int count, IntBuffer v); + public void glUniform2iv(int location, int count, IntBuffer v); - public void glUniform3f (int location, float x, float y, float z); + public void glUniform3f(int location, float x, float y, float z); - public void glUniform3fv (int location, int count, FloatBuffer v); + public void glUniform3fv(int location, int count, FloatBuffer v); - public void glUniform3i (int location, int x, int y, int z); + public void glUniform3i(int location, int x, int y, int z); - public void glUniform3iv (int location, int count, IntBuffer v); + public void glUniform3iv(int location, int count, IntBuffer v); - public void glUniform4f (int location, float x, float y, float z, float w); + public void glUniform4f(int location, float x, float y, float z, float w); - public void glUniform4fv (int location, int count, FloatBuffer v); + public void glUniform4fv(int location, int count, FloatBuffer v); - public void glUniform4i (int location, int x, int y, int z, int w); + public void glUniform4i(int location, int x, int y, int z, int w); - public void glUniform4iv (int location, int count, IntBuffer v); + public void glUniform4iv(int location, int count, IntBuffer v); - public void glUniformMatrix2fv (int location, int count, boolean transpose, FloatBuffer value); + public void glUniformMatrix2fv(int location, int count, boolean transpose, FloatBuffer value); - public void glUniformMatrix3fv (int location, int count, boolean transpose, FloatBuffer value); + public void glUniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value); - public void glUniformMatrix4fv (int location, int count, boolean transpose, FloatBuffer value); + public void glUniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value); - public void glUseProgram (int program); + public void glUseProgram(int program); - public void glValidateProgram (int program); + public void glValidateProgram(int program); - public void glVertexAttrib1f (int indx, float x); + public void glVertexAttrib1f(int indx, float x); - public void glVertexAttrib1fv (int indx, FloatBuffer values); + public void glVertexAttrib1fv(int indx, FloatBuffer values); - public void glVertexAttrib2f (int indx, float x, float y); + public void glVertexAttrib2f(int indx, float x, float y); - public void glVertexAttrib2fv (int indx, FloatBuffer values); + public void glVertexAttrib2fv(int indx, FloatBuffer values); - public void glVertexAttrib3f (int indx, float x, float y, float z); + public void glVertexAttrib3f(int indx, float x, float y, float z); - public void glVertexAttrib3fv (int indx, FloatBuffer values); + public void glVertexAttrib3fv(int indx, FloatBuffer values); - public void glVertexAttrib4f (int indx, float x, float y, float z, float w); + public void glVertexAttrib4f(int indx, float x, float y, float z, float w); - public void glVertexAttrib4fv (int indx, FloatBuffer values); + public void glVertexAttrib4fv(int indx, FloatBuffer values); - public void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, Buffer ptr); - - public void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, int ptr); + public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, + Buffer ptr); + public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, + int ptr); //------------------------ @@ -550,89 +558,96 @@ public interface GL20 { public static final int GL_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE; public static final int GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF; - public void glActiveTexture (int texture); + public void glActiveTexture(int texture); - public void glBindTexture (int target, int texture); + public void glBindTexture(int target, int texture); - public void glBlendFunc (int sfactor, int dfactor); + public void glBlendFunc(int sfactor, int dfactor); - public void glClear (int mask); + public void glClear(int mask); - public void glClearColor (float red, float green, float blue, float alpha); + public void glClearColor(float red, float green, float blue, float alpha); - public void glClearDepthf (float depth); + public void glClearDepthf(float depth); - public void glClearStencil (int s); + public void glClearStencil(int s); - public void glColorMask (boolean red, boolean green, boolean blue, boolean alpha); + public void glColorMask(boolean red, boolean green, boolean blue, boolean alpha); - public void glCompressedTexImage2D (int target, int level, int internalformat, int width, int height, int border, - int imageSize, Buffer data); + public void glCompressedTexImage2D(int target, int level, int internalformat, int width, + int height, int border, + int imageSize, Buffer data); - public void glCompressedTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, - int imageSize, Buffer data); + public void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset, + int width, int height, int format, + int imageSize, Buffer data); - public void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border); + public void glCopyTexImage2D(int target, int level, int internalformat, int x, int y, + int width, int height, int border); - public void glCopyTexSubImage2D (int target, int level, int xoffset, int yoffset, int x, int y, int width, int height); + public void glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y, + int width, int height); - public void glCullFace (int mode); + public void glCullFace(int mode); - public void glDeleteTextures (int n, IntBuffer textures); + public void glDeleteTextures(int n, IntBuffer textures); - public void glDepthFunc (int func); + public void glDepthFunc(int func); - public void glDepthMask (boolean flag); + public void glDepthMask(boolean flag); - public void glDepthRangef (float zNear, float zFar); + public void glDepthRangef(float zNear, float zFar); - public void glDisable (int cap); + public void glDisable(int cap); - public void glDrawArrays (int mode, int first, int count); + public void glDrawArrays(int mode, int first, int count); - public void glDrawElements (int mode, int count, int type, Buffer indices); + public void glDrawElements(int mode, int count, int type, Buffer indices); - public void glEnable (int cap); + public void glEnable(int cap); - public void glFinish (); + public void glFinish(); - public void glFlush (); + public void glFlush(); - public void glFrontFace (int mode); + public void glFrontFace(int mode); - public void glGenTextures (int n, IntBuffer textures); + public void glGenTextures(int n, IntBuffer textures); - public int glGetError (); + public int glGetError(); - public void glGetIntegerv (int pname, IntBuffer params); + public void glGetIntegerv(int pname, IntBuffer params); - public String glGetString (int name); + public String glGetString(int name); - public void glHint (int target, int mode); + public void glHint(int target, int mode); - public void glLineWidth (float width); + public void glLineWidth(float width); - public void glPixelStorei (int pname, int param); + public void glPixelStorei(int pname, int param); - public void glPolygonOffset (float factor, float units); + public void glPolygonOffset(float factor, float units); - public void glReadPixels (int x, int y, int width, int height, int format, int type, Buffer pixels); + public void glReadPixels(int x, int y, int width, int height, int format, int type, + Buffer pixels); - public void glScissor (int x, int y, int width, int height); + public void glScissor(int x, int y, int width, int height); - public void glStencilFunc (int func, int ref, int mask); + public void glStencilFunc(int func, int ref, int mask); - public void glStencilMask (int mask); + public void glStencilMask(int mask); - public void glStencilOp (int fail, int zfail, int zpass); + public void glStencilOp(int fail, int zfail, int zpass); - public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, - Buffer pixels); + public void glTexImage2D(int target, int level, int internalformat, int width, int height, + int border, int format, int type, + Buffer pixels); - public void glTexParameterf (int target, int pname, float param); + public void glTexParameterf(int target, int pname, float param); - public void glTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, - Buffer pixels); + public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, + int height, int format, int type, + Buffer pixels); - public void glViewport (int x, int y, int width, int height); + public void glViewport(int x, int y, int width, int height); } diff --git a/vtm/src/org/oscim/backend/canvas/Color.java b/vtm/src/org/oscim/backend/canvas/Color.java index b7942d2f..083fd51a 100644 --- a/vtm/src/org/oscim/backend/canvas/Color.java +++ b/vtm/src/org/oscim/backend/canvas/Color.java @@ -15,45 +15,45 @@ */ package org.oscim.backend.canvas; -public class Color { - public static final int BLACK = 0xFF000000; - public static final int DKGRAY = 0xFF444444; - public static final int GRAY = 0xFF888888; - public static final int LTGRAY = 0xFFCCCCCC; - public static final int WHITE = 0xFFFFFFFF; - public static final int RED = 0xFFFF0000; - public static final int GREEN = 0xFF00FF00; - public static final int BLUE = 0xFF0000FF; - public static final int YELLOW = 0xFFFFFF00; - public static final int CYAN = 0xFF00FFFF; - public static final int MAGENTA = 0xFFFF00FF; - public static final int TRANSPARENT = 0; +public class Color { + public static final int BLACK = 0xFF000000; + public static final int DKGRAY = 0xFF444444; + public static final int GRAY = 0xFF888888; + public static final int LTGRAY = 0xFFCCCCCC; + public static final int WHITE = 0xFFFFFFFF; + public static final int RED = 0xFFFF0000; + public static final int GREEN = 0xFF00FF00; + public static final int BLUE = 0xFF0000FF; + public static final int YELLOW = 0xFFFFFF00; + public static final int CYAN = 0xFF00FFFF; + public static final int MAGENTA = 0xFFFF00FF; + public static final int TRANSPARENT = 0; - public static int get(int r, int g ,int b){ - return 0xff << 24 | r << 16 | g << 8 | b; - } + public static int get(int r, int g, int b) { + return 0xff << 24 | r << 16 | g << 8 | b; + } - /** - * Parse the color string, and return the corresponding color-int. - * If the string cannot be parsed, throws an IllegalArgumentException - * exception. Supported formats are: - * #RRGGBB - * #AARRGGBB - * 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta', - * 'yellow', 'lightgray', 'darkgray' - */ - public static int parseColor(String colorString) { - if (colorString.charAt(0) == '#') { - // Use a long to avoid rollovers on #ffXXXXXX - long color = Long.parseLong(colorString.substring(1), 16); - if (colorString.length() == 7) { - // Set the alpha value - color |= 0x00000000ff000000; - } else if (colorString.length() != 9) { - throw new IllegalArgumentException("Unknown color"); - } - return (int)color; - } - throw new IllegalArgumentException("Unknown color"); - } + /** + * Parse the color string, and return the corresponding color-int. + * If the string cannot be parsed, throws an IllegalArgumentException + * exception. Supported formats are: + * #RRGGBB + * #AARRGGBB + * 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta', + * 'yellow', 'lightgray', 'darkgray' + */ + public static int parseColor(String colorString) { + if (colorString.charAt(0) == '#') { + // Use a long to avoid rollovers on #ffXXXXXX + long color = Long.parseLong(colorString.substring(1), 16); + if (colorString.length() == 7) { + // Set the alpha value + color |= 0x00000000ff000000; + } else if (colorString.length() != 9) { + throw new IllegalArgumentException("Unknown color"); + } + return (int) color; + } + throw new IllegalArgumentException("Unknown color"); + } } diff --git a/vtm/src/org/oscim/core/BoundingBox.java b/vtm/src/org/oscim/core/BoundingBox.java index 084a07f5..68e2a857 100644 --- a/vtm/src/org/oscim/core/BoundingBox.java +++ b/vtm/src/org/oscim/core/BoundingBox.java @@ -74,7 +74,7 @@ public class BoundingBox { } public BoundingBox(double minLatitude, double minLongitude, double maxLatitude, - double maxLongitude) { + double maxLongitude) { this.minLatitudeE6 = (int) (minLatitude * 1E6); this.minLongitudeE6 = (int) (minLongitude * 1E6); this.maxLatitudeE6 = (int) (maxLatitude * 1E6); @@ -90,9 +90,9 @@ public class BoundingBox { */ public boolean contains(GeoPoint geoPoint) { return geoPoint.latitudeE6 <= maxLatitudeE6 - && geoPoint.latitudeE6 >= minLatitudeE6 - && geoPoint.longitudeE6 <= maxLongitudeE6 - && geoPoint.longitudeE6 >= minLongitudeE6; + && geoPoint.latitudeE6 >= minLatitudeE6 + && geoPoint.longitudeE6 <= maxLongitudeE6 + && geoPoint.longitudeE6 >= minLongitudeE6; } @Override @@ -123,7 +123,7 @@ public class BoundingBox { int latitudeOffset = (maxLatitudeE6 - minLatitudeE6) / 2; int longitudeOffset = (maxLongitudeE6 - minLongitudeE6) / 2; return new GeoPoint(minLatitudeE6 + latitudeOffset, minLongitudeE6 - + longitudeOffset); + + longitudeOffset); } /** diff --git a/vtm/src/org/oscim/core/Box.java b/vtm/src/org/oscim/core/Box.java index 3ec66142..c3b0016a 100644 --- a/vtm/src/org/oscim/core/Box.java +++ b/vtm/src/org/oscim/core/Box.java @@ -40,7 +40,7 @@ public class Box { /** * Instantiates a new Box. - * + * * @param minX the min x * @param minY the min y * @param maxX the max x @@ -55,7 +55,7 @@ public class Box { /** * Check if Box contains point defined by coordinates x and y. - * + * * @param x the x ordinate * @param y the y ordinate * @return true, if point is inside box. @@ -66,7 +66,7 @@ public class Box { /** * Check if Box contains Point. - * + * * @param p the point * @return true, if point is inside box. */ diff --git a/vtm/src/org/oscim/core/MapPosition.java b/vtm/src/org/oscim/core/MapPosition.java index 4854e96a..2bf75367 100644 --- a/vtm/src/org/oscim/core/MapPosition.java +++ b/vtm/src/org/oscim/core/MapPosition.java @@ -56,7 +56,7 @@ public class MapPosition { this.scale = scale; } - public void setPosition(GeoPoint geoPoint){ + public void setPosition(GeoPoint geoPoint) { setPosition(geoPoint.getLatitude(), geoPoint.getLongitude()); } @@ -81,7 +81,7 @@ public class MapPosition { public GeoPoint getGeoPoint() { return new GeoPoint(MercatorProjection.toLatitude(y), - MercatorProjection.toLongitude(x)); + MercatorProjection.toLongitude(x)); } public double getLatitude() { diff --git a/vtm/src/org/oscim/core/MercatorProjection.java b/vtm/src/org/oscim/core/MercatorProjection.java index 4b62b138..7c730bc4 100644 --- a/vtm/src/org/oscim/core/MercatorProjection.java +++ b/vtm/src/org/oscim/core/MercatorProjection.java @@ -47,7 +47,7 @@ public final class MercatorProjection { /** * Calculates the distance on the ground that is represented by a single * pixel on the map. - * + * * @param latitude * the latitude coordinate at which the resolution should be * calculated. @@ -57,12 +57,12 @@ public final class MercatorProjection { */ public static double calculateGroundResolution(double latitude, double scale) { return Math.cos(latitude * (Math.PI / 180)) * EARTH_CIRCUMFERENCE - / (Tile.SIZE * scale); + / (Tile.SIZE * scale); } /** * Projects a longitude coordinate (in degrees) to the range [0.0,1.0] - * + * * @param latitude * the latitude coordinate that should be converted. * @return the position . @@ -78,7 +78,7 @@ public final class MercatorProjection { /** * Projects a longitude coordinate (in degrees) to the range [0.0,1.0] - * + * * @param longitude * the longitude coordinate that should be converted. * @return the position . @@ -108,7 +108,8 @@ public final class MercatorProjection { out[pos * 2] = ((p.longitudeE6 / 1E6) + 180.0) / 360.0; double sinLatitude = Math.sin((p.latitudeE6 / 1E6) * (Math.PI / 180.0)); - out[pos * 2 +1] = 0.5 - Math.log((1.0 + sinLatitude) / (1.0 - sinLatitude)) / (4.0 * Math.PI); + out[pos * 2 + 1] = 0.5 - Math.log((1.0 + sinLatitude) / (1.0 - sinLatitude)) + / (4.0 * Math.PI); } public static void project(double latitude, double longitude, double[] out, int pos) { @@ -116,7 +117,8 @@ public final class MercatorProjection { out[pos * 2] = (longitude + 180.0) / 360.0; double sinLatitude = Math.sin(latitude * (Math.PI / 180.0)); - out[pos * 2 +1] = 0.5 - Math.log((1.0 + sinLatitude) / (1.0 - sinLatitude)) / (4.0 * Math.PI); + out[pos * 2 + 1] = 0.5 - Math.log((1.0 + sinLatitude) / (1.0 - sinLatitude)) + / (4.0 * Math.PI); } /** diff --git a/vtm/src/org/oscim/core/Point.java b/vtm/src/org/oscim/core/Point.java index 5e8c01ed..81b694a3 100644 --- a/vtm/src/org/oscim/core/Point.java +++ b/vtm/src/org/oscim/core/Point.java @@ -17,21 +17,25 @@ package org.oscim.core; public class Point { public double x; public double y; + public Point() { } - public Point(double x, double y){ + + public Point(double x, double y) { this.x = x; this.y = y; } - public double getX(){ + + public double getX() { return x; } - public double getY(){ + + public double getY() { return y; } @Override - public String toString(){ + public String toString() { return x + " " + y; } } diff --git a/vtm/src/org/oscim/core/TagSet.java b/vtm/src/org/oscim/core/TagSet.java index 1d3ec3ec..04135465 100644 --- a/vtm/src/org/oscim/core/TagSet.java +++ b/vtm/src/org/oscim/core/TagSet.java @@ -16,7 +16,6 @@ package org.oscim.core; import java.util.Arrays; - public class TagSet { public static TagSet EMPTY_TAG_SET = new TagSet(); @@ -37,6 +36,7 @@ public class TagSet { /** * null out current tags + * * @param nulltags ... */ public void clear(boolean nulltags) { @@ -44,7 +44,7 @@ public class TagSet { numTags = 0; } - public Tag[] asArray(){ + public Tag[] asArray() { Tag[] result = new Tag[numTags]; System.arraycopy(tags, 0, result, 0, numTags); return result; @@ -58,7 +58,8 @@ public class TagSet { } return null; } - public boolean containsKey(String key){ + + public boolean containsKey(String key) { for (int i = 0; i < numTags; i++) { if (tags[i].key == key) return true; @@ -66,7 +67,7 @@ public class TagSet { return false; } - public String getValue(String key){ + public String getValue(String key) { for (int i = 0; i < numTags; i++) { if (tags[i].key == key) return tags[i].value; @@ -74,7 +75,7 @@ public class TagSet { return null; } - public boolean contains(String key, String value){ + public boolean contains(String key, String value) { for (int i = 0; i < numTags; i++) { if (tags[i].key == key) return value.equals(tags[i].value); @@ -91,7 +92,7 @@ public class TagSet { tags[numTags++] = tag; } - public void set(Tag[] tagArray){ + public void set(Tag[] tagArray) { int newTags = tagArray.length; if (newTags > tags.length) tags = new Tag[tagArray.length]; @@ -147,7 +148,7 @@ public class TagSet { return false; } - public String asString(){ + public String asString() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < numTags; i++) sb.append(tags[i]); diff --git a/vtm/src/org/oscim/core/Tile.java b/vtm/src/org/oscim/core/Tile.java index 14bfc448..3e49dcdd 100644 --- a/vtm/src/org/oscim/core/Tile.java +++ b/vtm/src/org/oscim/core/Tile.java @@ -79,7 +79,7 @@ public class Tile { Tile o = (Tile) obj; if (o.tileX == this.tileX && o.tileY == this.tileY - && o.zoomLevel == this.zoomLevel) + && o.zoomLevel == this.zoomLevel) return true; return false; diff --git a/vtm/src/org/oscim/event/EventDispatcher.java b/vtm/src/org/oscim/event/EventDispatcher.java index 1b0667cb..8c8ee368 100644 --- a/vtm/src/org/oscim/event/EventDispatcher.java +++ b/vtm/src/org/oscim/event/EventDispatcher.java @@ -3,5 +3,6 @@ package org.oscim.event; public interface EventDispatcher { public void addListener(String type, EventListener listener); + public void removeListener(String type, EventListener listener); } diff --git a/vtm/src/org/oscim/event/KeyEvent.java b/vtm/src/org/oscim/event/KeyEvent.java index 39c22be2..a59ce9a9 100644 --- a/vtm/src/org/oscim/event/KeyEvent.java +++ b/vtm/src/org/oscim/event/KeyEvent.java @@ -14,7 +14,7 @@ */ package org.oscim.event; -public class KeyEvent extends MapEvent{ +public class KeyEvent extends MapEvent { private static final long serialVersionUID = 1L; diff --git a/vtm/src/org/oscim/event/MapEvent.java b/vtm/src/org/oscim/event/MapEvent.java index f6cbf3f1..ab3be154 100644 --- a/vtm/src/org/oscim/event/MapEvent.java +++ b/vtm/src/org/oscim/event/MapEvent.java @@ -6,7 +6,6 @@ public class MapEvent extends EventObject { private static final long serialVersionUID = 1L; - public MapEvent(Object source) { super(source); } diff --git a/vtm/src/org/oscim/event/MotionEvent.java b/vtm/src/org/oscim/event/MotionEvent.java index 5fbecb5c..bba5762b 100644 --- a/vtm/src/org/oscim/event/MotionEvent.java +++ b/vtm/src/org/oscim/event/MotionEvent.java @@ -14,7 +14,6 @@ */ package org.oscim.event; - public abstract class MotionEvent extends MapEvent { private static final long serialVersionUID = 1L; diff --git a/vtm/src/org/oscim/event/TouchListener.java b/vtm/src/org/oscim/event/TouchListener.java index dc0d4e39..d85c3ce4 100644 --- a/vtm/src/org/oscim/event/TouchListener.java +++ b/vtm/src/org/oscim/event/TouchListener.java @@ -4,6 +4,8 @@ import org.oscim.core.MapPosition; public interface TouchListener { boolean onPress(MotionEvent e, MapPosition pos); + boolean onLongPress(MotionEvent e, MapPosition pos); + boolean onTap(MotionEvent e, MapPosition pos); } diff --git a/vtm/src/org/oscim/layers/CustomRenderLayer.java b/vtm/src/org/oscim/layers/CustomRenderLayer.java index 6846c111..20d78ef3 100644 --- a/vtm/src/org/oscim/layers/CustomRenderLayer.java +++ b/vtm/src/org/oscim/layers/CustomRenderLayer.java @@ -3,16 +3,16 @@ package org.oscim.layers; import org.oscim.backend.Log; import org.oscim.core.MapPosition; import org.oscim.map.Map; +import org.oscim.map.Map.UpdateListener; import org.oscim.renderer.LayerRenderer; import org.oscim.renderer.MapRenderer.Matrices; -public class CustomRenderLayer extends Layer { +public class CustomRenderLayer extends Layer implements UpdateListener { private static final String TAG = CustomRenderLayer.class.getName(); class CustomRenderer extends LayerRenderer { - // functions running on MapRender Thread @Override protected void update(MapPosition pos, boolean changed, Matrices matrices) { @@ -33,7 +33,6 @@ public class CustomRenderLayer extends Layer { @Override protected void render(MapPosition pos, Matrices m) { } - } public CustomRenderLayer(Map map, LayerRenderer renderer) { @@ -44,14 +43,11 @@ public class CustomRenderLayer extends Layer { private int someConccurentVariable; -// @Override -// public void onUpdate(MapPosition mapPosition, boolean changed, boolean clear) { -// -// synchronized (mRenderer) { -// // chang -// someConccurentVariable++; -// } -// -// } + @Override + public void onMapUpdate(MapPosition mapPosition, boolean changed, boolean clear) { + synchronized (mRenderer) { + someConccurentVariable++; + } + } } diff --git a/vtm/src/org/oscim/layers/MapEventLayer.java b/vtm/src/org/oscim/layers/MapEventLayer.java index 136e0a62..a562f608 100644 --- a/vtm/src/org/oscim/layers/MapEventLayer.java +++ b/vtm/src/org/oscim/layers/MapEventLayer.java @@ -24,7 +24,7 @@ import org.oscim.map.Viewport; /** * Changes Viewport for scroll, fling, scale, rotation and tilt gestures - * + * * @TODO: * - better recognition of tilt/rotate/scale state * one could check change of rotation / scale within a @@ -78,10 +78,11 @@ public class MapEventLayer extends Layer implements EventListener { } @Override - public void handleEvent(MapEvent event){ + public void handleEvent(MapEvent event) { if (event instanceof MotionEvent) - onTouchEvent((MotionEvent)event); + onTouchEvent((MotionEvent) event); } + //private long mPrevTime; private boolean mEnableRotation = true; @@ -243,13 +244,13 @@ public class MapEventLayer extends Layer implements EventListener { //Log.d(TAG, r + " " + slope + " m1:" + my + " m2:" + my2); if ((my > threshold && my2 > threshold) - || (my < -threshold && my2 < -threshold)) + || (my < -threshold && my2 < -threshold)) { mBeginTilt = true; changed = mMapPosition.tiltMap(my / 5); } } else if (mEnableRotation && !mBeginTilt && - (mBeginRotate || Math.abs(r) > PINCH_ROTATE_THRESHOLD)) { + (mBeginRotate || Math.abs(r) > PINCH_ROTATE_THRESHOLD)) { //Log.d(TAG, "rotate: " + mBeginRotate + " " + Math.toDegrees(rad)); if (!mBeginRotate) { mAngle = rad; @@ -312,10 +313,9 @@ public class MapEventLayer extends Layer implements EventListener { int w = Tile.SIZE * 3; int h = Tile.SIZE * 3; - mMap.getAnimator().animateFling( - Math.round(velocityX), - Math.round(velocityY), - -w, w, -h, h); + mMap.getAnimator().animateFling(Math.round(velocityX), + Math.round(velocityY), + -w, w, -h, h); return true; } diff --git a/vtm/src/org/oscim/layers/PathLayer.java b/vtm/src/org/oscim/layers/PathLayer.java index 331d9af5..d615ddf3 100644 --- a/vtm/src/org/oscim/layers/PathLayer.java +++ b/vtm/src/org/oscim/layers/PathLayer.java @@ -249,7 +249,7 @@ public class PathLayer extends Layer { /** * Draw a great circle. Calculate a point for every 100km along the path. - * + * * @param startPoint * start point of the great circle * @param endPoint @@ -270,7 +270,7 @@ public class PathLayer extends Layer { /** * Draw a great circle. - * + * * @param startPoint * start point of the great circle * @param endPoint @@ -279,7 +279,7 @@ public class PathLayer extends Layer { * number of points to calculate along the path */ public void addGreatCircle(GeoPoint startPoint, GeoPoint endPoint, - final int numberOfPoints) { + 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 @@ -291,13 +291,14 @@ public class PathLayer extends Layer { final double lon2 = endPoint.getLongitude() * Math.PI / 180; final double d = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin((lat1 - lat2) / 2), 2) - + Math.cos(lat1) * Math.cos(lat2) - * Math.pow(Math.sin((lon1 - lon2) / 2), 2))); + + Math.cos(lat1) * Math.cos(lat2) + * Math.pow(Math.sin((lon1 - lon2) / 2), 2))); double bearing = Math.atan2( - Math.sin(lon1 - lon2) * Math.cos(lat2), - Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) - * Math.cos(lon1 - lon2)) - / -(Math.PI / 180); + Math.sin(lon1 - lon2) * Math.cos(lat2), + Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) + * Math.cos(lat2) + * Math.cos(lon1 - lon2)) + / -(Math.PI / 180); bearing = bearing < 0 ? 360 + bearing : bearing; for (int i = 0, j = numberOfPoints + 1; i < j; i++) { @@ -305,9 +306,9 @@ public class PathLayer extends Layer { final double A = Math.sin((1 - f) * d) / Math.sin(d); final double B = Math.sin(f * d) / Math.sin(d); final double x = A * Math.cos(lat1) * Math.cos(lon1) + B * Math.cos(lat2) - * Math.cos(lon2); + * Math.cos(lon2); final double y = A * Math.cos(lat1) * Math.sin(lon1) + B * Math.cos(lat2) - * Math.sin(lon2); + * Math.sin(lon2); final double z = A * Math.sin(lat1) + B * Math.sin(lat2); final double latN = Math.atan2(z, Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))); diff --git a/vtm/src/org/oscim/layers/marker/ItemizedIconLayer.java b/vtm/src/org/oscim/layers/marker/ItemizedIconLayer.java index dfe5db6e..eb0082de 100644 --- a/vtm/src/org/oscim/layers/marker/ItemizedIconLayer.java +++ b/vtm/src/org/oscim/layers/marker/ItemizedIconLayer.java @@ -26,7 +26,7 @@ import org.oscim.map.Map; import org.oscim.map.Viewport; public class ItemizedIconLayer extends ItemizedLayer - implements TouchListener { + implements TouchListener { //private static final String TAG = ItemizedIconOverlay.class.getName(); protected final List mItemList; @@ -36,8 +36,8 @@ public class ItemizedIconLayer extends ItemizedLayer list, - MarkerSymbol defaultMarker, - ItemizedIconLayer.OnItemGestureListener onItemGestureListener) { + MarkerSymbol defaultMarker, + ItemizedIconLayer.OnItemGestureListener onItemGestureListener) { super(map, defaultMarker); @@ -157,6 +157,7 @@ public class ItemizedIconLayer extends ItemizedLayer extends ItemizedLayer * .... */ diff --git a/vtm/src/org/oscim/layers/marker/ItemizedLayer.java b/vtm/src/org/oscim/layers/marker/ItemizedLayer.java index fb1d57cb..8d252a17 100644 --- a/vtm/src/org/oscim/layers/marker/ItemizedLayer.java +++ b/vtm/src/org/oscim/layers/marker/ItemizedLayer.java @@ -43,12 +43,12 @@ import org.oscim.utils.GeometryUtils; * lowest index is drawn as last and therefore the 'topmost' marker. It also * gets checked for onTap first. This class is generic, because you then you get * your custom item-class passed back in onTap(). - * + * * @param * ... */ public abstract class ItemizedLayer extends MarkerLayer implements - MarkerLayer.Snappable { + MarkerLayer.Snappable { //private final static String TAG = ItemizedOverlay.class.getName(); @@ -183,7 +183,7 @@ public abstract class ItemizedLayer extends MarkerLayer /** * Method by which subclasses create the actual Items. This will only be * called from populate() we'll cache them for later use. - * + * * @param i * ... * @return ... @@ -192,7 +192,7 @@ public abstract class ItemizedLayer extends MarkerLayer /** * The number of items in this overlay. - * + * * @return ... */ public abstract int size(); @@ -249,7 +249,7 @@ public abstract class ItemizedLayer extends MarkerLayer /** * Returns the Item at the given index. - * + * * @param position * the position of the item to return * @return the Item of the given index. @@ -274,7 +274,7 @@ public abstract class ItemizedLayer extends MarkerLayer * move the map, so if the Item isn't already centered, the user may get * confused. If the Item is not found, this is a no-op. You can also pass * null to remove focus. - * + * * @param item * ... */ diff --git a/vtm/src/org/oscim/layers/marker/MarkerItem.java b/vtm/src/org/oscim/layers/marker/MarkerItem.java index 0a792448..3725265b 100644 --- a/vtm/src/org/oscim/layers/marker/MarkerItem.java +++ b/vtm/src/org/oscim/layers/marker/MarkerItem.java @@ -21,7 +21,7 @@ import org.oscim.core.GeoPoint; /** * Immutable class describing a GeoPoint with a Title and a Description. - * + * * @author Nicolas Gramlich * @author Theodore Hong * @author Fred Eisele @@ -64,7 +64,7 @@ public class MarkerItem { } public MarkerItem(String uid, String title, String description, - GeoPoint geoPoint) { + GeoPoint geoPoint) { mTitle = title; mDescription = description; mGeoPoint = geoPoint; diff --git a/vtm/src/org/oscim/layers/marker/MarkerLayer.java b/vtm/src/org/oscim/layers/marker/MarkerLayer.java index 15305407..f55e53e0 100644 --- a/vtm/src/org/oscim/layers/marker/MarkerLayer.java +++ b/vtm/src/org/oscim/layers/marker/MarkerLayer.java @@ -28,18 +28,18 @@ public abstract class MarkerLayer extends Layer { /** * TBD - * + * * Interface definition for overlays that contain items that can be snapped * to (for example, when the user invokes a zoom, this could be called * allowing the user to snap the zoom to an interesting point.) - * + * */ public interface Snappable { /** * Checks to see if the given x and y are close enough to an item * resulting in snapping the current action (e.g. zoom) to the item. - * + * * @param x * The x in screen coordinates. * @param y diff --git a/vtm/src/org/oscim/layers/tile/bitmap/ArcGISWorldShaded.java b/vtm/src/org/oscim/layers/tile/bitmap/ArcGISWorldShaded.java index 3c3b889d..2a65e623 100644 --- a/vtm/src/org/oscim/layers/tile/bitmap/ArcGISWorldShaded.java +++ b/vtm/src/org/oscim/layers/tile/bitmap/ArcGISWorldShaded.java @@ -20,8 +20,10 @@ import java.net.URL; import org.oscim.core.Tile; //http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/5/14/14 //http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer + public class ArcGISWorldShaded extends AbstractTileSource { - public static final ArcGISWorldShaded INSTANCE = new ArcGISWorldShaded("server.arcgisonline.com", 80); + public static final ArcGISWorldShaded INSTANCE = new ArcGISWorldShaded("server.arcgisonline.com", + 80); private static final int PARALLEL_REQUESTS_LIMIT = 4; private static final String PROTOCOL = "http"; private static final int ZOOM_LEVEL_MAX = 6; diff --git a/vtm/src/org/oscim/layers/tile/bitmap/BitmapTileLayer.java b/vtm/src/org/oscim/layers/tile/bitmap/BitmapTileLayer.java index 58214650..2b2f5695 100644 --- a/vtm/src/org/oscim/layers/tile/bitmap/BitmapTileLayer.java +++ b/vtm/src/org/oscim/layers/tile/bitmap/BitmapTileLayer.java @@ -34,8 +34,7 @@ import org.oscim.tiling.TileLoader; import org.oscim.tiling.TileManager; import org.oscim.utils.FastMath; - -public class BitmapTileLayer extends TileLayer { +public class BitmapTileLayer extends TileLayer { private static final int TIMEOUT_CONNECT = 5000; private static final int TIMEOUT_READ = 10000; protected static final String TAG = BitmapTileLayer.class.getName(); @@ -50,7 +49,6 @@ public class BitmapTileLayer extends TileLayer { } - @Override public void onMapUpdate(MapPosition pos, boolean changed, boolean clear) { super.onMapUpdate(pos, changed, clear); @@ -70,7 +68,7 @@ public class BitmapTileLayer extends TileLayer { break; } double range = f.scaleEnd / f.scaleStart; - float a = (float)((range - (pos.scale / f.scaleStart)) / range); + float a = (float) ((range - (pos.scale / f.scaleStart)) / range); a = FastMath.clamp(a, 0, 1); // interpolate alpha between start and end alpha = a * f.alphaStart + (1 - a) * f.alphaEnd; diff --git a/vtm/src/org/oscim/layers/tile/bitmap/NaturalEarth.java b/vtm/src/org/oscim/layers/tile/bitmap/NaturalEarth.java index baa53ef0..7867e66e 100644 --- a/vtm/src/org/oscim/layers/tile/bitmap/NaturalEarth.java +++ b/vtm/src/org/oscim/layers/tile/bitmap/NaturalEarth.java @@ -21,7 +21,7 @@ import org.oscim.core.Tile; public class NaturalEarth extends AbstractTileSource { public static final NaturalEarth INSTANCE = new NaturalEarth("city.informatik.uni-bremen.de", - 80); + 80); private static final int PARALLEL_REQUESTS_LIMIT = 4; private static final String PROTOCOL = "http"; private static final int ZOOM_LEVEL_MAX = 8; @@ -65,10 +65,10 @@ public class NaturalEarth extends AbstractTileSource { @Override public FadeStep[] getFadeSteps() { return new FadeStep[] { - new FadeStep(ZOOM_LEVEL_MIN, ZOOM_LEVEL_MAX - 1, 1, 0.7f), - // dont fade between zoom-min/max - // fade above zoom max + 2, interpolate 1 to 0 - new FadeStep(ZOOM_LEVEL_MAX - 1, ZOOM_LEVEL_MAX + 1, 0.7f, 0) + new FadeStep(ZOOM_LEVEL_MIN, ZOOM_LEVEL_MAX - 1, 1, 0.7f), + // dont fade between zoom-min/max + // fade above zoom max + 2, interpolate 1 to 0 + new FadeStep(ZOOM_LEVEL_MAX - 1, ZOOM_LEVEL_MAX + 1, 0.7f, 0) }; } } diff --git a/vtm/src/org/oscim/layers/tile/bitmap/TileSource.java b/vtm/src/org/oscim/layers/tile/bitmap/TileSource.java index 49fe643b..8ce14214 100644 --- a/vtm/src/org/oscim/layers/tile/bitmap/TileSource.java +++ b/vtm/src/org/oscim/layers/tile/bitmap/TileSource.java @@ -21,7 +21,8 @@ import org.oscim.core.Tile; public interface TileSource { /** - * @return the maximum number of parallel requests which this {@code TileSource} supports. + * @return the maximum number of parallel requests which this + * {@code TileSource} supports. */ int getParallelRequestsLimit(); @@ -42,7 +43,7 @@ public interface TileSource { FadeStep[] getFadeSteps(); - public class FadeStep{ + public class FadeStep { public final double scaleStart, scaleEnd; public final float alphaStart, alphaEnd; diff --git a/vtm/src/org/oscim/layers/tile/vector/VectorTileLayer.java b/vtm/src/org/oscim/layers/tile/vector/VectorTileLayer.java index b8c38a50..97eb12b8 100644 --- a/vtm/src/org/oscim/layers/tile/vector/VectorTileLayer.java +++ b/vtm/src/org/oscim/layers/tile/vector/VectorTileLayer.java @@ -45,7 +45,7 @@ public class VectorTileLayer extends TileLayer { /** * Sets the {@link TileSource} used by {@link TileLoader}. - * + * * @return true when new TileSource was set (has changed) */ public boolean setTileSource(TileSource tileSource) { diff --git a/vtm/src/org/oscim/layers/tile/vector/VectorTileLoader.java b/vtm/src/org/oscim/layers/tile/vector/VectorTileLoader.java index 8fd2036b..b16ebdc8 100644 --- a/vtm/src/org/oscim/layers/tile/vector/VectorTileLoader.java +++ b/vtm/src/org/oscim/layers/tile/vector/VectorTileLoader.java @@ -124,8 +124,8 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac mLineScale *= 0.4f + 0.6f * ((float) Math.sin(Math.abs(lat) * (Math.PI / 180))); mGroundScale = (float) (Math.cos(lat * (Math.PI / 180)) - * MercatorProjection.EARTH_CIRCUMFERENCE - / ((long) Tile.SIZE << tile.zoomLevel)); + * MercatorProjection.EARTH_CIRCUMFERENCE + / ((long) Tile.SIZE << tile.zoomLevel)); mTile = tile; mTile.layers = new ElementLayers(); 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 d76da417..3950e7d4 100644 --- a/vtm/src/org/oscim/layers/tile/vector/labeling/Debug.java +++ b/vtm/src/org/oscim/layers/tile/vector/labeling/Debug.java @@ -25,7 +25,7 @@ class Debug { private final static float[] mDebugPoints = new float[4]; static void addDebugBox(ElementLayers dbg, Label l, TextItem ti, int overlaps, boolean prev, - float scale) { + float scale) { LineLayer ll; if (prev) { diff --git a/vtm/src/org/oscim/layers/tile/vector/labeling/Label.java b/vtm/src/org/oscim/layers/tile/vector/labeling/Label.java index 471ba5ca..aa42a47a 100644 --- a/vtm/src/org/oscim/layers/tile/vector/labeling/Label.java +++ b/vtm/src/org/oscim/layers/tile/vector/labeling/Label.java @@ -52,9 +52,8 @@ class Label extends TextItem { this.y2 = y + text.fontHeight / 2; } - static int comparePriority(Label l1, Label l2){ - + static int comparePriority(Label l1, Label l2) { return 0; } -} \ No newline at end of file +} 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 37741a30..fdc5497a 100644 --- a/vtm/src/org/oscim/layers/tile/vector/labeling/LabelLayer.java +++ b/vtm/src/org/oscim/layers/tile/vector/labeling/LabelLayer.java @@ -49,7 +49,7 @@ public class LabelLayer extends Layer implements EventListener, Map.UpdateListen @Override public void handleEvent(MapEvent event) { - if (event instanceof MotionEvent) { + if (event instanceof MotionEvent) { MotionEvent e = (MotionEvent) event; int action = e.getAction() & MotionEvent.ACTION_MASK; @@ -68,11 +68,11 @@ public class LabelLayer extends Layer implements EventListener, Map.UpdateListen } } - @Override - public void onMapUpdate(MapPosition mapPosition, boolean changed, boolean clear) { - if (clear) - mTextRenderer.clearLabels(); - } + @Override + public void onMapUpdate(MapPosition mapPosition, boolean changed, boolean clear) { + if (clear) + mTextRenderer.clearLabels(); + } // @Override // public boolean onTouchEvent(MotionEvent e) { diff --git a/vtm/src/org/oscim/layers/tile/vector/labeling/TextRenderer.java b/vtm/src/org/oscim/layers/tile/vector/labeling/TextRenderer.java index 6ee61b1b..5477abfb 100644 --- a/vtm/src/org/oscim/layers/tile/vector/labeling/TextRenderer.java +++ b/vtm/src/org/oscim/layers/tile/vector/labeling/TextRenderer.java @@ -163,12 +163,12 @@ class TextRenderer extends ElementRenderer { // find other label with same text style if (l.text == ll.text) { while (ll.next != null - // break if next item uses different text style - && l.text == ll.next.text - // check same string instance - && l.string != ll.string - // check same string - && !l.string.equals(ll.string)) + // break if next item uses different text style + && l.text == ll.next.text + // check same string instance + && l.string != ll.string + // check same string + && !l.string.equals(ll.string)) ll = ll.next; // Note: this is required for 'packing test' in prepare to work! @@ -219,7 +219,7 @@ class TextRenderer extends ElementRenderer { // + " at " + ti.x + ":" + ti.y); if (!ll.text.caption - && (ll.text.priority > l.text.priority || ll.length < l.length)) { + && (ll.text.priority > l.text.priority || ll.length < l.length)) { ll = removeLabel(ll); continue; @@ -379,8 +379,8 @@ class TextRenderer extends ElementRenderer { } l.bbox.set(l.x, l.y, l.x1, l.y1, - l.width + MIN_WAY_DIST, - l.text.fontHeight + MIN_WAY_DIST); + l.width + MIN_WAY_DIST, + l.text.fontHeight + MIN_WAY_DIST); byte overlaps = checkOverlap(l); @@ -443,12 +443,12 @@ class TextRenderer extends ElementRenderer { if (l.bbox == null) l.bbox = new OBB2D(l.x, l.y, l.x1, l.y1, - l.width + MIN_WAY_DIST, - l.text.fontHeight + MIN_WAY_DIST); + l.width + MIN_WAY_DIST, + l.text.fontHeight + MIN_WAY_DIST); else l.bbox.set(l.x, l.y, l.x1, l.y1, - l.width + MIN_WAY_DIST, - l.text.fontHeight + MIN_WAY_DIST); + l.width + MIN_WAY_DIST, + l.text.fontHeight + MIN_WAY_DIST); if (dbg == null || ti.width < ti.length * scale) overlaps = checkOverlap(l); @@ -495,9 +495,9 @@ class TextRenderer extends ElementRenderer { l.bbox = new OBB2D(); l.bbox.setNormalized(l.x, l.y, cos, -sin, - l.width + MIN_CAPTION_DIST, - l.text.fontHeight + MIN_CAPTION_DIST, - l.text.dy); + l.width + MIN_CAPTION_DIST, + l.text.fontHeight + MIN_CAPTION_DIST, + l.text.dy); boolean overlaps = false; @@ -525,7 +525,7 @@ class TextRenderer extends ElementRenderer { } for (Label ti = mLabels; ti != null; ti = (Label) ti.next) { - if (ti.text.caption){ + if (ti.text.caption) { if (ti.text.texture != null) { SymbolItem s = SymbolItem.pool.get(); s.texRegion = ti.text.texture; @@ -595,7 +595,7 @@ class TextRenderer extends ElementRenderer { @Override public synchronized void update(MapPosition pos, boolean changed, - Matrices matrices) { + Matrices matrices) { //if (System.currentTimeMillis() - lastDraw > 1000){ // updateLabels(); 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 ff76f71d..4da9b842 100644 --- a/vtm/src/org/oscim/layers/tile/vector/labeling/WayDecorator.java +++ b/vtm/src/org/oscim/layers/tile/vector/labeling/WayDecorator.java @@ -25,7 +25,7 @@ import org.oscim.utils.LineClipper; public final class WayDecorator { public static void renderText(LineClipper clipper, float[] coordinates, String string, - Text text, int pos, int len, MapTile tile) { + Text text, int pos, int len, MapTile tile) { //TextItem items = textItems; TextItem t = null; diff --git a/vtm/src/org/oscim/map/Map.java b/vtm/src/org/oscim/map/Map.java index c5bce889..ac1cbf60 100644 --- a/vtm/src/org/oscim/map/Map.java +++ b/vtm/src/org/oscim/map/Map.java @@ -128,6 +128,7 @@ public abstract class Map implements EventDispatcher { * Request call to onUpdate for all layers. This function can * be called from any thread. Request will be handled on main * thread. + * * @param forceRedraw pass true to render next frame */ public abstract void updateMap(boolean forceRedraw); @@ -192,6 +193,7 @@ public abstract class Map implements EventDispatcher { /** * Get current {@link MapPosition}. + * * @param mapPosition */ public boolean getMapPosition(MapPosition mapPosition) { diff --git a/vtm/src/org/oscim/map/MapAnimator.java b/vtm/src/org/oscim/map/MapAnimator.java index fa0c4f59..f1d3e725 100644 --- a/vtm/src/org/oscim/map/MapAnimator.java +++ b/vtm/src/org/oscim/map/MapAnimator.java @@ -48,10 +48,10 @@ public class MapAnimator { // calculate the maximum scale at which the bbox is completely visible double dx = Math.abs(MercatorProjection.longitudeToX(bbox.getMaxLongitude()) - - MercatorProjection.longitudeToX(bbox.getMinLongitude())); + - MercatorProjection.longitudeToX(bbox.getMinLongitude())); double dy = Math.abs(MercatorProjection.latitudeToY(bbox.getMinLatitude()) - - MercatorProjection.latitudeToY(bbox.getMaxLatitude())); + - MercatorProjection.latitudeToY(bbox.getMaxLatitude())); double zx = mMap.getWidth() / (dx * Tile.SIZE); double zy = mMap.getHeight() / (dy * Tile.SIZE); diff --git a/vtm/src/org/oscim/map/Viewport.java b/vtm/src/org/oscim/map/Viewport.java index 15b26508..3956ea46 100644 --- a/vtm/src/org/oscim/map/Viewport.java +++ b/vtm/src/org/oscim/map/Viewport.java @@ -82,7 +82,7 @@ public class Viewport { float[] tmp = new float[16]; GLMatrix.frustumM(tmp, 0, -s, s, - aspect * s, -aspect * s, VIEW_NEAR, VIEW_FAR); + aspect * s, -aspect * s, VIEW_NEAR, VIEW_FAR); mProjMatrix.set(tmp); mTmpMatrix.setTranslation(0, 0, -VIEW_DISTANCE); @@ -107,10 +107,10 @@ public class Viewport { public synchronized boolean getMapPosition(MapPosition pos) { boolean changed = (pos.scale != mPos.scale - || pos.x != mPos.x - || pos.y != mPos.y - || pos.angle != mPos.angle - || pos.tilt != mPos.tilt); + || pos.x != mPos.x + || pos.y != mPos.y + || pos.angle != mPos.angle + || pos.tilt != mPos.tilt); pos.angle = mPos.angle; pos.tilt = mPos.tilt; diff --git a/vtm/src/org/oscim/renderer/BitmapRenderer.java b/vtm/src/org/oscim/renderer/BitmapRenderer.java index 86938d67..e611c759 100644 --- a/vtm/src/org/oscim/renderer/BitmapRenderer.java +++ b/vtm/src/org/oscim/renderer/BitmapRenderer.java @@ -41,8 +41,8 @@ public class BitmapRenderer extends ElementRenderer { * TODO height used */ public synchronized void setBitmap(Bitmap bitmap, - int srcWidth, int srcHeight, - int targetWidth, int targetHeight) { + int srcWidth, int srcHeight, + int targetWidth, int targetHeight) { mWidth = targetWidth; mHeight = targetHeight; mBitmap = bitmap; diff --git a/vtm/src/org/oscim/renderer/BufferObject.java b/vtm/src/org/oscim/renderer/BufferObject.java index 6c8a6838..79ab51f0 100644 --- a/vtm/src/org/oscim/renderer/BufferObject.java +++ b/vtm/src/org/oscim/renderer/BufferObject.java @@ -76,8 +76,8 @@ public final class BufferObject { return; Log.d(TAG, "buffer object usage: " - + mBufferMemoryUsage / MB - + "MB, force: " + force); + + mBufferMemoryUsage / MB + + "MB, force: " + force); mBufferMemoryUsage -= BufferObject.limitUsage(1024 * 1024); @@ -85,7 +85,7 @@ public final class BufferObject { } private final static BufferObject pool[] = new BufferObject[2]; - private final static int counter[] = new int[2]; + private final static int counter[] = new int[2]; public static synchronized BufferObject get(int target, int size) { @@ -195,7 +195,6 @@ public final class BufferObject { } } - static synchronized void clear() { mBufferMemoryUsage = 0; diff --git a/vtm/src/org/oscim/renderer/ExtrusionRenderer.java b/vtm/src/org/oscim/renderer/ExtrusionRenderer.java index 5a65a52d..7d94bc58 100644 --- a/vtm/src/org/oscim/renderer/ExtrusionRenderer.java +++ b/vtm/src/org/oscim/renderer/ExtrusionRenderer.java @@ -61,10 +61,10 @@ public class ExtrusionRenderer extends LayerRenderer { for (int i = 0; i <= SHADER; i++) { if (i == 0) { shaderProgram[i] = GLUtils.createProgram(extrusionVertexShader, - extrusionFragmentShader); + extrusionFragmentShader); } else { shaderProgram[i] = GLUtils.createProgram(extrusionVertexShader, - extrusionFragmentShaderZ); + extrusionFragmentShaderZ); } if (shaderProgram[i] == 0) { @@ -158,7 +158,7 @@ public class ExtrusionRenderer extends LayerRenderer { private static ExtrusionLayer getLayer(MapTile t) { if (t.layers != null && t.layers.extrusionLayers != null - && t.state(MapTile.STATE_READY)) + && t.state(MapTile.STATE_READY)) return (ExtrusionLayer) t.layers.extrusionLayers; return null; } @@ -198,18 +198,18 @@ public class ExtrusionRenderer extends LayerRenderer { el.vboVertices.bind(); GL.glVertexAttribPointer(uExtVertexPosition, 3, - GL20.GL_SHORT, false, 8, 0); + GL20.GL_SHORT, false, 8, 0); GL.glVertexAttribPointer(uExtLightPosition, 2, - GL20.GL_UNSIGNED_BYTE, false, 8, 6); + GL20.GL_UNSIGNED_BYTE, false, 8, 6); GL.glDrawElements(GL20.GL_TRIANGLES, - (el.mIndiceCnt[0] + el.mIndiceCnt[1] + el.mIndiceCnt[2]), - GL20.GL_UNSIGNED_SHORT, 0); + (el.mIndiceCnt[0] + el.mIndiceCnt[1] + el.mIndiceCnt[2]), + GL20.GL_UNSIGNED_SHORT, 0); GL.glDrawElements(GL20.GL_LINES, el.mIndiceCnt[3], - GL20.GL_UNSIGNED_SHORT, - (el.mIndiceCnt[0] + el.mIndiceCnt[1] + el.mIndiceCnt[2]) * 2); + GL20.GL_UNSIGNED_SHORT, + (el.mIndiceCnt[0] + el.mIndiceCnt[1] + el.mIndiceCnt[2]) * 2); // just a temporary reference! tiles[i] = null; @@ -250,11 +250,11 @@ public class ExtrusionRenderer extends LayerRenderer { el.vboVertices.bind(); GL.glVertexAttribPointer(uExtVertexPosition, 3, - GL20.GL_SHORT, false, 8, 0); + GL20.GL_SHORT, false, 8, 0); GL.glDrawElements(GL20.GL_TRIANGLES, - (el.mIndiceCnt[0] + el.mIndiceCnt[1] + el.mIndiceCnt[2]), - GL20.GL_UNSIGNED_SHORT, 0); + (el.mIndiceCnt[0] + el.mIndiceCnt[1] + el.mIndiceCnt[2]), + GL20.GL_UNSIGNED_SHORT, 0); } // enable color buffer, use depth mask @@ -276,25 +276,25 @@ public class ExtrusionRenderer extends LayerRenderer { el.vboVertices.bind(); GL.glVertexAttribPointer(uExtVertexPosition, 3, - GL20.GL_SHORT, false, 8, 0); + GL20.GL_SHORT, false, 8, 0); GL.glVertexAttribPointer(uExtLightPosition, 2, - GL20.GL_UNSIGNED_BYTE, false, 8, 6); + GL20.GL_UNSIGNED_BYTE, false, 8, 6); // draw roof GL.glUniform1i(uExtMode, 0); GL.glDrawElements(GL20.GL_TRIANGLES, el.mIndiceCnt[2], - GL20.GL_UNSIGNED_SHORT, (el.mIndiceCnt[0] + el.mIndiceCnt[1]) * 2); + GL20.GL_UNSIGNED_SHORT, (el.mIndiceCnt[0] + el.mIndiceCnt[1]) * 2); // draw sides 1 GL.glUniform1i(uExtMode, 1); GL.glDrawElements(GL20.GL_TRIANGLES, el.mIndiceCnt[0], - GL20.GL_UNSIGNED_SHORT, 0); + GL20.GL_UNSIGNED_SHORT, 0); // draw sides 2 GL.glUniform1i(uExtMode, 2); GL.glDrawElements(GL20.GL_TRIANGLES, el.mIndiceCnt[1], - GL20.GL_UNSIGNED_SHORT, el.mIndiceCnt[0] * 2); + GL20.GL_UNSIGNED_SHORT, el.mIndiceCnt[0] * 2); // drawing gl_lines with the same coordinates does not result in // same depth values as polygons, so add offset and draw gl_lequal: @@ -305,8 +305,8 @@ public class ExtrusionRenderer extends LayerRenderer { GL.glUniform1i(uExtMode, 3); GL.glDrawElements(GL20.GL_LINES, el.mIndiceCnt[3], - GL20.GL_UNSIGNED_SHORT, - (el.mIndiceCnt[0] + el.mIndiceCnt[1] + el.mIndiceCnt[2]) * 2); + GL20.GL_UNSIGNED_SHORT, + (el.mIndiceCnt[0] + el.mIndiceCnt[1] + el.mIndiceCnt[2]) * 2); // just a temporary reference! tiles[i] = null; @@ -321,7 +321,7 @@ public class ExtrusionRenderer extends LayerRenderer { } private static void setMatrix(MapPosition pos, Matrices m, - MapTile tile, int delta) { + MapTile tile, int delta) { int z = tile.zoomLevel; double curScale = Tile.SIZE * pos.scale; @@ -347,85 +347,85 @@ public class ExtrusionRenderer extends LayerRenderer { private final float _s = 4; private final float _l = 0; private final float[] mColor = { - // roof color - _a * ((_r + _l) / 255), - _a * ((_g + _l) / 255), - _a * ((_b + _l) / 255), - 0.8f, - // sligthly differ adjacent side - // faces to improve contrast - _a * ((_r - _s) / 255 + 0.01f), - _a * ((_g - _s) / 255 + 0.01f), - _a * ((_b - _s) / 255), - _a, - _a * ((_r - _s) / 255), - _a * ((_g - _s) / 255), - _a * ((_b - _s) / 255), - _a, - // roof outline - (_r - _o) / 255, - (_g - _o) / 255, - (_b - _o) / 255, - 0.9f, + // roof color + _a * ((_r + _l) / 255), + _a * ((_g + _l) / 255), + _a * ((_b + _l) / 255), + 0.8f, + // sligthly differ adjacent side + // faces to improve contrast + _a * ((_r - _s) / 255 + 0.01f), + _a * ((_g - _s) / 255 + 0.01f), + _a * ((_b - _s) / 255), + _a, + _a * ((_r - _s) / 255), + _a * ((_g - _s) / 255), + _a * ((_b - _s) / 255), + _a, + // roof outline + (_r - _o) / 255, + (_g - _o) / 255, + (_b - _o) / 255, + 0.9f, }; final static String extrusionVertexShader = "" - //+ "precision mediump float;" - + "uniform mat4 u_mvp;" - + "uniform vec4 u_color[4];" - + "uniform int u_mode;" - + "uniform float u_alpha;" - + "attribute vec4 a_pos;" - + "attribute vec2 a_light;" - + "varying vec4 color;" - + "varying float depth;" - + "const float ff = 255.0;" - + "void main() {" - // change height by u_alpha - + " gl_Position = u_mvp * vec4(a_pos.xy, a_pos.z * u_alpha, 1.0);" - //+ " depth = gl_Position.z;" - + " if (u_mode == 0)" - // roof / depth pass - + " color = u_color[0] * u_alpha;" - + " else {" - // decrease contrast with distance - + " if (u_mode == 1){" - // sides 1 - use 0xff00 - // scale direction to -0.5<>0.5 - + " float dir = a_light.y / ff;" - + " float z = (0.98 + gl_Position.z * 0.02);" - + " float h = 0.9 + clamp(a_pos.z / 2000.0, 0.0, 0.1);" - + " color = u_color[1];" - + " color.rgb *= (0.8 + dir * 0.2) * z * h;" - + " color *= u_alpha;" - + " } else if (u_mode == 2){" - // sides 2 - use 0x00ff - + " float dir = a_light.x / ff;" - + " float z = (0.98 + gl_Position.z * 0.02);" - + " float h = 0.9 + clamp(a_pos.z / 2000.0, 0.0, 0.1);" - + " color = u_color[2];" - + " color.rgb *= (0.8 + dir * 0.2) * z * h;" - + " color *= u_alpha;" - + " } else {" - // outline - + " float z = (0.98 - gl_Position.z * 0.02);" - + " color = u_color[3] * z;" - + "}}}"; + //+ "precision mediump float;" + + "uniform mat4 u_mvp;" + + "uniform vec4 u_color[4];" + + "uniform int u_mode;" + + "uniform float u_alpha;" + + "attribute vec4 a_pos;" + + "attribute vec2 a_light;" + + "varying vec4 color;" + + "varying float depth;" + + "const float ff = 255.0;" + + "void main() {" + // change height by u_alpha + + " gl_Position = u_mvp * vec4(a_pos.xy, a_pos.z * u_alpha, 1.0);" + //+ " depth = gl_Position.z;" + + " if (u_mode == 0)" + // roof / depth pass + + " color = u_color[0] * u_alpha;" + + " else {" + // decrease contrast with distance + + " if (u_mode == 1){" + // sides 1 - use 0xff00 + // scale direction to -0.5<>0.5 + + " float dir = a_light.y / ff;" + + " float z = (0.98 + gl_Position.z * 0.02);" + + " float h = 0.9 + clamp(a_pos.z / 2000.0, 0.0, 0.1);" + + " color = u_color[1];" + + " color.rgb *= (0.8 + dir * 0.2) * z * h;" + + " color *= u_alpha;" + + " } else if (u_mode == 2){" + // sides 2 - use 0x00ff + + " float dir = a_light.x / ff;" + + " float z = (0.98 + gl_Position.z * 0.02);" + + " float h = 0.9 + clamp(a_pos.z / 2000.0, 0.0, 0.1);" + + " color = u_color[2];" + + " color.rgb *= (0.8 + dir * 0.2) * z * h;" + + " color *= u_alpha;" + + " } else {" + // outline + + " float z = (0.98 - gl_Position.z * 0.02);" + + " color = u_color[3] * z;" + + "}}}"; final static String extrusionFragmentShader = "" - + "precision mediump float;" - + "varying vec4 color;" - + "void main() {" - + " gl_FragColor = color;" - + "}"; + + "precision mediump float;" + + "varying vec4 color;" + + "void main() {" + + " gl_FragColor = color;" + + "}"; final static String extrusionFragmentShaderZ = "" - + "precision mediump float;" - + "varying float depth;" - + "void main() {" - + "float d = depth * 0.2;" - + "if (d < 0.0)" - + " d = -d;" - + " gl_FragColor = vec4(1.0 - d, 1.0 - d, 1.0 - d, 1.0 - d);" - + "}"; + + "precision mediump float;" + + "varying float depth;" + + "void main() {" + + "float d = depth * 0.2;" + + "if (d < 0.0)" + + " d = -d;" + + " gl_FragColor = vec4(1.0 - d, 1.0 - d, 1.0 - d, 1.0 - d);" + + "}"; } diff --git a/vtm/src/org/oscim/renderer/GLMatrix.java b/vtm/src/org/oscim/renderer/GLMatrix.java index cfc85ffe..1bd5a439 100644 --- a/vtm/src/org/oscim/renderer/GLMatrix.java +++ b/vtm/src/org/oscim/renderer/GLMatrix.java @@ -35,7 +35,7 @@ public class GLMatrix { /** * Set the Matrix from float array - * + * * @param m float array to copy */ public void set(float[] m) { @@ -47,7 +47,7 @@ public class GLMatrix { /** * Get the Matrix as float array - * + * * @param m float array to store Matrix */ public void get(float[] m) { @@ -59,7 +59,7 @@ public class GLMatrix { /** * Copy values from mat - * + * * @param mat Matrix to copy */ public void copy(GLMatrix mat) { @@ -68,7 +68,7 @@ public class GLMatrix { /** * Project Vector with Matrix - * + * * @param vec3 Vector to project */ public void prj(float[] vec3) { @@ -80,7 +80,7 @@ public class GLMatrix { /** * Multiply rhs onto Matrix. - * + * * @param rhs right hand side */ public void multiplyRhs(GLMatrix rhs) { @@ -89,7 +89,7 @@ public class GLMatrix { /** * Use this matrix as rhs, multiply it on lhs and store result. - * + * * @param lhs right hand side */ public void multiplyLhs(GLMatrix lhs) { @@ -98,12 +98,12 @@ public class GLMatrix { /** * Multiply rhs onto lhs and store result in Matrix. - * + * * This matrix MUST be different from lhs and rhs! - * + * * As you know, when combining matrices for vector projection * this has the same effect first as applying rhs then lhs. - * + * * @param lhs left hand side * @param rhs right hand side */ @@ -113,7 +113,7 @@ public class GLMatrix { /** * Transpose mat and store result in Matrix - * + * * @param mat to transpose */ public void transposeM(GLMatrix mat) { @@ -122,7 +122,7 @@ public class GLMatrix { /** * Set rotation - * + * * @param a angle in degree * @param x around x-axis * @param y around y-axis @@ -134,7 +134,7 @@ public class GLMatrix { /** * Set translation - * + * * @param x along x-axis * @param y along y-axis * @param z along z-axis @@ -145,7 +145,7 @@ public class GLMatrix { /** * Set scale factor - * + * * @param x axis * @param y axis * @param z axis @@ -156,7 +156,7 @@ public class GLMatrix { /** * Set translation and x,y scale - * + * * @param tx translate x * @param ty translate y * @param scale factor x,y @@ -167,7 +167,7 @@ public class GLMatrix { /** * Set Matrix with glUniformMatrix - * + * * @param location GL location id */ public void setAsUniform(int location) { @@ -177,7 +177,7 @@ public class GLMatrix { /** * Set single value - * + * * @param pos at position * @param value value to set */ @@ -187,7 +187,7 @@ public class GLMatrix { /** * add some offset (similar to glDepthOffset) - * + * * @param delta offset */ public void addDepthOffset(int delta) { @@ -212,13 +212,13 @@ public class GLMatrix { /* * 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 - * + * + * 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. @@ -227,189 +227,190 @@ public class GLMatrix { */ /** - * Define a projection matrix in terms of six clip planes - * @param m the float array that holds the perspective matrix - * @param offset the offset into float array m where the perspective - * matrix data is written - */ - public static void frustumM(float[] m, int offset, - float left, float right, float bottom, float top, - float near, float far) { - if (left == right) { - throw new IllegalArgumentException("left == right"); - } - if (top == bottom) { - throw new IllegalArgumentException("top == bottom"); - } - if (near == far) { - throw new IllegalArgumentException("near == far"); - } - if (near <= 0.0f) { - throw new IllegalArgumentException("near <= 0.0f"); - } - if (far <= 0.0f) { - throw new IllegalArgumentException("far <= 0.0f"); - } - final float r_width = 1.0f / (right - left); - final float r_height = 1.0f / (top - bottom); - final float r_depth = 1.0f / (near - far); - final float x = 2.0f * (near * r_width); - final float y = 2.0f * (near * r_height); - final float A = (right + left) * r_width; - final float B = (top + bottom) * r_height; - final float C = (far + near) * r_depth; - final float D = 2.0f * (far * near * r_depth); - m[offset + 0] = x; - m[offset + 5] = y; - m[offset + 8] = A; - m[offset + 9] = B; - m[offset + 10] = C; - m[offset + 14] = D; - m[offset + 11] = -1.0f; - m[offset + 1] = 0.0f; - m[offset + 2] = 0.0f; - m[offset + 3] = 0.0f; - m[offset + 4] = 0.0f; - m[offset + 6] = 0.0f; - m[offset + 7] = 0.0f; - m[offset + 12] = 0.0f; - m[offset + 13] = 0.0f; - m[offset + 15] = 0.0f; - } + * Define a projection matrix in terms of six clip planes + * + * @param m the float array that holds the perspective matrix + * @param offset the offset into float array m where the perspective + * matrix data is written + */ + public static void frustumM(float[] m, int offset, + float left, float right, float bottom, float top, + float near, float far) { + if (left == right) { + throw new IllegalArgumentException("left == right"); + } + if (top == bottom) { + throw new IllegalArgumentException("top == bottom"); + } + if (near == far) { + throw new IllegalArgumentException("near == far"); + } + if (near <= 0.0f) { + throw new IllegalArgumentException("near <= 0.0f"); + } + if (far <= 0.0f) { + throw new IllegalArgumentException("far <= 0.0f"); + } + final float r_width = 1.0f / (right - left); + final float r_height = 1.0f / (top - bottom); + final float r_depth = 1.0f / (near - far); + final float x = 2.0f * (near * r_width); + final float y = 2.0f * (near * r_height); + final float A = (right + left) * r_width; + final float B = (top + bottom) * r_height; + final float C = (far + near) * r_depth; + final float D = 2.0f * (far * near * r_depth); + m[offset + 0] = x; + m[offset + 5] = y; + m[offset + 8] = A; + m[offset + 9] = B; + m[offset + 10] = C; + m[offset + 14] = D; + m[offset + 11] = -1.0f; + m[offset + 1] = 0.0f; + m[offset + 2] = 0.0f; + m[offset + 3] = 0.0f; + m[offset + 4] = 0.0f; + m[offset + 6] = 0.0f; + m[offset + 7] = 0.0f; + m[offset + 12] = 0.0f; + m[offset + 13] = 0.0f; + m[offset + 15] = 0.0f; + } - /** - * Inverts a 4 x 4 matrix. - * - * @param mInv the array that holds the output inverted matrix - * @param mInvOffset an offset into mInv where the inverted matrix is - * stored. - * @param m the input array - * @param mOffset an offset into m where the matrix is stored. - * @return true if the matrix could be inverted, false if it could not. - */ - public static boolean invertM(float[] mInv, int mInvOffset, float[] m, - int mOffset) { - // Invert a 4 x 4 matrix using Cramer's Rule + /** + * Inverts a 4 x 4 matrix. + * + * @param mInv the array that holds the output inverted matrix + * @param mInvOffset an offset into mInv where the inverted matrix is + * stored. + * @param m the input array + * @param mOffset an offset into m where the matrix is stored. + * @return true if the matrix could be inverted, false if it could not. + */ + public static boolean invertM(float[] mInv, int mInvOffset, float[] m, + int mOffset) { + // Invert a 4 x 4 matrix using Cramer's Rule - // transpose matrix - final float src0 = m[mOffset + 0]; - final float src4 = m[mOffset + 1]; - final float src8 = m[mOffset + 2]; - final float src12 = m[mOffset + 3]; + // transpose matrix + final float src0 = m[mOffset + 0]; + final float src4 = m[mOffset + 1]; + final float src8 = m[mOffset + 2]; + final float src12 = m[mOffset + 3]; - final float src1 = m[mOffset + 4]; - final float src5 = m[mOffset + 5]; - final float src9 = m[mOffset + 6]; - final float src13 = m[mOffset + 7]; + final float src1 = m[mOffset + 4]; + final float src5 = m[mOffset + 5]; + final float src9 = m[mOffset + 6]; + final float src13 = m[mOffset + 7]; - final float src2 = m[mOffset + 8]; - final float src6 = m[mOffset + 9]; - final float src10 = m[mOffset + 10]; - final float src14 = m[mOffset + 11]; + final float src2 = m[mOffset + 8]; + final float src6 = m[mOffset + 9]; + final float src10 = m[mOffset + 10]; + final float src14 = m[mOffset + 11]; - final float src3 = m[mOffset + 12]; - final float src7 = m[mOffset + 13]; - final float src11 = m[mOffset + 14]; - final float src15 = m[mOffset + 15]; + final float src3 = m[mOffset + 12]; + final float src7 = m[mOffset + 13]; + final float src11 = m[mOffset + 14]; + final float src15 = m[mOffset + 15]; - // calculate pairs for first 8 elements (cofactors) - final float atmp0 = src10 * src15; - final float atmp1 = src11 * src14; - final float atmp2 = src9 * src15; - final float atmp3 = src11 * src13; - final float atmp4 = src9 * src14; - final float atmp5 = src10 * src13; - final float atmp6 = src8 * src15; - final float atmp7 = src11 * src12; - final float atmp8 = src8 * src14; - final float atmp9 = src10 * src12; - final float atmp10 = src8 * src13; - final float atmp11 = src9 * src12; + // calculate pairs for first 8 elements (cofactors) + final float atmp0 = src10 * src15; + final float atmp1 = src11 * src14; + final float atmp2 = src9 * src15; + final float atmp3 = src11 * src13; + final float atmp4 = src9 * src14; + final float atmp5 = src10 * src13; + final float atmp6 = src8 * src15; + final float atmp7 = src11 * src12; + final float atmp8 = src8 * src14; + final float atmp9 = src10 * src12; + final float atmp10 = src8 * src13; + final float atmp11 = src9 * src12; - // calculate first 8 elements (cofactors) - final float dst0 = (atmp0 * src5 + atmp3 * src6 + atmp4 * src7) - - (atmp1 * src5 + atmp2 * src6 + atmp5 * src7); - final float dst1 = (atmp1 * src4 + atmp6 * src6 + atmp9 * src7) - - (atmp0 * src4 + atmp7 * src6 + atmp8 * src7); - final float dst2 = (atmp2 * src4 + atmp7 * src5 + atmp10 * src7) - - (atmp3 * src4 + atmp6 * src5 + atmp11 * src7); - final float dst3 = (atmp5 * src4 + atmp8 * src5 + atmp11 * src6) - - (atmp4 * src4 + atmp9 * src5 + atmp10 * src6); - final float dst4 = (atmp1 * src1 + atmp2 * src2 + atmp5 * src3) - - (atmp0 * src1 + atmp3 * src2 + atmp4 * src3); - final float dst5 = (atmp0 * src0 + atmp7 * src2 + atmp8 * src3) - - (atmp1 * src0 + atmp6 * src2 + atmp9 * src3); - final float dst6 = (atmp3 * src0 + atmp6 * src1 + atmp11 * src3) - - (atmp2 * src0 + atmp7 * src1 + atmp10 * src3); - final float dst7 = (atmp4 * src0 + atmp9 * src1 + atmp10 * src2) - - (atmp5 * src0 + atmp8 * src1 + atmp11 * src2); + // calculate first 8 elements (cofactors) + final float dst0 = (atmp0 * src5 + atmp3 * src6 + atmp4 * src7) + - (atmp1 * src5 + atmp2 * src6 + atmp5 * src7); + final float dst1 = (atmp1 * src4 + atmp6 * src6 + atmp9 * src7) + - (atmp0 * src4 + atmp7 * src6 + atmp8 * src7); + final float dst2 = (atmp2 * src4 + atmp7 * src5 + atmp10 * src7) + - (atmp3 * src4 + atmp6 * src5 + atmp11 * src7); + final float dst3 = (atmp5 * src4 + atmp8 * src5 + atmp11 * src6) + - (atmp4 * src4 + atmp9 * src5 + atmp10 * src6); + final float dst4 = (atmp1 * src1 + atmp2 * src2 + atmp5 * src3) + - (atmp0 * src1 + atmp3 * src2 + atmp4 * src3); + final float dst5 = (atmp0 * src0 + atmp7 * src2 + atmp8 * src3) + - (atmp1 * src0 + atmp6 * src2 + atmp9 * src3); + final float dst6 = (atmp3 * src0 + atmp6 * src1 + atmp11 * src3) + - (atmp2 * src0 + atmp7 * src1 + atmp10 * src3); + final float dst7 = (atmp4 * src0 + atmp9 * src1 + atmp10 * src2) + - (atmp5 * src0 + atmp8 * src1 + atmp11 * src2); - // calculate pairs for second 8 elements (cofactors) - final float btmp0 = src2 * src7; - final float btmp1 = src3 * src6; - final float btmp2 = src1 * src7; - final float btmp3 = src3 * src5; - final float btmp4 = src1 * src6; - final float btmp5 = src2 * src5; - final float btmp6 = src0 * src7; - final float btmp7 = src3 * src4; - final float btmp8 = src0 * src6; - final float btmp9 = src2 * src4; - final float btmp10 = src0 * src5; - final float btmp11 = src1 * src4; + // calculate pairs for second 8 elements (cofactors) + final float btmp0 = src2 * src7; + final float btmp1 = src3 * src6; + final float btmp2 = src1 * src7; + final float btmp3 = src3 * src5; + final float btmp4 = src1 * src6; + final float btmp5 = src2 * src5; + final float btmp6 = src0 * src7; + final float btmp7 = src3 * src4; + final float btmp8 = src0 * src6; + final float btmp9 = src2 * src4; + final float btmp10 = src0 * src5; + final float btmp11 = src1 * src4; - // calculate second 8 elements (cofactors) - final float dst8 = (btmp0 * src13 + btmp3 * src14 + btmp4 * src15) - - (btmp1 * src13 + btmp2 * src14 + btmp5 * src15); - final float dst9 = (btmp1 * src12 + btmp6 * src14 + btmp9 * src15) - - (btmp0 * src12 + btmp7 * src14 + btmp8 * src15); - final float dst10 = (btmp2 * src12 + btmp7 * src13 + btmp10 * src15) - - (btmp3 * src12 + btmp6 * src13 + btmp11 * src15); - final float dst11 = (btmp5 * src12 + btmp8 * src13 + btmp11 * src14) - - (btmp4 * src12 + btmp9 * src13 + btmp10 * src14); - final float dst12 = (btmp2 * src10 + btmp5 * src11 + btmp1 * src9 ) - - (btmp4 * src11 + btmp0 * src9 + btmp3 * src10); - final float dst13 = (btmp8 * src11 + btmp0 * src8 + btmp7 * src10) - - (btmp6 * src10 + btmp9 * src11 + btmp1 * src8 ); - final float dst14 = (btmp6 * src9 + btmp11 * src11 + btmp3 * src8 ) - - (btmp10 * src11 + btmp2 * src8 + btmp7 * src9 ); - final float dst15 = (btmp10 * src10 + btmp4 * src8 + btmp9 * src9 ) - - (btmp8 * src9 + btmp11 * src10 + btmp5 * src8 ); + // calculate second 8 elements (cofactors) + final float dst8 = (btmp0 * src13 + btmp3 * src14 + btmp4 * src15) + - (btmp1 * src13 + btmp2 * src14 + btmp5 * src15); + final float dst9 = (btmp1 * src12 + btmp6 * src14 + btmp9 * src15) + - (btmp0 * src12 + btmp7 * src14 + btmp8 * src15); + final float dst10 = (btmp2 * src12 + btmp7 * src13 + btmp10 * src15) + - (btmp3 * src12 + btmp6 * src13 + btmp11 * src15); + final float dst11 = (btmp5 * src12 + btmp8 * src13 + btmp11 * src14) + - (btmp4 * src12 + btmp9 * src13 + btmp10 * src14); + final float dst12 = (btmp2 * src10 + btmp5 * src11 + btmp1 * src9) + - (btmp4 * src11 + btmp0 * src9 + btmp3 * src10); + final float dst13 = (btmp8 * src11 + btmp0 * src8 + btmp7 * src10) + - (btmp6 * src10 + btmp9 * src11 + btmp1 * src8); + final float dst14 = (btmp6 * src9 + btmp11 * src11 + btmp3 * src8) + - (btmp10 * src11 + btmp2 * src8 + btmp7 * src9); + final float dst15 = (btmp10 * src10 + btmp4 * src8 + btmp9 * src9) + - (btmp8 * src9 + btmp11 * src10 + btmp5 * src8); - // calculate determinant - final float det = - src0 * dst0 + src1 * dst1 + src2 * dst2 + src3 * dst3; + // calculate determinant + final float det = + src0 * dst0 + src1 * dst1 + src2 * dst2 + src3 * dst3; - if (det == 0.0f) { - return false; - } + if (det == 0.0f) { + return false; + } - // calculate matrix inverse - final float invdet = 1.0f / det; - mInv[ mInvOffset] = dst0 * invdet; - mInv[ 1 + mInvOffset] = dst1 * invdet; - mInv[ 2 + mInvOffset] = dst2 * invdet; - mInv[ 3 + mInvOffset] = dst3 * invdet; + // calculate matrix inverse + final float invdet = 1.0f / det; + mInv[mInvOffset] = dst0 * invdet; + mInv[1 + mInvOffset] = dst1 * invdet; + mInv[2 + mInvOffset] = dst2 * invdet; + mInv[3 + mInvOffset] = dst3 * invdet; - mInv[ 4 + mInvOffset] = dst4 * invdet; - mInv[ 5 + mInvOffset] = dst5 * invdet; - mInv[ 6 + mInvOffset] = dst6 * invdet; - mInv[ 7 + mInvOffset] = dst7 * invdet; + mInv[4 + mInvOffset] = dst4 * invdet; + mInv[5 + mInvOffset] = dst5 * invdet; + mInv[6 + mInvOffset] = dst6 * invdet; + mInv[7 + mInvOffset] = dst7 * invdet; - mInv[ 8 + mInvOffset] = dst8 * invdet; - mInv[ 9 + mInvOffset] = dst9 * invdet; - mInv[10 + mInvOffset] = dst10 * invdet; - mInv[11 + mInvOffset] = dst11 * invdet; + mInv[8 + mInvOffset] = dst8 * invdet; + mInv[9 + mInvOffset] = dst9 * invdet; + mInv[10 + mInvOffset] = dst10 * invdet; + mInv[11 + mInvOffset] = dst11 * invdet; - mInv[12 + mInvOffset] = dst12 * invdet; - mInv[13 + mInvOffset] = dst13 * invdet; - mInv[14 + mInvOffset] = dst14 * invdet; - mInv[15 + mInvOffset] = dst15 * invdet; + mInv[12 + mInvOffset] = dst12 * invdet; + mInv[13 + mInvOffset] = dst13 * invdet; + mInv[14 + mInvOffset] = dst14 * invdet; + mInv[15 + mInvOffset] = dst15 * invdet; - return true; - } + return true; + } - private native static long alloc(); + private native static long alloc(); private native static void delete(long self); diff --git a/vtm/src/org/oscim/renderer/GLState.java b/vtm/src/org/oscim/renderer/GLState.java index 5301db13..103ca9e0 100644 --- a/vtm/src/org/oscim/renderer/GLState.java +++ b/vtm/src/org/oscim/renderer/GLState.java @@ -42,10 +42,10 @@ public class GLState { GL.glDisable(GL20.GL_STENCIL_TEST); GL.glDisable(GL20.GL_DEPTH_TEST); -// if (currentTexId != 0) { -// GL.glBindTexture(GL20.GL_TEXTURE_2D, 0); -// currentTexId = 0; -// } + // if (currentTexId != 0) { + // GL.glBindTexture(GL20.GL_TEXTURE_2D, 0); + // currentTexId = 0; + // } } public static boolean useProgram(int shaderProgram) { @@ -120,15 +120,15 @@ public class GLState { } public static void bindTex2D(int id) { -// if (GLAdapter.GDX_DESKTOP_QUIRKS){ -// GL.glBindTexture(GL20.GL_TEXTURE_2D, 0); - //if (GLAdapter.GDX_DESKTOP_QUIRKS && id != 0) - // GL.glBindTexture(GL20.GL_TEXTURE_2D, 0); -// } else + // if (GLAdapter.GDX_DESKTOP_QUIRKS){ + // GL.glBindTexture(GL20.GL_TEXTURE_2D, 0); + //if (GLAdapter.GDX_DESKTOP_QUIRKS && id != 0) + // GL.glBindTexture(GL20.GL_TEXTURE_2D, 0); + // } else - if (currentTexId != id) { + if (currentTexId != id) { GL.glBindTexture(GL20.GL_TEXTURE_2D, id); currentTexId = id; - } + } } } diff --git a/vtm/src/org/oscim/renderer/GLUtils.java b/vtm/src/org/oscim/renderer/GLUtils.java index f34a8ab5..44a3ccfd 100644 --- a/vtm/src/org/oscim/renderer/GLUtils.java +++ b/vtm/src/org/oscim/renderer/GLUtils.java @@ -31,11 +31,11 @@ public class GLUtils { private static String TAG = GLUtils.class.getName(); private static GL20 GL; - - static void init(GL20 gl){ + + static void init(GL20 gl) { GL = gl; } - + public static void setColor(int location, int color, float alpha) { if (alpha >= 1) alpha = ((color >>> 24) & 0xff) / 255f; @@ -62,12 +62,14 @@ public class GLUtils { public static void setColorBlend(int location, int color1, int color2, float mix) { float a1 = (((color1 >>> 24) & 0xff) / 255f) * (1 - mix); float a2 = (((color2 >>> 24) & 0xff) / 255f) * mix; - GL.glUniform4f - (location, - ((((color1 >>> 16) & 0xff) / 255f) * a1 + (((color2 >>> 16) & 0xff) / 255f) * a2), - ((((color1 >>> 8) & 0xff) / 255f) * a1 + (((color2 >>> 8) & 0xff) / 255f) * a2), - ((((color1 >>> 0) & 0xff) / 255f) * a1 + (((color2 >>> 0) & 0xff) / 255f) * a2), - (a1 + a2)); + GL.glUniform4f(location, + ((((color1 >>> 16) & 0xff) / 255f) * a1 + + (((color2 >>> 16) & 0xff) / 255f) * a2), + ((((color1 >>> 8) & 0xff) / 255f) * a1 + + (((color2 >>> 8) & 0xff) / 255f) * a2), + ((((color1 >>> 0) & 0xff) / 255f) * a1 + + (((color2 >>> 0) & 0xff) / 255f) * a2), + (a1 + a2)); } public static void setTextureParameter(int min_filter, int mag_filter, int wrap_s, int wrap_t) { @@ -133,7 +135,8 @@ public class GLUtils { return loadTexture(pixel, sum, 1, GL20.GL_ALPHA, GL20.GL_LINEAR, GL20.GL_LINEAR, // GLES20.GL_NEAREST, GLES20.GL_NEAREST, - GL20.GL_REPEAT, GL20.GL_REPEAT); + GL20.GL_REPEAT, + GL20.GL_REPEAT); } /** diff --git a/vtm/src/org/oscim/renderer/GridRenderer.java b/vtm/src/org/oscim/renderer/GridRenderer.java index 694fb911..55cfe656 100644 --- a/vtm/src/org/oscim/renderer/GridRenderer.java +++ b/vtm/src/org/oscim/renderer/GridRenderer.java @@ -84,8 +84,8 @@ public class GridRenderer extends ElementRenderer { // Integer.valueOf(y + yy), // Integer.valueOf(z)); String label = Integer.valueOf(x + xx) + "/" + - Integer.valueOf(y + yy) + "/" + - Integer.valueOf(z); + Integer.valueOf(y + yy) + "/" + + Integer.valueOf(z); TextItem ti = TextItem.pool.get(); ti.set(s * xx + s / 2, s * yy + s / 2, label, mText); diff --git a/vtm/src/org/oscim/renderer/MapRenderer.java b/vtm/src/org/oscim/renderer/MapRenderer.java index 4b83c61f..0ba4be6a 100644 --- a/vtm/src/org/oscim/renderer/MapRenderer.java +++ b/vtm/src/org/oscim/renderer/MapRenderer.java @@ -77,9 +77,9 @@ public class MapRenderer { mvp.setScale(ratio, ratio, ratio); else mvp.setTransScale( - (-screenWidth / 2) * ratio * scale, - (-screenHeight / 2) * ratio * scale, - ratio); + (-screenWidth / 2) * ratio * scale, + (-screenHeight / 2) * ratio * scale, + ratio); mvp.multiplyLhs(proj); } @@ -193,8 +193,8 @@ public class MapRenderer { size = (1 << 15); ByteBuffer buf = ByteBuffer - .allocateDirect(size) - .order(ByteOrder.nativeOrder()); + .allocateDirect(size) + .order(ByteOrder.nativeOrder()); this.floatBuffer = buf.asFloatBuffer(); this.shortBuffer = buf.asShortBuffer(); @@ -231,7 +231,7 @@ public class MapRenderer { } public static boolean uploadLayers(ElementLayers layers, int newSize, - boolean addFill) { + boolean addFill) { // add fill coordinates if (addFill) newSize += 8; @@ -246,10 +246,10 @@ public class MapRenderer { if (newSize != sbuf.remaining()) { Log.d(TAG, "wrong size: " - + " new size: " + newSize - + " buffer pos: " + sbuf.position() - + " buffer limit: " + sbuf.limit() - + " buffer fill: " + sbuf.remaining()); + + " new size: " + newSize + + " buffer pos: " + sbuf.position() + + " buffer limit: " + sbuf.limit() + + " buffer fill: " + sbuf.remaining()); return false; } newSize *= SHORT_BYTES; @@ -281,8 +281,8 @@ public class MapRenderer { GL.glDepthMask(true); GL.glStencilMask(0xFF); GL.glClear(GL20.GL_COLOR_BUFFER_BIT - | GL20.GL_DEPTH_BUFFER_BIT - | GL20.GL_STENCIL_BUFFER_BIT); + | GL20.GL_DEPTH_BUFFER_BIT + | GL20.GL_STENCIL_BUFFER_BIT); GLState.blend(false); GL.glDisable(GL20.GL_BLEND); @@ -318,7 +318,7 @@ public class MapRenderer { for (int i = 0, n = layers.length; i < n; i++) { LayerRenderer renderer = layers[i]; - if (!renderer.isInitialized){ + if (!renderer.isInitialized) { renderer.setup(); renderer.isInitialized = true; } @@ -393,9 +393,9 @@ public class MapRenderer { buf.flip(); GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, - mQuadIndicesID); + mQuadIndicesID); GL.glBufferData(GL20.GL_ELEMENT_ARRAY_BUFFER, - indices.length * 2, buf, GL20.GL_STATIC_DRAW); + indices.length * 2, buf, GL20.GL_STATIC_DRAW); GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0); // initialize default quad @@ -408,7 +408,7 @@ public class MapRenderer { GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, mQuadVerticesID); GL.glBufferData(GL20.GL_ARRAY_BUFFER, - quad.length * 4, floatBuffer, GL20.GL_STATIC_DRAW); + quad.length * 4, floatBuffer, GL20.GL_STATIC_DRAW); GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0); if (mClearColor != null) diff --git a/vtm/src/org/oscim/renderer/atlas/SpriteManager.java b/vtm/src/org/oscim/renderer/atlas/SpriteManager.java index 153afcdd..706704b1 100644 --- a/vtm/src/org/oscim/renderer/atlas/SpriteManager.java +++ b/vtm/src/org/oscim/renderer/atlas/SpriteManager.java @@ -20,12 +20,9 @@ import org.oscim.renderer.atlas.TextureAtlas.Rect; import org.oscim.renderer.elements.TextureItem; import org.oscim.utils.pool.Inlist; - - - public abstract class SpriteManager { - public class Sprite extends Inlist{ + public class Sprite extends Inlist { public Sprite(T i, TextureAtlas a, Rect r) { atlas = a; @@ -52,9 +49,9 @@ public abstract class SpriteManager { //mTexture.ownBitmap = true; mAtlas = new TextureAtlas( - TextureItem.TEXTURE_WIDTH, - TextureItem.TEXTURE_HEIGHT, - 32); + TextureItem.TEXTURE_WIDTH, + TextureItem.TEXTURE_HEIGHT, + 32); mCanvas.setBitmap(mTexture.bitmap); } @@ -68,7 +65,7 @@ public abstract class SpriteManager { return null; } - public void clear(){ + public void clear() { TextureItem.releaseAll(mTexture); mAtlas.clear(); items = null; @@ -78,7 +75,7 @@ public abstract class SpriteManager { mCanvas.setBitmap(mTexture.bitmap); } - public TextureItem getTextures(){ + public TextureItem getTextures() { return mTexture; } @@ -99,4 +96,4 @@ public abstract class SpriteManager { abstract void draw(T item, Rect r); -} \ No newline at end of file +} diff --git a/vtm/src/org/oscim/renderer/atlas/TextureAtlas.java b/vtm/src/org/oscim/renderer/atlas/TextureAtlas.java index 05eee56c..86138aac 100644 --- a/vtm/src/org/oscim/renderer/atlas/TextureAtlas.java +++ b/vtm/src/org/oscim/renderer/atlas/TextureAtlas.java @@ -66,7 +66,6 @@ import org.oscim.backend.canvas.Bitmap; import org.oscim.renderer.elements.TextureItem; import org.oscim.utils.pool.Inlist; - public class TextureAtlas extends Inlist { private final static String TAG = TextureAtlas.class.getName(); @@ -86,7 +85,6 @@ public class TextureAtlas extends Inlist { /** Allocated surface size */ int mUsed; - public TextureItem texture; /** diff --git a/vtm/src/org/oscim/renderer/elements/BitmapLayer.java b/vtm/src/org/oscim/renderer/elements/BitmapLayer.java index 862ed848..00d9d144 100644 --- a/vtm/src/org/oscim/renderer/elements/BitmapLayer.java +++ b/vtm/src/org/oscim/renderer/elements/BitmapLayer.java @@ -173,7 +173,7 @@ public class BitmapLayer extends TextureLayer { GL = gl; mTextureProgram = GLUtils.createProgram(textVertexShader, - textFragmentShader); + textFragmentShader); hTextureMVMatrix = GL.glGetUniformLocation(mTextureProgram, "u_mv"); hTextureProjMatrix = GL.glGetUniformLocation(mTextureProgram, "u_proj"); @@ -185,7 +185,7 @@ public class BitmapLayer extends TextureLayer { } public static RenderElement draw(RenderElement renderElement, Matrices m, float scale, - float alpha) { + float alpha) { //GLState.test(false, false); GLState.blend(true); @@ -221,17 +221,17 @@ public class BitmapLayer extends TextureLayer { int off = (ti.offset + i) * 8 + tl.offset; GL.glVertexAttribPointer(hTextureVertex, 4, - GL20.GL_SHORT, false, 12, off); + GL20.GL_SHORT, false, 12, off); GL.glVertexAttribPointer(hTextureTexCoord, 2, - GL20.GL_SHORT, false, 12, off + 8); + GL20.GL_SHORT, false, 12, off + 8); int numVertices = ti.vertices - i; if (numVertices > maxVertices) numVertices = maxVertices; GL.glDrawElements(GL20.GL_TRIANGLES, numVertices, - GL20.GL_UNSIGNED_SHORT, 0); + GL20.GL_UNSIGNED_SHORT, 0); } } @@ -241,27 +241,27 @@ public class BitmapLayer extends TextureLayer { } private final static String textVertexShader = "" - + "precision mediump float; " - + "attribute vec4 vertex;" - + "attribute vec2 tex_coord;" - + "uniform mat4 u_mv;" - + "uniform mat4 u_proj;" - + "uniform float u_scale;" - + "uniform float u_swidth;" - + "varying vec2 tex_c;" - + "void main() {" - + " gl_Position = u_mv * vec4(vertex.xy, 0.0, 1.0);" - + " tex_c = tex_coord;" - + "}"; + + "precision mediump float; " + + "attribute vec4 vertex;" + + "attribute vec2 tex_coord;" + + "uniform mat4 u_mv;" + + "uniform mat4 u_proj;" + + "uniform float u_scale;" + + "uniform float u_swidth;" + + "varying vec2 tex_c;" + + "void main() {" + + " gl_Position = u_mv * vec4(vertex.xy, 0.0, 1.0);" + + " tex_c = tex_coord;" + + "}"; private final static String textFragmentShader = "" - + "precision mediump float;" - + "uniform sampler2D tex;" - + "uniform float u_alpha;" - + "varying vec2 tex_c;" - + "void main() {" - + " gl_FragColor = texture2D(tex, tex_c.xy) * u_alpha;" - + "}"; + + "precision mediump float;" + + "uniform sampler2D tex;" + + "uniform float u_alpha;" + + "varying vec2 tex_c;" + + "void main() {" + + " gl_FragColor = texture2D(tex, tex_c.xy) * u_alpha;" + + "}"; } } diff --git a/vtm/src/org/oscim/renderer/elements/ElementLayers.java b/vtm/src/org/oscim/renderer/elements/ElementLayers.java index 0f898456..005f2c16 100644 --- a/vtm/src/org/oscim/renderer/elements/ElementLayers.java +++ b/vtm/src/org/oscim/renderer/elements/ElementLayers.java @@ -162,7 +162,7 @@ public class ElementLayers { if (renderElement.type != type) { // check if found layer matches requested type Log.d(TAG, "BUG wrong layer " + renderElement.type + " " + type + - " on layer " + renderElement.level); + " on layer " + renderElement.level); // TODO throw exception return null; } @@ -173,9 +173,9 @@ public class ElementLayers { } private final static int[] VERTEX_SHORT_CNT = { - 4, // LINE_VERTEX_SHORTS - 2, // POLY_VERTEX_SHORTS - 6, // TEXLINE_VERTEX_SHORTS + 4, // LINE_VERTEX_SHORTS + 2, // POLY_VERTEX_SHORTS + 6, // TEXLINE_VERTEX_SHORTS }; private final static int TEXTURE_VERTEX_SHORTS = 6; diff --git a/vtm/src/org/oscim/renderer/elements/ExtrusionLayer.java b/vtm/src/org/oscim/renderer/elements/ExtrusionLayer.java index b7a44bab..cae71bcc 100644 --- a/vtm/src/org/oscim/renderer/elements/ExtrusionLayer.java +++ b/vtm/src/org/oscim/renderer/elements/ExtrusionLayer.java @@ -126,7 +126,7 @@ public class ExtrusionLayer extends RenderElement { // 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]) { + && points[ppos + 1] == points[ppos + len - 1]) { len -= 2; Log.d(TAG, "explicit closed poly " + len); } @@ -185,7 +185,7 @@ public class ExtrusionLayer extends RenderElement { } int used = Tessellator.triangulate(points, ppos, len, index, ipos, rings, - startVertex + 1, mCurIndices[IND_ROOF]); + startVertex + 1, mCurIndices[IND_ROOF]); if (used > 0) { // get back to the last item added.. diff --git a/vtm/src/org/oscim/renderer/elements/LineLayer.java b/vtm/src/org/oscim/renderer/elements/LineLayer.java index 434557d5..b50fdf02 100644 --- a/vtm/src/org/oscim/renderer/elements/LineLayer.java +++ b/vtm/src/org/oscim/renderer/elements/LineLayer.java @@ -586,7 +586,7 @@ public final class LineLayer extends RenderElement { // factor to normalize extrusion vector and scale to coord scale private final static float COORD_SCALE_BY_DIR_SCALE = - MapRenderer.COORD_SCALE / LineLayer.DIR_SCALE; + MapRenderer.COORD_SCALE / LineLayer.DIR_SCALE; // shader handles private static int[] lineProgram = new int[2]; @@ -602,14 +602,14 @@ public final class LineLayer extends RenderElement { GL = gl; lineProgram[0] = GLUtils.createProgram(lineVertexShader, - lineFragmentShader); + lineFragmentShader); if (lineProgram[0] == 0) { Log.e(TAG, "Could not create line program."); //return false; } lineProgram[1] = GLUtils.createProgram(lineVertexShader, - lineSimpleFragmentShader); + lineSimpleFragmentShader); if (lineProgram[1] == 0) { Log.e(TAG, "Could not create simple line program."); return false; @@ -643,16 +643,16 @@ public final class LineLayer extends RenderElement { } mTexID = GLUtils.loadTexture(pixel, 128, 128, GL20.GL_ALPHA, - GL20.GL_NEAREST, GL20.GL_NEAREST, - GL20.GL_MIRRORED_REPEAT, GL20.GL_MIRRORED_REPEAT); + GL20.GL_NEAREST, GL20.GL_NEAREST, + GL20.GL_MIRRORED_REPEAT, GL20.GL_MIRRORED_REPEAT); Log.d(TAG, "TEX ID: " + mTexID); return true; } public static RenderElement draw(ElementLayers layers, RenderElement curLayer, - MapPosition pos, - Matrices m, float div, int mode) { + MapPosition pos, + Matrices m, float div, int mode) { if (curLayer == null) return null; @@ -680,7 +680,7 @@ public final class LineLayer extends RenderElement { GLState.enableVertexArrays(hLineVertexPosition[mode], -1); GL.glVertexAttribPointer(hLineVertexPosition[mode], 4, GL20.GL_SHORT, - false, 0, layers.lineOffset + LINE_VERTICES_DATA_POS_OFFSET); + false, 0, layers.lineOffset + LINE_VERTICES_DATA_POS_OFFSET); //glUniformMatrix4fv(hLineMatrix[mode], 1, false, matrix, 0); m.mvp.setAsUniform(hLineMatrix[mode]); @@ -809,84 +809,84 @@ public final class LineLayer extends RenderElement { } private final static String lineVertexShader = "" - + "precision mediump float;" - + "uniform mat4 u_mvp;" - // factor to increase line width relative to scale - + "uniform float u_width;" - // xy hold position, zw extrusion vector - + "attribute vec4 a_pos;" - + "uniform float u_mode;" - + "varying vec2 v_st;" - + "void main() {" - // scale extrusion to u_width pixel - // just ignore the two most insignificant bits of a_st :) - + " vec2 dir = a_pos.zw;" - + " gl_Position = u_mvp * vec4(a_pos.xy + (u_width * dir), 0.0, 1.0);" - // last two bits of a_st hold the texture coordinates - // ..maybe one could wrap texture so that `abs` is not required - + " v_st = abs(mod(dir, 4.0)) - 1.0;" - + "}"; + + "precision mediump float;" + + "uniform mat4 u_mvp;" + // factor to increase line width relative to scale + + "uniform float u_width;" + // xy hold position, zw extrusion vector + + "attribute vec4 a_pos;" + + "uniform float u_mode;" + + "varying vec2 v_st;" + + "void main() {" + // scale extrusion to u_width pixel + // just ignore the two most insignificant bits of a_st :) + + " vec2 dir = a_pos.zw;" + + " gl_Position = u_mvp * vec4(a_pos.xy + (u_width * dir), 0.0, 1.0);" + // last two bits of a_st hold the texture coordinates + // ..maybe one could wrap texture so that `abs` is not required + + " v_st = abs(mod(dir, 4.0)) - 1.0;" + + "}"; private final static String lineSimpleFragmentShader = "" - + "precision mediump float;" - + "uniform sampler2D tex;" - + "uniform float u_wscale;" - + "uniform float u_mode;" - + "uniform vec4 u_color;" - + "varying vec2 v_st;" - + "void main() {" - //+ " float len;" - // (currently required as overlay line renderers dont load the texture) - //+ " if (u_mode == 0)" - //+ " len = abs(v_st.s);" - //+ " else" - //+ " len = texture2D(tex, v_st).a;" - //+ " len = u_mode * length(v_st);" - // this avoids branching, need to check performance - + (GLAdapter.GDX_DESKTOP_QUIRKS - ? " float len = max((1.0 - u_mode) * abs(v_st.s), u_mode * length(v_st));" - : " float len = max((1.0 - u_mode) * abs(v_st.s), u_mode * texture2D(tex, v_st).a);") - // interpolate alpha between: 0.0 < 1.0 - len < u_wscale - // where wscale is 'filter width' / 'line width' and 0 <= len <= sqrt(2) - //+ " gl_FragColor = u_color * smoothstep(0.0, u_wscale, 1.0 - len);" - //+ " gl_FragColor = mix(vec4(1.0,0.0,0.0,1.0), u_color, smoothstep(0.0, u_wscale, 1.0 - len));" - + " float alpha = min(1.0, (1.0 - len) / u_wscale);" - + " if (alpha > 0.1)" - + " gl_FragColor = u_color * alpha;" - + " else" - + " discard;" - // + "gl_FragColor = vec4(texture2D(tex, v_st).a);" - + "}"; + + "precision mediump float;" + + "uniform sampler2D tex;" + + "uniform float u_wscale;" + + "uniform float u_mode;" + + "uniform vec4 u_color;" + + "varying vec2 v_st;" + + "void main() {" + //+ " float len;" + // (currently required as overlay line renderers dont load the texture) + //+ " if (u_mode == 0)" + //+ " len = abs(v_st.s);" + //+ " else" + //+ " len = texture2D(tex, v_st).a;" + //+ " len = u_mode * length(v_st);" + // this avoids branching, need to check performance + + (GLAdapter.GDX_DESKTOP_QUIRKS + ? " float len = max((1.0 - u_mode) * abs(v_st.s), u_mode * length(v_st));" + : " float len = max((1.0 - u_mode) * abs(v_st.s), u_mode * texture2D(tex, v_st).a);") + // interpolate alpha between: 0.0 < 1.0 - len < u_wscale + // where wscale is 'filter width' / 'line width' and 0 <= len <= sqrt(2) + //+ " gl_FragColor = u_color * smoothstep(0.0, u_wscale, 1.0 - len);" + //+ " gl_FragColor = mix(vec4(1.0,0.0,0.0,1.0), u_color, smoothstep(0.0, u_wscale, 1.0 - len));" + + " float alpha = min(1.0, (1.0 - len) / u_wscale);" + + " if (alpha > 0.1)" + + " gl_FragColor = u_color * alpha;" + + " else" + + " discard;" + // + "gl_FragColor = vec4(texture2D(tex, v_st).a);" + + "}"; private final static String lineFragmentShader = "" - + "#extension GL_OES_standard_derivatives : enable\n" - + "precision mediump float;" - + "uniform sampler2D tex;" - + "uniform float u_mode;" - + "uniform vec4 u_color;" - + "uniform float u_wscale;" - + "varying vec2 v_st;" - + "void main() {" - + " float len;" - + " float fuzz;" - + " if (u_mode == 0.0){" - + " len = abs(v_st.s);" - + " fuzz = fwidth(v_st.s);" - + " } else {" - + (GLAdapter.GDX_DESKTOP_QUIRKS - ? " len = length(v_st);" - : " len = texture2D(tex, v_st).a;") - + " vec2 st_width = fwidth(v_st);" - + " fuzz = max(st_width.s, st_width.t);" - + " }" - //+ " gl_FragColor = u_color * smoothstep(0.0, fuzz + u_wscale, 1.0 - len);" - // smoothstep is too sharp, guess one could increase extrusion with z.. - // this looks ok: - //+ " gl_FragColor = u_color * min(1.0, (1.0 - len) / (u_wscale + fuzz));" - // can be faster according to nvidia docs 'Optimize OpenGL ES 2.0 Performace' - + " gl_FragColor = u_color * clamp((1.0 - len) / (u_wscale + fuzz), 0.0, 1.0);" - //+ " gl_FragColor = mix(vec4(0.0,1.0,0.0,1.0), u_color, clamp((1.0 - len) / (u_wscale + fuzz), 0.0, 1.0));" - + "}"; + + "#extension GL_OES_standard_derivatives : enable\n" + + "precision mediump float;" + + "uniform sampler2D tex;" + + "uniform float u_mode;" + + "uniform vec4 u_color;" + + "uniform float u_wscale;" + + "varying vec2 v_st;" + + "void main() {" + + " float len;" + + " float fuzz;" + + " if (u_mode == 0.0){" + + " len = abs(v_st.s);" + + " fuzz = fwidth(v_st.s);" + + " } else {" + + (GLAdapter.GDX_DESKTOP_QUIRKS + ? " len = length(v_st);" + : " len = texture2D(tex, v_st).a;") + + " vec2 st_width = fwidth(v_st);" + + " fuzz = max(st_width.s, st_width.t);" + + " }" + //+ " gl_FragColor = u_color * smoothstep(0.0, fuzz + u_wscale, 1.0 - len);" + // smoothstep is too sharp, guess one could increase extrusion with z.. + // this looks ok: + //+ " gl_FragColor = u_color * min(1.0, (1.0 - len) / (u_wscale + fuzz));" + // can be faster according to nvidia docs 'Optimize OpenGL ES 2.0 Performace' + + " gl_FragColor = u_color * clamp((1.0 - len) / (u_wscale + fuzz), 0.0, 1.0);" + //+ " gl_FragColor = mix(vec4(0.0,1.0,0.0,1.0), u_color, clamp((1.0 - len) / (u_wscale + fuzz), 0.0, 1.0));" + + "}"; // private final static String lineVertexShader = "" // + "precision mediump float;" diff --git a/vtm/src/org/oscim/renderer/elements/LineTexLayer.java b/vtm/src/org/oscim/renderer/elements/LineTexLayer.java index efbfb5f2..cf3453a0 100644 --- a/vtm/src/org/oscim/renderer/elements/LineTexLayer.java +++ b/vtm/src/org/oscim/renderer/elements/LineTexLayer.java @@ -254,8 +254,8 @@ public final class LineTexLayer extends RenderElement { // factor to normalize extrusion vector and scale to coord scale private final static float COORD_SCALE_BY_DIR_SCALE = - MapRenderer.COORD_SCALE - / LineLayer.DIR_SCALE; + MapRenderer.COORD_SCALE + / LineLayer.DIR_SCALE; private static int shader; private static int hVertexPosition0; @@ -305,7 +305,7 @@ public final class LineTexLayer extends RenderElement { flip[i] = (byte) (i % 2); ByteBuffer buf = ByteBuffer.allocateDirect(flip.length) - .order(ByteOrder.nativeOrder()); + .order(ByteOrder.nativeOrder()); buf.put(flip); buf.flip(); @@ -313,7 +313,7 @@ public final class LineTexLayer extends RenderElement { GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, mVertexFlipID); GL.glBufferData(GL20.GL_ARRAY_BUFFER, flip.length, sbuf, - GL20.GL_STATIC_DRAW); + GL20.GL_STATIC_DRAW); GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0); // mTexID = new int[10]; @@ -327,7 +327,7 @@ public final class LineTexLayer extends RenderElement { private final static int LEN_OFFSET = 8; public static RenderElement draw(ElementLayers layers, RenderElement curLayer, - MapPosition pos, Matrices m, float div) { + MapPosition pos, Matrices m, float div) { // shader failed to compile if (shader == 0) @@ -348,11 +348,11 @@ public final class LineTexLayer extends RenderElement { int maxIndices = MapRenderer.maxQuads * 6; GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, - MapRenderer.mQuadIndicesID); + MapRenderer.mQuadIndicesID); GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, mVertexFlipID); GL.glVertexAttribPointer(hVertexFlip, 1, - GL20.GL_BYTE, false, 0, 0); + GL20.GL_BYTE, false, 0, 0); layers.vbo.bind(); @@ -395,23 +395,23 @@ public final class LineTexLayer extends RenderElement { int add = (l.offset + i * 8) + vOffset; GL.glVertexAttribPointer(hVertexPosition0, - 4, GL20.GL_SHORT, false, STRIDE, - add + STRIDE); + 4, GL20.GL_SHORT, false, STRIDE, + add + STRIDE); GL.glVertexAttribPointer(hVertexLength0, - 2, GL20.GL_SHORT, false, STRIDE, - add + STRIDE + LEN_OFFSET); + 2, GL20.GL_SHORT, false, STRIDE, + add + STRIDE + LEN_OFFSET); GL.glVertexAttribPointer(hVertexPosition1, - 4, GL20.GL_SHORT, false, STRIDE, - add); + 4, GL20.GL_SHORT, false, STRIDE, + add); GL.glVertexAttribPointer(hVertexLength1, - 2, GL20.GL_SHORT, false, STRIDE, - add + LEN_OFFSET); + 2, GL20.GL_SHORT, false, STRIDE, + add + LEN_OFFSET); GL.glDrawElements(GL20.GL_TRIANGLES, numIndices, - GL20.GL_UNSIGNED_SHORT, 0); + GL20.GL_UNSIGNED_SHORT, 0); } // second pass @@ -424,23 +424,23 @@ public final class LineTexLayer extends RenderElement { int add = (l.offset + i * 8) + vOffset; GL.glVertexAttribPointer(hVertexPosition0, - 4, GL20.GL_SHORT, false, STRIDE, - add + 2 * STRIDE); + 4, GL20.GL_SHORT, false, STRIDE, + add + 2 * STRIDE); GL.glVertexAttribPointer(hVertexLength0, - 2, GL20.GL_SHORT, false, STRIDE, - add + 2 * STRIDE + LEN_OFFSET); + 2, GL20.GL_SHORT, false, STRIDE, + add + 2 * STRIDE + LEN_OFFSET); GL.glVertexAttribPointer(hVertexPosition1, - 4, GL20.GL_SHORT, false, STRIDE, - add + STRIDE); + 4, GL20.GL_SHORT, false, STRIDE, + add + STRIDE); GL.glVertexAttribPointer(hVertexLength1, - 2, GL20.GL_SHORT, false, STRIDE, - add + STRIDE + LEN_OFFSET); + 2, GL20.GL_SHORT, false, STRIDE, + add + STRIDE + LEN_OFFSET); GL.glDrawElements(GL20.GL_TRIANGLES, numIndices, - GL20.GL_UNSIGNED_SHORT, 0); + GL20.GL_UNSIGNED_SHORT, 0); } //GlUtils.checkGlError(TAG); } @@ -459,54 +459,55 @@ public final class LineTexLayer extends RenderElement { } final static String vertexShader = "" - + "precision mediump float;" - + "uniform mat4 u_mvp;" - + "uniform vec4 u_color;" - + "uniform float u_pscale;" - + "uniform float u_width;" - + "attribute vec4 a_pos0;" - + "attribute vec4 a_pos1;" - + "attribute vec2 a_len0;" - + "attribute vec2 a_len1;" - + "attribute float a_flip;" - + "varying vec2 v_st;" - + "void main() {" - + " vec4 pos;" - + " if (a_flip == 0.0){" - //+ " vec2 dir = u_width * a_pos0.zw;" - + " pos = vec4(a_pos0.xy + (u_width * a_pos0.zw), 0.0, 1.0);" - + " v_st = vec2(a_len0.x / u_pscale, 1.0);" - + " } else {" - //+ " vec2 dir = u_width * a_pos1.zw;" - + " pos = vec4(a_pos1.xy - (u_width * a_pos1.zw), 0.0, 1.0);" - + " v_st = vec2(a_len1.x / u_pscale, -1.0);" - + " }" - + " gl_Position = u_mvp * pos;" - + "}"; + + "precision mediump float;" + + "uniform mat4 u_mvp;" + + "uniform vec4 u_color;" + + "uniform float u_pscale;" + + "uniform float u_width;" + + "attribute vec4 a_pos0;" + + "attribute vec4 a_pos1;" + + "attribute vec2 a_len0;" + + "attribute vec2 a_len1;" + + "attribute float a_flip;" + + "varying vec2 v_st;" + + "void main() {" + + " vec4 pos;" + + " if (a_flip == 0.0){" + //+ " vec2 dir = u_width * a_pos0.zw;" + + " pos = vec4(a_pos0.xy + (u_width * a_pos0.zw), 0.0, 1.0);" + + " v_st = vec2(a_len0.x / u_pscale, 1.0);" + + " } else {" + //+ " vec2 dir = u_width * a_pos1.zw;" + + " pos = vec4(a_pos1.xy - (u_width * a_pos1.zw), 0.0, 1.0);" + + " v_st = vec2(a_len1.x / u_pscale, -1.0);" + + " }" + + " gl_Position = u_mvp * pos;" + + "}"; //* final static String fragmentShader = "" - + "#extension GL_OES_standard_derivatives : enable\n" - + " precision mediump float;" - + " uniform vec4 u_color;" - + " uniform vec4 u_bgcolor;" - + " uniform float u_pwidth;" - + " varying vec2 v_st;" - + " void main() {" - // distance on perpendicular to the line - + " float dist = abs(v_st.t);" - + " float fuzz = fwidth(v_st.t);" - + " float fuzz_p = fwidth(v_st.s);" - + " float line_w = smoothstep(0.0, fuzz, 1.0 - dist);" - + " float stipple_w = smoothstep(0.0, fuzz, u_pwidth - dist);" - // triangle waveform in the range 0..1 for regular pattern - + " float phase = abs(mod(v_st.s, 2.0) - 1.0);" - // interpolate between on/off phase, 0.5 = equal phase length - + " float stipple_p = smoothstep(0.5 - fuzz_p, 0.5 + fuzz_p, phase);" - + " gl_FragColor = line_w * mix(u_bgcolor, u_color, min(stipple_w, stipple_p));" - + " } "; //*/ + + "#extension GL_OES_standard_derivatives : enable\n" + + " precision mediump float;" + + " uniform vec4 u_color;" + + " uniform vec4 u_bgcolor;" + + " uniform float u_pwidth;" + + " varying vec2 v_st;" + + " void main() {" + // distance on perpendicular to the line + + " float dist = abs(v_st.t);" + + " float fuzz = fwidth(v_st.t);" + + " float fuzz_p = fwidth(v_st.s);" + + " float line_w = smoothstep(0.0, fuzz, 1.0 - dist);" + + " float stipple_w = smoothstep(0.0, fuzz, u_pwidth - dist);" + // triangle waveform in the range 0..1 for regular pattern + + " float phase = abs(mod(v_st.s, 2.0) - 1.0);" + // interpolate between on/off phase, 0.5 = equal phase length + + " float stipple_p = smoothstep(0.5 - fuzz_p, 0.5 + fuzz_p, phase);" + + " gl_FragColor = line_w * mix(u_bgcolor, u_color, min(stipple_w, stipple_p));" + + " } "; //*/ - /* final static String fragmentShader = "" + /* + * final static String fragmentShader = "" * + "#extension GL_OES_standard_derivatives : enable\n" * + " precision mediump float;" * + " uniform sampler2D tex;" @@ -527,8 +528,10 @@ public final class LineTexLayer extends RenderElement { * + " gl_FragColor = u_bgcolor * stipple_p;" * // + * " gl_FragColor = line_w * mix(u_bgcolor, u_color, min(stipple_w, stipple_p));" - * + "}"; // */ - /* final static String fragmentShader = "" + * + "}"; // + */ + /* + * final static String fragmentShader = "" * + "#extension GL_OES_standard_derivatives : enable\n" * + " precision mediump float;" * + " uniform sampler2D tex;" @@ -547,7 +550,8 @@ public final class LineTexLayer extends RenderElement { * + " float stipple_p = smoothstep(0.495, 0.505, dist);" * + * " gl_FragColor = line_w * mix(u_bgcolor, u_color, min(stipple_w, stipple_p));" - * + " } "; // */ + * + " } "; // + */ } } diff --git a/vtm/src/org/oscim/renderer/elements/MeshLayer.java b/vtm/src/org/oscim/renderer/elements/MeshLayer.java index 26404808..35b4a3f1 100644 --- a/vtm/src/org/oscim/renderer/elements/MeshLayer.java +++ b/vtm/src/org/oscim/renderer/elements/MeshLayer.java @@ -21,9 +21,8 @@ import org.oscim.backend.Log; import org.oscim.core.GeometryBuffer; import org.oscim.core.Tile; - public class MeshLayer extends RenderElement { - GeometryBuffer mGeom = new GeometryBuffer(10,10); + GeometryBuffer mGeom = new GeometryBuffer(10, 10); public MeshLayer() { GeometryBuffer e = mGeom; @@ -58,18 +57,18 @@ public class MeshLayer extends RenderElement { addMesh(e); } - public void addMesh(GeometryBuffer geom){ + public void addMesh(GeometryBuffer geom) { int numRings = 2; long ctx = tessellate(geom.points, 0, geom.index, 0, numRings); short[] coordinates = new short[100]; - while (tessGetCoordinates(ctx, coordinates, 2) > 0){ + while (tessGetCoordinates(ctx, coordinates, 2) > 0) { Log.d("..", Arrays.toString(coordinates)); } - while (tessGetIndices(ctx, coordinates) > 0){ + while (tessGetIndices(ctx, coordinates) > 0) { Log.d("..", Arrays.toString(coordinates)); } @@ -95,7 +94,7 @@ public class MeshLayer extends RenderElement { * @return number of triangles in io buffer */ public static native int tessellate(float[] points, int pos, - short[] index, int ipos, int numRings); + short[] index, int ipos, int numRings); public static native void tessFinish(long ctx); diff --git a/vtm/src/org/oscim/renderer/elements/PolygonLayer.java b/vtm/src/org/oscim/renderer/elements/PolygonLayer.java index 9f7480cc..63b95d44 100644 --- a/vtm/src/org/oscim/renderer/elements/PolygonLayer.java +++ b/vtm/src/org/oscim/renderer/elements/PolygonLayer.java @@ -52,7 +52,7 @@ public final class PolygonLayer extends RenderElement { vertexItems = curItem; } - public void addPolygon(GeometryBuffer geom){ + public void addPolygon(GeometryBuffer geom) { addPolygon(geom.points, geom.index); } @@ -153,13 +153,13 @@ public final class PolygonLayer extends RenderElement { if (i == 0) { if (MapRenderer.debugView) polygonProgram[i] = GLUtils.createProgram(polygonVertexShaderZ, - polygonFragmentShaderZ); + polygonFragmentShaderZ); else polygonProgram[i] = GLUtils.createProgram(polygonVertexShader, - polygonFragmentShader); + polygonFragmentShader); } else if (i == 1) { polygonProgram[i] = GLUtils.createProgram(textureVertexShader, - textureFragmentShader); + textureFragmentShader); } @@ -180,7 +180,7 @@ public final class PolygonLayer extends RenderElement { } private static void fillPolygons(Matrices m, int start, int end, int zoom, float scale, - float div) { + float div) { /* draw to framebuffer */ GL.glColorMask(true, true, true, true); @@ -222,7 +222,7 @@ public final class PolygonLayer extends RenderElement { if (a.blend == zoom) GLUtils.setColorBlend(hPolygonColor[shader], - a.color, a.blendColor, scale - 1.0f); + a.color, a.blendColor, scale - 1.0f); else GLUtils.setColor(hPolygonColor[shader], a.blendColor, 1); @@ -260,7 +260,7 @@ public final class PolygonLayer extends RenderElement { GLState.enableVertexArrays(hPolygonVertexPosition[shader], -1); GL.glVertexAttribPointer(hPolygonVertexPosition[shader], 2, GL20.GL_SHORT, - false, 0, POLYGON_VERTICES_DATA_POS_OFFSET); + false, 0, POLYGON_VERTICES_DATA_POS_OFFSET); m.mvp.setAsUniform(hPolygonMatrix[shader]); } @@ -268,7 +268,7 @@ public final class PolygonLayer extends RenderElement { /** * draw polygon layers (unil layer.next is not polygon layer) * using stencil buffer method - * + * * @param pos * used to fade layers accorind to 'fade' * in layer.area. @@ -286,7 +286,7 @@ public final class PolygonLayer extends RenderElement { * next layer */ public static RenderElement draw(MapPosition pos, RenderElement renderElement, - Matrices m, boolean first, float div, boolean clip) { + Matrices m, boolean first, float div, boolean clip) { GLState.test(false, true); @@ -367,7 +367,7 @@ public final class PolygonLayer extends RenderElement { /** * Draw a tile filling rectangle to set stencil- and depth buffer * appropriately - * + * * @param first in the first run the clip region is set based on * depth buffer and depth buffer is updated */ @@ -465,8 +465,10 @@ public final class PolygonLayer extends RenderElement { static void debugDraw(GLMatrix m, float[] coords, int color) { GLState.test(false, false); if (mDebugFill == null) { - mDebugFill = ByteBuffer.allocateDirect(32).order(ByteOrder.nativeOrder()) - .asFloatBuffer(); + mDebugFill = ByteBuffer + .allocateDirect(32) + .order(ByteOrder.nativeOrder()) + .asFloatBuffer(); mDebugFill.put(coords); } @@ -477,7 +479,7 @@ public final class PolygonLayer extends RenderElement { GL.glEnableVertexAttribArray(hPolygonVertexPosition[0]); GL.glVertexAttribPointer(hPolygonVertexPosition[0], 2, GL20.GL_FLOAT, - false, 0, mDebugFill); + false, 0, mDebugFill); m.setAsUniform(hPolygonMatrix[0]); @@ -492,67 +494,67 @@ public final class PolygonLayer extends RenderElement { } private final static String polygonVertexShader = "" - + "precision mediump float;" - + "uniform mat4 u_mvp;" - + "attribute vec4 a_pos;" - + "void main() {" - + " gl_Position = u_mvp * a_pos;" - + "}"; + + "precision mediump float;" + + "uniform mat4 u_mvp;" + + "attribute vec4 a_pos;" + + "void main() {" + + " gl_Position = u_mvp * a_pos;" + + "}"; private final static String polygonFragmentShader = "" - + "precision mediump float;" - + "uniform vec4 u_color;" - + "void main() {" - + " gl_FragColor = u_color;" - + "}"; + + "precision mediump float;" + + "uniform vec4 u_color;" + + "void main() {" + + " gl_FragColor = u_color;" + + "}"; private final static String polygonVertexShaderZ = "" - + "precision highp float;" - + "uniform mat4 u_mvp;" - + "attribute vec4 a_pos;" - + "varying float z;" - + "void main() {" - + " gl_Position = u_mvp * a_pos;" - + " z = gl_Position.z;" - + "}"; + + "precision highp float;" + + "uniform mat4 u_mvp;" + + "attribute vec4 a_pos;" + + "varying float z;" + + "void main() {" + + " gl_Position = u_mvp * a_pos;" + + " z = gl_Position.z;" + + "}"; private final static String polygonFragmentShaderZ = "" - + "precision highp float;" - + "uniform vec4 u_color;" - + "varying float z;" - + "void main() {" - + "if (z < -1.0)" - + " gl_FragColor = vec4(0.0, z + 2.0, 0.0, 1.0)*0.8;" - + "else if (z < 0.0)" - + " gl_FragColor = vec4(z + 1.0, 0.0, 0.0, 1.0)*0.8;" - + "else if (z < 1.0)" - + " gl_FragColor = vec4(0.0, 0.0, z, 1.0)*0.8;" - + "else" - + " gl_FragColor = vec4(0.0, z - 1.0, 0.0, 1.0)*0.8;" - + "}"; + + "precision highp float;" + + "uniform vec4 u_color;" + + "varying float z;" + + "void main() {" + + "if (z < -1.0)" + + " gl_FragColor = vec4(0.0, z + 2.0, 0.0, 1.0)*0.8;" + + "else if (z < 0.0)" + + " gl_FragColor = vec4(z + 1.0, 0.0, 0.0, 1.0)*0.8;" + + "else if (z < 1.0)" + + " gl_FragColor = vec4(0.0, 0.0, z, 1.0)*0.8;" + + "else" + + " gl_FragColor = vec4(0.0, z - 1.0, 0.0, 1.0)*0.8;" + + "}"; private final static String textureVertexShader = "" - + "precision mediump float;" - + "uniform mat4 u_mvp;" - + "uniform vec2 u_scale;" - + "attribute vec4 a_pos;" - + "varying vec2 v_st;" - + "varying vec2 v_st2;" - + "void main() {" - + " v_st = clamp(a_pos.xy, 0.0, 1.0) * (2.0 / u_scale.y);" - + " v_st2 = clamp(a_pos.xy, 0.0, 1.0) * (4.0 / u_scale.y);" - + " gl_Position = u_mvp * a_pos;" - + "}"; + + "precision mediump float;" + + "uniform mat4 u_mvp;" + + "uniform vec2 u_scale;" + + "attribute vec4 a_pos;" + + "varying vec2 v_st;" + + "varying vec2 v_st2;" + + "void main() {" + + " v_st = clamp(a_pos.xy, 0.0, 1.0) * (2.0 / u_scale.y);" + + " v_st2 = clamp(a_pos.xy, 0.0, 1.0) * (4.0 / u_scale.y);" + + " gl_Position = u_mvp * a_pos;" + + "}"; private final static String textureFragmentShader = "" - + "precision mediump float;" - + "uniform vec4 u_color;" - + "uniform sampler2D tex;" - + "uniform vec2 u_scale;" - + "varying vec2 v_st;" - + "varying vec2 v_st2;" - + "void main() {" - + " gl_FragColor = mix(texture2D(tex, v_st), texture2D(tex, v_st2), u_scale.x);" - + "}"; + + "precision mediump float;" + + "uniform vec4 u_color;" + + "uniform sampler2D tex;" + + "uniform vec2 u_scale;" + + "varying vec2 v_st;" + + "varying vec2 v_st2;" + + "void main() {" + + " gl_FragColor = mix(texture2D(tex, v_st), texture2D(tex, v_st2), u_scale.x);" + + "}"; } } diff --git a/vtm/src/org/oscim/renderer/elements/RenderElement.java b/vtm/src/org/oscim/renderer/elements/RenderElement.java index b834a4aa..3c720ee6 100644 --- a/vtm/src/org/oscim/renderer/elements/RenderElement.java +++ b/vtm/src/org/oscim/renderer/elements/RenderElement.java @@ -18,7 +18,7 @@ import java.nio.ShortBuffer; import org.oscim.utils.pool.Inlist; -public abstract class RenderElement extends Inlist{ +public abstract class RenderElement extends Inlist { public final static byte LINE = 0; public final static byte POLYGON = 1; public final static byte TEXLINE = 2; @@ -44,5 +44,6 @@ public abstract class RenderElement extends Inlist{ protected VertexItem curItem; abstract protected void compile(ShortBuffer sbuf); + abstract protected void clear(); } diff --git a/vtm/src/org/oscim/renderer/elements/SymbolLayer.java b/vtm/src/org/oscim/renderer/elements/SymbolLayer.java index 8b295f4f..01b3a343 100644 --- a/vtm/src/org/oscim/renderer/elements/SymbolLayer.java +++ b/vtm/src/org/oscim/renderer/elements/SymbolLayer.java @@ -21,7 +21,6 @@ import org.oscim.backend.canvas.Bitmap; import org.oscim.renderer.atlas.TextureAtlas; import org.oscim.utils.pool.Inlist; - public final class SymbolLayer extends TextureLayer { private final static String TAG = SymbolLayer.class.getName(); @@ -129,8 +128,8 @@ public final class SymbolLayer extends TextureLayer { y1 = (short) (SCALE * (hh)); y2 = (short) (SCALE * (-hh)); } else { - float hw = (float)(it.offset.x * width); - float hh = (float)(it.offset.y * height); + float hw = (float) (it.offset.x * width); + float hh = (float) (it.offset.y * height); x1 = (short) (SCALE * (-hw)); x2 = (short) (SCALE * (width - hw)); y1 = (short) (SCALE * (height - hh)); @@ -146,15 +145,15 @@ public final class SymbolLayer extends TextureLayer { for (SymbolItem it2 = it;; it2 = it2.next) { if (it2 == null - || (it.bitmap != null && it2.bitmap != it.bitmap) - || (it.texRegion != null && it2.texRegion != it.texRegion)) { + || (it.bitmap != null && it2.bitmap != it.bitmap) + || (it.texRegion != null && it2.texRegion != it.texRegion)) { it = it2; break; } // add vertices short tx = (short) ((int) (SCALE * it2.x) & LBIT_MASK - | (it2.billboard ? 1 : 0)); + | (it2.billboard ? 1 : 0)); short ty = (short) (SCALE * it2.y); @@ -164,7 +163,7 @@ public final class SymbolLayer extends TextureLayer { } TextureLayer.putSprite(buf, pos, tx, ty, - x1, y1, x2, y2, u1, v1, u2, v2); + x1, y1, x2, y2, u1, v1, u2, v2); // TextureRenderer.VERTICES_PER_SPRITE // * TextureRenderer.SHORTS_PER_VERTICE; diff --git a/vtm/src/org/oscim/renderer/elements/TextItem.java b/vtm/src/org/oscim/renderer/elements/TextItem.java index 6e7a81d0..d5b137c7 100644 --- a/vtm/src/org/oscim/renderer/elements/TextItem.java +++ b/vtm/src/org/oscim/renderer/elements/TextItem.java @@ -55,14 +55,14 @@ public class TextItem extends Inlist { return ti; } - public static boolean shareText(TextItem ti1, TextItem ti2){ + public static boolean shareText(TextItem ti1, TextItem ti2) { if (ti1.text != ti2.text) return false; if (ti1.string == ti2.string) return true; - if (ti1.string.equals(ti2.string)){ + if (ti1.string.equals(ti2.string)) { // make strings unique, should be done only once.. ti1.string = ti2.string; return true; @@ -88,29 +88,29 @@ public class TextItem extends Inlist { if (it1.y1 < it1.y2) { if (it2.y1 < it2.y2) return (it1.x1 - add < it2.x2) - && (it2.x1 < it1.x2 + add) - && (it1.y1 - add < it2.y2) - && (it2.y1 < it1.y2 + add); + && (it2.x1 < it1.x2 + add) + && (it1.y1 - add < it2.y2) + && (it2.y1 < it1.y2 + add); // flip it2 return (it1.x1 - add < it2.x2) - && (it2.x1 < it1.x2 + add) - && (it1.y1 - add < it2.y1) - && (it2.y2 < it1.y2 + add); + && (it2.x1 < it1.x2 + add) + && (it1.y1 - add < it2.y1) + && (it2.y2 < it1.y2 + add); } // flip it1 if (it2.y1 < it2.y2) return (it1.x1 - add < it2.x2) - && (it2.x1 < it1.x2 + add) - && (it1.y2 - add < it2.y2) - && (it2.y1 < it1.y1 + add); + && (it2.x1 < it1.x2 + add) + && (it1.y2 - add < it2.y2) + && (it2.y1 < it1.y1 + add); // flip both return (it1.x1 - add < it2.x2) - && (it2.x1 < it1.x2 + add) - && (it1.y2 - add < it2.y1) - && (it2.y2 < it1.y1 + add); + && (it2.x1 < it1.x2 + add) + && (it1.y2 - add < it2.y1) + && (it2.y2 < it1.y1 + add); } // link to next node diff --git a/vtm/src/org/oscim/renderer/elements/TextLayer.java b/vtm/src/org/oscim/renderer/elements/TextLayer.java index 790ca96e..2f25b11a 100644 --- a/vtm/src/org/oscim/renderer/elements/TextLayer.java +++ b/vtm/src/org/oscim/renderer/elements/TextLayer.java @@ -51,12 +51,12 @@ public final class TextLayer extends TextureLayer { if (item.text == it.text) { while (it.next != null - // break if next item uses different text style - && item.text == it.next.text - // check same string instance - && item.string != it.string - // check same string - && !item.string.equals(it.string)) + // break if next item uses different text style + && item.text == it.next.text + // check same string instance + && item.string != it.string + // check same string + && !item.string.equals(it.string)) it = it.next; // unify duplicate string :) @@ -248,7 +248,7 @@ public final class TextLayer extends TextureLayer { verticesCnt += 4; if (it.next == null || (it.next.text != it.text) - || (it.next.string != it.string)) { + || (it.next.string != it.string)) { it = it.next; break; } diff --git a/vtm/src/org/oscim/renderer/elements/TextureItem.java b/vtm/src/org/oscim/renderer/elements/TextureItem.java index 83a735c5..f11a36e8 100644 --- a/vtm/src/org/oscim/renderer/elements/TextureItem.java +++ b/vtm/src/org/oscim/renderer/elements/TextureItem.java @@ -248,8 +248,8 @@ public class TextureItem extends Inlist { initTexture(t); if (TextureLayer.Renderer.debug) Log.d(TAG, "fill:" + pool.getFill() - + " count:" + mTexCnt - + " new texture " + t.id); + + " count:" + mTexCnt + + " new texture " + t.id); } //Log.d(TAG, "UPLOAD ID: " + t.id); diff --git a/vtm/src/org/oscim/renderer/elements/TextureLayer.java b/vtm/src/org/oscim/renderer/elements/TextureLayer.java index 233d90eb..4df1e16e 100644 --- a/vtm/src/org/oscim/renderer/elements/TextureLayer.java +++ b/vtm/src/org/oscim/renderer/elements/TextureLayer.java @@ -48,11 +48,11 @@ public abstract class TextureLayer extends RenderElement { abstract public boolean prepare(); static void putSprite(short buf[], int pos, - short tx, short ty, - short x1, short y1, - short x2, short y2, - short u1, short v1, - short u2, short v2) { + short tx, short ty, + short x1, short y1, + short x2, short y2, + short u1, short v1, + short u2, short v2) { // top-left buf[pos + 0] = tx; @@ -108,7 +108,7 @@ public abstract class TextureLayer extends RenderElement { GL = gl; mTextureProgram = GLUtils.createProgram(textVertexShader, - textFragmentShader); + textFragmentShader); hTextureMVMatrix = GL.glGetUniformLocation(mTextureProgram, "u_mv"); hTextureProjMatrix = GL.glGetUniformLocation(mTextureProgram, "u_proj"); @@ -149,8 +149,8 @@ public abstract class TextureLayer extends RenderElement { int maxVertices = MapRenderer.maxQuads * INDICES_PER_SPRITE; GL.glUniform2f(hTextureSize, - 1f / (ti.width * COORD_SCALE), - 1f / (ti.height * COORD_SCALE)); + 1f / (ti.width * COORD_SCALE), + 1f / (ti.height * COORD_SCALE)); // draw up to maxVertices in each iteration for (int i = 0; i < ti.vertices; i += maxVertices) { @@ -158,17 +158,17 @@ public abstract class TextureLayer extends RenderElement { int off = (ti.offset + i) * 8 + tl.offset; GL.glVertexAttribPointer(hTextureVertex, 4, - GL20.GL_SHORT, false, 12, off); + GL20.GL_SHORT, false, 12, off); GL.glVertexAttribPointer(hTextureTexCoord, 2, - GL20.GL_SHORT, false, 12, off + 8); + GL20.GL_SHORT, false, 12, off + 8); int numVertices = ti.vertices - i; if (numVertices > maxVertices) numVertices = maxVertices; GL.glDrawElements(GL20.GL_TRIANGLES, numVertices, - GL20.GL_UNSIGNED_SHORT, 0); + GL20.GL_UNSIGNED_SHORT, 0); } } @@ -180,35 +180,35 @@ public abstract class TextureLayer extends RenderElement { private final static double COORD_DIV = 1.0 / MapRenderer.COORD_SCALE; private final static String textVertexShader = "" - + "precision highp float;" - + "attribute vec4 vertex;" - + "attribute vec2 tex_coord;" - + "uniform mat4 u_mv;" - + "uniform mat4 u_proj;" - + "uniform float u_scale;" - + "uniform float u_swidth;" - + "uniform vec2 u_div;" - + "varying vec2 tex_c;" - + "const float coord_scale = " + COORD_DIV + ";" - + "void main() {" - + " vec4 pos;" - + " vec2 dir = vertex.zw;" - + " if (mod(vertex.x, 2.0) == 0.0){" - + " pos = u_proj * (u_mv * vec4(vertex.xy + dir * u_scale, 0.0, 1.0));" - + " } else {" // place as billboard - + " vec4 center = u_mv * vec4(vertex.xy, 0.0, 1.0);" - + " pos = u_proj * (center + vec4(dir * (coord_scale * u_swidth), 0.0, 0.0));" - + " }" - + " gl_Position = pos;" - + " tex_c = tex_coord * u_div;" - + "}"; + + "precision highp float;" + + "attribute vec4 vertex;" + + "attribute vec2 tex_coord;" + + "uniform mat4 u_mv;" + + "uniform mat4 u_proj;" + + "uniform float u_scale;" + + "uniform float u_swidth;" + + "uniform vec2 u_div;" + + "varying vec2 tex_c;" + + "const float coord_scale = " + COORD_DIV + ";" + + "void main() {" + + " vec4 pos;" + + " vec2 dir = vertex.zw;" + + " if (mod(vertex.x, 2.0) == 0.0){" + + " pos = u_proj * (u_mv * vec4(vertex.xy + dir * u_scale, 0.0, 1.0));" + + " } else {" // place as billboard + + " vec4 center = u_mv * vec4(vertex.xy, 0.0, 1.0);" + + " pos = u_proj * (center + vec4(dir * (coord_scale * u_swidth), 0.0, 0.0));" + + " }" + + " gl_Position = pos;" + + " tex_c = tex_coord * u_div;" + + "}"; private final static String textFragmentShader = "" - + "precision highp float;" - + "uniform sampler2D tex;" - + "varying vec2 tex_c;" - + "void main() {" - + " gl_FragColor = texture2D(tex, tex_c.xy);" - + "}"; + + "precision highp float;" + + "uniform sampler2D tex;" + + "varying vec2 tex_c;" + + "void main() {" + + " gl_FragColor = texture2D(tex, tex_c.xy);" + + "}"; } } diff --git a/vtm/src/org/oscim/renderer/elements/VertexItem.java b/vtm/src/org/oscim/renderer/elements/VertexItem.java index d654cb5f..12ed7eb0 100644 --- a/vtm/src/org/oscim/renderer/elements/VertexItem.java +++ b/vtm/src/org/oscim/renderer/elements/VertexItem.java @@ -36,12 +36,13 @@ public class VertexItem extends Inlist { }; /** - * Add VertexItems back to pool. Make sure to not use the reference afterwards! + * Add VertexItems back to pool. Make sure to not use the reference + * afterwards! * i.e.: * vertexItem.release(); * vertexItem = null; * */ - public void release(){ + public void release() { VertexItem.pool.releaseAll(this); } diff --git a/vtm/src/org/oscim/renderer/test/CustomRenderer.java b/vtm/src/org/oscim/renderer/test/CustomRenderer.java index 1907f712..f119b385 100644 --- a/vtm/src/org/oscim/renderer/test/CustomRenderer.java +++ b/vtm/src/org/oscim/renderer/test/CustomRenderer.java @@ -26,7 +26,6 @@ import org.oscim.renderer.GLUtils; import org.oscim.renderer.LayerRenderer; import org.oscim.renderer.MapRenderer.Matrices; - /* * This is an example how to integrate custom OpenGL drawing routines as map overlay * @@ -45,10 +44,10 @@ public class CustomRenderer extends LayerRenderer { private FloatBuffer mVertices; private final float[] mVerticesData = { - -200, -200, 1.0f, - 200, 200, 0, - -200, 200, 0.5f, - 200, -200, 0.5f, + -200, -200, 1.0f, + 200, 200, 0, + -200, 200, 0.5f, + 200, -200, 0.5f, }; private boolean mInitialized; @@ -135,28 +134,28 @@ public class CustomRenderer extends LayerRenderer { mProgramObject = programObject; mVertices = ByteBuffer.allocateDirect(mVerticesData.length * 4) - .order(ByteOrder.nativeOrder()).asFloatBuffer(); + .order(ByteOrder.nativeOrder()).asFloatBuffer(); return true; } - private final static String vShaderStr = - "precision mediump float;" - + "uniform mat4 u_mvp;" - + "attribute vec4 a_pos;" - + "varying float alpha;" - + "void main()" - + "{" - + " gl_Position = u_mvp * vec4(a_pos.xy, 0.0, 1.0);" - + " alpha = a_pos.z;" - + "}"; + private final static String vShaderStr = "" + + "precision mediump float;" + + "uniform mat4 u_mvp;" + + "attribute vec4 a_pos;" + + "varying float alpha;" + + "void main()" + + "{" + + " gl_Position = u_mvp * vec4(a_pos.xy, 0.0, 1.0);" + + " alpha = a_pos.z;" + + "}"; - private final static String fShaderStr = - "precision mediump float;" - + "varying float alpha;" - + "void main()" - + "{" - + " gl_FragColor = vec4 (alpha, 1.0-alpha, 0.0, 0.7 );" - + "}"; + private final static String fShaderStr = "" + + "precision mediump float;" + + "varying float alpha;" + + "void main()" + + "{" + + " gl_FragColor = vec4 (alpha, 1.0-alpha, 0.0, 0.7 );" + + "}"; } diff --git a/vtm/src/org/oscim/renderer/test/CustomRenderer2.java b/vtm/src/org/oscim/renderer/test/CustomRenderer2.java index 6445001e..f9616c93 100644 --- a/vtm/src/org/oscim/renderer/test/CustomRenderer2.java +++ b/vtm/src/org/oscim/renderer/test/CustomRenderer2.java @@ -27,7 +27,6 @@ import org.oscim.renderer.MapRenderer; import org.oscim.renderer.MapRenderer.Matrices; import org.oscim.utils.FastMath; - /* * This is an example how to integrate custom OpenGL drawing routines as map overlay * @@ -128,17 +127,20 @@ public class CustomRenderer2 extends ElementRenderer { //float alpha = 1 + (float) Math.log10(FastMath.clamp( // (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; + float alpha = (float) Math.sqrt(xx * xx + yy * yy) / offset_y; float fy = (float) (y + offset_y) / (offset_y * 2); float fx = (float) (x + offset_x) / (offset_x * 2); float fz = FastMath.clamp( - (float) (x < 0 || y < 0 ? 1 - Math.sqrt(fx * fx + fy * fy) : 0), 0, 1); + (float) (x < 0 || y < 0 ? 1 - Math.sqrt(fx * fx + fy * fy) + : 0), + 0, + 1); int c = 0xff << 24 - | (int) (0xff * fy) << 16 - | (int) (0xff * fx) << 8 - | (int) (0xff * fz); + | (int) (0xff * fy) << 16 + | (int) (0xff * fx) << 8 + | (int) (0xff * fz); GLUtils.setColor(hColorPosition, c, alpha); @@ -183,23 +185,23 @@ public class CustomRenderer2 extends ElementRenderer { return true; } - private final static String vShaderStr = - "precision mediump float;" - + "uniform mat4 u_mvp;" - + "uniform vec2 u_center;" - + "attribute vec2 a_pos;" - + "void main()" - + "{" - + " gl_Position = u_mvp * vec4(u_center + a_pos, 0.0, 1.0);" - + "}"; + private final static String vShaderStr = "" + + "precision mediump float;" + + "uniform mat4 u_mvp;" + + "uniform vec2 u_center;" + + "attribute vec2 a_pos;" + + "void main()" + + "{" + + " gl_Position = u_mvp * vec4(u_center + a_pos, 0.0, 1.0);" + + "}"; - private final static String fShaderStr = - "precision mediump float;" - + "varying float alpha;" - + "uniform vec4 u_color;" - + "void main()" - + "{" - + " gl_FragColor = u_color;" - + "}"; + private final static String fShaderStr = "" + + "precision mediump float;" + + "varying float alpha;" + + "uniform vec4 u_color;" + + "void main()" + + "{" + + " gl_FragColor = u_color;" + + "}"; } diff --git a/vtm/src/org/oscim/renderer/test/SymbolRenderLayer.java b/vtm/src/org/oscim/renderer/test/SymbolRenderLayer.java index 3eab526f..84f78b8e 100644 --- a/vtm/src/org/oscim/renderer/test/SymbolRenderLayer.java +++ b/vtm/src/org/oscim/renderer/test/SymbolRenderLayer.java @@ -42,7 +42,7 @@ public class SymbolRenderLayer extends ElementRenderer { @Override protected void update(MapPosition position, boolean changed, Matrices matrices) { - if (initialize){ + if (initialize) { initialize = false; mMapPosition.copy(position); compile(); diff --git a/vtm/src/org/oscim/renderer/test/TestRenderLayer.java b/vtm/src/org/oscim/renderer/test/TestRenderLayer.java index b8494ead..5ec9e498 100644 --- a/vtm/src/org/oscim/renderer/test/TestRenderLayer.java +++ b/vtm/src/org/oscim/renderer/test/TestRenderLayer.java @@ -116,7 +116,7 @@ public class TestRenderLayer extends ElementRenderer { @Override protected synchronized void update(MapPosition curPos, boolean positionChanged, - Matrices matrices) { + Matrices matrices) { // keep position constant (or update layer relative to new position) //mMapPosition.copy(curPos); diff --git a/vtm/src/org/oscim/theme/IRenderTheme.java b/vtm/src/org/oscim/theme/IRenderTheme.java index 196b3f08..0f177421 100644 --- a/vtm/src/org/oscim/theme/IRenderTheme.java +++ b/vtm/src/org/oscim/theme/IRenderTheme.java @@ -28,14 +28,13 @@ public interface IRenderTheme { /** * Matches a MapElement with the given parameters against this RenderTheme. - * + * * @param zoomLevel * the zoom level at which the way should be matched. * @return matching render instructions */ public abstract RenderInstruction[] matchElement(MapElement element, int zoomLevel); - /** * Must be called when this RenderTheme gets destroyed to clean up and free * resources. @@ -55,7 +54,7 @@ public interface IRenderTheme { /** * Scales the stroke width of this RenderTheme by the given factor. - * + * * @param scaleFactor * the factor by which the stroke width should be scaled. */ @@ -63,20 +62,19 @@ public interface IRenderTheme { /** * Scales the text size of this RenderTheme by the given factor. - * + * * @param scaleFactor * the factor by which the text size should be scaled. */ public abstract void scaleTextSize(float scaleFactor); - /** * Callback methods for rendering areas, ways and points of interest (POIs). */ public interface Callback { /** * Renders an area with the given parameters. - * + * * @param area * @param level */ @@ -84,7 +82,7 @@ public interface IRenderTheme { /** * Renders an area symbol with the given bitmap. - * + * * @param symbol * the symbol to be rendered. */ @@ -92,7 +90,7 @@ public interface IRenderTheme { /** * Renders an area caption with the given text. - * + * * @param text * the text to be rendered. */ @@ -100,7 +98,7 @@ public interface IRenderTheme { /** * Renders a point of interest circle with the given parameters. - * + * * @param circle * the circle. * @param level @@ -110,7 +108,7 @@ public interface IRenderTheme { /** * Renders a point of interest symbol with the given bitmap. - * + * * @param symbol * the symbol to be rendered. */ @@ -118,7 +116,7 @@ public interface IRenderTheme { /** * Renders a point of interest caption with the given text. - * + * * @param text * the text to be rendered. */ @@ -126,7 +124,7 @@ public interface IRenderTheme { /** * Renders a way with the given parameters. - * + * * @param line * @param level */ @@ -134,7 +132,7 @@ public interface IRenderTheme { /** * Renders a way with the given symbol along the way path. - * + * * @param symbol * the symbol to be rendered. */ @@ -142,7 +140,7 @@ public interface IRenderTheme { /** * Renders a way with the given text along the way path. - * + * * @param text */ void renderWayText(Text text); diff --git a/vtm/src/org/oscim/theme/MatchingCacheKey.java b/vtm/src/org/oscim/theme/MatchingCacheKey.java index 0bb9bad4..d2c53fbc 100644 --- a/vtm/src/org/oscim/theme/MatchingCacheKey.java +++ b/vtm/src/org/oscim/theme/MatchingCacheKey.java @@ -50,7 +50,7 @@ class MatchingCacheKey { mTags = new Tag[numTags]; int result = 7; - for (int i = 0; i < numTags; i++){ + for (int i = 0; i < numTags; i++) { Tag t = tags.tags[i]; result = 31 * result + t.hashCode(); mTags[i] = t; diff --git a/vtm/src/org/oscim/theme/RenderTheme.java b/vtm/src/org/oscim/theme/RenderTheme.java index b1571087..c26b0394 100644 --- a/vtm/src/org/oscim/theme/RenderTheme.java +++ b/vtm/src/org/oscim/theme/RenderTheme.java @@ -57,7 +57,8 @@ public class RenderTheme implements IRenderTheme { cacheKey = new MatchingCacheKey(); matchType = type; } - RenderInstructionItem getRenderInstructions(){ + + RenderInstructionItem getRenderInstructions() { return cache.get(cacheKey); } } @@ -164,8 +165,8 @@ public class RenderTheme implements IRenderTheme { for (int j = i + 1; j < size; j++) { if (matches.get(j) == r) { Log.d(TAG, "fix duplicate instruction! " - + Arrays.deepToString(cache.cacheKey.mTags) - + ":" + zoomLevel); + + Arrays.deepToString(cache.cacheKey.mTags) + + ":" + zoomLevel); matches.remove(j--); size--; } diff --git a/vtm/src/org/oscim/theme/RenderThemeHandler.java b/vtm/src/org/oscim/theme/RenderThemeHandler.java index 1c997fa1..9c5643b1 100644 --- a/vtm/src/org/oscim/theme/RenderThemeHandler.java +++ b/vtm/src/org/oscim/theme/RenderThemeHandler.java @@ -79,7 +79,7 @@ public class RenderThemeHandler extends DefaultHandler { * if an I/O error occurs while reading from the input stream. */ public static IRenderTheme getRenderTheme(InputStream inputStream) - throws SAXException, IOException { + throws SAXException, IOException { RenderThemeHandler renderThemeHandler = new RenderThemeHandler(); @@ -90,7 +90,7 @@ public class RenderThemeHandler extends DefaultHandler { /** * Logs the given information about an unknown XML attribute. - * + * * @param element * the XML element name. * @param name @@ -101,7 +101,7 @@ public class RenderThemeHandler extends DefaultHandler { * the XML attribute index position. */ public static void logUnknownAttribute(String element, String name, - String value, int attributeIndex) { + String value, int attributeIndex) { StringBuilder sb = new StringBuilder(); sb.append("unknown attribute in element "); sb.append(element); @@ -120,7 +120,7 @@ public class RenderThemeHandler extends DefaultHandler { private final Stack mElementStack = new Stack(); private final Stack mRuleStack = new Stack(); private final HashMap tmpStyleHash = - new HashMap(10); + new HashMap(10); private TextureAtlas mTextureAtlas; private int mLevel; private RenderTheme mRenderTheme; @@ -166,7 +166,7 @@ public class RenderThemeHandler extends DefaultHandler { @Override public void startElement(String uri, String localName, String qName, - Attributes attributes) throws SAXException { + Attributes attributes) throws SAXException { try { if ("rendertheme".equals(localName)) { checkState(localName, Element.RENDER_THEME); @@ -198,7 +198,7 @@ public class RenderThemeHandler extends DefaultHandler { RenderInstruction ri = tmpStyleHash.get("l" + style); if (ri instanceof Line) { Line line = createLine((Line) ri, localName, attributes, 0, - false); + false); tmpStyleHash.put("l" + line.style, line); } else Log.d(TAG, "not a style: " + style); @@ -224,7 +224,7 @@ public class RenderThemeHandler extends DefaultHandler { Area area = (Area) tmpStyleHash.get("a" + style); if (area != null) mCurrentRule.addRenderingInstruction(new AreaLevel(area, - mLevel++)); + mLevel++)); else Log.d(TAG, "BUG not an area style: " + style); } @@ -256,7 +256,7 @@ public class RenderThemeHandler extends DefaultHandler { Line line = (Line) tmpStyleHash.get("l" + style); if (line != null) { Line newLine = createLine(line, localName, attributes, - mLevel++, false); + mLevel++, false); mCurrentRule.addRenderingInstruction(newLine); } else @@ -337,9 +337,8 @@ public class RenderThemeHandler extends DefaultHandler { } } if (img == null) - throw new IllegalArgumentException( - "missing attribute 'img' for element: " - + elementName); + throw new IllegalArgumentException("missing attribute 'img' for element: " + + elementName); Bitmap bitmap = CanvasAdapter.g.loadBitmapAsset(IMG_PATH + img); mTextureAtlas = new TextureAtlas(bitmap); @@ -359,18 +358,17 @@ public class RenderThemeHandler extends DefaultHandler { String[] pos = value.split(" "); if (pos.length == 4) { r = new Rect(Integer.parseInt(pos[0]), - Integer.parseInt(pos[1]), - Integer.parseInt(pos[2]), - Integer.parseInt(pos[3])); + Integer.parseInt(pos[1]), + Integer.parseInt(pos[2]), + Integer.parseInt(pos[3])); } } else { RenderThemeHandler.logUnknownAttribute(elementName, name, value, i); } } if (regionName == null || r == null) - throw new IllegalArgumentException( - "missing attribute 'name' or 'rect' for element: " - + elementName); + throw new IllegalArgumentException("missing attribute 'name' or 'rect' for element: " + + elementName); mTextureAtlas.addTextureRegion(regionName.intern(), r); } @@ -387,7 +385,7 @@ public class RenderThemeHandler extends DefaultHandler { case RULE: parentElement = mElementStack.peek(); if (parentElement != Element.RENDER_THEME - && parentElement != Element.RULE) { + && parentElement != Element.RULE) { throw new SAXException(UNEXPECTED_ELEMENT + elementName); } return; @@ -408,7 +406,7 @@ public class RenderThemeHandler extends DefaultHandler { parentElement = mElementStack.peek(); // FIXME if (parentElement != Element.RENDER_THEME - && parentElement != Element.ATLAS) { + && parentElement != Element.ATLAS) { throw new SAXException(UNEXPECTED_ELEMENT + elementName); } return; @@ -449,15 +447,15 @@ public class RenderThemeHandler extends DefaultHandler { if (version == null) { throw new IllegalArgumentException("missing attribute version for element:" - + elementName); + + elementName); } else if (version.intValue() != RENDER_THEME_VERSION) { throw new IllegalArgumentException("invalid render theme version:" + version); } else if (baseStrokeWidth < 0) { throw new IllegalArgumentException("base-stroke-width must not be negative: " - + baseStrokeWidth); + + baseStrokeWidth); } else if (baseTextSize < 0) { throw new IllegalArgumentException("base-text-size must not be negative: " - + baseTextSize); + + baseTextSize); } return new RenderTheme(mapBackground, baseStrokeWidth, baseTextSize); @@ -520,20 +518,20 @@ public class RenderThemeHandler extends DefaultHandler { validateText(elementName, textKey, fontSize, strokeWidth); return new Text(style, textKey, fontFamily, fontStyle, fontSize, fill, stroke, strokeWidth, - dy, caption, symbol, priority); + dy, caption, symbol, priority); } private static void validateText(String elementName, String textKey, float fontSize, - float strokeWidth) { + float strokeWidth) { if (textKey == null) { throw new IllegalArgumentException("missing attribute k for element: " - + elementName); + + elementName); } else if (fontSize < 0) { throw new IllegalArgumentException("font-size must not be negative: " - + fontSize); + + fontSize); } else if (strokeWidth < 0) { throw new IllegalArgumentException("stroke-width must not be negative: " - + strokeWidth); + + strokeWidth); } } @@ -551,7 +549,7 @@ public class RenderThemeHandler extends DefaultHandler { * @return a new Line with the given rendering attributes. */ private static Line createLine(Line line, String elementName, Attributes attributes, - int level, boolean isOutline) { + int level, boolean isOutline) { // Style name String style = null; @@ -632,14 +630,14 @@ public class RenderThemeHandler extends DefaultHandler { } return new Line(level, style, color, width, cap, fixed, - stipple, stippleColor, stippleWidth, - fade, blur, isOutline, min); + stipple, stippleColor, stippleWidth, + fade, blur, isOutline, min); } private static void validateLine(float strokeWidth) { if (strokeWidth < 0) { throw new IllegalArgumentException("width must not be negative: " - + strokeWidth); + + strokeWidth); } } @@ -700,13 +698,13 @@ public class RenderThemeHandler extends DefaultHandler { } } return new Area(style, fill, stroke, strokeWidth, fade, level, blend, - blendFill, texture); + blendFill, texture); } private static void validateArea(float strokeWidth) { if (strokeWidth < 0) { throw new IllegalArgumentException("stroke-width must not be negative: " - + strokeWidth); + + strokeWidth); } } @@ -752,12 +750,12 @@ public class RenderThemeHandler extends DefaultHandler { private static void validateCircle(String elementName, Float radius, float strokeWidth) { if (radius == null) { throw new IllegalArgumentException("missing attribute r for element: " - + elementName); + + elementName); } else if (radius.floatValue() < 0) { throw new IllegalArgumentException("radius must not be negative: " + radius); } else if (strokeWidth < 0) { throw new IllegalArgumentException("stroke-width must not be negative: " - + strokeWidth); + + strokeWidth); } } @@ -795,7 +793,7 @@ public class RenderThemeHandler extends DefaultHandler { private static void validateLineSymbol(String elementName, String src) { if (src == null) { throw new IllegalArgumentException("missing attribute src for element: " - + elementName); + + elementName); } } @@ -827,7 +825,7 @@ public class RenderThemeHandler extends DefaultHandler { private static void validateSymbol(String elementName, String src) { if (src == null) { throw new IllegalArgumentException("missing attribute src for element: " - + elementName); + + elementName); } } } diff --git a/vtm/src/org/oscim/theme/ThemeLoader.java b/vtm/src/org/oscim/theme/ThemeLoader.java index b2842dfe..bc6f0fc9 100644 --- a/vtm/src/org/oscim/theme/ThemeLoader.java +++ b/vtm/src/org/oscim/theme/ThemeLoader.java @@ -28,18 +28,17 @@ public class ThemeLoader { /** * Load internal theme, see {@link InternalRenderTheme}. - * + * * @param internalRenderTheme ... * @return ... */ public static IRenderTheme load(InternalRenderTheme internalRenderTheme) { - return load((Theme) internalRenderTheme); + return load((Theme) internalRenderTheme); } - /** * Load theme from XML file. - * + * * @param renderThemePath .. * @return ... * @throws FileNotFoundException ... diff --git a/vtm/src/org/oscim/theme/renderinstruction/Area.java b/vtm/src/org/oscim/theme/renderinstruction/Area.java index 1b7236fb..7d935e17 100644 --- a/vtm/src/org/oscim/theme/renderinstruction/Area.java +++ b/vtm/src/org/oscim/theme/renderinstruction/Area.java @@ -22,7 +22,6 @@ import org.oscim.theme.IRenderTheme.Callback; */ public final class Area extends RenderInstruction { - public Area(int fill) { this(0, fill); } @@ -39,9 +38,8 @@ public final class Area extends RenderInstruction { texture = null; } - public Area(String style, int fill, int stroke, float strokeWidth, - int fade, int level, int blend, int blendFill, TextureItem texture) { + int fade, int level, int blend, int blendFill, TextureItem texture) { this.style = style; diff --git a/vtm/src/org/oscim/theme/renderinstruction/Circle.java b/vtm/src/org/oscim/theme/renderinstruction/Circle.java index 1ddc2ad3..14f118a8 100644 --- a/vtm/src/org/oscim/theme/renderinstruction/Circle.java +++ b/vtm/src/org/oscim/theme/renderinstruction/Circle.java @@ -16,24 +16,22 @@ package org.oscim.theme.renderinstruction; import org.oscim.theme.IRenderTheme.Callback; - /** * Represents a round area on the map. */ public final class Circle extends RenderInstruction { - public final int level; public final int fill; public final int outline; public final float radius; - public float renderRadius; + public float renderRadius; public final boolean scaleRadius; public final float strokeWidth; public Circle(Float radius, boolean scaleRadius, int fill, int stroke, - float strokeWidth, int level) { + float strokeWidth, int level) { super(); this.radius = radius.floatValue(); @@ -48,6 +46,6 @@ public final class Circle extends RenderInstruction { @Override public void renderNode(Callback renderCallback) { - renderCallback.renderPointCircle(this, this.level); + renderCallback.renderPointCircle(this, this.level); } } diff --git a/vtm/src/org/oscim/theme/renderinstruction/Line.java b/vtm/src/org/oscim/theme/renderinstruction/Line.java index 00615730..486459c5 100644 --- a/vtm/src/org/oscim/theme/renderinstruction/Line.java +++ b/vtm/src/org/oscim/theme/renderinstruction/Line.java @@ -22,14 +22,14 @@ import org.oscim.theme.IRenderTheme.Callback; */ public final class Line extends RenderInstruction { -// static float[] parseFloatArray(String dashString) { -// String[] dashEntries = SPLIT_PATTERN.split(dashString); -// float[] dashIntervals = new float[dashEntries.length]; -// for (int i = 0; i < dashEntries.length; ++i) { -// dashIntervals[i] = Float.parseFloat(dashEntries[i]); -// } -// return dashIntervals; -// } + // static float[] parseFloatArray(String dashString) { + // String[] dashEntries = SPLIT_PATTERN.split(dashString); + // float[] dashIntervals = new float[dashEntries.length]; + // for (int i = 0; i < dashEntries.length; ++i) { + // dashIntervals[i] = Float.parseFloat(dashEntries[i]); + // } + // return dashIntervals; + // } private final int level; @@ -47,12 +47,10 @@ public final class Line extends RenderInstruction { public final int stippleColor; public final float stippleWidth; - - public Line(int level, String style, int color, float width, - Cap cap, boolean fixed, - int stipple, int stippleColor, float stippleWidth, - int fade, float blur, boolean isOutline, float min) { + Cap cap, boolean fixed, + int stipple, int stippleColor, float stippleWidth, + int fade, float blur, boolean isOutline, float min) { this.level = level; this.style = style; diff --git a/vtm/src/org/oscim/theme/renderinstruction/RenderInstruction.java b/vtm/src/org/oscim/theme/renderinstruction/RenderInstruction.java index ca0a9a6a..4ca6e256 100644 --- a/vtm/src/org/oscim/theme/renderinstruction/RenderInstruction.java +++ b/vtm/src/org/oscim/theme/renderinstruction/RenderInstruction.java @@ -42,7 +42,7 @@ public abstract class RenderInstruction { /** * Scales the stroke width of this RenderInstruction by the given factor. - * + * * @param scaleFactor * the factor by which the stroke width should be scaled. */ @@ -51,7 +51,7 @@ public abstract class RenderInstruction { /** * Scales the text size of this RenderInstruction by the given factor. - * + * * @param scaleFactor * the factor by which the text size should be scaled. */ diff --git a/vtm/src/org/oscim/theme/renderinstruction/Text.java b/vtm/src/org/oscim/theme/renderinstruction/Text.java index f637959b..7141d7b5 100644 --- a/vtm/src/org/oscim/theme/renderinstruction/Text.java +++ b/vtm/src/org/oscim/theme/renderinstruction/Text.java @@ -27,7 +27,6 @@ import org.oscim.theme.IRenderTheme.Callback; */ public final class Text extends RenderInstruction { - public final String style; public final float fontSize; @@ -47,17 +46,27 @@ public final class Text extends RenderInstruction { public TextureRegion texture; public static Text createText(float fontSize, float strokeWidth, int fill, int outline, - boolean billboard) { + boolean billboard) { return createText("", fontSize, strokeWidth, fill, outline, billboard); } + public static Text createText(String textKey, float fontSize, float strokeWidth, int fill, + int outline, + boolean billboard) { - public static Text createText(String textKey, float fontSize, float strokeWidth, int fill, int outline, - boolean billboard) { - - Text t = new Text("", textKey, FontFamily.DEFAULT, FontStyle.NORMAL, - fontSize, fill, outline, strokeWidth, 0, billboard, null, Integer.MAX_VALUE); + Text t = new Text("", + textKey, + FontFamily.DEFAULT, + FontStyle.NORMAL, + fontSize, + fill, + outline, + strokeWidth, + 0, + billboard, + null, + Integer.MAX_VALUE); t.fontHeight = t.paint.getFontHeight(); t.fontDescent = t.paint.getFontDescent(); @@ -66,8 +75,8 @@ public final class Text extends RenderInstruction { } public Text(String style, String textKey, FontFamily fontFamily, FontStyle fontStyle, - float fontSize, int fill, int outline, float strokeWidth, float dy, boolean caption, - String symbol, int priority) { + float fontSize, int fill, int outline, float strokeWidth, float dy, boolean caption, + String symbol, int priority) { this.style = style; this.textKey = textKey; diff --git a/vtm/src/org/oscim/theme/rule/PositiveRule.java b/vtm/src/org/oscim/theme/rule/PositiveRule.java index 90e85b96..a39b2963 100644 --- a/vtm/src/org/oscim/theme/rule/PositiveRule.java +++ b/vtm/src/org/oscim/theme/rule/PositiveRule.java @@ -37,6 +37,6 @@ class PositiveRule extends Rule { @Override boolean matchesTags(Tag[] tags) { return (mKeyMatcher == null || mKeyMatcher.matches(tags)) - && (mValueMatcher == null || mValueMatcher.matches(tags)); + && (mValueMatcher == null || mValueMatcher.matches(tags)); } } diff --git a/vtm/src/org/oscim/theme/rule/Rule.java b/vtm/src/org/oscim/theme/rule/Rule.java index 1f8551cf..2f5d0617 100644 --- a/vtm/src/org/oscim/theme/rule/Rule.java +++ b/vtm/src/org/oscim/theme/rule/Rule.java @@ -27,15 +27,18 @@ import org.oscim.theme.renderinstruction.RenderInstruction; import org.xml.sax.Attributes; public abstract class Rule { - private static final Map, AttributeMatcher> MATCHERS_CACHE_KEY = new HashMap, AttributeMatcher>(); - private static final Map, AttributeMatcher> MATCHERS_CACHE_VALUE = new HashMap, AttributeMatcher>(); + private static final Map, AttributeMatcher> MATCHERS_CACHE_KEY = + new HashMap, AttributeMatcher>(); + private static final Map, AttributeMatcher> MATCHERS_CACHE_VALUE = + new HashMap, AttributeMatcher>(); + //private static final Pattern SPLIT_PATTERN = Pattern.compile("\\|"); private static final String STRING_NEGATION = "~"; private static final String STRING_EXCLUSIVE = "-"; private static final String STRING_WILDCARD = "*"; private static Rule createRule(Stack ruleStack, int element, String keys, - String values, byte zoomMin, byte zoomMax) { + String values, byte zoomMin, byte zoomMax) { int zoom = 0; for (int z = zoomMin; z <= zoomMax && z < 32; z++) @@ -127,13 +130,13 @@ public abstract class Rule { private static void validate(byte zoomMin, byte zoomMax) { if (zoomMin < 0) { throw new IllegalArgumentException("zoom-min must not be negative: " - + zoomMin); + + zoomMin); } else if (zoomMax < 0) { throw new IllegalArgumentException("zoom-max must not be negative: " - + zoomMax); + + zoomMax); } else if (zoomMin > zoomMax) { - throw new IllegalArgumentException( - "zoom-min must be less or equal zoom-max: " + zoomMin); + throw new IllegalArgumentException("zoom-min must be less or equal zoom-max: " + + zoomMin); } } @@ -212,7 +215,7 @@ public abstract class Rule { abstract boolean matchesTags(Tag[] tags); public void matchElement(int type, Tag[] tags, int zoomLevel, - List matchingList) { + List matchingList) { if (((mElement & type) != 0) && ((mZoom & zoomLevel) != 0) && (matchesTags(tags))) { diff --git a/vtm/src/org/oscim/theme/rule/RuleOptimizer.java b/vtm/src/org/oscim/theme/rule/RuleOptimizer.java index cae9e42d..9f73afab 100644 --- a/vtm/src/org/oscim/theme/rule/RuleOptimizer.java +++ b/vtm/src/org/oscim/theme/rule/RuleOptimizer.java @@ -19,12 +19,12 @@ import java.util.Stack; final class RuleOptimizer { private static AttributeMatcher optimizeKeyMatcher(AttributeMatcher attributeMatcher, - Stack ruleStack) { + Stack ruleStack) { for (int i = 0, n = ruleStack.size(); i < n; ++i) { if (ruleStack.get(i) instanceof PositiveRule) { PositiveRule positiveRule = (PositiveRule) ruleStack.get(i); if (positiveRule.mKeyMatcher != null - && positiveRule.mKeyMatcher.isCoveredBy(attributeMatcher)) { + && positiveRule.mKeyMatcher.isCoveredBy(attributeMatcher)) { return null; } } @@ -34,13 +34,13 @@ final class RuleOptimizer { } private static AttributeMatcher optimizeValueMatcher( - AttributeMatcher attributeMatcher, Stack ruleStack) { + AttributeMatcher attributeMatcher, Stack ruleStack) { for (int i = 0, n = ruleStack.size(); i < n; ++i) { if (ruleStack.get(i) instanceof PositiveRule) { PositiveRule positiveRule = (PositiveRule) ruleStack.get(i); if (positiveRule.mValueMatcher != null - && positiveRule.mValueMatcher.isCoveredBy(attributeMatcher)) { + && positiveRule.mValueMatcher.isCoveredBy(attributeMatcher)) { return null; } } @@ -50,7 +50,7 @@ final class RuleOptimizer { } static AttributeMatcher optimize(AttributeMatcher attributeMatcher, - Stack ruleStack) { + Stack ruleStack) { if (attributeMatcher instanceof AnyMatcher) return attributeMatcher;// return null; else if (attributeMatcher instanceof NegativeMatcher) { @@ -65,7 +65,7 @@ final class RuleOptimizer { return optimizeValueMatcher(attributeMatcher, ruleStack); } throw new IllegalArgumentException("unknown AttributeMatcher: " - + attributeMatcher); + + attributeMatcher); } // static ClosedMatcher optimize(ClosedMatcher closedMatcher, Stack ruleStack) { diff --git a/vtm/src/org/oscim/tiling/TileDistanceSort.java b/vtm/src/org/oscim/tiling/TileDistanceSort.java index 3085dd4f..3a82d514 100644 --- a/vtm/src/org/oscim/tiling/TileDistanceSort.java +++ b/vtm/src/org/oscim/tiling/TileDistanceSort.java @@ -51,11 +51,11 @@ public class TileDistanceSort { return 0; } - private static void binarySort(MapTile[] a, int lo, int hi, int start) { + private static void binarySort(MapTile[] a, int lo, int hi, int start) { assert ((lo <= start) && (start <= hi)); if (start == lo) ++start; - for (; start < hi; ++start) { + for (; start < hi; ++start) { MapTile pivot = a[start]; int left = lo; diff --git a/vtm/src/org/oscim/tiling/TileLoader.java b/vtm/src/org/oscim/tiling/TileLoader.java index 996b9bf3..5797c182 100644 --- a/vtm/src/org/oscim/tiling/TileLoader.java +++ b/vtm/src/org/oscim/tiling/TileLoader.java @@ -35,7 +35,7 @@ public abstract class TileLoader extends PausableThread { public void go() { synchronized (this) { notify(); - } + } } @Override diff --git a/vtm/src/org/oscim/tiling/TileManager.java b/vtm/src/org/oscim/tiling/TileManager.java index e5d7bcae..f43d80d2 100644 --- a/vtm/src/org/oscim/tiling/TileManager.java +++ b/vtm/src/org/oscim/tiling/TileManager.java @@ -273,7 +273,7 @@ public class TileManager { int remove = mTilesCount - mCacheLimit; if (remove > CACHE_THRESHOLD || - mTilesForUpload > MAX_TILES_IN_QUEUE) + mTilesForUpload > MAX_TILES_IN_QUEUE) limitCache(pos, remove); @@ -474,10 +474,10 @@ public class TileManager { if (t.isLocked()) { // dont remove tile used by GLRenderer, or somewhere else Log.d(TAG, "locked " + t - + " " + t.distance - + " " + (t.state == STATE_NEW_DATA) - + " " + (t.state == STATE_LOADING) - + " " + pos.zoomLevel); + + " " + t.distance + + " " + (t.state == STATE_NEW_DATA) + + " " + (t.state == STATE_LOADING) + + " " + pos.zoomLevel); // try again in next run. } else if (t.state == STATE_LOADING) { // NOTE: when set loading to false the tile could be @@ -485,7 +485,7 @@ public class TileManager { // MapTileLoader => need tile.cancel flag. // t.isLoading = false; Log.d(TAG, "cancel loading " + t - + " " + t.distance); + + " " + t.distance); } else { // clear unused tile diff --git a/vtm/src/org/oscim/tiling/TileRenderer.java b/vtm/src/org/oscim/tiling/TileRenderer.java index 1260a19a..4f80abdf 100644 --- a/vtm/src/org/oscim/tiling/TileRenderer.java +++ b/vtm/src/org/oscim/tiling/TileRenderer.java @@ -63,7 +63,7 @@ public class TileRenderer extends LayerRenderer { @Override protected void update(MapPosition pos, boolean positionChanged, Matrices m) { - if (mAlpha == 0){ + if (mAlpha == 0) { mTileManager.releaseTiles(mDrawTiles); return; } @@ -80,7 +80,7 @@ public class TileRenderer extends LayerRenderer { int tileCnt = mDrawTiles.cnt; MapTile[] tiles = mDrawTiles.tiles; - if (tilesChanged || positionChanged){ + if (tilesChanged || positionChanged) { updateTileVisibility(pos, m.mapPlane); } @@ -99,8 +99,6 @@ public class TileRenderer extends LayerRenderer { draw(tiles, tileCnt, pos, m); } - - public void clearTiles() { // Clear all references to MapTiles as all current // tiles will also be removed from TileManager. @@ -230,7 +228,7 @@ public class TileRenderer extends LayerRenderer { // unlock previous tiles tileSet.releaseTiles(); - + // ensure same size if (tileSet.tiles.length != mDrawTiles.tiles.length) { tileSet.tiles = new MapTile[mDrawTiles.tiles.length]; @@ -245,7 +243,7 @@ public class TileRenderer extends LayerRenderer { tileSet.tiles[tileSet.cnt++] = t; } } - + tileSet.serial = mUploadSerial; } @@ -321,7 +319,7 @@ public class TileRenderer extends LayerRenderer { if (tile == null) continue; - if (cnt + mNumTileHolder >= tiles.length){ + if (cnt + mNumTileHolder >= tiles.length) { Log.e(TAG, "too many tiles " + cnt + ", " + mNumTileHolder); break; } @@ -346,7 +344,7 @@ public class TileRenderer extends LayerRenderer { /** * Draw tiles: - * + * * @param fade * alpha value for bitmap tiles * @param overdrawColor @@ -487,11 +485,11 @@ public class TileRenderer extends LayerRenderer { PolygonLayer.Renderer.draw(pos, null, m, true, div, true); clipped = true; } -// if (!clipped) { -// // draw stencil buffer clip region -// PolygonRenderer.clip(m); -// clipped = true; -// } + // if (!clipped) { + // // draw stencil buffer clip region + // PolygonRenderer.clip(m); + // clipped = true; + // } //GLState.test(false, false); switch (l.type) { case RenderElement.BITMAP: @@ -523,7 +521,7 @@ public class TileRenderer extends LayerRenderer { } private void drawProxyTile(MapTile tile, MapPosition pos, boolean parent, - boolean preferParent) { + boolean preferParent) { QuadTree r = tile.rel; MapTile proxy; diff --git a/vtm/src/org/oscim/tiling/source/ITileCache.java b/vtm/src/org/oscim/tiling/source/ITileCache.java index ead86902..2be6244b 100644 --- a/vtm/src/org/oscim/tiling/source/ITileCache.java +++ b/vtm/src/org/oscim/tiling/source/ITileCache.java @@ -48,13 +48,17 @@ public interface ITileCache { public interface TileReader { Tile getTile(); + InputStream getInputStream(); + int getBytes(); } public interface TileWriter { Tile getTile(); + OutputStream getOutputStream(); + void complete(boolean success); } } diff --git a/vtm/src/org/oscim/tiling/source/ITileDataSource.java b/vtm/src/org/oscim/tiling/source/ITileDataSource.java index 131cb233..c34f3efd 100644 --- a/vtm/src/org/oscim/tiling/source/ITileDataSource.java +++ b/vtm/src/org/oscim/tiling/source/ITileDataSource.java @@ -25,7 +25,7 @@ public interface ITileDataSource { /** * Starts a database query with the given parameters. - * + * * @param tile * the tile to read. * @param mapDataSink @@ -33,8 +33,7 @@ public interface ITileDataSource { * @return true if successful */ abstract QueryResult executeQuery(MapTile tile, - ITileDataSink mapDataSink); - + ITileDataSink mapDataSink); abstract void destroy(); diff --git a/vtm/src/org/oscim/tiling/source/common/LwHttp.java b/vtm/src/org/oscim/tiling/source/common/LwHttp.java index b291e1f8..33308ed9 100644 --- a/vtm/src/org/oscim/tiling/source/common/LwHttp.java +++ b/vtm/src/org/oscim/tiling/source/common/LwHttp.java @@ -36,7 +36,7 @@ public class LwHttp { private final static byte[] HEADER_CONTENT_TYPE = "Content-Type".getBytes(); private final static byte[] HEADER_CONTENT_LENGTH = "Content-Length".getBytes(); private final static int RESPONSE_EXPECTED_LIVES = 100; - private final static long RESPONSE_TIMEOUT = (long)10E9; // 10 second in nanosecond (I guess) + private final static long RESPONSE_TIMEOUT = (long) 10E9; // 10 second in nanosecond (I guess) private final static int BUFFER_SIZE = 1024; private final byte[] buffer = new byte[BUFFER_SIZE]; @@ -75,16 +75,16 @@ public class LwHttp { REQUEST_GET_START = ("GET " + path).getBytes(); REQUEST_GET_END = ("." + extension + " HTTP/1.1" + - "\nHost: " + host + - "\nConnection: Keep-Alive" + - "\n\n").getBytes(); + "\nHost: " + host + + "\nConnection: Keep-Alive" + + "\n\n").getBytes(); mHost = host; mPort = port; mRequestBuffer = new byte[1024]; System.arraycopy(REQUEST_GET_START, 0, - mRequestBuffer, 0, REQUEST_GET_START.length); + mRequestBuffer, 0, REQUEST_GET_START.length); } static class Buffer extends BufferedInputStream { @@ -99,7 +99,7 @@ public class LwHttp { @Override public synchronized int read(byte[] buffer, int offset, int byteCount) - throws IOException { + throws IOException { return super.read(buffer, offset, byteCount); } } @@ -134,7 +134,7 @@ public class LwHttp { // header cannot 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) { + (len = is.read(buf, read, BUFFER_SIZE - read)) >= 0); len = 0) { read += len; // end of header lines @@ -160,12 +160,12 @@ public class LwHttp { } else if (check(HEADER_CONTENT_TYPE, buf, pos, end)) { if (!check(mContentType, buf, - pos + HEADER_CONTENT_TYPE.length + 2, end)) + pos + HEADER_CONTENT_TYPE.length + 2, end)) ok = false; } else if (check(HEADER_CONTENT_LENGTH, buf, pos, end)) { mContentLength = parseInt(buf, - pos + HEADER_CONTENT_LENGTH.length + 2, end - 1); + pos + HEADER_CONTENT_LENGTH.length + 2, end - 1); } if (!ok) { @@ -194,7 +194,7 @@ public class LwHttp { public boolean sendRequest(Tile tile) throws IOException { if (mSocket != null && ((mMaxReq-- <= 0) - || (System.nanoTime() - mLastRequest > RESPONSE_TIMEOUT))) { + || (System.nanoTime() - mLastRequest > RESPONSE_TIMEOUT))) { try { mSocket.close(); @@ -301,7 +301,7 @@ public class LwHttp { } private static boolean check(byte[] string, byte[] buffer, - int position, int available) { + int position, int available) { int length = string.length; @@ -325,7 +325,7 @@ public class LwHttp { /** * Write custom tile url - * + * * @param tile Tile * @param path to write url string * @param curPos current position diff --git a/vtm/src/org/oscim/tiling/source/common/PbfDecoder.java b/vtm/src/org/oscim/tiling/source/common/PbfDecoder.java index 16b9d8b4..a8fbdf46 100644 --- a/vtm/src/org/oscim/tiling/source/common/PbfDecoder.java +++ b/vtm/src/org/oscim/tiling/source/common/PbfDecoder.java @@ -36,10 +36,14 @@ public abstract class PbfDecoder { } } - final static ProtobufException TRUNCATED_MSG = new ProtobufException("truncated msg"); - protected final static ProtobufException INVALID_VARINT = new ProtobufException("invalid varint"); - protected final static ProtobufException INVALID_PACKED_SIZE = new ProtobufException( - "invalid message size"); + final static ProtobufException TRUNCATED_MSG = + new ProtobufException("truncated msg"); + + protected final static ProtobufException INVALID_VARINT = + new ProtobufException("invalid varint"); + + protected final static ProtobufException INVALID_PACKED_SIZE = + new ProtobufException("invalid message size"); protected void error(String msg) throws IOException { throw new ProtobufException(msg); @@ -72,7 +76,7 @@ public abstract class PbfDecoder { } public abstract boolean decode(Tile tile, ITileDataSink sink, - InputStream is, int contentLength) throws IOException; + InputStream is, int contentLength) throws IOException; public void setInputStream(InputStream is, int contentLength) { mInputStream = is; @@ -149,9 +153,9 @@ public abstract class PbfDecoder { fillBuffer(4); int val = (buffer[bufferPos++] & 0xFF - | (buffer[bufferPos++] & 0xFF) << 8 - | (buffer[bufferPos++] & 0xFF) << 16 - | (buffer[bufferPos++] & 0xFF) << 24); + | (buffer[bufferPos++] & 0xFF) << 8 + | (buffer[bufferPos++] & 0xFF) << 16 + | (buffer[bufferPos++] & 0xFF) << 24); return Float.intBitsToFloat(val); } @@ -161,13 +165,13 @@ public abstract class PbfDecoder { fillBuffer(8); long val = (buffer[bufferPos++] & 0xFF - | (buffer[bufferPos++] & 0xFF) << 8 - | (buffer[bufferPos++] & 0xFF) << 16 - | (buffer[bufferPos++] & 0xFF) << 24 - | (buffer[bufferPos++] & 0xFF) << 32 - | (buffer[bufferPos++] & 0xFF) << 40 - | (buffer[bufferPos++] & 0xFF) << 48 - | (buffer[bufferPos++] & 0xFF) << 56); + | (buffer[bufferPos++] & 0xFF) << 8 + | (buffer[bufferPos++] & 0xFF) << 16 + | (buffer[bufferPos++] & 0xFF) << 24 + | (buffer[bufferPos++] & 0xFF) << 32 + | (buffer[bufferPos++] & 0xFF) << 40 + | (buffer[bufferPos++] & 0xFF) << 48 + | (buffer[bufferPos++] & 0xFF) << 56); return Double.longBitsToDouble(val); } @@ -180,7 +184,7 @@ public abstract class PbfDecoder { } protected int decodeInterleavedPoints(float[] coords, float scale) - throws IOException { + throws IOException { int bytes = decodeVarint32(); fillBuffer(bytes); @@ -201,25 +205,25 @@ public abstract class PbfDecoder { } else if (buf[pos + 1] >= 0) { val = (buf[pos++] & 0x7f) - | buf[pos++] << 7; + | buf[pos++] << 7; } else if (buf[pos + 2] >= 0) { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++]) << 14; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++]) << 14; } else if (buf[pos + 3] >= 0) { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++] & 0x7f) << 14 - | (buf[pos++]) << 21; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++] & 0x7f) << 14 + | (buf[pos++]) << 21; } else { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++] & 0x7f) << 14 - | (buf[pos++] & 0x7f) << 21 - | (buf[pos]) << 28; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++] & 0x7f) << 14 + | (buf[pos++] & 0x7f) << 21 + | (buf[pos]) << 28; if (buf[pos++] < 0) throw INVALID_VARINT; @@ -271,22 +275,22 @@ public abstract class PbfDecoder { val = buf[pos++]; } else if (buf[pos + 1] >= 0) { val = (buf[pos++] & 0x7f) - | buf[pos++] << 7; + | buf[pos++] << 7; } else if (buf[pos + 2] >= 0) { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++]) << 14; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++]) << 14; } else if (buf[pos + 3] >= 0) { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++] & 0x7f) << 14 - | (buf[pos++]) << 21; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++] & 0x7f) << 14 + | (buf[pos++]) << 21; } else { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++] & 0x7f) << 14 - | (buf[pos++] & 0x7f) << 21 - | (buf[pos]) << 28; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++] & 0x7f) << 14 + | (buf[pos++] & 0x7f) << 21 + | (buf[pos]) << 28; if (buf[pos++] < 0) throw INVALID_VARINT; } @@ -326,22 +330,22 @@ public abstract class PbfDecoder { val = buf[pos++]; } else if (buf[pos + 1] >= 0) { val = (buf[pos++] & 0x7f) - | buf[pos++] << 7; + | buf[pos++] << 7; } else if (buf[pos + 2] >= 0) { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++]) << 14; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++]) << 14; } else if (buf[pos + 3] >= 0) { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++] & 0x7f) << 14 - | (buf[pos++]) << 21; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++] & 0x7f) << 14 + | (buf[pos++]) << 21; } else { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++] & 0x7f) << 14 - | (buf[pos++] & 0x7f) << 21 - | (buf[pos]) << 28; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++] & 0x7f) << 14 + | (buf[pos++] & 0x7f) << 21 + | (buf[pos]) << 28; if (buf[pos++] < 0) throw INVALID_VARINT; @@ -380,24 +384,24 @@ public abstract class PbfDecoder { } else { if (buf[pos + 1] >= 0) { val = (buf[pos++] & 0x7f) - | (buf[pos++]) << 7; + | (buf[pos++]) << 7; } else if (buf[pos + 2] >= 0) { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++]) << 14; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++]) << 14; } else if (buf[pos + 3] >= 0) { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++] & 0x7f) << 14 - | (buf[pos++]) << 21; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++] & 0x7f) << 14 + | (buf[pos++]) << 21; } else { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++] & 0x7f) << 14 - | (buf[pos++] & 0x7f) << 21 - | (buf[pos]) << 28; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++] & 0x7f) << 14 + | (buf[pos++] & 0x7f) << 21 + | (buf[pos]) << 28; if (buf[pos++] < 0) throw INVALID_VARINT; @@ -516,7 +520,7 @@ public abstract class PbfDecoder { static int decodeInt(byte[] buffer, int offset) { return buffer[offset] << 24 | (buffer[offset + 1] & 0xff) << 16 - | (buffer[offset + 2] & 0xff) << 8 - | (buffer[offset + 3] & 0xff); + | (buffer[offset + 2] & 0xff) << 8 + | (buffer[offset + 3] & 0xff); } } diff --git a/vtm/src/org/oscim/tiling/source/common/PbfTileDataSource.java b/vtm/src/org/oscim/tiling/source/common/PbfTileDataSource.java index ed62f8dd..ca6b1f27 100644 --- a/vtm/src/org/oscim/tiling/source/common/PbfTileDataSource.java +++ b/vtm/src/org/oscim/tiling/source/common/PbfTileDataSource.java @@ -35,7 +35,6 @@ public abstract class PbfTileDataSource implements ITileDataSource { protected LwHttp mConn; protected final PbfDecoder mTileDecoder; - public PbfTileDataSource(PbfDecoder tileDecoder) { mTileDecoder = tileDecoder; } diff --git a/vtm/src/org/oscim/tiling/source/mapfile/Deserializer.java b/vtm/src/org/oscim/tiling/source/mapfile/Deserializer.java index 0c93ca71..19d589d9 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/Deserializer.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/Deserializer.java @@ -22,7 +22,7 @@ final class Deserializer { * Converts five bytes of a byte array to an unsigned long. *

* The byte order is big-endian. - * + * * @param buffer * the byte array. * @param offset @@ -31,15 +31,15 @@ final class Deserializer { */ static long getFiveBytesLong(byte[] buffer, int offset) { return (buffer[offset] & 0xffL) << 32 | (buffer[offset + 1] & 0xffL) << 24 - | (buffer[offset + 2] & 0xffL) << 16 - | (buffer[offset + 3] & 0xffL) << 8 | (buffer[offset + 4] & 0xffL); + | (buffer[offset + 2] & 0xffL) << 16 + | (buffer[offset + 3] & 0xffL) << 8 | (buffer[offset + 4] & 0xffL); } /** * Converts four bytes of a byte array to a signed int. *

* The byte order is big-endian. - * + * * @param buffer * the byte array. * @param offset @@ -48,15 +48,15 @@ final class Deserializer { */ static int getInt(byte[] buffer, int offset) { return buffer[offset] << 24 | (buffer[offset + 1] & 0xff) << 16 - | (buffer[offset + 2] & 0xff) << 8 - | (buffer[offset + 3] & 0xff); + | (buffer[offset + 2] & 0xff) << 8 + | (buffer[offset + 3] & 0xff); } /** * Converts eight bytes of a byte array to a signed long. *

* The byte order is big-endian. - * + * * @param buffer * the byte array. * @param offset @@ -65,17 +65,17 @@ final class Deserializer { */ static long getLong(byte[] buffer, int offset) { return (buffer[offset] & 0xffL) << 56 | (buffer[offset + 1] & 0xffL) << 48 - | (buffer[offset + 2] & 0xffL) << 40 - | (buffer[offset + 3] & 0xffL) << 32 | (buffer[offset + 4] & 0xffL) << 24 - | (buffer[offset + 5] & 0xffL) << 16 | (buffer[offset + 6] & 0xffL) << 8 - | (buffer[offset + 7] & 0xffL); + | (buffer[offset + 2] & 0xffL) << 40 + | (buffer[offset + 3] & 0xffL) << 32 | (buffer[offset + 4] & 0xffL) << 24 + | (buffer[offset + 5] & 0xffL) << 16 | (buffer[offset + 6] & 0xffL) << 8 + | (buffer[offset + 7] & 0xffL); } /** * Converts two bytes of a byte array to a signed int. *

* The byte order is big-endian. - * + * * @param buffer * the byte array. * @param offset diff --git a/vtm/src/org/oscim/tiling/source/mapfile/IndexCache.java b/vtm/src/org/oscim/tiling/source/mapfile/IndexCache.java index 8301b896..ed8a872b 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/IndexCache.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/IndexCache.java @@ -39,7 +39,7 @@ class IndexCache { * Maximum size in bytes of one index block. */ private static final int SIZE_OF_INDEX_BLOCK = INDEX_ENTRIES_PER_BLOCK - * SubFileParameter.BYTES_PER_INDEX_ENTRY; + * SubFileParameter.BYTES_PER_INDEX_ENTRY; private final Map map; private final RandomAccessFile randomAccessFile; @@ -68,7 +68,7 @@ class IndexCache { * Returns the index entry of a block in the given map file. If the required * index entry is not cached, it will be * read from the map file index and put in the cache. - * + * * @param subFileParameter * the parameters of the map file for which the index entry is * needed. @@ -88,14 +88,14 @@ class IndexCache { // create the cache entry key for this request IndexCacheEntryKey indexCacheEntryKey = new IndexCacheEntryKey(subFileParameter, - indexBlockNumber); + indexBlockNumber); // check for cached index block byte[] indexBlock = this.map.get(indexCacheEntryKey); if (indexBlock == null) { // cache miss, seek to the correct index block in the file and read it long indexBlockPosition = subFileParameter.indexStartAddress + indexBlockNumber - * SIZE_OF_INDEX_BLOCK; + * SIZE_OF_INDEX_BLOCK; int remainingIndexSize = (int) (subFileParameter.indexEndAddress - indexBlockPosition); int indexBlockSize = Math.min(SIZE_OF_INDEX_BLOCK, remainingIndexSize); diff --git a/vtm/src/org/oscim/tiling/source/mapfile/IndexCacheEntryKey.java b/vtm/src/org/oscim/tiling/source/mapfile/IndexCacheEntryKey.java index 87f7b506..fdd116eb 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/IndexCacheEntryKey.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/IndexCacheEntryKey.java @@ -26,7 +26,7 @@ class IndexCacheEntryKey { /** * Creates an immutable key to be stored in a map. - * + * * @param subFileParameter * the parameters of the map file. * @param indexBlockNumber @@ -49,7 +49,7 @@ class IndexCacheEntryKey { if (this.subFileParameter == null && other.subFileParameter != null) { return false; } else if (this.subFileParameter != null - && !this.subFileParameter.equals(other.subFileParameter)) { + && !this.subFileParameter.equals(other.subFileParameter)) { return false; } else if (this.indexBlockNumber != other.indexBlockNumber) { return false; @@ -68,7 +68,7 @@ class IndexCacheEntryKey { private int calculateHashCode() { int result = 7; result = 31 * result - + ((this.subFileParameter == null) ? 0 : this.subFileParameter.hashCode()); + + ((this.subFileParameter == null) ? 0 : this.subFileParameter.hashCode()); result = 31 * result + (int) (this.indexBlockNumber ^ (this.indexBlockNumber >>> 32)); return result; } diff --git a/vtm/src/org/oscim/tiling/source/mapfile/MapInfo.java b/vtm/src/org/oscim/tiling/source/mapfile/MapInfo.java index 15adf0b6..d56fabe6 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/MapInfo.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/MapInfo.java @@ -19,7 +19,7 @@ import org.oscim.core.GeoPoint; /** * Contains the immutable metadata of a map file. - * + * */ public class MapInfo { /** @@ -108,8 +108,8 @@ public class MapInfo { * TODO */ public MapInfo(BoundingBox bbox, Byte zoom, GeoPoint start, String projection, - long date, long size, int version, String language, String comment, - String createdBy, int[] zoomLevel) { + long date, long size, int version, String language, String comment, + String createdBy, int[] zoomLevel) { this.startZoomLevel = zoom; this.zoomLevel = zoomLevel; diff --git a/vtm/src/org/oscim/tiling/source/mapfile/Projection.java b/vtm/src/org/oscim/tiling/source/mapfile/Projection.java index 456fd11c..6dbf8f5b 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/Projection.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/Projection.java @@ -18,11 +18,10 @@ import org.oscim.core.Tile; public class Projection { - /** * Converts a tile X number at a certain zoom level to a longitude * coordinate. - * + * * @param tileX * the tile X number that should be converted. * @param zoomLevel @@ -36,7 +35,7 @@ public class Projection { /** * Converts a tile Y number at a certain zoom level to a latitude * coordinate. - * + * * @param tileY * the tile Y number that should be converted. * @param zoomLevel @@ -50,7 +49,7 @@ public class Projection { /** * Converts a latitude coordinate (in degrees) to a tile Y number at a * certain zoom level. - * + * * @param latitude * the latitude coordinate that should be converted. * @param zoomLevel @@ -64,7 +63,7 @@ public class Projection { /** * Converts a longitude coordinate (in degrees) to the tile X number at a * certain zoom level. - * + * * @param longitude * the longitude coordinate that should be converted. * @param zoomLevel @@ -77,7 +76,7 @@ public class Projection { /** * Converts a pixel X coordinate to the tile X number. - * + * * @param pixelX * the pixel X coordinate that should be converted. * @param zoomLevel @@ -86,11 +85,12 @@ public class Projection { */ public static int pixelXToTileX(double pixelX, int zoomLevel) { return (int) Math.min(Math.max(pixelX / Tile.SIZE, 0), - Math.pow(2, zoomLevel) - 1); + Math.pow(2, zoomLevel) - 1); } + /** * Converts a pixel Y coordinate to the tile Y number. - * + * * @param pixelY * the pixel Y coordinate that should be converted. * @param zoomLevel @@ -99,13 +99,13 @@ public class Projection { */ public static int pixelYToTileY(double pixelY, int zoomLevel) { return (int) Math.min(Math.max(pixelY / Tile.SIZE, 0), - Math.pow(2, zoomLevel) - 1); + Math.pow(2, zoomLevel) - 1); } /** * Converts a pixel X coordinate at a certain zoom level to a longitude * coordinate. - * + * * @param pixelX * the pixel X coordinate that should be converted. * @param zoomLevel @@ -119,7 +119,7 @@ public class Projection { /** * Converts a longitude coordinate (in degrees) to a pixel X coordinate at a * certain zoom level. - * + * * @param longitude * the longitude coordinate that should be converted. * @param zoomLevel @@ -133,7 +133,7 @@ public class Projection { /** * Converts a pixel Y coordinate at a certain zoom level to a latitude * coordinate. - * + * * @param pixelY * the pixel Y coordinate that should be converted. * @param zoomLevel @@ -148,7 +148,7 @@ public class Projection { /** * Converts a latitude coordinate (in degrees) to a pixel Y coordinate at a * certain zoom level. - * + * * @param latitude * the latitude coordinate that should be converted. * @param zoomLevel @@ -158,9 +158,10 @@ public class Projection { public static double latitudeToPixelY(double latitude, int zoomLevel) { double sinLatitude = Math.sin(latitude * (Math.PI / 180)); return (0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI)) - * ((long) Tile.SIZE << zoomLevel); + * ((long) Tile.SIZE << zoomLevel); } - private Projection(){ + + private Projection() { } } diff --git a/vtm/src/org/oscim/tiling/source/mapfile/QueryCalculations.java b/vtm/src/org/oscim/tiling/source/mapfile/QueryCalculations.java index 4c6c2096..38d569ad 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/QueryCalculations.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/QueryCalculations.java @@ -99,7 +99,7 @@ final class QueryCalculations { } static void calculateBaseTiles(QueryParameters queryParameters, Tile tile, - SubFileParameter subFileParameter) { + SubFileParameter subFileParameter) { if (tile.zoomLevel < subFileParameter.baseZoomLevel) { // calculate the XY numbers of the upper left and lower right // sub-tiles @@ -107,9 +107,9 @@ final class QueryCalculations { queryParameters.fromBaseTileX = tile.tileX << zoomLevelDifference; queryParameters.fromBaseTileY = tile.tileY << zoomLevelDifference; queryParameters.toBaseTileX = queryParameters.fromBaseTileX - + (1 << zoomLevelDifference) - 1; + + (1 << zoomLevelDifference) - 1; queryParameters.toBaseTileY = queryParameters.fromBaseTileY - + (1 << zoomLevelDifference) - 1; + + (1 << zoomLevelDifference) - 1; queryParameters.useTileBitmask = false; } else if (tile.zoomLevel > subFileParameter.baseZoomLevel) { // calculate the XY numbers of the parent base tile @@ -133,15 +133,15 @@ final class QueryCalculations { static void calculateBlocks(QueryParameters queryParameters, SubFileParameter subFileParameter) { // calculate the blocks in the file which need to be read queryParameters.fromBlockX = Math.max(queryParameters.fromBaseTileX - - subFileParameter.boundaryTileLeft, 0); + - subFileParameter.boundaryTileLeft, 0); queryParameters.fromBlockY = Math.max(queryParameters.fromBaseTileY - - subFileParameter.boundaryTileTop, 0); + - subFileParameter.boundaryTileTop, 0); queryParameters.toBlockX = Math.min(queryParameters.toBaseTileX - - subFileParameter.boundaryTileLeft, - subFileParameter.blocksWidth - 1); + - subFileParameter.boundaryTileLeft, + subFileParameter.blocksWidth - 1); queryParameters.toBlockY = Math.min(queryParameters.toBaseTileY - - subFileParameter.boundaryTileTop, - subFileParameter.blocksHeight - 1); + - subFileParameter.boundaryTileTop, + subFileParameter.blocksHeight - 1); } static int calculateTileBitmask(Tile tile, int zoomLevelDifference) { diff --git a/vtm/src/org/oscim/tiling/source/mapfile/ReadBuffer.java b/vtm/src/org/oscim/tiling/source/mapfile/ReadBuffer.java index 65f5816f..68364305 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/ReadBuffer.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/ReadBuffer.java @@ -44,7 +44,7 @@ public class ReadBuffer { /** * Returns one signed byte from the read buffer. - * + * * @return the byte value. */ public byte readByte() { @@ -56,7 +56,7 @@ public class ReadBuffer { * resets the internal buffer position. If * the capacity of the read buffer is too small, a larger one is created * automatically. - * + * * @param length * the amount of bytes to read from the file. * @return true if the whole data was read successfully, false otherwise. @@ -85,7 +85,7 @@ public class ReadBuffer { * Converts four bytes from the read buffer to a signed int. *

* The byte order is big-endian. - * + * * @return the int value. */ public int readInt() { @@ -94,16 +94,16 @@ public class ReadBuffer { mBufferPosition += 4; return data[pos] << 24 - | (data[pos + 1] & 0xff) << 16 - | (data[pos + 2] & 0xff) << 8 - | (data[pos + 3] & 0xff); + | (data[pos + 1] & 0xff) << 16 + | (data[pos + 2] & 0xff) << 8 + | (data[pos + 3] & 0xff); } /** * Converts eight bytes from the read buffer to a signed long. *

* The byte order is big-endian. - * + * * @return the long value. */ public long readLong() { @@ -112,13 +112,13 @@ public class ReadBuffer { mBufferPosition += 8; return (data[pos] & 0xffL) << 56 - | (data[pos + 1] & 0xffL) << 48 - | (data[pos + 2] & 0xffL) << 40 - | (data[pos + 3] & 0xffL) << 32 - | (data[pos + 4] & 0xffL) << 24 - | (data[pos + 5] & 0xffL) << 16 - | (data[pos + 6] & 0xffL) << 8 - | (data[pos + 7] & 0xffL); + | (data[pos + 1] & 0xffL) << 48 + | (data[pos + 2] & 0xffL) << 40 + | (data[pos + 3] & 0xffL) << 32 + | (data[pos + 4] & 0xffL) << 24 + | (data[pos + 5] & 0xffL) << 16 + | (data[pos + 6] & 0xffL) << 8 + | (data[pos + 7] & 0xffL); } @@ -126,7 +126,7 @@ public class ReadBuffer { * Converts two bytes from the read buffer to a signed int. *

* The byte order is big-endian. - * + * * @return the int value. */ public int readShort() { @@ -140,7 +140,7 @@ public class ReadBuffer { * The first bit is for continuation info, the other six (last byte) or * seven (all other bytes) bits are for data. The second bit in the last * byte indicates the sign of the number. - * + * * @return the value. */ public int readSignedInt() { @@ -160,7 +160,7 @@ public class ReadBuffer { flag = ((data[pos + 1] & 0x40) >> 6); return (((data[pos] & 0x7f) - | (data[pos + 1] & 0x3f) << 7) ^ -flag) + flag; + | (data[pos + 1] & 0x3f) << 7) ^ -flag) + flag; } @@ -169,8 +169,8 @@ public class ReadBuffer { flag = ((data[pos + 2] & 0x40) >> 6); return (((data[pos] & 0x7f) - | (data[pos + 1] & 0x7f) << 7 - | (data[pos + 2] & 0x3f) << 14) ^ -flag) + flag; + | (data[pos + 1] & 0x7f) << 7 + | (data[pos + 2] & 0x3f) << 14) ^ -flag) + flag; } @@ -179,19 +179,19 @@ public class ReadBuffer { flag = ((data[pos + 3] & 0x40) >> 6); return (((data[pos] & 0x7f) - | ((data[pos + 1] & 0x7f) << 7) - | ((data[pos + 2] & 0x7f) << 14) - | ((data[pos + 3] & 0x3f) << 21)) ^ -flag) + flag; + | ((data[pos + 1] & 0x7f) << 7) + | ((data[pos + 2] & 0x7f) << 14) + | ((data[pos + 3] & 0x3f) << 21)) ^ -flag) + flag; } mBufferPosition += 5; flag = ((data[pos + 4] & 0x40) >> 6); return ((((data[pos] & 0x7f) - | (data[pos + 1] & 0x7f) << 7 - | (data[pos + 2] & 0x7f) << 14 - | (data[pos + 3] & 0x7f) << 21 - | (data[pos + 4] & 0x3f) << 28)) ^ -flag) + flag; + | (data[pos + 1] & 0x7f) << 7 + | (data[pos + 2] & 0x7f) << 14 + | (data[pos + 3] & 0x7f) << 21 + | (data[pos + 4] & 0x3f) << 28)) ^ -flag) + flag; } @@ -202,7 +202,7 @@ public class ReadBuffer { * The first bit is for continuation info, the other six (last byte) or * seven (all other bytes) bits are for data. The second bit in the last * byte indicates the sign of the number. - * + * * @param values * result values * @param length @@ -227,7 +227,7 @@ public class ReadBuffer { flag = ((data[pos + 1] & 0x40) >> 6); values[i] = (((data[pos] & 0x7f) - | ((data[pos + 1] & 0x3f) << 7)) ^ -flag) + flag; + | ((data[pos + 1] & 0x3f) << 7)) ^ -flag) + flag; pos += 2; } else if ((data[pos + 2] & 0x80) == 0) { @@ -235,8 +235,8 @@ public class ReadBuffer { flag = ((data[pos + 2] & 0x40) >> 6); values[i] = (((data[pos] & 0x7f) - | ((data[pos + 1] & 0x7f) << 7) - | ((data[pos + 2] & 0x3f) << 14)) ^ -flag) + flag; + | ((data[pos + 1] & 0x7f) << 7) + | ((data[pos + 2] & 0x3f) << 14)) ^ -flag) + flag; pos += 3; } else if ((data[pos + 3] & 0x80) == 0) { @@ -244,19 +244,19 @@ public class ReadBuffer { flag = ((data[pos + 3] & 0x40) >> 6); values[i] = (((data[pos] & 0x7f) - | ((data[pos + 1] & 0x7f) << 7) - | ((data[pos + 2] & 0x7f) << 14) - | ((data[pos + 3] & 0x3f) << 21)) ^ -flag) + flag; + | ((data[pos + 1] & 0x7f) << 7) + | ((data[pos + 2] & 0x7f) << 14) + | ((data[pos + 3] & 0x3f) << 21)) ^ -flag) + flag; pos += 4; } else { flag = ((data[pos + 4] & 0x40) >> 6); values[i] = ((((data[pos] & 0x7f) - | ((data[pos + 1] & 0x7f) << 7) - | ((data[pos + 2] & 0x7f) << 14) - | ((data[pos + 3] & 0x7f) << 21) - | ((data[pos + 4] & 0x3f) << 28))) ^ -flag) + flag; + | ((data[pos + 1] & 0x7f) << 7) + | ((data[pos + 2] & 0x7f) << 14) + | ((data[pos + 3] & 0x7f) << 21) + | ((data[pos + 4] & 0x3f) << 28))) ^ -flag) + flag; pos += 5; } @@ -271,7 +271,7 @@ public class ReadBuffer { *

* The first bit is for continuation info, the other seven bits are for * data. - * + * * @return the int value. */ public int readUnsignedInt() { @@ -286,35 +286,35 @@ public class ReadBuffer { if ((data[pos + 1] & 0x80) == 0) { mBufferPosition += 2; return (data[pos] & 0x7f) - | (data[pos + 1] & 0x7f) << 7; + | (data[pos + 1] & 0x7f) << 7; } if ((data[pos + 2] & 0x80) == 0) { mBufferPosition += 3; return (data[pos] & 0x7f) - | ((data[pos + 1] & 0x7f) << 7) - | ((data[pos + 2] & 0x7f) << 14); + | ((data[pos + 1] & 0x7f) << 7) + | ((data[pos + 2] & 0x7f) << 14); } if ((data[pos + 3] & 0x80) == 0) { mBufferPosition += 4; return (data[pos] & 0x7f) - | ((data[pos + 1] & 0x7f) << 7) - | ((data[pos + 2] & 0x7f) << 14) - | ((data[pos + 3] & 0x7f) << 21); + | ((data[pos + 1] & 0x7f) << 7) + | ((data[pos + 2] & 0x7f) << 14) + | ((data[pos + 3] & 0x7f) << 21); } mBufferPosition += 5; return (data[pos] & 0x7f) - | ((data[pos + 1] & 0x7f) << 7) - | ((data[pos + 2] & 0x7f) << 14) - | ((data[pos + 3] & 0x7f) << 21) - | ((data[pos + 4] & 0x7f) << 28); + | ((data[pos + 1] & 0x7f) << 7) + | ((data[pos + 2] & 0x7f) << 14) + | ((data[pos + 3] & 0x7f) << 21) + | ((data[pos + 4] & 0x7f) << 28); } /** * Decodes a variable amount of bytes from the read buffer to a string. - * + * * @return the UTF-8 decoded string (may be null). */ public String readUTF8EncodedString() { @@ -333,7 +333,7 @@ public class ReadBuffer { /** * Decodes the given amount of bytes from the read buffer to a string. - * + * * @param stringLength * the length of the string in bytes. * @return the UTF-8 decoded string (may be null). @@ -343,7 +343,7 @@ public class ReadBuffer { mBufferPosition += stringLength; try { return new String(mBufferData, mBufferPosition - stringLength, stringLength, - CHARSET_UTF8); + CHARSET_UTF8); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } @@ -354,7 +354,7 @@ public class ReadBuffer { /** * Decodes a variable amount of bytes from the read buffer to a string. - * + * * @param position * buffer offset position of string * @return the UTF-8 decoded string (may be null). @@ -383,7 +383,7 @@ public class ReadBuffer { /** * Sets the buffer position to the given offset. - * + * * @param bufferPosition * the buffer position. */ @@ -393,7 +393,7 @@ public class ReadBuffer { /** * Skips the given number of bytes in the read buffer. - * + * * @param bytes * the number of bytes to skip. */ @@ -435,25 +435,25 @@ public class ReadBuffer { pos += 1; } else if ((data[pos + 1] & 0x80) == 0) { skip = (data[pos] & 0x7f) - | (data[pos + 1] & 0x7f) << 7; + | (data[pos + 1] & 0x7f) << 7; pos += 2; } else if ((data[pos + 2] & 0x80) == 0) { skip = (data[pos] & 0x7f) - | ((data[pos + 1] & 0x7f) << 7) - | ((data[pos + 2] & 0x7f) << 14); + | ((data[pos + 1] & 0x7f) << 7) + | ((data[pos + 2] & 0x7f) << 14); pos += 3; } else if ((data[pos + 3] & 0x80) == 0) { skip = (data[pos] & 0x7f) - | ((data[pos + 1] & 0x7f) << 7) - | ((data[pos + 2] & 0x7f) << 14) - | ((data[pos + 3] & 0x7f) << 21); + | ((data[pos + 1] & 0x7f) << 7) + | ((data[pos + 2] & 0x7f) << 14) + | ((data[pos + 3] & 0x7f) << 21); pos += 4; } else { skip = (data[pos] & 0x7f) - | ((data[pos + 1] & 0x7f) << 7) - | ((data[pos + 2] & 0x7f) << 14) - | ((data[pos + 3] & 0x7f) << 21) - | ((data[pos + 4] & 0x7f) << 28); + | ((data[pos + 1] & 0x7f) << 7) + | ((data[pos + 2] & 0x7f) << 14) + | ((data[pos + 3] & 0x7f) << 21) + | ((data[pos + 4] & 0x7f) << 28); pos += 5; } // invalid way size diff --git a/vtm/src/org/oscim/tiling/source/mapfile/header/MapFileHeader.java b/vtm/src/org/oscim/tiling/source/mapfile/header/MapFileHeader.java index e2fc161a..bf0eb734 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/header/MapFileHeader.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/header/MapFileHeader.java @@ -80,7 +80,7 @@ public class MapFileHeader { /** * Reads and validates the header block from the map file. - * + * * @param readBuffer * the ReadBuffer for the file data. * @param fileSize @@ -108,8 +108,7 @@ public class MapFileHeader { return openResult; } - openResult = RequiredFields - .readFileSize(readBuffer, fileSize, mapFileInfoBuilder); + openResult = RequiredFields.readFileSize(readBuffer, fileSize, mapFileInfoBuilder); if (!openResult.isSuccess()) { return openResult; } @@ -160,7 +159,7 @@ public class MapFileHeader { } private OpenResult readSubFileParameters(ReadBuffer readBuffer, long fileSize, - MapFileInfoBuilder mapFileInfoBuilder) { + MapFileInfoBuilder mapFileInfoBuilder) { // get and check the number of sub-files (1 byte) byte numberOfSubFiles = readBuffer.readByte(); if (numberOfSubFiles < 1) { @@ -200,7 +199,7 @@ public class MapFileHeader { // check for valid zoom level range if (zoomLevelMin > zoomLevelMax) { return new OpenResult("invalid zoom level range: " + zoomLevelMin + SPACE - + zoomLevelMax); + + zoomLevelMax); } // get and check the start address of the sub-file (8 bytes) diff --git a/vtm/src/org/oscim/tiling/source/mapfile/header/MapFileInfo.java b/vtm/src/org/oscim/tiling/source/mapfile/header/MapFileInfo.java index 35507f6f..0e5f57ad 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/header/MapFileInfo.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/header/MapFileInfo.java @@ -18,7 +18,7 @@ import org.oscim.core.Tag; /** * Contains the immutable metadata of a map file. - * + * */ public class MapFileInfo extends org.oscim.tiling.source.mapfile.MapInfo { @@ -49,16 +49,16 @@ public class MapFileInfo extends org.oscim.tiling.source.mapfile.MapInfo { MapFileInfo(MapFileInfoBuilder mapFileInfoBuilder) { super(mapFileInfoBuilder.boundingBox, - mapFileInfoBuilder.optionalFields.startZoomLevel, - mapFileInfoBuilder.optionalFields.startPosition, - mapFileInfoBuilder.projectionName, - mapFileInfoBuilder.mapDate, - mapFileInfoBuilder.fileSize, - mapFileInfoBuilder.fileVersion, - mapFileInfoBuilder.optionalFields.languagePreference, - mapFileInfoBuilder.optionalFields.comment, - mapFileInfoBuilder.optionalFields.createdBy, - mapFileInfoBuilder.zoomLevel); + mapFileInfoBuilder.optionalFields.startZoomLevel, + mapFileInfoBuilder.optionalFields.startPosition, + mapFileInfoBuilder.projectionName, + mapFileInfoBuilder.mapDate, + mapFileInfoBuilder.fileSize, + mapFileInfoBuilder.fileVersion, + mapFileInfoBuilder.optionalFields.languagePreference, + mapFileInfoBuilder.optionalFields.comment, + mapFileInfoBuilder.optionalFields.createdBy, + mapFileInfoBuilder.zoomLevel); debugFile = mapFileInfoBuilder.optionalFields.isDebugFile; diff --git a/vtm/src/org/oscim/tiling/source/mapfile/header/OptionalFields.java b/vtm/src/org/oscim/tiling/source/mapfile/header/OptionalFields.java index b32194ec..b52093ed 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/header/OptionalFields.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/header/OptionalFields.java @@ -60,7 +60,7 @@ final class OptionalFields { private static final int START_ZOOM_LEVEL_MAX = 22; static OpenResult readOptionalFields(ReadBuffer readBuffer, - MapFileInfoBuilder mapFileInfoBuilder) { + MapFileInfoBuilder mapFileInfoBuilder) { OptionalFields optionalFields = new OptionalFields(readBuffer.readByte()); mapFileInfoBuilder.optionalFields = optionalFields; @@ -108,14 +108,14 @@ final class OptionalFields { // get and check the start position latitude (4 byte) int mapStartLatitude = readBuffer.readInt(); if (mapStartLatitude < RequiredFields.LATITUDE_MIN - || mapStartLatitude > RequiredFields.LATITUDE_MAX) { + || mapStartLatitude > RequiredFields.LATITUDE_MAX) { return new OpenResult("invalid map start latitude: " + mapStartLatitude); } // get and check the start position longitude (4 byte) int mapStartLongitude = readBuffer.readInt(); if (mapStartLongitude < RequiredFields.LONGITUDE_MIN - || mapStartLongitude > RequiredFields.LONGITUDE_MAX) { + || mapStartLongitude > RequiredFields.LONGITUDE_MAX) { return new OpenResult("invalid map start longitude: " + mapStartLongitude); } diff --git a/vtm/src/org/oscim/tiling/source/mapfile/header/RequiredFields.java b/vtm/src/org/oscim/tiling/source/mapfile/header/RequiredFields.java index a004f7f3..b51e3f0b 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/header/RequiredFields.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/header/RequiredFields.java @@ -106,12 +106,12 @@ final class RequiredFields { } mapFileInfoBuilder.boundingBox = new BoundingBox(minLatitude, minLongitude, maxLatitude, - maxLongitude); + maxLongitude); return OpenResult.SUCCESS; } static OpenResult readFileSize(ReadBuffer readBuffer, long fileSize, - MapFileInfoBuilder mapFileInfoBuilder) { + MapFileInfoBuilder mapFileInfoBuilder) { // get and check the file size (8 bytes) long headerFileSize = readBuffer.readLong(); if (headerFileSize != fileSize) { @@ -178,7 +178,7 @@ final class RequiredFields { } static OpenResult readProjectionName(ReadBuffer readBuffer, - MapFileInfoBuilder mapFileInfoBuilder) { + MapFileInfoBuilder mapFileInfoBuilder) { // get and check the projection name String projectionName = readBuffer.readUTF8EncodedString(); if (!MERCATOR.equals(projectionName)) { diff --git a/vtm/src/org/oscim/tiling/source/mapfile/header/SubFileParameter.java b/vtm/src/org/oscim/tiling/source/mapfile/header/SubFileParameter.java index 976f53b5..6e664104 100644 --- a/vtm/src/org/oscim/tiling/source/mapfile/header/SubFileParameter.java +++ b/vtm/src/org/oscim/tiling/source/mapfile/header/SubFileParameter.java @@ -110,7 +110,6 @@ public class SubFileParameter { */ private final int hashCodeValue; - SubFileParameter(SubFileParameterBuilder subFileParameterBuilder) { this.startAddress = subFileParameterBuilder.startAddress; this.indexStartAddress = subFileParameterBuilder.indexStartAddress; @@ -122,17 +121,21 @@ public class SubFileParameter { // calculate the XY numbers of the boundary tiles in this sub-file this.boundaryTileBottom = Projection.latitudeToTileY( - subFileParameterBuilder.boundingBox.minLatitudeE6 - / COORDINATES_DIVISOR, this.baseZoomLevel); + subFileParameterBuilder.boundingBox.minLatitudeE6 + / COORDINATES_DIVISOR, + this.baseZoomLevel); this.boundaryTileLeft = Projection.longitudeToTileX( - subFileParameterBuilder.boundingBox.minLongitudeE6 - / COORDINATES_DIVISOR, this.baseZoomLevel); + subFileParameterBuilder.boundingBox.minLongitudeE6 + / COORDINATES_DIVISOR, + this.baseZoomLevel); this.boundaryTileTop = Projection.latitudeToTileY( - subFileParameterBuilder.boundingBox.maxLatitudeE6 - / COORDINATES_DIVISOR, this.baseZoomLevel); + subFileParameterBuilder.boundingBox.maxLatitudeE6 + / COORDINATES_DIVISOR, + this.baseZoomLevel); this.boundaryTileRight = Projection.longitudeToTileX( - subFileParameterBuilder.boundingBox.maxLongitudeE6 - / COORDINATES_DIVISOR, this.baseZoomLevel); + subFileParameterBuilder.boundingBox.maxLongitudeE6 + / COORDINATES_DIVISOR, + this.baseZoomLevel); // calculate the horizontal and vertical amount of blocks in this sub-file this.blocksWidth = this.boundaryTileRight - this.boundaryTileLeft + 1; diff --git a/vtm/src/org/oscim/tiling/source/mapnik/MapnikVectorTileSource.java b/vtm/src/org/oscim/tiling/source/mapnik/MapnikVectorTileSource.java index b8916be6..482f1e84 100644 --- a/vtm/src/org/oscim/tiling/source/mapnik/MapnikVectorTileSource.java +++ b/vtm/src/org/oscim/tiling/source/mapnik/MapnikVectorTileSource.java @@ -39,10 +39,10 @@ public class MapnikVectorTileSource extends UrlTileSource { protected int formatTilePath(Tile tile, byte[] path, int pos) { // url formatter for mapbox streets byte[] hexTable = { - '0', '1', '2', '3', - '4', '5', '6', '7', - '8', '9', 'a', 'b', - 'c', 'd', 'e', 'f' + '0', '1', '2', '3', + '4', '5', '6', '7', + '8', '9', 'a', 'b', + 'c', 'd', 'e', 'f' }; path[pos++] = '/'; diff --git a/vtm/src/org/oscim/tiling/source/mapnik/TileDecoder.java b/vtm/src/org/oscim/tiling/source/mapnik/TileDecoder.java index c688ed44..84c20af8 100644 --- a/vtm/src/org/oscim/tiling/source/mapnik/TileDecoder.java +++ b/vtm/src/org/oscim/tiling/source/mapnik/TileDecoder.java @@ -14,7 +14,6 @@ */ package org.oscim.tiling.source.mapnik; - import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -70,8 +69,9 @@ public class TileDecoder extends PbfDecoder { private float mScale; @Override - public boolean decode(Tile tile, ITileDataSink mapDataCallback, InputStream is, int contentLength) - throws IOException { + public boolean decode(Tile tile, ITileDataSink mapDataCallback, InputStream is, + int contentLength) + throws IOException { if (debug) Log.d(TAG, tile + " decode"); @@ -97,7 +97,7 @@ public class TileDecoder extends PbfDecoder { } } - if (hasData()){ + if (hasData()) { error(tile + " invalid tile"); return false; } @@ -475,14 +475,14 @@ public class TileDecoder extends PbfDecoder { int dx = (curX - prevX); int dy = (curY - prevY); - if (isPoly && num == 0 && cnt > 0){ + if (isPoly && num == 0 && cnt > 0) { prevX = curX; prevY = curY; // only add last point if it is di int ppos = cnt * 2; if (elem.points[elem.pointPos - ppos] != curX - || elem.points[elem.pointPos - ppos + 1] != curY) + || elem.points[elem.pointPos - ppos + 1] != curY) elem.addPoint(curX / mScale, curY / mScale); lastClip = false; @@ -490,11 +490,11 @@ public class TileDecoder extends PbfDecoder { } if ((isPoint || cmd == MOVE_TO) - || (dx > pixel || dx < -pixel) - || (dy > pixel || dy < -pixel) - // hack to not clip at tile boundaries - || (curX <= 0 || curX >= 4095) - || (curY <= 0 || curY >= 4095)) { + || (dx > pixel || dx < -pixel) + || (dy > pixel || dy < -pixel) + // hack to not clip at tile boundaries + || (curX <= 0 || curX >= 4095) + || (curY <= 0 || curY >= 4095)) { prevX = curX; prevY = curY; diff --git a/vtm/src/org/oscim/tiling/source/oscimap/OSciMap1TileSource.java b/vtm/src/org/oscim/tiling/source/oscimap/OSciMap1TileSource.java index 9e1653c8..d51573fc 100644 --- a/vtm/src/org/oscim/tiling/source/oscimap/OSciMap1TileSource.java +++ b/vtm/src/org/oscim/tiling/source/oscimap/OSciMap1TileSource.java @@ -20,9 +20,10 @@ import org.oscim.tiling.source.ITileDataSource; import org.oscim.tiling.source.common.LwHttp; import org.oscim.tiling.source.common.PbfTileDataSource; import org.oscim.tiling.source.common.UrlTileSource; + /** * Deprecated - * + * */ public class OSciMap1TileSource extends UrlTileSource { diff --git a/vtm/src/org/oscim/tiling/source/oscimap/Tags.java b/vtm/src/org/oscim/tiling/source/oscimap/Tags.java index e797bfd2..a4fcb8b0 100644 --- a/vtm/src/org/oscim/tiling/source/oscimap/Tags.java +++ b/vtm/src/org/oscim/tiling/source/oscimap/Tags.java @@ -271,7 +271,7 @@ public class Tags { private static final String s_siding = "siding".intern(); private static final String s_aeroway = "aeroway".intern(); private static final String s_emergency_access_point = "emergency_access_point" - .intern(); + .intern(); private static final String s_watermill = "watermill".intern(); private static final String s_college = "college".intern(); private static final String s_landuse = "landuse".intern(); @@ -368,7 +368,7 @@ public class Tags { private static final String s_helipad = "helipad".intern(); private static final String s_railway = "railway".intern(); private static final String s_greenhouse_horticulture = "greenhouse_horticulture" - .intern(); + .intern(); private static final String s_wall = "wall".intern(); private static final String s_recycling = "recycling".intern(); private static final String s_passing_place = "passing_place".intern(); @@ -582,377 +582,377 @@ public class Tags { public static final Tag[] tags = { - new Tag(s_building, s_yes, false), new Tag(s_highway, s_residential, false), - new Tag(s_highway, s_service, false), new Tag(s_waterway, s_stream, false), - new Tag(s_highway, s_unclassified, false), new Tag(s_highway, s_track, false), - new Tag(s_oneway, s_yes, false), new Tag(s_natural, s_water, false), - new Tag(s_highway, s_footway, false), new Tag(s_access, s_private, false), - new Tag(s_highway, s_tertiary, false), new Tag(s_highway, s_path, false), - new Tag(s_highway, s_secondary, false), new Tag(s_landuse, s_forest, false), - new Tag(s_bridge, s_yes, false), new Tag(s_natural, s_tree, false), - new Tag(s_surface, s_paved, false), new Tag(s_natural, s_wood, false), - new Tag(s_highway, s_primary, false), new Tag(s_landuse, s_grass, false), - new Tag(s_landuse, s_residential, false), new Tag(s_surface, s_unpaved, false), - new Tag(s_highway, s_bus_stop, false), new Tag(s_surface, s_asphalt, false), - new Tag(s_bicycle, s_yes, false), new Tag(s_amenity, s_parking, false), - new Tag(s_place, s_locality, false), new Tag(s_railway, s_rail, false), - new Tag(s_service, s_parking_aisle, false), - new Tag(s_boundary, s_administrative, false), - new Tag(s_building, s_house, false), new Tag(s_place, s_village, false), - new Tag(s_natural, s_coastline, false), new Tag(s_tracktype, s_grade2, false), - new Tag(s_oneway, s_no, false), new Tag(s_service, s_driveway, false), - new Tag(s_highway, s_turning_circle, false), new Tag(s_place, s_hamlet, false), - new Tag(s_natural, s_wetland, false), new Tag(s_tracktype, s_grade3, false), - new Tag(s_waterway, s_river, false), new Tag(s_highway, s_cycleway, false), - new Tag(s_barrier, s_fence, false), new Tag(s_building, s_residential, false), - new Tag(s_amenity, s_school, false), new Tag(s_highway, s_crossing, false), - new Tag(s_admin_level, s_8, false), new Tag(s_highway, s_trunk, false), - new Tag(s_amenity, s_place_of_worship, false), - new Tag(s_landuse, s_farmland, false), new Tag(s_tracktype, s_grade1, false), - new Tag(s_highway, s_road, false), new Tag(s_landuse, s_farm, false), - new Tag(s_surface, s_gravel, false), new Tag(s_landuse, s_meadow, false), - new Tag(s_highway, s_motorway, false), - new Tag(s_highway, s_traffic_signals, false), - new Tag(s_building, s_hut, false), new Tag(s_highway, s_motorway_link, false), - new Tag(s_tracktype, s_grade4, false), new Tag(s_barrier, s_gate, false), - new Tag(s_highway, s_living_street, false), new Tag(s_bicycle, s_no, false), - new Tag(s_leisure, s_pitch, false), new Tag(s_tunnel, s_yes, false), - new Tag(s_surface, s_ground, false), new Tag(s_highway, s_steps, false), - new Tag(s_natural, s_land, false), new Tag(s_man_made, s_survey_point, false), - new Tag(s_tracktype, s_grade5, false), new Tag(s_waterway, s_ditch, false), - new Tag(s_leisure, s_park, false), new Tag(s_amenity, s_restaurant, false), - new Tag(s_barrier, s_wall, false), new Tag(s_waterway, s_riverbank, false), - new Tag(s_amenity, s_bench, false), new Tag(s_building, s_garage, false), - new Tag(s_natural, s_scrub, false), new Tag(s_highway, s_pedestrian, false), - new Tag(s_natural, s_peak, false), new Tag(s_building, s_entrance, false), - new Tag(s_landuse, s_reservoir, false), new Tag(s_access, s_yes, false), - new Tag(s_bicycle, s_designated, false), - new Tag(s_leisure, s_swimming_pool, false), - new Tag(s_landuse, s_farmyard, false), - new Tag(s_railway, s_level_crossing, false), - new Tag(s_building, s_apartments, false), new Tag(s_surface, s_grass, false), - new Tag(s_wheelchair, s_yes, false), new Tag(s_service, s_alley, false), - new Tag(s_landuse, s_industrial, false), new Tag(s_amenity, s_fuel, false), - new Tag(s_surface, s_dirt, false), new Tag(s_highway, s_trunk_link, false), - new Tag(s_waterway, s_drain, false), new Tag(s_barrier, s_hedge, false), - new Tag(s_amenity, s_grave_yard, false), - new Tag(s_tourism, s_information, false), - new Tag(s_shop, s_supermarket, false), - new Tag(s_highway, s_primary_link, false), new Tag(s_wood, s_deciduous, false), - new Tag(s_leisure, s_playground, false), new Tag(s_building, s_roof, false), - new Tag(s_building, s_industrial, false), - new Tag(s_amenity, s_post_box, false), new Tag(s_waterway, s_canal, false), - new Tag(s_barrier, s_bollard, false), new Tag(s_leisure, s_garden, false), - new Tag(s_wood, s_mixed, false), new Tag(s_landuse, s_cemetery, false), - new Tag(s_landuse, s_orchard, false), new Tag(s_shop, s_convenience, false), - new Tag(s_access, s_permissive, false), new Tag(s_surface, s_concrete, false), - new Tag(s_surface, s_paving_stones, false), new Tag(s_service, s_spur, false), - new Tag(s_building, s_garages, false), new Tag(s_amenity, s_bank, false), - new Tag(s_tourism, s_hotel, false), new Tag(s_access, s_no, false), - new Tag(s_amenity, s_fast_food, false), new Tag(s_man_made, s_pier, false), - new Tag(s_amenity, s_kindergarten, false), - new Tag(s_access, s_agricultural, false), - new Tag(s_surface, s_cobblestone, false), new Tag(s_wheelchair, s_no, false), - new Tag(s_amenity, s_cafe, false), new Tag(s_amenity, s_hospital, false), - new Tag(s_amenity, s_post_office, false), - new Tag(s_amenity, s_public_building, false), - new Tag(s_amenity, s_recycling, false), - new Tag(s_highway, s_street_lamp, false), new Tag(s_man_made, s_tower, false), - new Tag(s_waterway, s_dam, false), new Tag(s_amenity, s_pub, false), - new Tag(s_wood, s_coniferous, false), new Tag(s_access, s_destination, false), - new Tag(s_admin_level, s_6, false), new Tag(s_landuse, s_commercial, false), - new Tag(s_amenity, s_pharmacy, false), new Tag(s_railway, s_abandoned, false), - new Tag(s_service, s_yard, false), new Tag(s_place, s_island, false), - new Tag(s_oneway, s__1, false), new Tag(s_landuse, s_quarry, false), - new Tag(s_landuse, s_vineyard, false), - new Tag(s_highway, s_motorway_junction, false), - new Tag(s_railway, s_station, false), new Tag(s_landuse, s_allotments, false), - new Tag(s_barrier, s_lift_gate, false), new Tag(s_admin_level, s_10, false), - new Tag(s_amenity, s_telephone, false), new Tag(s_place, s_town, false), - new Tag(s_man_made, s_cutline, false), new Tag(s_place, s_suburb, false), - new Tag(s_aeroway, s_taxiway, false), new Tag(s_wheelchair, s_limited, false), - new Tag(s_highway, s_secondary_link, false), - new Tag(s_leisure, s_sports_centre, false), - new Tag(s_amenity, s_bicycle_parking, false), - new Tag(s_surface, s_sand, false), new Tag(s_highway, s_stop, false), - new Tag(s_man_made, s_works, false), new Tag(s_landuse, s_retail, false), - new Tag(s_amenity, s_fire_station, false), new Tag(s_service, s_siding, false), - new Tag(s_amenity, s_toilets, false), new Tag(s_bench, s_yes, false), - new Tag(s_oneway, s_1, false), new Tag(s_surface, s_compacted, false), - new Tag(s_landuse, s_basin, false), new Tag(s_amenity, s_police, false), - new Tag(s_railway, s_tram, false), new Tag(s_route, s_road, false), - new Tag(s_natural, s_cliff, false), new Tag(s_highway, s_construction, false), - new Tag(s_aeroway, s_aerodrome, false), new Tag(s_entrance, s_yes, false), - new Tag(s_man_made, s_storage_tank, false), new Tag(s_amenity, s_atm, false), - new Tag(s_tourism, s_attraction, false), new Tag(s_route, s_bus, false), - new Tag(s_shop, s_bakery, false), new Tag(s_tourism, s_viewpoint, false), - new Tag(s_amenity, s_swimming_pool, false), new Tag(s_natural, s_beach, false), - new Tag(s_tourism, s_picnic_site, false), new Tag(s_oneway, s_true, false), - new Tag(s_highway, s_bridleway, false), new Tag(s_tourism, s_camp_site, false), - new Tag(s_abutters, s_residential, false), - new Tag(s_leisure, s_nature_reserve, false), - new Tag(s_amenity, s_drinking_water, false), new Tag(s_shop, s_clothes, false), - new Tag(s_natural, s_heath, false), - new Tag(s_highway, s_mini_roundabout, false), - new Tag(s_landuse, s_construction, false), - new Tag(s_amenity, s_waste_basket, false), - new Tag(s_railway, s_platform, false), new Tag(s_amenity, s_townhall, false), - new Tag(s_shop, s_hairdresser, false), new Tag(s_amenity, s_shelter, false), - new Tag(s_admin_level, s_9, false), - new Tag(s_building, s_farm_auxiliary, false), - new Tag(s_amenity, s_library, false), new Tag(s_building, s_detached, false), - new Tag(s_admin_level, s_4, false), new Tag(s_landuse, s_village_green, false), - new Tag(s_barrier, s_stile, false), new Tag(s_landuse, s_garages, false), - new Tag(s_amenity, s_bar, false), new Tag(s_railway, s_buffer_stop, false), - new Tag(s_wetland, s_marsh, false), new Tag(s_tourism, s_museum, false), - new Tag(s_barrier, s_cycle_barrier, false), new Tag(s_route, s_bicycle, false), - new Tag(s_railway, s_tram_stop, false), - new Tag(s_amenity, s_parking_space, false), - new Tag(s_barrier, s_retaining_wall, false), - new Tag(s_landuse, s_recreation_ground, false), - new Tag(s_amenity, s_university, false), - new Tag(s_highway, s_tertiary_link, false), - new Tag(s_building, s_terrace, false), new Tag(s_shop, s_car_repair, false), - new Tag(s_amenity, s_hunting_stand, false), - new Tag(s_amenity, s_fountain, false), new Tag(s_man_made, s_pipeline, false), - new Tag(s_wetland, s_swamp, false), new Tag(s_shop, s_car, false), - new Tag(s_bench, s_no, false), new Tag(s_tunnel, s_culvert, false), - new Tag(s_building, s_school, false), new Tag(s_barrier, s_entrance, false), - new Tag(s_railway, s_disused, false), new Tag(s_railway, s_crossing, false), - new Tag(s_building, s_church, false), - new Tag(s_amenity, s_social_facility, false), new Tag(s_natural, s_bay, false), - new Tag(s_shop, s_kiosk, false), new Tag(s_amenity, s_vending_machine, false), - new Tag(s_route, s_hiking, false), new Tag(s_natural, s_spring, false), - new Tag(s_leisure, s_common, false), new Tag(s_railway, s_switch, false), - new Tag(s_waterway, s_rapids, false), new Tag(s_admin_level, s_7, false), - new Tag(s_leisure, s_stadium, false), new Tag(s_leisure, s_track, false), - new Tag(s_place, s_isolated_dwelling, false), new Tag(s_place, s_islet, false), - new Tag(s_waterway, s_weir, false), new Tag(s_amenity, s_doctors, false), - new Tag(s_access, s_designated, false), - new Tag(s_landuse, s_conservation, false), - new Tag(s_waterway, s_artificial, false), - new Tag(s_amenity, s_bus_station, false), - new Tag(s_leisure, s_golf_course, false), - new Tag(s_shop, s_doityourself, false), new Tag(s_building, s_service, false), - new Tag(s_tourism, s_guest_house, false), new Tag(s_aeroway, s_runway, false), - new Tag(s_place, s_city, false), new Tag(s_railway, s_subway, false), - new Tag(s_man_made, s_wastewater_plant, false), - new Tag(s_building, s_commercial, false), new Tag(s_railway, s_halt, false), - new Tag(s_amenity, s_emergency_phone, false), - new Tag(s_building, s_retail, false), new Tag(s_barrier, s_block, false), - new Tag(s_leisure, s_recreation_ground, false), - new Tag(s_access, s_forestry, false), new Tag(s_amenity, s_college, false), - new Tag(s_highway, s_platform, false), new Tag(s_access, s_unknown, false), - new Tag(s_man_made, s_water_tower, false), - new Tag(s_surface, s_pebblestone, false), new Tag(s_bridge, s_viaduct, false), - new Tag(s_shop, s_butcher, false), new Tag(s_shop, s_florist, false), - new Tag(s_boundary, s_landuse, false), new Tag(s_aeroway, s_helipad, false), - new Tag(s_building, s_hangar, false), new Tag(s_natural, s_glacier, false), - new Tag(s_highway, s_proposed, false), new Tag(s_shop, s_mall, false), - new Tag(s_barrier, s_toll_booth, false), - new Tag(s_amenity, s_fire_hydrant, false), - new Tag(s_building, s_manufacture, false), new Tag(s_building, s_farm, false), - new Tag(s_surface, s_wood, false), new Tag(s_amenity, s_car_wash, false), - new Tag(s_amenity, s_dentist, false), new Tag(s_natural, s_marsh, false), - new Tag(s_man_made, s_surveillance, false), new Tag(s_shop, s_bicycle, false), - new Tag(s_route, s_foot, false), new Tag(s_amenity, s_theatre, false), - new Tag(s_building, s_office, false), new Tag(s_railway, s_light_rail, false), - new Tag(s_man_made, s_petroleum_well, false), - new Tag(s_amenity, s_taxi, false), new Tag(s_building, s_greenhouse, false), - new Tag(s_landuse, s_brownfield, false), - new Tag(s_bicycle, s_permissive, false), new Tag(s_admin_level, s_2, false), - new Tag(s_aeroway, s_apron, false), new Tag(s_building, s_cabin, false), - new Tag(s_amenity, s_cinema, false), new Tag(s_access, s_customers, false), - new Tag(s_tourism, s_motel, false), new Tag(s_railway, s_narrow_gauge, false), - new Tag(s_amenity, s_marketplace, false), new Tag(s_shop, s_furniture, false), - new Tag(s_entrance, s_staircase, false), new Tag(s_tourism, s_artwork, false), - new Tag(s_natural, s_grassland, false), new Tag(s_shop, s_books, false), - new Tag(s_admin_level, s_5, false), new Tag(s_man_made, s_groyne, false), - new Tag(s_waterway, s_lock_gate, false), - new Tag(s_highway, s_emergency_access_point, false), - new Tag(s_natural, s_sand, false), new Tag(s_landuse, s_military, false), - new Tag(s_boundary, s_protected_area, false), - new Tag(s_amenity, s_community_centre, false), - new Tag(s_barrier, s_kissing_gate, false), - new Tag(s_highway, s_speed_camera, false), - new Tag(s_boundary, s_national_park, false), - new Tag(s_railway, s_subway_entrance, false), - new Tag(s_man_made, s_silo, false), new Tag(s_shop, s_alcohol, false), - new Tag(s_highway, s_give_way, false), new Tag(s_leisure, s_slipway, false), - new Tag(s_shop, s_electronics, false), new Tag(s_bicycle, s_dismount, false), - new Tag(s_leisure, s_marina, false), new Tag(s_entrance, s_main, false), - new Tag(s_boundary, s_postal_code, false), - new Tag(s_landuse, s_greenhouse_horticulture, false), - new Tag(s_highway, s_milestone, false), - new Tag(s_natural, s_cave_entrance, false), - new Tag(s_landuse, s_landfill, false), new Tag(s_shop, s_chemist, false), - new Tag(s_shop, s_shoes, false), new Tag(s_barrier, s_cattle_grid, false), - new Tag(s_landuse, s_railway, false), new Tag(s_tourism, s_hostel, false), - new Tag(s_tourism, s_chalet, false), new Tag(s_place, s_county, false), - new Tag(s_shop, s_department_store, false), new Tag(s_highway, s_ford, false), - new Tag(s_natural, s_scree, false), new Tag(s_landuse, s_greenfield, false), - new Tag(s_amenity, s_nursing_home, false), - new Tag(s_barrier, s_wire_fence, false), - new Tag(s_access, s_restricted, false), - new Tag(s_man_made, s_reservoir_covered, false), - new Tag(s_amenity, s_bicycle_rental, false), new Tag(s_man_made, s_MDF, false), - new Tag(s_man_made, s_water_well, false), new Tag(s_landuse, s_field, false), - new Tag(s_landuse, s_wood, false), new Tag(s_shop, s_hardware, false), - new Tag(s_tourism, s_alpine_hut, false), new Tag(s_natural, s_tree_row, false), - new Tag(s_tourism, s_caravan_site, false), new Tag(s_bridge, s_no, false), - new Tag(s_wetland, s_bog, false), new Tag(s_amenity, s_courthouse, false), - new Tag(s_route, s_ferry, false), new Tag(s_barrier, s_city_wall, false), - new Tag(s_amenity, s_veterinary, false), new Tag(s_shop, s_jewelry, false), - new Tag(s_building, s_transportation, false), - new Tag(s_amenity, s_arts_centre, false), - new Tag(s_bicycle, s_official, false), new Tag(s_shop, s_optician, false), - new Tag(s_shop, s_yes, false), new Tag(s_building, s_collapsed, false), - new Tag(s_shop, s_garden_centre, false), new Tag(s_man_made, s_chimney, false), - new Tag(s_man_made, s_mine, false), new Tag(s_bench, s_unknown, false), - new Tag(s_railway, s_preserved, false), new Tag(s_building, s_public, false), - new Tag(s_amenity, s_ferry_terminal, false), - new Tag(s_highway, s_raceway, false), new Tag(s_natural, s_rock, false), - new Tag(s_tunnel, s_no, false), new Tag(s_building, s_university, false), - new Tag(s_shop, s_beverages, false), - new Tag(s_amenity, s_waste_disposal, false), - new Tag(s_building, s_warehouse, false), - new Tag(s_leisure, s_water_park, false), new Tag(s_shop, s_gift, false), - new Tag(s_place, s_farm, false), new Tag(s_wetland, s_tidalflat, false), - new Tag(s_waterway, s_waterfall, false), new Tag(s_man_made, s_dolphin, false), - new Tag(s_service, s_drive_through, false), - new Tag(s_amenity, s_nightclub, false), new Tag(s_building, s_shed, false), - new Tag(s_shop, s_greengrocer, false), new Tag(s_natural, s_fell, false), - new Tag(s_wetland, s_wet_meadow, false), new Tag(s_aeroway, s_gate, false), - new Tag(s_shop, s_computer, false), new Tag(s_man_made, s_lighthouse, false), - new Tag(s_wetland, s_reedbed, false), new Tag(s_man_made, s_breakwater, false), - new Tag(s_surface, s_Dirt_Sand, false), new Tag(s_barrier, s_ditch, false), - new Tag(s_barrier, s_yes, false), new Tag(s_amenity, s_biergarten, false), - new Tag(s_shop, s_mobile_phone, false), new Tag(s_route, s_mtb, false), - new Tag(s_amenity, s_grit_bin, false), new Tag(s_amenity, s_bbq, false), - new Tag(s_shop, s_sports, false), new Tag(s_barrier, s_wood_fence, false), - new Tag(s_entrance, s_home, false), new Tag(s_shop, s_laundry, false), - new Tag(s_man_made, s_gasometer, false), - new Tag(s_barrier, s_embankment, false), new Tag(s_shop, s_toys, false), - new Tag(s_wetland, s_saltmarsh, false), new Tag(s_waterway, s_soakhole, false), - new Tag(s_shop, s_travel_agency, false), - new Tag(s_man_made, s_water_works, false), new Tag(s_route, s_railway, false), - new Tag(s_amenity, s_prison, false), new Tag(s_highway, s_rest_area, false), - new Tag(s_shop, s_stationery, false), new Tag(s_admin_level, s_11, false), - new Tag(s_building, s_train_station, false), - new Tag(s_building, s_storage_tank, false), - new Tag(s_man_made, s_windmill, false), new Tag(s_shop, s_beauty, false), - new Tag(s_building, s_semi, false), new Tag(s_highway, s_services, false), - new Tag(s_bicycle, s_private, false), new Tag(s_route, s_ski, false), - new Tag(s_service, s_emergency_access, false), - new Tag(s_building, s_factory, false), - new Tag(s_man_made, s_reinforced_slope, false), - new Tag(s_amenity, s_car_sharing, false), new Tag(s_surface, s_earth, false), - new Tag(s_shop, s_hifi, false), new Tag(s_amenity, s_car_rental, false), - new Tag(s_barrier, s_hedge_bank, false), - new Tag(s_shop, s_confectionery, false), new Tag(s_aeroway, s_terminal, false), - new Tag(s_highway, s_passing_place, false), - new Tag(s_building, s_building, false), new Tag(s_man_made, s_dyke, false), - new Tag(s_building, s_construction, false), new Tag(s_building, s_shop, false), - new Tag(s_natural, s_reef, false), new Tag(s_landuse, s_aquaculture, false), - new Tag(s_shop, s_dry_cleaning, false), new Tag(s_amenity, s_embassy, false), - new Tag(s_shop, s_newsagent, false), new Tag(s_landuse, s_salt_pond, false), - new Tag(s_railway, s_spur, false), new Tag(s_wheelchair, s_unknown, false), - new Tag(s_tourism, s_zoo, false), new Tag(s_man_made, s_waterway, false), - new Tag(s_surface, s_fine_gravel, false), new Tag(s_shop, s_motorcycle, false), - new Tag(s_building, s_Building, false), - new Tag(s_railway, s_construction, false), - new Tag(s_place, s_neighbourhood, false), new Tag(s_route, s_train, false), - new Tag(s_building, s_no, false), new Tag(s_natural, s_mud, false), - new Tag(s_place, s_region, false), - new Tag(s_landuse, s_reservoir_watershed, false), - new Tag(s_boundary, s_marker, false), new Tag(s_man_made, s_beacon, false), - new Tag(s_shop, s_outdoor, false), new Tag(s_access, s_public, false), - new Tag(s_abutters, s_industrial, false), new Tag(s_building, s_barn, false), - new Tag(s_leisure, s_picnic_table, false), - new Tag(s_building, s_hospital, false), new Tag(s_access, s_official, false), - new Tag(s_shop, s_variety_store, false), new Tag(s_man_made, s_crane, false), - new Tag(s_amenity, s_parking_fuel, false), new Tag(s_route, s_tram, false), - new Tag(s_tourism, s_theme_park, false), new Tag(s_shop, s_pet, false), - new Tag(s_building, s_kindergarten, false), - new Tag(s_man_made, s_storage, false), new Tag(s_man_made, s_mast, false), - new Tag(s_amenity, s_parking_entrance, false), - new Tag(s_amenity, s_clock, false), - new Tag(s_landuse, s_industrial_retail, false), - new Tag(s_shop, s_video, false), new Tag(s_access, s_delivery, false), - new Tag(s_amenity, s_driving_school, false), new Tag(s_service, s_yes, false), - new Tag(s_natural, s_bare_rock, false), new Tag(s_building, s_chapel, false), - new Tag(s_natural, s_volcano, false), new Tag(s_waterway, s_dock, false), - new Tag(s_building, s_dormitory, false), - new Tag(s_amenity, s_boat_storage, false), new Tag(s_man_made, s_tank, false), - new Tag(s_man_made, s_flagpole, false), - new Tag(s_surface, s_grass_paver, false), new Tag(s_shop, s_organic, false), - new Tag(s_natural, s_landform, false), new Tag(s_highway, s_unsurfaced, false), - new Tag(s_route, s_power, false), new Tag(s_surface, s_mud, false), - new Tag(s_building, s_building_concrete, false), - new Tag(s_abutters, s_retail, false), new Tag(s_building, s_store, false), - new Tag(s_shop, s_vacant, false), new Tag(s_leisure, s_miniature_golf, false), - new Tag(s_man_made, s_monitoring_station, false), - new Tag(s_natural, s_waterfall, false), new Tag(s_aeroway, s_hangar, false), - new Tag(s_shop, s_boutique, false), new Tag(s_route, s_detour, false), - new Tag(s_building, s_way, false), new Tag(s_railway, s_stop, false), - new Tag(s_amenity, s_ice_cream, false), new Tag(s_building, s_storage, false), - new Tag(s_shop, s_car_parts, false), new Tag(s_natural, s_ridge, false), - new Tag(s_shop, s_tyres, false), new Tag(s_railway, s_dismantled, false), - new Tag(s_amenity, s_shop, false), new Tag(s_landuse, s_plant_nursery, false), - new Tag(s_building, s_residentiel1, false), - new Tag(s_barrier, s_field_boundary, false), - new Tag(s_barrier, s_border_control, false), - new Tag(s_surface, s_Paved, false), new Tag(s_barrier, s_sally_port, false), - new Tag(s_amenity, s_bureau_de_change, false), - new Tag(s_leisure, s_fishing, false), - new Tag(s_amenity, s_charging_station, false), - new Tag(s_building, s_supermarket, false), new Tag(s_highway, s_stile, false), - new Tag(s_amenity, s_sauna, false), new Tag(s_place, s_municipality, false), - new Tag(s_building, s_hotel, false), new Tag(s_surface, s_metal, false), - new Tag(s_highway, s_incline_steep, false), - new Tag(s_shop, s_estate_agent, false), new Tag(s_natural, s_grass, false), - new Tag(s_shop, s_pharmacy, false), - new Tag(s_surface, s_concrete_plates, false), - new Tag(s_shop, s_copyshop, false), - new Tag(s_surface, s_paving_stones_30, false), - new Tag(s_surface, s_interlock, false), new Tag(s_access, s_hov, false), - new Tag(s_highway, s_elevator, false), - new Tag(s_boundary, s_local_authority, false), - new Tag(s_man_made, s_communications_tower, false), - new Tag(s_shop, s_deli, false), new Tag(s_barrier, s_turnstile, false), - new Tag(s_building, s_offices, false), new Tag(s_building, s_bunker, false), - new Tag(s_natural, s_stone, false), - new Tag(s_railway, s_railway_crossing, false), - new Tag(s_leisure, s_dog_park, false), - new Tag(s_building, s_semi_detached, false), - new Tag(s_man_made, s_watermill, false), new Tag(s_route, s_trolleybus, false), - new Tag(s_admin_level, s_3, false), new Tag(s_building, s_block, false), - new Tag(s_barrier, s_guard_rail, false), new Tag(s_bicycle, s_unknown, false), - new Tag(s_highway, s_abandoned, false), new Tag(s_surface, s_dirt_sand, false), - new Tag(s_barrier, s_chain, false), new Tag(s_barrier, s_bump_gate, false), - new Tag(s_building, s_residental, false), new Tag(s_surface, s_cement, false), - new Tag(s_man_made, s_embankment, false), new Tag(s_building, s_ruins, false), - new Tag(s_highway, s_incline, false), new Tag(s_abutters, s_commercial, false), - new Tag(s_barrier, s_hampshire_gate, false), new Tag(s_shop, s_music, false), - new Tag(s_shop, s_funeral_directors, false), - new Tag(s_wetland, s_mangrove, false), new Tag(s_place, s_borough, false), - new Tag(s_building, s_apartment, false), new Tag(s_boundary, s_census, false), - new Tag(s_barrier, s_kerb, false), new Tag(s_building, s_glasshouse, false), - new Tag(s_aeroway, s_holding_position, false), - new Tag(s_shop, s_general, false), new Tag(s_building, s_tank, false), - new Tag(s_railway, s_monorail, false), new Tag(s_service, s_parking, false), - new Tag(s_place, s_state, false), new Tag(s_railway, s_proposed, false), - new Tag(s_shop, s_art, false), new Tag(s_natural, s_hill, false), - new Tag(s_railway, s_turntable, false), new Tag(s_tourism, s_cabin, false), - new Tag(s_shop, s_photo, false), new Tag(s_boundary, s_lot, false), - new Tag(s_shop, s_fishmonger, false), new Tag(s_amenity, s_clinic, false), - new Tag(s_boundary, s_political, false), new Tag(s_man_made, s_well, false), - new Tag(s_highway, s_byway, false), new Tag(s_leisure, s_horse_riding, false), - new Tag(s_service, s_bus, false), new Tag(s_building, s_tower, false), - new Tag(s_entrance, s_service, false), new Tag(s_shop, s_fabric, false), - new Tag(s_railway, s_miniature, false), new Tag(s_abutters, s_mixed, false), - new Tag(s_surface, s_stone, false), new Tag(s_access, s_emergency, false), - new Tag(s_landuse, s_mine, false), new Tag(s_amenity, s_shower, false), - new Tag(s_waterway, s_lock, false) + new Tag(s_building, s_yes, false), new Tag(s_highway, s_residential, false), + new Tag(s_highway, s_service, false), new Tag(s_waterway, s_stream, false), + new Tag(s_highway, s_unclassified, false), new Tag(s_highway, s_track, false), + new Tag(s_oneway, s_yes, false), new Tag(s_natural, s_water, false), + new Tag(s_highway, s_footway, false), new Tag(s_access, s_private, false), + new Tag(s_highway, s_tertiary, false), new Tag(s_highway, s_path, false), + new Tag(s_highway, s_secondary, false), new Tag(s_landuse, s_forest, false), + new Tag(s_bridge, s_yes, false), new Tag(s_natural, s_tree, false), + new Tag(s_surface, s_paved, false), new Tag(s_natural, s_wood, false), + new Tag(s_highway, s_primary, false), new Tag(s_landuse, s_grass, false), + new Tag(s_landuse, s_residential, false), new Tag(s_surface, s_unpaved, false), + new Tag(s_highway, s_bus_stop, false), new Tag(s_surface, s_asphalt, false), + new Tag(s_bicycle, s_yes, false), new Tag(s_amenity, s_parking, false), + new Tag(s_place, s_locality, false), new Tag(s_railway, s_rail, false), + new Tag(s_service, s_parking_aisle, false), + new Tag(s_boundary, s_administrative, false), + new Tag(s_building, s_house, false), new Tag(s_place, s_village, false), + new Tag(s_natural, s_coastline, false), new Tag(s_tracktype, s_grade2, false), + new Tag(s_oneway, s_no, false), new Tag(s_service, s_driveway, false), + new Tag(s_highway, s_turning_circle, false), new Tag(s_place, s_hamlet, false), + new Tag(s_natural, s_wetland, false), new Tag(s_tracktype, s_grade3, false), + new Tag(s_waterway, s_river, false), new Tag(s_highway, s_cycleway, false), + new Tag(s_barrier, s_fence, false), new Tag(s_building, s_residential, false), + new Tag(s_amenity, s_school, false), new Tag(s_highway, s_crossing, false), + new Tag(s_admin_level, s_8, false), new Tag(s_highway, s_trunk, false), + new Tag(s_amenity, s_place_of_worship, false), + new Tag(s_landuse, s_farmland, false), new Tag(s_tracktype, s_grade1, false), + new Tag(s_highway, s_road, false), new Tag(s_landuse, s_farm, false), + new Tag(s_surface, s_gravel, false), new Tag(s_landuse, s_meadow, false), + new Tag(s_highway, s_motorway, false), + new Tag(s_highway, s_traffic_signals, false), + new Tag(s_building, s_hut, false), new Tag(s_highway, s_motorway_link, false), + new Tag(s_tracktype, s_grade4, false), new Tag(s_barrier, s_gate, false), + new Tag(s_highway, s_living_street, false), new Tag(s_bicycle, s_no, false), + new Tag(s_leisure, s_pitch, false), new Tag(s_tunnel, s_yes, false), + new Tag(s_surface, s_ground, false), new Tag(s_highway, s_steps, false), + new Tag(s_natural, s_land, false), new Tag(s_man_made, s_survey_point, false), + new Tag(s_tracktype, s_grade5, false), new Tag(s_waterway, s_ditch, false), + new Tag(s_leisure, s_park, false), new Tag(s_amenity, s_restaurant, false), + new Tag(s_barrier, s_wall, false), new Tag(s_waterway, s_riverbank, false), + new Tag(s_amenity, s_bench, false), new Tag(s_building, s_garage, false), + new Tag(s_natural, s_scrub, false), new Tag(s_highway, s_pedestrian, false), + new Tag(s_natural, s_peak, false), new Tag(s_building, s_entrance, false), + new Tag(s_landuse, s_reservoir, false), new Tag(s_access, s_yes, false), + new Tag(s_bicycle, s_designated, false), + new Tag(s_leisure, s_swimming_pool, false), + new Tag(s_landuse, s_farmyard, false), + new Tag(s_railway, s_level_crossing, false), + new Tag(s_building, s_apartments, false), new Tag(s_surface, s_grass, false), + new Tag(s_wheelchair, s_yes, false), new Tag(s_service, s_alley, false), + new Tag(s_landuse, s_industrial, false), new Tag(s_amenity, s_fuel, false), + new Tag(s_surface, s_dirt, false), new Tag(s_highway, s_trunk_link, false), + new Tag(s_waterway, s_drain, false), new Tag(s_barrier, s_hedge, false), + new Tag(s_amenity, s_grave_yard, false), + new Tag(s_tourism, s_information, false), + new Tag(s_shop, s_supermarket, false), + new Tag(s_highway, s_primary_link, false), new Tag(s_wood, s_deciduous, false), + new Tag(s_leisure, s_playground, false), new Tag(s_building, s_roof, false), + new Tag(s_building, s_industrial, false), + new Tag(s_amenity, s_post_box, false), new Tag(s_waterway, s_canal, false), + new Tag(s_barrier, s_bollard, false), new Tag(s_leisure, s_garden, false), + new Tag(s_wood, s_mixed, false), new Tag(s_landuse, s_cemetery, false), + new Tag(s_landuse, s_orchard, false), new Tag(s_shop, s_convenience, false), + new Tag(s_access, s_permissive, false), new Tag(s_surface, s_concrete, false), + new Tag(s_surface, s_paving_stones, false), new Tag(s_service, s_spur, false), + new Tag(s_building, s_garages, false), new Tag(s_amenity, s_bank, false), + new Tag(s_tourism, s_hotel, false), new Tag(s_access, s_no, false), + new Tag(s_amenity, s_fast_food, false), new Tag(s_man_made, s_pier, false), + new Tag(s_amenity, s_kindergarten, false), + new Tag(s_access, s_agricultural, false), + new Tag(s_surface, s_cobblestone, false), new Tag(s_wheelchair, s_no, false), + new Tag(s_amenity, s_cafe, false), new Tag(s_amenity, s_hospital, false), + new Tag(s_amenity, s_post_office, false), + new Tag(s_amenity, s_public_building, false), + new Tag(s_amenity, s_recycling, false), + new Tag(s_highway, s_street_lamp, false), new Tag(s_man_made, s_tower, false), + new Tag(s_waterway, s_dam, false), new Tag(s_amenity, s_pub, false), + new Tag(s_wood, s_coniferous, false), new Tag(s_access, s_destination, false), + new Tag(s_admin_level, s_6, false), new Tag(s_landuse, s_commercial, false), + new Tag(s_amenity, s_pharmacy, false), new Tag(s_railway, s_abandoned, false), + new Tag(s_service, s_yard, false), new Tag(s_place, s_island, false), + new Tag(s_oneway, s__1, false), new Tag(s_landuse, s_quarry, false), + new Tag(s_landuse, s_vineyard, false), + new Tag(s_highway, s_motorway_junction, false), + new Tag(s_railway, s_station, false), new Tag(s_landuse, s_allotments, false), + new Tag(s_barrier, s_lift_gate, false), new Tag(s_admin_level, s_10, false), + new Tag(s_amenity, s_telephone, false), new Tag(s_place, s_town, false), + new Tag(s_man_made, s_cutline, false), new Tag(s_place, s_suburb, false), + new Tag(s_aeroway, s_taxiway, false), new Tag(s_wheelchair, s_limited, false), + new Tag(s_highway, s_secondary_link, false), + new Tag(s_leisure, s_sports_centre, false), + new Tag(s_amenity, s_bicycle_parking, false), + new Tag(s_surface, s_sand, false), new Tag(s_highway, s_stop, false), + new Tag(s_man_made, s_works, false), new Tag(s_landuse, s_retail, false), + new Tag(s_amenity, s_fire_station, false), new Tag(s_service, s_siding, false), + new Tag(s_amenity, s_toilets, false), new Tag(s_bench, s_yes, false), + new Tag(s_oneway, s_1, false), new Tag(s_surface, s_compacted, false), + new Tag(s_landuse, s_basin, false), new Tag(s_amenity, s_police, false), + new Tag(s_railway, s_tram, false), new Tag(s_route, s_road, false), + new Tag(s_natural, s_cliff, false), new Tag(s_highway, s_construction, false), + new Tag(s_aeroway, s_aerodrome, false), new Tag(s_entrance, s_yes, false), + new Tag(s_man_made, s_storage_tank, false), new Tag(s_amenity, s_atm, false), + new Tag(s_tourism, s_attraction, false), new Tag(s_route, s_bus, false), + new Tag(s_shop, s_bakery, false), new Tag(s_tourism, s_viewpoint, false), + new Tag(s_amenity, s_swimming_pool, false), new Tag(s_natural, s_beach, false), + new Tag(s_tourism, s_picnic_site, false), new Tag(s_oneway, s_true, false), + new Tag(s_highway, s_bridleway, false), new Tag(s_tourism, s_camp_site, false), + new Tag(s_abutters, s_residential, false), + new Tag(s_leisure, s_nature_reserve, false), + new Tag(s_amenity, s_drinking_water, false), new Tag(s_shop, s_clothes, false), + new Tag(s_natural, s_heath, false), + new Tag(s_highway, s_mini_roundabout, false), + new Tag(s_landuse, s_construction, false), + new Tag(s_amenity, s_waste_basket, false), + new Tag(s_railway, s_platform, false), new Tag(s_amenity, s_townhall, false), + new Tag(s_shop, s_hairdresser, false), new Tag(s_amenity, s_shelter, false), + new Tag(s_admin_level, s_9, false), + new Tag(s_building, s_farm_auxiliary, false), + new Tag(s_amenity, s_library, false), new Tag(s_building, s_detached, false), + new Tag(s_admin_level, s_4, false), new Tag(s_landuse, s_village_green, false), + new Tag(s_barrier, s_stile, false), new Tag(s_landuse, s_garages, false), + new Tag(s_amenity, s_bar, false), new Tag(s_railway, s_buffer_stop, false), + new Tag(s_wetland, s_marsh, false), new Tag(s_tourism, s_museum, false), + new Tag(s_barrier, s_cycle_barrier, false), new Tag(s_route, s_bicycle, false), + new Tag(s_railway, s_tram_stop, false), + new Tag(s_amenity, s_parking_space, false), + new Tag(s_barrier, s_retaining_wall, false), + new Tag(s_landuse, s_recreation_ground, false), + new Tag(s_amenity, s_university, false), + new Tag(s_highway, s_tertiary_link, false), + new Tag(s_building, s_terrace, false), new Tag(s_shop, s_car_repair, false), + new Tag(s_amenity, s_hunting_stand, false), + new Tag(s_amenity, s_fountain, false), new Tag(s_man_made, s_pipeline, false), + new Tag(s_wetland, s_swamp, false), new Tag(s_shop, s_car, false), + new Tag(s_bench, s_no, false), new Tag(s_tunnel, s_culvert, false), + new Tag(s_building, s_school, false), new Tag(s_barrier, s_entrance, false), + new Tag(s_railway, s_disused, false), new Tag(s_railway, s_crossing, false), + new Tag(s_building, s_church, false), + new Tag(s_amenity, s_social_facility, false), new Tag(s_natural, s_bay, false), + new Tag(s_shop, s_kiosk, false), new Tag(s_amenity, s_vending_machine, false), + new Tag(s_route, s_hiking, false), new Tag(s_natural, s_spring, false), + new Tag(s_leisure, s_common, false), new Tag(s_railway, s_switch, false), + new Tag(s_waterway, s_rapids, false), new Tag(s_admin_level, s_7, false), + new Tag(s_leisure, s_stadium, false), new Tag(s_leisure, s_track, false), + new Tag(s_place, s_isolated_dwelling, false), new Tag(s_place, s_islet, false), + new Tag(s_waterway, s_weir, false), new Tag(s_amenity, s_doctors, false), + new Tag(s_access, s_designated, false), + new Tag(s_landuse, s_conservation, false), + new Tag(s_waterway, s_artificial, false), + new Tag(s_amenity, s_bus_station, false), + new Tag(s_leisure, s_golf_course, false), + new Tag(s_shop, s_doityourself, false), new Tag(s_building, s_service, false), + new Tag(s_tourism, s_guest_house, false), new Tag(s_aeroway, s_runway, false), + new Tag(s_place, s_city, false), new Tag(s_railway, s_subway, false), + new Tag(s_man_made, s_wastewater_plant, false), + new Tag(s_building, s_commercial, false), new Tag(s_railway, s_halt, false), + new Tag(s_amenity, s_emergency_phone, false), + new Tag(s_building, s_retail, false), new Tag(s_barrier, s_block, false), + new Tag(s_leisure, s_recreation_ground, false), + new Tag(s_access, s_forestry, false), new Tag(s_amenity, s_college, false), + new Tag(s_highway, s_platform, false), new Tag(s_access, s_unknown, false), + new Tag(s_man_made, s_water_tower, false), + new Tag(s_surface, s_pebblestone, false), new Tag(s_bridge, s_viaduct, false), + new Tag(s_shop, s_butcher, false), new Tag(s_shop, s_florist, false), + new Tag(s_boundary, s_landuse, false), new Tag(s_aeroway, s_helipad, false), + new Tag(s_building, s_hangar, false), new Tag(s_natural, s_glacier, false), + new Tag(s_highway, s_proposed, false), new Tag(s_shop, s_mall, false), + new Tag(s_barrier, s_toll_booth, false), + new Tag(s_amenity, s_fire_hydrant, false), + new Tag(s_building, s_manufacture, false), new Tag(s_building, s_farm, false), + new Tag(s_surface, s_wood, false), new Tag(s_amenity, s_car_wash, false), + new Tag(s_amenity, s_dentist, false), new Tag(s_natural, s_marsh, false), + new Tag(s_man_made, s_surveillance, false), new Tag(s_shop, s_bicycle, false), + new Tag(s_route, s_foot, false), new Tag(s_amenity, s_theatre, false), + new Tag(s_building, s_office, false), new Tag(s_railway, s_light_rail, false), + new Tag(s_man_made, s_petroleum_well, false), + new Tag(s_amenity, s_taxi, false), new Tag(s_building, s_greenhouse, false), + new Tag(s_landuse, s_brownfield, false), + new Tag(s_bicycle, s_permissive, false), new Tag(s_admin_level, s_2, false), + new Tag(s_aeroway, s_apron, false), new Tag(s_building, s_cabin, false), + new Tag(s_amenity, s_cinema, false), new Tag(s_access, s_customers, false), + new Tag(s_tourism, s_motel, false), new Tag(s_railway, s_narrow_gauge, false), + new Tag(s_amenity, s_marketplace, false), new Tag(s_shop, s_furniture, false), + new Tag(s_entrance, s_staircase, false), new Tag(s_tourism, s_artwork, false), + new Tag(s_natural, s_grassland, false), new Tag(s_shop, s_books, false), + new Tag(s_admin_level, s_5, false), new Tag(s_man_made, s_groyne, false), + new Tag(s_waterway, s_lock_gate, false), + new Tag(s_highway, s_emergency_access_point, false), + new Tag(s_natural, s_sand, false), new Tag(s_landuse, s_military, false), + new Tag(s_boundary, s_protected_area, false), + new Tag(s_amenity, s_community_centre, false), + new Tag(s_barrier, s_kissing_gate, false), + new Tag(s_highway, s_speed_camera, false), + new Tag(s_boundary, s_national_park, false), + new Tag(s_railway, s_subway_entrance, false), + new Tag(s_man_made, s_silo, false), new Tag(s_shop, s_alcohol, false), + new Tag(s_highway, s_give_way, false), new Tag(s_leisure, s_slipway, false), + new Tag(s_shop, s_electronics, false), new Tag(s_bicycle, s_dismount, false), + new Tag(s_leisure, s_marina, false), new Tag(s_entrance, s_main, false), + new Tag(s_boundary, s_postal_code, false), + new Tag(s_landuse, s_greenhouse_horticulture, false), + new Tag(s_highway, s_milestone, false), + new Tag(s_natural, s_cave_entrance, false), + new Tag(s_landuse, s_landfill, false), new Tag(s_shop, s_chemist, false), + new Tag(s_shop, s_shoes, false), new Tag(s_barrier, s_cattle_grid, false), + new Tag(s_landuse, s_railway, false), new Tag(s_tourism, s_hostel, false), + new Tag(s_tourism, s_chalet, false), new Tag(s_place, s_county, false), + new Tag(s_shop, s_department_store, false), new Tag(s_highway, s_ford, false), + new Tag(s_natural, s_scree, false), new Tag(s_landuse, s_greenfield, false), + new Tag(s_amenity, s_nursing_home, false), + new Tag(s_barrier, s_wire_fence, false), + new Tag(s_access, s_restricted, false), + new Tag(s_man_made, s_reservoir_covered, false), + new Tag(s_amenity, s_bicycle_rental, false), new Tag(s_man_made, s_MDF, false), + new Tag(s_man_made, s_water_well, false), new Tag(s_landuse, s_field, false), + new Tag(s_landuse, s_wood, false), new Tag(s_shop, s_hardware, false), + new Tag(s_tourism, s_alpine_hut, false), new Tag(s_natural, s_tree_row, false), + new Tag(s_tourism, s_caravan_site, false), new Tag(s_bridge, s_no, false), + new Tag(s_wetland, s_bog, false), new Tag(s_amenity, s_courthouse, false), + new Tag(s_route, s_ferry, false), new Tag(s_barrier, s_city_wall, false), + new Tag(s_amenity, s_veterinary, false), new Tag(s_shop, s_jewelry, false), + new Tag(s_building, s_transportation, false), + new Tag(s_amenity, s_arts_centre, false), + new Tag(s_bicycle, s_official, false), new Tag(s_shop, s_optician, false), + new Tag(s_shop, s_yes, false), new Tag(s_building, s_collapsed, false), + new Tag(s_shop, s_garden_centre, false), new Tag(s_man_made, s_chimney, false), + new Tag(s_man_made, s_mine, false), new Tag(s_bench, s_unknown, false), + new Tag(s_railway, s_preserved, false), new Tag(s_building, s_public, false), + new Tag(s_amenity, s_ferry_terminal, false), + new Tag(s_highway, s_raceway, false), new Tag(s_natural, s_rock, false), + new Tag(s_tunnel, s_no, false), new Tag(s_building, s_university, false), + new Tag(s_shop, s_beverages, false), + new Tag(s_amenity, s_waste_disposal, false), + new Tag(s_building, s_warehouse, false), + new Tag(s_leisure, s_water_park, false), new Tag(s_shop, s_gift, false), + new Tag(s_place, s_farm, false), new Tag(s_wetland, s_tidalflat, false), + new Tag(s_waterway, s_waterfall, false), new Tag(s_man_made, s_dolphin, false), + new Tag(s_service, s_drive_through, false), + new Tag(s_amenity, s_nightclub, false), new Tag(s_building, s_shed, false), + new Tag(s_shop, s_greengrocer, false), new Tag(s_natural, s_fell, false), + new Tag(s_wetland, s_wet_meadow, false), new Tag(s_aeroway, s_gate, false), + new Tag(s_shop, s_computer, false), new Tag(s_man_made, s_lighthouse, false), + new Tag(s_wetland, s_reedbed, false), new Tag(s_man_made, s_breakwater, false), + new Tag(s_surface, s_Dirt_Sand, false), new Tag(s_barrier, s_ditch, false), + new Tag(s_barrier, s_yes, false), new Tag(s_amenity, s_biergarten, false), + new Tag(s_shop, s_mobile_phone, false), new Tag(s_route, s_mtb, false), + new Tag(s_amenity, s_grit_bin, false), new Tag(s_amenity, s_bbq, false), + new Tag(s_shop, s_sports, false), new Tag(s_barrier, s_wood_fence, false), + new Tag(s_entrance, s_home, false), new Tag(s_shop, s_laundry, false), + new Tag(s_man_made, s_gasometer, false), + new Tag(s_barrier, s_embankment, false), new Tag(s_shop, s_toys, false), + new Tag(s_wetland, s_saltmarsh, false), new Tag(s_waterway, s_soakhole, false), + new Tag(s_shop, s_travel_agency, false), + new Tag(s_man_made, s_water_works, false), new Tag(s_route, s_railway, false), + new Tag(s_amenity, s_prison, false), new Tag(s_highway, s_rest_area, false), + new Tag(s_shop, s_stationery, false), new Tag(s_admin_level, s_11, false), + new Tag(s_building, s_train_station, false), + new Tag(s_building, s_storage_tank, false), + new Tag(s_man_made, s_windmill, false), new Tag(s_shop, s_beauty, false), + new Tag(s_building, s_semi, false), new Tag(s_highway, s_services, false), + new Tag(s_bicycle, s_private, false), new Tag(s_route, s_ski, false), + new Tag(s_service, s_emergency_access, false), + new Tag(s_building, s_factory, false), + new Tag(s_man_made, s_reinforced_slope, false), + new Tag(s_amenity, s_car_sharing, false), new Tag(s_surface, s_earth, false), + new Tag(s_shop, s_hifi, false), new Tag(s_amenity, s_car_rental, false), + new Tag(s_barrier, s_hedge_bank, false), + new Tag(s_shop, s_confectionery, false), new Tag(s_aeroway, s_terminal, false), + new Tag(s_highway, s_passing_place, false), + new Tag(s_building, s_building, false), new Tag(s_man_made, s_dyke, false), + new Tag(s_building, s_construction, false), new Tag(s_building, s_shop, false), + new Tag(s_natural, s_reef, false), new Tag(s_landuse, s_aquaculture, false), + new Tag(s_shop, s_dry_cleaning, false), new Tag(s_amenity, s_embassy, false), + new Tag(s_shop, s_newsagent, false), new Tag(s_landuse, s_salt_pond, false), + new Tag(s_railway, s_spur, false), new Tag(s_wheelchair, s_unknown, false), + new Tag(s_tourism, s_zoo, false), new Tag(s_man_made, s_waterway, false), + new Tag(s_surface, s_fine_gravel, false), new Tag(s_shop, s_motorcycle, false), + new Tag(s_building, s_Building, false), + new Tag(s_railway, s_construction, false), + new Tag(s_place, s_neighbourhood, false), new Tag(s_route, s_train, false), + new Tag(s_building, s_no, false), new Tag(s_natural, s_mud, false), + new Tag(s_place, s_region, false), + new Tag(s_landuse, s_reservoir_watershed, false), + new Tag(s_boundary, s_marker, false), new Tag(s_man_made, s_beacon, false), + new Tag(s_shop, s_outdoor, false), new Tag(s_access, s_public, false), + new Tag(s_abutters, s_industrial, false), new Tag(s_building, s_barn, false), + new Tag(s_leisure, s_picnic_table, false), + new Tag(s_building, s_hospital, false), new Tag(s_access, s_official, false), + new Tag(s_shop, s_variety_store, false), new Tag(s_man_made, s_crane, false), + new Tag(s_amenity, s_parking_fuel, false), new Tag(s_route, s_tram, false), + new Tag(s_tourism, s_theme_park, false), new Tag(s_shop, s_pet, false), + new Tag(s_building, s_kindergarten, false), + new Tag(s_man_made, s_storage, false), new Tag(s_man_made, s_mast, false), + new Tag(s_amenity, s_parking_entrance, false), + new Tag(s_amenity, s_clock, false), + new Tag(s_landuse, s_industrial_retail, false), + new Tag(s_shop, s_video, false), new Tag(s_access, s_delivery, false), + new Tag(s_amenity, s_driving_school, false), new Tag(s_service, s_yes, false), + new Tag(s_natural, s_bare_rock, false), new Tag(s_building, s_chapel, false), + new Tag(s_natural, s_volcano, false), new Tag(s_waterway, s_dock, false), + new Tag(s_building, s_dormitory, false), + new Tag(s_amenity, s_boat_storage, false), new Tag(s_man_made, s_tank, false), + new Tag(s_man_made, s_flagpole, false), + new Tag(s_surface, s_grass_paver, false), new Tag(s_shop, s_organic, false), + new Tag(s_natural, s_landform, false), new Tag(s_highway, s_unsurfaced, false), + new Tag(s_route, s_power, false), new Tag(s_surface, s_mud, false), + new Tag(s_building, s_building_concrete, false), + new Tag(s_abutters, s_retail, false), new Tag(s_building, s_store, false), + new Tag(s_shop, s_vacant, false), new Tag(s_leisure, s_miniature_golf, false), + new Tag(s_man_made, s_monitoring_station, false), + new Tag(s_natural, s_waterfall, false), new Tag(s_aeroway, s_hangar, false), + new Tag(s_shop, s_boutique, false), new Tag(s_route, s_detour, false), + new Tag(s_building, s_way, false), new Tag(s_railway, s_stop, false), + new Tag(s_amenity, s_ice_cream, false), new Tag(s_building, s_storage, false), + new Tag(s_shop, s_car_parts, false), new Tag(s_natural, s_ridge, false), + new Tag(s_shop, s_tyres, false), new Tag(s_railway, s_dismantled, false), + new Tag(s_amenity, s_shop, false), new Tag(s_landuse, s_plant_nursery, false), + new Tag(s_building, s_residentiel1, false), + new Tag(s_barrier, s_field_boundary, false), + new Tag(s_barrier, s_border_control, false), + new Tag(s_surface, s_Paved, false), new Tag(s_barrier, s_sally_port, false), + new Tag(s_amenity, s_bureau_de_change, false), + new Tag(s_leisure, s_fishing, false), + new Tag(s_amenity, s_charging_station, false), + new Tag(s_building, s_supermarket, false), new Tag(s_highway, s_stile, false), + new Tag(s_amenity, s_sauna, false), new Tag(s_place, s_municipality, false), + new Tag(s_building, s_hotel, false), new Tag(s_surface, s_metal, false), + new Tag(s_highway, s_incline_steep, false), + new Tag(s_shop, s_estate_agent, false), new Tag(s_natural, s_grass, false), + new Tag(s_shop, s_pharmacy, false), + new Tag(s_surface, s_concrete_plates, false), + new Tag(s_shop, s_copyshop, false), + new Tag(s_surface, s_paving_stones_30, false), + new Tag(s_surface, s_interlock, false), new Tag(s_access, s_hov, false), + new Tag(s_highway, s_elevator, false), + new Tag(s_boundary, s_local_authority, false), + new Tag(s_man_made, s_communications_tower, false), + new Tag(s_shop, s_deli, false), new Tag(s_barrier, s_turnstile, false), + new Tag(s_building, s_offices, false), new Tag(s_building, s_bunker, false), + new Tag(s_natural, s_stone, false), + new Tag(s_railway, s_railway_crossing, false), + new Tag(s_leisure, s_dog_park, false), + new Tag(s_building, s_semi_detached, false), + new Tag(s_man_made, s_watermill, false), new Tag(s_route, s_trolleybus, false), + new Tag(s_admin_level, s_3, false), new Tag(s_building, s_block, false), + new Tag(s_barrier, s_guard_rail, false), new Tag(s_bicycle, s_unknown, false), + new Tag(s_highway, s_abandoned, false), new Tag(s_surface, s_dirt_sand, false), + new Tag(s_barrier, s_chain, false), new Tag(s_barrier, s_bump_gate, false), + new Tag(s_building, s_residental, false), new Tag(s_surface, s_cement, false), + new Tag(s_man_made, s_embankment, false), new Tag(s_building, s_ruins, false), + new Tag(s_highway, s_incline, false), new Tag(s_abutters, s_commercial, false), + new Tag(s_barrier, s_hampshire_gate, false), new Tag(s_shop, s_music, false), + new Tag(s_shop, s_funeral_directors, false), + new Tag(s_wetland, s_mangrove, false), new Tag(s_place, s_borough, false), + new Tag(s_building, s_apartment, false), new Tag(s_boundary, s_census, false), + new Tag(s_barrier, s_kerb, false), new Tag(s_building, s_glasshouse, false), + new Tag(s_aeroway, s_holding_position, false), + new Tag(s_shop, s_general, false), new Tag(s_building, s_tank, false), + new Tag(s_railway, s_monorail, false), new Tag(s_service, s_parking, false), + new Tag(s_place, s_state, false), new Tag(s_railway, s_proposed, false), + new Tag(s_shop, s_art, false), new Tag(s_natural, s_hill, false), + new Tag(s_railway, s_turntable, false), new Tag(s_tourism, s_cabin, false), + new Tag(s_shop, s_photo, false), new Tag(s_boundary, s_lot, false), + new Tag(s_shop, s_fishmonger, false), new Tag(s_amenity, s_clinic, false), + new Tag(s_boundary, s_political, false), new Tag(s_man_made, s_well, false), + new Tag(s_highway, s_byway, false), new Tag(s_leisure, s_horse_riding, false), + new Tag(s_service, s_bus, false), new Tag(s_building, s_tower, false), + new Tag(s_entrance, s_service, false), new Tag(s_shop, s_fabric, false), + new Tag(s_railway, s_miniature, false), new Tag(s_abutters, s_mixed, false), + new Tag(s_surface, s_stone, false), new Tag(s_access, s_emergency, false), + new Tag(s_landuse, s_mine, false), new Tag(s_amenity, s_shower, false), + new Tag(s_waterway, s_lock, false) }; } diff --git a/vtm/src/org/oscim/tiling/source/oscimap/TileDecoder.java b/vtm/src/org/oscim/tiling/source/oscimap/TileDecoder.java index 39597d3d..fea0c277 100644 --- a/vtm/src/org/oscim/tiling/source/oscimap/TileDecoder.java +++ b/vtm/src/org/oscim/tiling/source/oscimap/TileDecoder.java @@ -67,7 +67,7 @@ public class TileDecoder extends PbfDecoder { @Override public boolean decode(Tile tile, ITileDataSink sink, InputStream is, int contentLength) - throws IOException { + throws IOException { setInputStream(is, contentLength); @@ -78,19 +78,20 @@ public class TileDecoder extends PbfDecoder { } private static final int MAX_TAGS_CACHE = 100; - private static Map tagHash = Collections - .synchronizedMap(new LinkedHashMap( - MAX_TAGS_CACHE, 0.75f, true) { + private static Map tagHash = + Collections.synchronizedMap(new LinkedHashMap(MAX_TAGS_CACHE, + 0.75f, + true) { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; -// @Override -// protected boolean removeEldestEntry(Entry e) { -// if (size() < MAX_TAGS_CACHE) -// return false; -// return true; -// } - }); + //@Override + //protected boolean removeEldestEntry(Entry e) { + //if (size() < MAX_TAGS_CACHE) + //return false; + //return true; + //} + }); private boolean decode() throws IOException { int val; @@ -194,7 +195,7 @@ public class TileDecoder extends PbfDecoder { if (cnt != coordCnt) { Log.d(TAG, mTile + " wrong number of coordintes " - + coordCnt + "/" + cnt); + + coordCnt + "/" + cnt); fail = true; } @@ -223,8 +224,8 @@ public class TileDecoder extends PbfDecoder { if (fail || indexCnt == 0 || tagCnt == 0) { Log.d(TAG, "failed reading way: bytes:" + bytes + " index:" - //+ (tags != null ? tags.toString() : "...") + " " - + indexCnt + " " + coordCnt + " " + tagCnt); + //+ (tags != null ? tags.toString() : "...") + " " + + indexCnt + " " + coordCnt + " " + tagCnt); return false; } @@ -288,7 +289,7 @@ public class TileDecoder extends PbfDecoder { } private int decodeNodeCoordinates(int numNodes, byte layer) - throws IOException { + throws IOException { int bytes = decodeVarint32(); fillBuffer(bytes); @@ -330,8 +331,8 @@ public class TileDecoder extends PbfDecoder { if (tagNum < 0 || cnt == tagCnt) { Log.d(TAG, "NULL TAG: " + mTile - + " invalid tag:" + tagNum - + " " + tagCnt + "/" + cnt); + + " invalid tag:" + tagNum + + " " + tagCnt + "/" + cnt); continue; } @@ -346,9 +347,9 @@ public class TileDecoder extends PbfDecoder { mElem.tags.add(curTags[tagNum]); } else { Log.d(TAG, "NULL TAG: " + mTile - + " could find tag:" - + tagNum + " " + tagCnt - + "/" + cnt); + + " could find tag:" + + tagNum + " " + tagCnt + + "/" + cnt); } } @@ -382,7 +383,7 @@ public class TileDecoder extends PbfDecoder { @Override protected int decodeInterleavedPoints(float[] coords, float scale) - throws IOException { + throws IOException { int bytes = decodeVarint32(); fillBuffer(bytes); @@ -403,25 +404,25 @@ public class TileDecoder extends PbfDecoder { } else if (buf[pos + 1] >= 0) { val = (buf[pos++] & 0x7f) - | buf[pos++] << 7; + | buf[pos++] << 7; } else if (buf[pos + 2] >= 0) { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++]) << 14; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++]) << 14; } else if (buf[pos + 3] >= 0) { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++] & 0x7f) << 14 - | (buf[pos++]) << 21; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++] & 0x7f) << 14 + | (buf[pos++]) << 21; } else { val = (buf[pos++] & 0x7f) - | (buf[pos++] & 0x7f) << 7 - | (buf[pos++] & 0x7f) << 14 - | (buf[pos++] & 0x7f) << 21 - | (buf[pos]) << 28; + | (buf[pos++] & 0x7f) << 7 + | (buf[pos++] & 0x7f) << 14 + | (buf[pos++] & 0x7f) << 21 + | (buf[pos]) << 28; if (buf[pos++] < 0) throw INVALID_VARINT; diff --git a/vtm/src/org/oscim/tiling/source/oscimap2/OSciMap2TileSource.java b/vtm/src/org/oscim/tiling/source/oscimap2/OSciMap2TileSource.java index c4139e29..b7c36912 100644 --- a/vtm/src/org/oscim/tiling/source/oscimap2/OSciMap2TileSource.java +++ b/vtm/src/org/oscim/tiling/source/oscimap2/OSciMap2TileSource.java @@ -90,7 +90,7 @@ public class OSciMap2TileSource extends UrlTileSource { @Override public boolean decode(Tile tile, ITileDataSink sink, InputStream is, int contentLength) - throws IOException { + throws IOException { int byteCount = readUnsignedInt(is, buffer); //Log.d(TAG, tile + " contentLength:" + byteCount); @@ -265,9 +265,9 @@ public class OSciMap2TileSource extends UrlTileSource { if (fail || indexCnt == 0) { Log.d(TAG, mTile + " failed reading way: bytes:" + bytes + " index:" - + (Arrays.toString(index)) + " tag:" - + (mElem.tags.numTags > 0 ? Arrays.deepToString(mElem.tags.tags) : "null") - + " " + indexCnt + " " + coordCnt); + + (Arrays.toString(index)) + " tag:" + + (mElem.tags.numTags > 0 ? Arrays.deepToString(mElem.tags.tags) : "null") + + " " + indexCnt + " " + coordCnt); return false; } @@ -302,8 +302,8 @@ public class OSciMap2TileSource extends UrlTileSource { if (tagNum < 0) { Log.d(TAG, "NULL TAG: " + mTile - + " invalid tag:" - + tagNum + " " + cnt); + + " invalid tag:" + + tagNum + " " + cnt); return false; } @@ -315,8 +315,8 @@ public class OSciMap2TileSource extends UrlTileSource { if (tagNum < 0 || tagNum > max) { Log.d(TAG, "NULL TAG: " + mTile - + " could not find tag:" - + tagNum + " " + cnt); + + " could not find tag:" + + tagNum + " " + cnt); return false; } diff --git a/vtm/src/org/oscim/tiling/source/oscimap2/Tags.java b/vtm/src/org/oscim/tiling/source/oscimap2/Tags.java index d027503c..93f00051 100644 --- a/vtm/src/org/oscim/tiling/source/oscimap2/Tags.java +++ b/vtm/src/org/oscim/tiling/source/oscimap2/Tags.java @@ -583,700 +583,700 @@ public class Tags { // only the keys that were imported via osm2pgsql // FIXME add whats missing, e.g. wheelchair public final static String[] keys = { - "access", - "addr:housename", - "addr:housenumber", - "addr:interpolation", - "admin_level", - "aerialway", - "aeroway", - "amenity", - "area", - "barrier", - "bicycle", - "brand", - "bridge", - "boundary", - "building", - "construction", - "covered", - "culvert", - "cutting", - "denomination", - "disused", - "embankment", - "foot", - "generator:source", - "harbour", - "highway", - "historic", - "horse", - "intermittent", - "junction", - "landuse", - "layer", - "leisure", - "lock", - "man_made", - "military", - "motorcar", - "name", - "natural", - "oneway", - "operator", - "population", - "power", - "power_source", - "place", - "railway", - "ref", - "religion", - "route", - "service", - "shop", - "sport", - "surface", - "toll", - "tourism", - "tower:type", - "tracktype", - "tunnel", - "water", - "waterway", - "wetland", - "width", - "wood" + "access", + "addr:housename", + "addr:housenumber", + "addr:interpolation", + "admin_level", + "aerialway", + "aeroway", + "amenity", + "area", + "barrier", + "bicycle", + "brand", + "bridge", + "boundary", + "building", + "construction", + "covered", + "culvert", + "cutting", + "denomination", + "disused", + "embankment", + "foot", + "generator:source", + "harbour", + "highway", + "historic", + "horse", + "intermittent", + "junction", + "landuse", + "layer", + "leisure", + "lock", + "man_made", + "military", + "motorcar", + "name", + "natural", + "oneway", + "operator", + "population", + "power", + "power_source", + "place", + "railway", + "ref", + "religion", + "route", + "service", + "shop", + "sport", + "surface", + "toll", + "tourism", + "tower:type", + "tracktype", + "tunnel", + "water", + "waterway", + "wetland", + "width", + "wood" }; // most common tags, ordered by tag count public final static Tag[] tags = { - new Tag(s_building, s_yes, false), - new Tag(s_highway, s_residential, false), - new Tag(s_highway, s_service, false), - new Tag(s_waterway, s_stream, false), - new Tag(s_highway, s_unclassified, false), - new Tag(s_highway, s_track, false), - new Tag(s_oneway, s_yes, false), - new Tag(s_natural, s_water, false), - new Tag(s_highway, s_footway, false), - new Tag(s_access, s_private, false), - new Tag(s_highway, s_tertiary, false), - new Tag(s_highway, s_path, false), - new Tag(s_highway, s_secondary, false), - new Tag(s_landuse, s_forest, false), - new Tag(s_bridge, s_yes, false), - new Tag(s_natural, s_tree, false), - new Tag(s_surface, s_paved, false), - new Tag(s_natural, s_wood, false), - new Tag(s_highway, s_primary, false), - new Tag(s_landuse, s_grass, false), - new Tag(s_landuse, s_residential, false), - new Tag(s_surface, s_unpaved, false), - new Tag(s_highway, s_bus_stop, false), - new Tag(s_surface, s_asphalt, false), - new Tag(s_bicycle, s_yes, false), - new Tag(s_amenity, s_parking, false), - new Tag(s_place, s_locality, false), - new Tag(s_railway, s_rail, false), - new Tag(s_service, s_parking_aisle, false), - new Tag(s_boundary, s_administrative, false), - new Tag(s_building, s_house, false), - new Tag(s_place, s_village, false), - new Tag(s_natural, s_coastline, false), - new Tag(s_tracktype, s_grade2, false), - new Tag(s_oneway, s_no, false), - new Tag(s_service, s_driveway, false), - new Tag(s_highway, s_turning_circle, false), - new Tag(s_place, s_hamlet, false), - new Tag(s_natural, s_wetland, false), - new Tag(s_tracktype, s_grade3, false), - new Tag(s_waterway, s_river, false), - new Tag(s_highway, s_cycleway, false), - new Tag(s_barrier, s_fence, false), - new Tag(s_building, s_residential, false), - new Tag(s_amenity, s_school, false), - new Tag(s_highway, s_crossing, false), - new Tag(s_admin_level, s_8, false), - new Tag(s_highway, s_trunk, false), - new Tag(s_amenity, s_place_of_worship, false), - new Tag(s_landuse, s_farmland, false), - new Tag(s_tracktype, s_grade1, false), - new Tag(s_highway, s_road, false), - new Tag(s_landuse, s_farm, false), - new Tag(s_surface, s_gravel, false), - new Tag(s_landuse, s_meadow, false), - new Tag(s_highway, s_motorway, false), - new Tag(s_highway, s_traffic_signals, false), - new Tag(s_building, s_hut, false), - new Tag(s_highway, s_motorway_link, false), - new Tag(s_tracktype, s_grade4, false), - new Tag(s_barrier, s_gate, false), - new Tag(s_highway, s_living_street, false), - new Tag(s_bicycle, s_no, false), - new Tag(s_leisure, s_pitch, false), - new Tag(s_tunnel, s_yes, false), - new Tag(s_surface, s_ground, false), - new Tag(s_highway, s_steps, false), - new Tag(s_natural, s_land, false), - new Tag(s_man_made, s_survey_point, false), - new Tag(s_tracktype, s_grade5, false), - new Tag(s_waterway, s_ditch, false), - new Tag(s_leisure, s_park, false), - new Tag(s_amenity, s_restaurant, false), - new Tag(s_barrier, s_wall, false), - new Tag(s_waterway, s_riverbank, false), - new Tag(s_amenity, s_bench, false), - new Tag(s_building, s_garage, false), - new Tag(s_natural, s_scrub, false), - new Tag(s_highway, s_pedestrian, false), - new Tag(s_natural, s_peak, false), - new Tag(s_building, s_entrance, false), - new Tag(s_landuse, s_reservoir, false), - new Tag(s_access, s_yes, false), - new Tag(s_bicycle, s_designated, false), - new Tag(s_leisure, s_swimming_pool, false), - new Tag(s_landuse, s_farmyard, false), - new Tag(s_railway, s_level_crossing, false), - new Tag(s_building, s_apartments, false), - new Tag(s_surface, s_grass, false), - new Tag(s_wheelchair, s_yes, false), - new Tag(s_service, s_alley, false), - new Tag(s_landuse, s_industrial, false), - new Tag(s_amenity, s_fuel, false), - new Tag(s_surface, s_dirt, false), - new Tag(s_highway, s_trunk_link, false), - new Tag(s_waterway, s_drain, false), - new Tag(s_barrier, s_hedge, false), - new Tag(s_amenity, s_grave_yard, false), - new Tag(s_tourism, s_information, false), - new Tag(s_shop, s_supermarket, false), - new Tag(s_highway, s_primary_link, false), - new Tag(s_wood, s_deciduous, false), - new Tag(s_leisure, s_playground, false), - new Tag(s_building, s_roof, false), - new Tag(s_building, s_industrial, false), - new Tag(s_amenity, s_post_box, false), - new Tag(s_waterway, s_canal, false), - new Tag(s_barrier, s_bollard, false), - new Tag(s_leisure, s_garden, false), - new Tag(s_wood, s_mixed, false), - new Tag(s_landuse, s_cemetery, false), - new Tag(s_landuse, s_orchard, false), - new Tag(s_shop, s_convenience, false), - new Tag(s_access, s_permissive, false), - new Tag(s_surface, s_concrete, false), - new Tag(s_surface, s_paving_stones, false), - new Tag(s_service, s_spur, false), - new Tag(s_building, s_garages, false), - new Tag(s_amenity, s_bank, false), - new Tag(s_tourism, s_hotel, false), - new Tag(s_access, s_no, false), - new Tag(s_amenity, s_fast_food, false), - new Tag(s_man_made, s_pier, false), - new Tag(s_amenity, s_kindergarten, false), - new Tag(s_access, s_agricultural, false), - new Tag(s_surface, s_cobblestone, false), - new Tag(s_wheelchair, s_no, false), - new Tag(s_amenity, s_cafe, false), - new Tag(s_amenity, s_hospital, false), - new Tag(s_amenity, s_post_office, false), - new Tag(s_amenity, s_public_building, false), - new Tag(s_amenity, s_recycling, false), - new Tag(s_highway, s_street_lamp, false), - new Tag(s_man_made, s_tower, false), - new Tag(s_waterway, s_dam, false), - new Tag(s_amenity, s_pub, false), - new Tag(s_wood, s_coniferous, false), - new Tag(s_access, s_destination, false), - new Tag(s_admin_level, s_6, false), - new Tag(s_landuse, s_commercial, false), - new Tag(s_amenity, s_pharmacy, false), - new Tag(s_railway, s_abandoned, false), - new Tag(s_service, s_yard, false), - new Tag(s_place, s_island, false), - new Tag(s_oneway, s__1, false), - new Tag(s_landuse, s_quarry, false), - new Tag(s_landuse, s_vineyard, false), - new Tag(s_highway, s_motorway_junction, false), - new Tag(s_railway, s_station, false), - new Tag(s_landuse, s_allotments, false), - new Tag(s_barrier, s_lift_gate, false), - new Tag(s_admin_level, s_10, false), - new Tag(s_amenity, s_telephone, false), - new Tag(s_place, s_town, false), - new Tag(s_man_made, s_cutline, false), - new Tag(s_place, s_suburb, false), - new Tag(s_aeroway, s_taxiway, false), - new Tag(s_wheelchair, s_limited, false), - new Tag(s_highway, s_secondary_link, false), - new Tag(s_leisure, s_sports_centre, false), - new Tag(s_amenity, s_bicycle_parking, false), - new Tag(s_surface, s_sand, false), - new Tag(s_highway, s_stop, false), - new Tag(s_man_made, s_works, false), - new Tag(s_landuse, s_retail, false), - new Tag(s_amenity, s_fire_station, false), - new Tag(s_service, s_siding, false), - new Tag(s_amenity, s_toilets, false), - new Tag(s_bench, s_yes, false), - new Tag(s_oneway, s_1, false), - new Tag(s_surface, s_compacted, false), - new Tag(s_landuse, s_basin, false), - new Tag(s_amenity, s_police, false), - new Tag(s_railway, s_tram, false), - new Tag(s_route, s_road, false), - new Tag(s_natural, s_cliff, false), - new Tag(s_highway, s_construction, false), - new Tag(s_aeroway, s_aerodrome, false), - new Tag(s_entrance, s_yes, false), - new Tag(s_man_made, s_storage_tank, false), - new Tag(s_amenity, s_atm, false), - new Tag(s_tourism, s_attraction, false), - new Tag(s_route, s_bus, false), - new Tag(s_shop, s_bakery, false), - new Tag(s_tourism, s_viewpoint, false), - new Tag(s_amenity, s_swimming_pool, false), - new Tag(s_natural, s_beach, false), - new Tag(s_tourism, s_picnic_site, false), - new Tag(s_oneway, s_true, false), - new Tag(s_highway, s_bridleway, false), - new Tag(s_tourism, s_camp_site, false), - new Tag(s_abutters, s_residential, false), - new Tag(s_leisure, s_nature_reserve, false), - new Tag(s_amenity, s_drinking_water, false), - new Tag(s_shop, s_clothes, false), - new Tag(s_natural, s_heath, false), - new Tag(s_highway, s_mini_roundabout, false), - new Tag(s_landuse, s_construction, false), - new Tag(s_amenity, s_waste_basket, false), - new Tag(s_railway, s_platform, false), - new Tag(s_amenity, s_townhall, false), - new Tag(s_shop, s_hairdresser, false), - new Tag(s_amenity, s_shelter, false), - new Tag(s_admin_level, s_9, false), - new Tag(s_building, s_farm_auxiliary, false), - new Tag(s_amenity, s_library, false), - new Tag(s_building, s_detached, false), - new Tag(s_admin_level, s_4, false), - new Tag(s_landuse, s_village_green, false), - new Tag(s_barrier, s_stile, false), - new Tag(s_landuse, s_garages, false), - new Tag(s_amenity, s_bar, false), - new Tag(s_railway, s_buffer_stop, false), - new Tag(s_wetland, s_marsh, false), - new Tag(s_tourism, s_museum, false), - new Tag(s_barrier, s_cycle_barrier, false), - new Tag(s_route, s_bicycle, false), - new Tag(s_railway, s_tram_stop, false), - new Tag(s_amenity, s_parking_space, false), - new Tag(s_barrier, s_retaining_wall, false), - new Tag(s_landuse, s_recreation_ground, false), - new Tag(s_amenity, s_university, false), - new Tag(s_highway, s_tertiary_link, false), - new Tag(s_building, s_terrace, false), - new Tag(s_shop, s_car_repair, false), - new Tag(s_amenity, s_hunting_stand, false), - new Tag(s_amenity, s_fountain, false), - new Tag(s_man_made, s_pipeline, false), - new Tag(s_wetland, s_swamp, false), - new Tag(s_shop, s_car, false), - new Tag(s_bench, s_no, false), - new Tag(s_tunnel, s_culvert, false), - new Tag(s_building, s_school, false), - new Tag(s_barrier, s_entrance, false), - new Tag(s_railway, s_disused, false), - new Tag(s_railway, s_crossing, false), - new Tag(s_building, s_church, false), - new Tag(s_amenity, s_social_facility, false), - new Tag(s_natural, s_bay, false), - new Tag(s_shop, s_kiosk, false), - new Tag(s_amenity, s_vending_machine, false), - new Tag(s_route, s_hiking, false), - new Tag(s_natural, s_spring, false), - new Tag(s_leisure, s_common, false), - new Tag(s_railway, s_switch, false), - new Tag(s_waterway, s_rapids, false), - new Tag(s_admin_level, s_7, false), - new Tag(s_leisure, s_stadium, false), - new Tag(s_leisure, s_track, false), - new Tag(s_place, s_isolated_dwelling, false), - new Tag(s_place, s_islet, false), - new Tag(s_waterway, s_weir, false), - new Tag(s_amenity, s_doctors, false), - new Tag(s_access, s_designated, false), - new Tag(s_landuse, s_conservation, false), - new Tag(s_waterway, s_artificial, false), - new Tag(s_amenity, s_bus_station, false), - new Tag(s_leisure, s_golf_course, false), - new Tag(s_shop, s_doityourself, false), - new Tag(s_building, s_service, false), - new Tag(s_tourism, s_guest_house, false), - new Tag(s_aeroway, s_runway, false), - new Tag(s_place, s_city, false), - new Tag(s_railway, s_subway, false), - new Tag(s_man_made, s_wastewater_plant, false), - new Tag(s_building, s_commercial, false), - new Tag(s_railway, s_halt, false), - new Tag(s_amenity, s_emergency_phone, false), - new Tag(s_building, s_retail, false), - new Tag(s_barrier, s_block, false), - new Tag(s_leisure, s_recreation_ground, false), - new Tag(s_access, s_forestry, false), - new Tag(s_amenity, s_college, false), - new Tag(s_highway, s_platform, false), - new Tag(s_access, s_unknown, false), - new Tag(s_man_made, s_water_tower, false), - new Tag(s_surface, s_pebblestone, false), - new Tag(s_bridge, s_viaduct, false), - new Tag(s_shop, s_butcher, false), - new Tag(s_shop, s_florist, false), - new Tag(s_boundary, s_landuse, false), - new Tag(s_aeroway, s_helipad, false), - new Tag(s_building, s_hangar, false), - new Tag(s_natural, s_glacier, false), - new Tag(s_highway, s_proposed, false), - new Tag(s_shop, s_mall, false), - new Tag(s_barrier, s_toll_booth, false), - new Tag(s_amenity, s_fire_hydrant, false), - new Tag(s_building, s_manufacture, false), - new Tag(s_building, s_farm, false), - new Tag(s_surface, s_wood, false), - new Tag(s_amenity, s_car_wash, false), - new Tag(s_amenity, s_dentist, false), - new Tag(s_natural, s_marsh, false), - new Tag(s_man_made, s_surveillance, false), - new Tag(s_shop, s_bicycle, false), - new Tag(s_route, s_foot, false), - new Tag(s_amenity, s_theatre, false), - new Tag(s_building, s_office, false), - new Tag(s_railway, s_light_rail, false), - new Tag(s_man_made, s_petroleum_well, false), - new Tag(s_amenity, s_taxi, false), - new Tag(s_building, s_greenhouse, false), - new Tag(s_landuse, s_brownfield, false), - new Tag(s_bicycle, s_permissive, false), - new Tag(s_admin_level, s_2, false), - new Tag(s_aeroway, s_apron, false), - new Tag(s_building, s_cabin, false), - new Tag(s_amenity, s_cinema, false), - new Tag(s_access, s_customers, false), - new Tag(s_tourism, s_motel, false), - new Tag(s_railway, s_narrow_gauge, false), - new Tag(s_amenity, s_marketplace, false), - new Tag(s_shop, s_furniture, false), - new Tag(s_entrance, s_staircase, false), - new Tag(s_tourism, s_artwork, false), - new Tag(s_natural, s_grassland, false), - new Tag(s_shop, s_books, false), - new Tag(s_admin_level, s_5, false), - new Tag(s_man_made, s_groyne, false), - new Tag(s_waterway, s_lock_gate, false), - new Tag(s_highway, s_emergency_access_point, false), - new Tag(s_natural, s_sand, false), - new Tag(s_landuse, s_military, false), - new Tag(s_boundary, s_protected_area, false), - new Tag(s_amenity, s_community_centre, false), - new Tag(s_barrier, s_kissing_gate, false), - new Tag(s_highway, s_speed_camera, false), - new Tag(s_boundary, s_national_park, false), - new Tag(s_railway, s_subway_entrance, false), - new Tag(s_man_made, s_silo, false), - new Tag(s_shop, s_alcohol, false), - new Tag(s_highway, s_give_way, false), - new Tag(s_leisure, s_slipway, false), - new Tag(s_shop, s_electronics, false), - new Tag(s_bicycle, s_dismount, false), - new Tag(s_leisure, s_marina, false), - new Tag(s_entrance, s_main, false), - new Tag(s_boundary, s_postal_code, false), - new Tag(s_landuse, s_greenhouse_horticulture, false), - new Tag(s_highway, s_milestone, false), - new Tag(s_natural, s_cave_entrance, false), - new Tag(s_landuse, s_landfill, false), - new Tag(s_shop, s_chemist, false), - new Tag(s_shop, s_shoes, false), - new Tag(s_barrier, s_cattle_grid, false), - new Tag(s_landuse, s_railway, false), - new Tag(s_tourism, s_hostel, false), - new Tag(s_tourism, s_chalet, false), - new Tag(s_place, s_county, false), - new Tag(s_shop, s_department_store, false), - new Tag(s_highway, s_ford, false), - new Tag(s_natural, s_scree, false), - new Tag(s_landuse, s_greenfield, false), - new Tag(s_amenity, s_nursing_home, false), - new Tag(s_barrier, s_wire_fence, false), - new Tag(s_access, s_restricted, false), - new Tag(s_man_made, s_reservoir_covered, false), - new Tag(s_amenity, s_bicycle_rental, false), - new Tag(s_man_made, s_MDF, false), - new Tag(s_man_made, s_water_well, false), - new Tag(s_landuse, s_field, false), - new Tag(s_landuse, s_wood, false), - new Tag(s_shop, s_hardware, false), - new Tag(s_tourism, s_alpine_hut, false), - new Tag(s_natural, s_tree_row, false), - new Tag(s_tourism, s_caravan_site, false), - new Tag(s_bridge, s_no, false), - new Tag(s_wetland, s_bog, false), - new Tag(s_amenity, s_courthouse, false), - new Tag(s_route, s_ferry, false), - new Tag(s_barrier, s_city_wall, false), - new Tag(s_amenity, s_veterinary, false), - new Tag(s_shop, s_jewelry, false), - new Tag(s_building, s_transportation, false), - new Tag(s_amenity, s_arts_centre, false), - new Tag(s_bicycle, s_official, false), - new Tag(s_shop, s_optician, false), - new Tag(s_shop, s_yes, false), - new Tag(s_building, s_collapsed, false), - new Tag(s_shop, s_garden_centre, false), - new Tag(s_man_made, s_chimney, false), - new Tag(s_man_made, s_mine, false), - new Tag(s_bench, s_unknown, false), - new Tag(s_railway, s_preserved, false), - new Tag(s_building, s_public, false), - new Tag(s_amenity, s_ferry_terminal, false), - new Tag(s_highway, s_raceway, false), - new Tag(s_natural, s_rock, false), - new Tag(s_tunnel, s_no, false), - new Tag(s_building, s_university, false), - new Tag(s_shop, s_beverages, false), - new Tag(s_amenity, s_waste_disposal, false), - new Tag(s_building, s_warehouse, false), - new Tag(s_leisure, s_water_park, false), - new Tag(s_shop, s_gift, false), - new Tag(s_place, s_farm, false), - new Tag(s_wetland, s_tidalflat, false), - new Tag(s_waterway, s_waterfall, false), - new Tag(s_man_made, s_dolphin, false), - new Tag(s_service, s_drive_through, false), - new Tag(s_amenity, s_nightclub, false), - new Tag(s_building, s_shed, false), - new Tag(s_shop, s_greengrocer, false), - new Tag(s_natural, s_fell, false), - new Tag(s_wetland, s_wet_meadow, false), - new Tag(s_aeroway, s_gate, false), - new Tag(s_shop, s_computer, false), - new Tag(s_man_made, s_lighthouse, false), - new Tag(s_wetland, s_reedbed, false), - new Tag(s_man_made, s_breakwater, false), - new Tag(s_surface, s_Dirt_Sand, false), - new Tag(s_barrier, s_ditch, false), - new Tag(s_barrier, s_yes, false), - new Tag(s_amenity, s_biergarten, false), - new Tag(s_shop, s_mobile_phone, false), - new Tag(s_route, s_mtb, false), - new Tag(s_amenity, s_grit_bin, false), - new Tag(s_amenity, s_bbq, false), - new Tag(s_shop, s_sports, false), - new Tag(s_barrier, s_wood_fence, false), - new Tag(s_entrance, s_home, false), - new Tag(s_shop, s_laundry, false), - new Tag(s_man_made, s_gasometer, false), - new Tag(s_barrier, s_embankment, false), - new Tag(s_shop, s_toys, false), - new Tag(s_wetland, s_saltmarsh, false), - new Tag(s_waterway, s_soakhole, false), - new Tag(s_shop, s_travel_agency, false), - new Tag(s_man_made, s_water_works, false), - new Tag(s_route, s_railway, false), - new Tag(s_amenity, s_prison, false), - new Tag(s_highway, s_rest_area, false), - new Tag(s_shop, s_stationery, false), - new Tag(s_admin_level, s_11, false), - new Tag(s_building, s_train_station, false), - new Tag(s_building, s_storage_tank, false), - new Tag(s_man_made, s_windmill, false), - new Tag(s_shop, s_beauty, false), - new Tag(s_building, s_semi, false), - new Tag(s_highway, s_services, false), - new Tag(s_bicycle, s_private, false), - new Tag(s_route, s_ski, false), - new Tag(s_service, s_emergency_access, false), - new Tag(s_building, s_factory, false), - new Tag(s_man_made, s_reinforced_slope, false), - new Tag(s_amenity, s_car_sharing, false), - new Tag(s_surface, s_earth, false), - new Tag(s_shop, s_hifi, false), - new Tag(s_amenity, s_car_rental, false), - new Tag(s_barrier, s_hedge_bank, false), - new Tag(s_shop, s_confectionery, false), - new Tag(s_aeroway, s_terminal, false), - new Tag(s_highway, s_passing_place, false), - new Tag(s_building, s_building, false), - new Tag(s_man_made, s_dyke, false), - new Tag(s_building, s_construction, false), - new Tag(s_building, s_shop, false), - new Tag(s_natural, s_reef, false), - new Tag(s_landuse, s_aquaculture, false), - new Tag(s_shop, s_dry_cleaning, false), - new Tag(s_amenity, s_embassy, false), - new Tag(s_shop, s_newsagent, false), - new Tag(s_landuse, s_salt_pond, false), - new Tag(s_railway, s_spur, false), - new Tag(s_wheelchair, s_unknown, false), - new Tag(s_tourism, s_zoo, false), - new Tag(s_man_made, s_waterway, false), - new Tag(s_surface, s_fine_gravel, false), - new Tag(s_shop, s_motorcycle, false), - new Tag(s_building, s_Building, false), - new Tag(s_railway, s_construction, false), - new Tag(s_place, s_neighbourhood, false), - new Tag(s_route, s_train, false), - new Tag(s_building, s_no, false), - new Tag(s_natural, s_mud, false), - new Tag(s_place, s_region, false), - new Tag(s_landuse, s_reservoir_watershed, false), - new Tag(s_boundary, s_marker, false), - new Tag(s_man_made, s_beacon, false), - new Tag(s_shop, s_outdoor, false), - new Tag(s_access, s_public, false), - new Tag(s_abutters, s_industrial, false), - new Tag(s_building, s_barn, false), - new Tag(s_leisure, s_picnic_table, false), - new Tag(s_building, s_hospital, false), - new Tag(s_access, s_official, false), - new Tag(s_shop, s_variety_store, false), - new Tag(s_man_made, s_crane, false), - new Tag(s_amenity, s_parking_fuel, false), - new Tag(s_route, s_tram, false), - new Tag(s_tourism, s_theme_park, false), - new Tag(s_shop, s_pet, false), - new Tag(s_building, s_kindergarten, false), - new Tag(s_man_made, s_storage, false), - new Tag(s_man_made, s_mast, false), - new Tag(s_amenity, s_parking_entrance, false), - new Tag(s_amenity, s_clock, false), - new Tag(s_landuse, s_industrial_retail, false), - new Tag(s_shop, s_video, false), - new Tag(s_access, s_delivery, false), - new Tag(s_amenity, s_driving_school, false), - new Tag(s_service, s_yes, false), - new Tag(s_natural, s_bare_rock, false), - new Tag(s_building, s_chapel, false), - new Tag(s_natural, s_volcano, false), - new Tag(s_waterway, s_dock, false), - new Tag(s_building, s_dormitory, false), - new Tag(s_amenity, s_boat_storage, false), - new Tag(s_man_made, s_tank, false), - new Tag(s_man_made, s_flagpole, false), - new Tag(s_surface, s_grass_paver, false), - new Tag(s_shop, s_organic, false), - new Tag(s_natural, s_landform, false), - new Tag(s_highway, s_unsurfaced, false), - new Tag(s_route, s_power, false), - new Tag(s_surface, s_mud, false), - new Tag(s_building, s_building_concrete, false), - new Tag(s_abutters, s_retail, false), - new Tag(s_building, s_store, false), - new Tag(s_shop, s_vacant, false), - new Tag(s_leisure, s_miniature_golf, false), - new Tag(s_man_made, s_monitoring_station, false), - new Tag(s_natural, s_waterfall, false), - new Tag(s_aeroway, s_hangar, false), - new Tag(s_shop, s_boutique, false), - new Tag(s_route, s_detour, false), - new Tag(s_building, s_way, false), - new Tag(s_railway, s_stop, false), - new Tag(s_amenity, s_ice_cream, false), - new Tag(s_building, s_storage, false), - new Tag(s_shop, s_car_parts, false), - new Tag(s_natural, s_ridge, false), - new Tag(s_shop, s_tyres, false), - new Tag(s_railway, s_dismantled, false), - new Tag(s_amenity, s_shop, false), - new Tag(s_landuse, s_plant_nursery, false), - new Tag(s_building, s_residentiel1, false), - new Tag(s_barrier, s_field_boundary, false), - new Tag(s_barrier, s_border_control, false), - new Tag(s_surface, s_Paved, false), - new Tag(s_barrier, s_sally_port, false), - new Tag(s_amenity, s_bureau_de_change, false), - new Tag(s_leisure, s_fishing, false), - new Tag(s_amenity, s_charging_station, false), - new Tag(s_building, s_supermarket, false), - new Tag(s_highway, s_stile, false), - new Tag(s_amenity, s_sauna, false), - new Tag(s_place, s_municipality, false), - new Tag(s_building, s_hotel, false), - new Tag(s_surface, s_metal, false), - new Tag(s_highway, s_incline_steep, false), - new Tag(s_shop, s_estate_agent, false), - new Tag(s_natural, s_grass, false), - new Tag(s_shop, s_pharmacy, false), - new Tag(s_surface, s_concrete_plates, false), - new Tag(s_shop, s_copyshop, false), - new Tag(s_surface, s_paving_stones_30, false), - new Tag(s_surface, s_interlock, false), - new Tag(s_access, s_hov, false), - new Tag(s_highway, s_elevator, false), - new Tag(s_boundary, s_local_authority, false), - new Tag(s_man_made, s_communications_tower, false), - new Tag(s_shop, s_deli, false), - new Tag(s_barrier, s_turnstile, false), - new Tag(s_building, s_offices, false), - new Tag(s_building, s_bunker, false), - new Tag(s_natural, s_stone, false), - new Tag(s_railway, s_railway_crossing, false), - new Tag(s_leisure, s_dog_park, false), - new Tag(s_building, s_semi_detached, false), - new Tag(s_man_made, s_watermill, false), - new Tag(s_route, s_trolleybus, false), - new Tag(s_admin_level, s_3, false), - new Tag(s_building, s_block, false), - new Tag(s_barrier, s_guard_rail, false), - new Tag(s_bicycle, s_unknown, false), - new Tag(s_highway, s_abandoned, false), - new Tag(s_surface, s_dirt_sand, false), - new Tag(s_barrier, s_chain, false), - new Tag(s_barrier, s_bump_gate, false), - new Tag(s_building, s_residental, false), - new Tag(s_surface, s_cement, false), - new Tag(s_man_made, s_embankment, false), - new Tag(s_building, s_ruins, false), - new Tag(s_highway, s_incline, false), - new Tag(s_abutters, s_commercial, false), - new Tag(s_barrier, s_hampshire_gate, false), - new Tag(s_shop, s_music, false), - new Tag(s_shop, s_funeral_directors, false), - new Tag(s_wetland, s_mangrove, false), - new Tag(s_place, s_borough, false), - new Tag(s_building, s_apartment, false), - new Tag(s_boundary, s_census, false), - new Tag(s_barrier, s_kerb, false), - new Tag(s_building, s_glasshouse, false), - new Tag(s_aeroway, s_holding_position, false), - new Tag(s_shop, s_general, false), - new Tag(s_building, s_tank, false), - new Tag(s_railway, s_monorail, false), - new Tag(s_service, s_parking, false), - new Tag(s_place, s_state, false), - new Tag(s_railway, s_proposed, false), - new Tag(s_shop, s_art, false), - new Tag(s_natural, s_hill, false), - new Tag(s_railway, s_turntable, false), - new Tag(s_tourism, s_cabin, false), - new Tag(s_shop, s_photo, false), - new Tag(s_boundary, s_lot, false), - new Tag(s_shop, s_fishmonger, false), - new Tag(s_amenity, s_clinic, false), - new Tag(s_boundary, s_political, false), - new Tag(s_man_made, s_well, false), - new Tag(s_highway, s_byway, false), - new Tag(s_leisure, s_horse_riding, false), - new Tag(s_service, s_bus, false), - new Tag(s_building, s_tower, false), - new Tag(s_entrance, s_service, false), - new Tag(s_shop, s_fabric, false), - new Tag(s_railway, s_miniature, false), - new Tag(s_abutters, s_mixed, false), - new Tag(s_surface, s_stone, false), - new Tag(s_access, s_emergency, false), - new Tag(s_landuse, s_mine, false), - new Tag(s_amenity, s_shower, false), - new Tag(s_waterway, s_lock, false), - new Tag(s_area, s_yes, false), - new Tag(s_landuse, s_urban, false), + new Tag(s_building, s_yes, false), + new Tag(s_highway, s_residential, false), + new Tag(s_highway, s_service, false), + new Tag(s_waterway, s_stream, false), + new Tag(s_highway, s_unclassified, false), + new Tag(s_highway, s_track, false), + new Tag(s_oneway, s_yes, false), + new Tag(s_natural, s_water, false), + new Tag(s_highway, s_footway, false), + new Tag(s_access, s_private, false), + new Tag(s_highway, s_tertiary, false), + new Tag(s_highway, s_path, false), + new Tag(s_highway, s_secondary, false), + new Tag(s_landuse, s_forest, false), + new Tag(s_bridge, s_yes, false), + new Tag(s_natural, s_tree, false), + new Tag(s_surface, s_paved, false), + new Tag(s_natural, s_wood, false), + new Tag(s_highway, s_primary, false), + new Tag(s_landuse, s_grass, false), + new Tag(s_landuse, s_residential, false), + new Tag(s_surface, s_unpaved, false), + new Tag(s_highway, s_bus_stop, false), + new Tag(s_surface, s_asphalt, false), + new Tag(s_bicycle, s_yes, false), + new Tag(s_amenity, s_parking, false), + new Tag(s_place, s_locality, false), + new Tag(s_railway, s_rail, false), + new Tag(s_service, s_parking_aisle, false), + new Tag(s_boundary, s_administrative, false), + new Tag(s_building, s_house, false), + new Tag(s_place, s_village, false), + new Tag(s_natural, s_coastline, false), + new Tag(s_tracktype, s_grade2, false), + new Tag(s_oneway, s_no, false), + new Tag(s_service, s_driveway, false), + new Tag(s_highway, s_turning_circle, false), + new Tag(s_place, s_hamlet, false), + new Tag(s_natural, s_wetland, false), + new Tag(s_tracktype, s_grade3, false), + new Tag(s_waterway, s_river, false), + new Tag(s_highway, s_cycleway, false), + new Tag(s_barrier, s_fence, false), + new Tag(s_building, s_residential, false), + new Tag(s_amenity, s_school, false), + new Tag(s_highway, s_crossing, false), + new Tag(s_admin_level, s_8, false), + new Tag(s_highway, s_trunk, false), + new Tag(s_amenity, s_place_of_worship, false), + new Tag(s_landuse, s_farmland, false), + new Tag(s_tracktype, s_grade1, false), + new Tag(s_highway, s_road, false), + new Tag(s_landuse, s_farm, false), + new Tag(s_surface, s_gravel, false), + new Tag(s_landuse, s_meadow, false), + new Tag(s_highway, s_motorway, false), + new Tag(s_highway, s_traffic_signals, false), + new Tag(s_building, s_hut, false), + new Tag(s_highway, s_motorway_link, false), + new Tag(s_tracktype, s_grade4, false), + new Tag(s_barrier, s_gate, false), + new Tag(s_highway, s_living_street, false), + new Tag(s_bicycle, s_no, false), + new Tag(s_leisure, s_pitch, false), + new Tag(s_tunnel, s_yes, false), + new Tag(s_surface, s_ground, false), + new Tag(s_highway, s_steps, false), + new Tag(s_natural, s_land, false), + new Tag(s_man_made, s_survey_point, false), + new Tag(s_tracktype, s_grade5, false), + new Tag(s_waterway, s_ditch, false), + new Tag(s_leisure, s_park, false), + new Tag(s_amenity, s_restaurant, false), + new Tag(s_barrier, s_wall, false), + new Tag(s_waterway, s_riverbank, false), + new Tag(s_amenity, s_bench, false), + new Tag(s_building, s_garage, false), + new Tag(s_natural, s_scrub, false), + new Tag(s_highway, s_pedestrian, false), + new Tag(s_natural, s_peak, false), + new Tag(s_building, s_entrance, false), + new Tag(s_landuse, s_reservoir, false), + new Tag(s_access, s_yes, false), + new Tag(s_bicycle, s_designated, false), + new Tag(s_leisure, s_swimming_pool, false), + new Tag(s_landuse, s_farmyard, false), + new Tag(s_railway, s_level_crossing, false), + new Tag(s_building, s_apartments, false), + new Tag(s_surface, s_grass, false), + new Tag(s_wheelchair, s_yes, false), + new Tag(s_service, s_alley, false), + new Tag(s_landuse, s_industrial, false), + new Tag(s_amenity, s_fuel, false), + new Tag(s_surface, s_dirt, false), + new Tag(s_highway, s_trunk_link, false), + new Tag(s_waterway, s_drain, false), + new Tag(s_barrier, s_hedge, false), + new Tag(s_amenity, s_grave_yard, false), + new Tag(s_tourism, s_information, false), + new Tag(s_shop, s_supermarket, false), + new Tag(s_highway, s_primary_link, false), + new Tag(s_wood, s_deciduous, false), + new Tag(s_leisure, s_playground, false), + new Tag(s_building, s_roof, false), + new Tag(s_building, s_industrial, false), + new Tag(s_amenity, s_post_box, false), + new Tag(s_waterway, s_canal, false), + new Tag(s_barrier, s_bollard, false), + new Tag(s_leisure, s_garden, false), + new Tag(s_wood, s_mixed, false), + new Tag(s_landuse, s_cemetery, false), + new Tag(s_landuse, s_orchard, false), + new Tag(s_shop, s_convenience, false), + new Tag(s_access, s_permissive, false), + new Tag(s_surface, s_concrete, false), + new Tag(s_surface, s_paving_stones, false), + new Tag(s_service, s_spur, false), + new Tag(s_building, s_garages, false), + new Tag(s_amenity, s_bank, false), + new Tag(s_tourism, s_hotel, false), + new Tag(s_access, s_no, false), + new Tag(s_amenity, s_fast_food, false), + new Tag(s_man_made, s_pier, false), + new Tag(s_amenity, s_kindergarten, false), + new Tag(s_access, s_agricultural, false), + new Tag(s_surface, s_cobblestone, false), + new Tag(s_wheelchair, s_no, false), + new Tag(s_amenity, s_cafe, false), + new Tag(s_amenity, s_hospital, false), + new Tag(s_amenity, s_post_office, false), + new Tag(s_amenity, s_public_building, false), + new Tag(s_amenity, s_recycling, false), + new Tag(s_highway, s_street_lamp, false), + new Tag(s_man_made, s_tower, false), + new Tag(s_waterway, s_dam, false), + new Tag(s_amenity, s_pub, false), + new Tag(s_wood, s_coniferous, false), + new Tag(s_access, s_destination, false), + new Tag(s_admin_level, s_6, false), + new Tag(s_landuse, s_commercial, false), + new Tag(s_amenity, s_pharmacy, false), + new Tag(s_railway, s_abandoned, false), + new Tag(s_service, s_yard, false), + new Tag(s_place, s_island, false), + new Tag(s_oneway, s__1, false), + new Tag(s_landuse, s_quarry, false), + new Tag(s_landuse, s_vineyard, false), + new Tag(s_highway, s_motorway_junction, false), + new Tag(s_railway, s_station, false), + new Tag(s_landuse, s_allotments, false), + new Tag(s_barrier, s_lift_gate, false), + new Tag(s_admin_level, s_10, false), + new Tag(s_amenity, s_telephone, false), + new Tag(s_place, s_town, false), + new Tag(s_man_made, s_cutline, false), + new Tag(s_place, s_suburb, false), + new Tag(s_aeroway, s_taxiway, false), + new Tag(s_wheelchair, s_limited, false), + new Tag(s_highway, s_secondary_link, false), + new Tag(s_leisure, s_sports_centre, false), + new Tag(s_amenity, s_bicycle_parking, false), + new Tag(s_surface, s_sand, false), + new Tag(s_highway, s_stop, false), + new Tag(s_man_made, s_works, false), + new Tag(s_landuse, s_retail, false), + new Tag(s_amenity, s_fire_station, false), + new Tag(s_service, s_siding, false), + new Tag(s_amenity, s_toilets, false), + new Tag(s_bench, s_yes, false), + new Tag(s_oneway, s_1, false), + new Tag(s_surface, s_compacted, false), + new Tag(s_landuse, s_basin, false), + new Tag(s_amenity, s_police, false), + new Tag(s_railway, s_tram, false), + new Tag(s_route, s_road, false), + new Tag(s_natural, s_cliff, false), + new Tag(s_highway, s_construction, false), + new Tag(s_aeroway, s_aerodrome, false), + new Tag(s_entrance, s_yes, false), + new Tag(s_man_made, s_storage_tank, false), + new Tag(s_amenity, s_atm, false), + new Tag(s_tourism, s_attraction, false), + new Tag(s_route, s_bus, false), + new Tag(s_shop, s_bakery, false), + new Tag(s_tourism, s_viewpoint, false), + new Tag(s_amenity, s_swimming_pool, false), + new Tag(s_natural, s_beach, false), + new Tag(s_tourism, s_picnic_site, false), + new Tag(s_oneway, s_true, false), + new Tag(s_highway, s_bridleway, false), + new Tag(s_tourism, s_camp_site, false), + new Tag(s_abutters, s_residential, false), + new Tag(s_leisure, s_nature_reserve, false), + new Tag(s_amenity, s_drinking_water, false), + new Tag(s_shop, s_clothes, false), + new Tag(s_natural, s_heath, false), + new Tag(s_highway, s_mini_roundabout, false), + new Tag(s_landuse, s_construction, false), + new Tag(s_amenity, s_waste_basket, false), + new Tag(s_railway, s_platform, false), + new Tag(s_amenity, s_townhall, false), + new Tag(s_shop, s_hairdresser, false), + new Tag(s_amenity, s_shelter, false), + new Tag(s_admin_level, s_9, false), + new Tag(s_building, s_farm_auxiliary, false), + new Tag(s_amenity, s_library, false), + new Tag(s_building, s_detached, false), + new Tag(s_admin_level, s_4, false), + new Tag(s_landuse, s_village_green, false), + new Tag(s_barrier, s_stile, false), + new Tag(s_landuse, s_garages, false), + new Tag(s_amenity, s_bar, false), + new Tag(s_railway, s_buffer_stop, false), + new Tag(s_wetland, s_marsh, false), + new Tag(s_tourism, s_museum, false), + new Tag(s_barrier, s_cycle_barrier, false), + new Tag(s_route, s_bicycle, false), + new Tag(s_railway, s_tram_stop, false), + new Tag(s_amenity, s_parking_space, false), + new Tag(s_barrier, s_retaining_wall, false), + new Tag(s_landuse, s_recreation_ground, false), + new Tag(s_amenity, s_university, false), + new Tag(s_highway, s_tertiary_link, false), + new Tag(s_building, s_terrace, false), + new Tag(s_shop, s_car_repair, false), + new Tag(s_amenity, s_hunting_stand, false), + new Tag(s_amenity, s_fountain, false), + new Tag(s_man_made, s_pipeline, false), + new Tag(s_wetland, s_swamp, false), + new Tag(s_shop, s_car, false), + new Tag(s_bench, s_no, false), + new Tag(s_tunnel, s_culvert, false), + new Tag(s_building, s_school, false), + new Tag(s_barrier, s_entrance, false), + new Tag(s_railway, s_disused, false), + new Tag(s_railway, s_crossing, false), + new Tag(s_building, s_church, false), + new Tag(s_amenity, s_social_facility, false), + new Tag(s_natural, s_bay, false), + new Tag(s_shop, s_kiosk, false), + new Tag(s_amenity, s_vending_machine, false), + new Tag(s_route, s_hiking, false), + new Tag(s_natural, s_spring, false), + new Tag(s_leisure, s_common, false), + new Tag(s_railway, s_switch, false), + new Tag(s_waterway, s_rapids, false), + new Tag(s_admin_level, s_7, false), + new Tag(s_leisure, s_stadium, false), + new Tag(s_leisure, s_track, false), + new Tag(s_place, s_isolated_dwelling, false), + new Tag(s_place, s_islet, false), + new Tag(s_waterway, s_weir, false), + new Tag(s_amenity, s_doctors, false), + new Tag(s_access, s_designated, false), + new Tag(s_landuse, s_conservation, false), + new Tag(s_waterway, s_artificial, false), + new Tag(s_amenity, s_bus_station, false), + new Tag(s_leisure, s_golf_course, false), + new Tag(s_shop, s_doityourself, false), + new Tag(s_building, s_service, false), + new Tag(s_tourism, s_guest_house, false), + new Tag(s_aeroway, s_runway, false), + new Tag(s_place, s_city, false), + new Tag(s_railway, s_subway, false), + new Tag(s_man_made, s_wastewater_plant, false), + new Tag(s_building, s_commercial, false), + new Tag(s_railway, s_halt, false), + new Tag(s_amenity, s_emergency_phone, false), + new Tag(s_building, s_retail, false), + new Tag(s_barrier, s_block, false), + new Tag(s_leisure, s_recreation_ground, false), + new Tag(s_access, s_forestry, false), + new Tag(s_amenity, s_college, false), + new Tag(s_highway, s_platform, false), + new Tag(s_access, s_unknown, false), + new Tag(s_man_made, s_water_tower, false), + new Tag(s_surface, s_pebblestone, false), + new Tag(s_bridge, s_viaduct, false), + new Tag(s_shop, s_butcher, false), + new Tag(s_shop, s_florist, false), + new Tag(s_boundary, s_landuse, false), + new Tag(s_aeroway, s_helipad, false), + new Tag(s_building, s_hangar, false), + new Tag(s_natural, s_glacier, false), + new Tag(s_highway, s_proposed, false), + new Tag(s_shop, s_mall, false), + new Tag(s_barrier, s_toll_booth, false), + new Tag(s_amenity, s_fire_hydrant, false), + new Tag(s_building, s_manufacture, false), + new Tag(s_building, s_farm, false), + new Tag(s_surface, s_wood, false), + new Tag(s_amenity, s_car_wash, false), + new Tag(s_amenity, s_dentist, false), + new Tag(s_natural, s_marsh, false), + new Tag(s_man_made, s_surveillance, false), + new Tag(s_shop, s_bicycle, false), + new Tag(s_route, s_foot, false), + new Tag(s_amenity, s_theatre, false), + new Tag(s_building, s_office, false), + new Tag(s_railway, s_light_rail, false), + new Tag(s_man_made, s_petroleum_well, false), + new Tag(s_amenity, s_taxi, false), + new Tag(s_building, s_greenhouse, false), + new Tag(s_landuse, s_brownfield, false), + new Tag(s_bicycle, s_permissive, false), + new Tag(s_admin_level, s_2, false), + new Tag(s_aeroway, s_apron, false), + new Tag(s_building, s_cabin, false), + new Tag(s_amenity, s_cinema, false), + new Tag(s_access, s_customers, false), + new Tag(s_tourism, s_motel, false), + new Tag(s_railway, s_narrow_gauge, false), + new Tag(s_amenity, s_marketplace, false), + new Tag(s_shop, s_furniture, false), + new Tag(s_entrance, s_staircase, false), + new Tag(s_tourism, s_artwork, false), + new Tag(s_natural, s_grassland, false), + new Tag(s_shop, s_books, false), + new Tag(s_admin_level, s_5, false), + new Tag(s_man_made, s_groyne, false), + new Tag(s_waterway, s_lock_gate, false), + new Tag(s_highway, s_emergency_access_point, false), + new Tag(s_natural, s_sand, false), + new Tag(s_landuse, s_military, false), + new Tag(s_boundary, s_protected_area, false), + new Tag(s_amenity, s_community_centre, false), + new Tag(s_barrier, s_kissing_gate, false), + new Tag(s_highway, s_speed_camera, false), + new Tag(s_boundary, s_national_park, false), + new Tag(s_railway, s_subway_entrance, false), + new Tag(s_man_made, s_silo, false), + new Tag(s_shop, s_alcohol, false), + new Tag(s_highway, s_give_way, false), + new Tag(s_leisure, s_slipway, false), + new Tag(s_shop, s_electronics, false), + new Tag(s_bicycle, s_dismount, false), + new Tag(s_leisure, s_marina, false), + new Tag(s_entrance, s_main, false), + new Tag(s_boundary, s_postal_code, false), + new Tag(s_landuse, s_greenhouse_horticulture, false), + new Tag(s_highway, s_milestone, false), + new Tag(s_natural, s_cave_entrance, false), + new Tag(s_landuse, s_landfill, false), + new Tag(s_shop, s_chemist, false), + new Tag(s_shop, s_shoes, false), + new Tag(s_barrier, s_cattle_grid, false), + new Tag(s_landuse, s_railway, false), + new Tag(s_tourism, s_hostel, false), + new Tag(s_tourism, s_chalet, false), + new Tag(s_place, s_county, false), + new Tag(s_shop, s_department_store, false), + new Tag(s_highway, s_ford, false), + new Tag(s_natural, s_scree, false), + new Tag(s_landuse, s_greenfield, false), + new Tag(s_amenity, s_nursing_home, false), + new Tag(s_barrier, s_wire_fence, false), + new Tag(s_access, s_restricted, false), + new Tag(s_man_made, s_reservoir_covered, false), + new Tag(s_amenity, s_bicycle_rental, false), + new Tag(s_man_made, s_MDF, false), + new Tag(s_man_made, s_water_well, false), + new Tag(s_landuse, s_field, false), + new Tag(s_landuse, s_wood, false), + new Tag(s_shop, s_hardware, false), + new Tag(s_tourism, s_alpine_hut, false), + new Tag(s_natural, s_tree_row, false), + new Tag(s_tourism, s_caravan_site, false), + new Tag(s_bridge, s_no, false), + new Tag(s_wetland, s_bog, false), + new Tag(s_amenity, s_courthouse, false), + new Tag(s_route, s_ferry, false), + new Tag(s_barrier, s_city_wall, false), + new Tag(s_amenity, s_veterinary, false), + new Tag(s_shop, s_jewelry, false), + new Tag(s_building, s_transportation, false), + new Tag(s_amenity, s_arts_centre, false), + new Tag(s_bicycle, s_official, false), + new Tag(s_shop, s_optician, false), + new Tag(s_shop, s_yes, false), + new Tag(s_building, s_collapsed, false), + new Tag(s_shop, s_garden_centre, false), + new Tag(s_man_made, s_chimney, false), + new Tag(s_man_made, s_mine, false), + new Tag(s_bench, s_unknown, false), + new Tag(s_railway, s_preserved, false), + new Tag(s_building, s_public, false), + new Tag(s_amenity, s_ferry_terminal, false), + new Tag(s_highway, s_raceway, false), + new Tag(s_natural, s_rock, false), + new Tag(s_tunnel, s_no, false), + new Tag(s_building, s_university, false), + new Tag(s_shop, s_beverages, false), + new Tag(s_amenity, s_waste_disposal, false), + new Tag(s_building, s_warehouse, false), + new Tag(s_leisure, s_water_park, false), + new Tag(s_shop, s_gift, false), + new Tag(s_place, s_farm, false), + new Tag(s_wetland, s_tidalflat, false), + new Tag(s_waterway, s_waterfall, false), + new Tag(s_man_made, s_dolphin, false), + new Tag(s_service, s_drive_through, false), + new Tag(s_amenity, s_nightclub, false), + new Tag(s_building, s_shed, false), + new Tag(s_shop, s_greengrocer, false), + new Tag(s_natural, s_fell, false), + new Tag(s_wetland, s_wet_meadow, false), + new Tag(s_aeroway, s_gate, false), + new Tag(s_shop, s_computer, false), + new Tag(s_man_made, s_lighthouse, false), + new Tag(s_wetland, s_reedbed, false), + new Tag(s_man_made, s_breakwater, false), + new Tag(s_surface, s_Dirt_Sand, false), + new Tag(s_barrier, s_ditch, false), + new Tag(s_barrier, s_yes, false), + new Tag(s_amenity, s_biergarten, false), + new Tag(s_shop, s_mobile_phone, false), + new Tag(s_route, s_mtb, false), + new Tag(s_amenity, s_grit_bin, false), + new Tag(s_amenity, s_bbq, false), + new Tag(s_shop, s_sports, false), + new Tag(s_barrier, s_wood_fence, false), + new Tag(s_entrance, s_home, false), + new Tag(s_shop, s_laundry, false), + new Tag(s_man_made, s_gasometer, false), + new Tag(s_barrier, s_embankment, false), + new Tag(s_shop, s_toys, false), + new Tag(s_wetland, s_saltmarsh, false), + new Tag(s_waterway, s_soakhole, false), + new Tag(s_shop, s_travel_agency, false), + new Tag(s_man_made, s_water_works, false), + new Tag(s_route, s_railway, false), + new Tag(s_amenity, s_prison, false), + new Tag(s_highway, s_rest_area, false), + new Tag(s_shop, s_stationery, false), + new Tag(s_admin_level, s_11, false), + new Tag(s_building, s_train_station, false), + new Tag(s_building, s_storage_tank, false), + new Tag(s_man_made, s_windmill, false), + new Tag(s_shop, s_beauty, false), + new Tag(s_building, s_semi, false), + new Tag(s_highway, s_services, false), + new Tag(s_bicycle, s_private, false), + new Tag(s_route, s_ski, false), + new Tag(s_service, s_emergency_access, false), + new Tag(s_building, s_factory, false), + new Tag(s_man_made, s_reinforced_slope, false), + new Tag(s_amenity, s_car_sharing, false), + new Tag(s_surface, s_earth, false), + new Tag(s_shop, s_hifi, false), + new Tag(s_amenity, s_car_rental, false), + new Tag(s_barrier, s_hedge_bank, false), + new Tag(s_shop, s_confectionery, false), + new Tag(s_aeroway, s_terminal, false), + new Tag(s_highway, s_passing_place, false), + new Tag(s_building, s_building, false), + new Tag(s_man_made, s_dyke, false), + new Tag(s_building, s_construction, false), + new Tag(s_building, s_shop, false), + new Tag(s_natural, s_reef, false), + new Tag(s_landuse, s_aquaculture, false), + new Tag(s_shop, s_dry_cleaning, false), + new Tag(s_amenity, s_embassy, false), + new Tag(s_shop, s_newsagent, false), + new Tag(s_landuse, s_salt_pond, false), + new Tag(s_railway, s_spur, false), + new Tag(s_wheelchair, s_unknown, false), + new Tag(s_tourism, s_zoo, false), + new Tag(s_man_made, s_waterway, false), + new Tag(s_surface, s_fine_gravel, false), + new Tag(s_shop, s_motorcycle, false), + new Tag(s_building, s_Building, false), + new Tag(s_railway, s_construction, false), + new Tag(s_place, s_neighbourhood, false), + new Tag(s_route, s_train, false), + new Tag(s_building, s_no, false), + new Tag(s_natural, s_mud, false), + new Tag(s_place, s_region, false), + new Tag(s_landuse, s_reservoir_watershed, false), + new Tag(s_boundary, s_marker, false), + new Tag(s_man_made, s_beacon, false), + new Tag(s_shop, s_outdoor, false), + new Tag(s_access, s_public, false), + new Tag(s_abutters, s_industrial, false), + new Tag(s_building, s_barn, false), + new Tag(s_leisure, s_picnic_table, false), + new Tag(s_building, s_hospital, false), + new Tag(s_access, s_official, false), + new Tag(s_shop, s_variety_store, false), + new Tag(s_man_made, s_crane, false), + new Tag(s_amenity, s_parking_fuel, false), + new Tag(s_route, s_tram, false), + new Tag(s_tourism, s_theme_park, false), + new Tag(s_shop, s_pet, false), + new Tag(s_building, s_kindergarten, false), + new Tag(s_man_made, s_storage, false), + new Tag(s_man_made, s_mast, false), + new Tag(s_amenity, s_parking_entrance, false), + new Tag(s_amenity, s_clock, false), + new Tag(s_landuse, s_industrial_retail, false), + new Tag(s_shop, s_video, false), + new Tag(s_access, s_delivery, false), + new Tag(s_amenity, s_driving_school, false), + new Tag(s_service, s_yes, false), + new Tag(s_natural, s_bare_rock, false), + new Tag(s_building, s_chapel, false), + new Tag(s_natural, s_volcano, false), + new Tag(s_waterway, s_dock, false), + new Tag(s_building, s_dormitory, false), + new Tag(s_amenity, s_boat_storage, false), + new Tag(s_man_made, s_tank, false), + new Tag(s_man_made, s_flagpole, false), + new Tag(s_surface, s_grass_paver, false), + new Tag(s_shop, s_organic, false), + new Tag(s_natural, s_landform, false), + new Tag(s_highway, s_unsurfaced, false), + new Tag(s_route, s_power, false), + new Tag(s_surface, s_mud, false), + new Tag(s_building, s_building_concrete, false), + new Tag(s_abutters, s_retail, false), + new Tag(s_building, s_store, false), + new Tag(s_shop, s_vacant, false), + new Tag(s_leisure, s_miniature_golf, false), + new Tag(s_man_made, s_monitoring_station, false), + new Tag(s_natural, s_waterfall, false), + new Tag(s_aeroway, s_hangar, false), + new Tag(s_shop, s_boutique, false), + new Tag(s_route, s_detour, false), + new Tag(s_building, s_way, false), + new Tag(s_railway, s_stop, false), + new Tag(s_amenity, s_ice_cream, false), + new Tag(s_building, s_storage, false), + new Tag(s_shop, s_car_parts, false), + new Tag(s_natural, s_ridge, false), + new Tag(s_shop, s_tyres, false), + new Tag(s_railway, s_dismantled, false), + new Tag(s_amenity, s_shop, false), + new Tag(s_landuse, s_plant_nursery, false), + new Tag(s_building, s_residentiel1, false), + new Tag(s_barrier, s_field_boundary, false), + new Tag(s_barrier, s_border_control, false), + new Tag(s_surface, s_Paved, false), + new Tag(s_barrier, s_sally_port, false), + new Tag(s_amenity, s_bureau_de_change, false), + new Tag(s_leisure, s_fishing, false), + new Tag(s_amenity, s_charging_station, false), + new Tag(s_building, s_supermarket, false), + new Tag(s_highway, s_stile, false), + new Tag(s_amenity, s_sauna, false), + new Tag(s_place, s_municipality, false), + new Tag(s_building, s_hotel, false), + new Tag(s_surface, s_metal, false), + new Tag(s_highway, s_incline_steep, false), + new Tag(s_shop, s_estate_agent, false), + new Tag(s_natural, s_grass, false), + new Tag(s_shop, s_pharmacy, false), + new Tag(s_surface, s_concrete_plates, false), + new Tag(s_shop, s_copyshop, false), + new Tag(s_surface, s_paving_stones_30, false), + new Tag(s_surface, s_interlock, false), + new Tag(s_access, s_hov, false), + new Tag(s_highway, s_elevator, false), + new Tag(s_boundary, s_local_authority, false), + new Tag(s_man_made, s_communications_tower, false), + new Tag(s_shop, s_deli, false), + new Tag(s_barrier, s_turnstile, false), + new Tag(s_building, s_offices, false), + new Tag(s_building, s_bunker, false), + new Tag(s_natural, s_stone, false), + new Tag(s_railway, s_railway_crossing, false), + new Tag(s_leisure, s_dog_park, false), + new Tag(s_building, s_semi_detached, false), + new Tag(s_man_made, s_watermill, false), + new Tag(s_route, s_trolleybus, false), + new Tag(s_admin_level, s_3, false), + new Tag(s_building, s_block, false), + new Tag(s_barrier, s_guard_rail, false), + new Tag(s_bicycle, s_unknown, false), + new Tag(s_highway, s_abandoned, false), + new Tag(s_surface, s_dirt_sand, false), + new Tag(s_barrier, s_chain, false), + new Tag(s_barrier, s_bump_gate, false), + new Tag(s_building, s_residental, false), + new Tag(s_surface, s_cement, false), + new Tag(s_man_made, s_embankment, false), + new Tag(s_building, s_ruins, false), + new Tag(s_highway, s_incline, false), + new Tag(s_abutters, s_commercial, false), + new Tag(s_barrier, s_hampshire_gate, false), + new Tag(s_shop, s_music, false), + new Tag(s_shop, s_funeral_directors, false), + new Tag(s_wetland, s_mangrove, false), + new Tag(s_place, s_borough, false), + new Tag(s_building, s_apartment, false), + new Tag(s_boundary, s_census, false), + new Tag(s_barrier, s_kerb, false), + new Tag(s_building, s_glasshouse, false), + new Tag(s_aeroway, s_holding_position, false), + new Tag(s_shop, s_general, false), + new Tag(s_building, s_tank, false), + new Tag(s_railway, s_monorail, false), + new Tag(s_service, s_parking, false), + new Tag(s_place, s_state, false), + new Tag(s_railway, s_proposed, false), + new Tag(s_shop, s_art, false), + new Tag(s_natural, s_hill, false), + new Tag(s_railway, s_turntable, false), + new Tag(s_tourism, s_cabin, false), + new Tag(s_shop, s_photo, false), + new Tag(s_boundary, s_lot, false), + new Tag(s_shop, s_fishmonger, false), + new Tag(s_amenity, s_clinic, false), + new Tag(s_boundary, s_political, false), + new Tag(s_man_made, s_well, false), + new Tag(s_highway, s_byway, false), + new Tag(s_leisure, s_horse_riding, false), + new Tag(s_service, s_bus, false), + new Tag(s_building, s_tower, false), + new Tag(s_entrance, s_service, false), + new Tag(s_shop, s_fabric, false), + new Tag(s_railway, s_miniature, false), + new Tag(s_abutters, s_mixed, false), + new Tag(s_surface, s_stone, false), + new Tag(s_access, s_emergency, false), + new Tag(s_landuse, s_mine, false), + new Tag(s_amenity, s_shower, false), + new Tag(s_waterway, s_lock, false), + new Tag(s_area, s_yes, false), + new Tag(s_landuse, s_urban, false), }; } diff --git a/vtm/src/org/oscim/tiling/source/oscimap4/Tags.java b/vtm/src/org/oscim/tiling/source/oscimap4/Tags.java index 186cc6e2..ee6d2a95 100644 --- a/vtm/src/org/oscim/tiling/source/oscimap4/Tags.java +++ b/vtm/src/org/oscim/tiling/source/oscimap4/Tags.java @@ -21,336 +21,336 @@ public class Tags { // the keys that were imported via osm2pgsql + some more public final static String[] keys = { - "access", - "addr:housename", - "addr:housenumber", - "addr:interpolation", - "admin_level", - "aerialway", - "aeroway", - "amenity", - "area", - "barrier", - "bicycle", - "brand", - "bridge", - "boundary", - "building", - "construction", - "covered", - "culvert", - "cutting", - "denomination", - "disused", - "embankment", - "foot", - "generator:source", - "harbour", - "highway", - "historic", - "horse", - "intermittent", - "junction", - "landuse", - "layer", - "leisure", - "lock", - "man_made", - "military", - "motorcar", - "name", - "natural", - "oneway", - "operator", - "population", - "power", - "power_source", - "place", - "railway", - "ref", - "religion", - "route", - "service", - "shop", - "sport", - "surface", - "toll", - "tourism", - "tower:type", - "tracktype", - "tunnel", - "water", - "waterway", - "wetland", - "width", - "wood", + "access", + "addr:housename", + "addr:housenumber", + "addr:interpolation", + "admin_level", + "aerialway", + "aeroway", + "amenity", + "area", + "barrier", + "bicycle", + "brand", + "bridge", + "boundary", + "building", + "construction", + "covered", + "culvert", + "cutting", + "denomination", + "disused", + "embankment", + "foot", + "generator:source", + "harbour", + "highway", + "historic", + "horse", + "intermittent", + "junction", + "landuse", + "layer", + "leisure", + "lock", + "man_made", + "military", + "motorcar", + "name", + "natural", + "oneway", + "operator", + "population", + "power", + "power_source", + "place", + "railway", + "ref", + "religion", + "route", + "service", + "shop", + "sport", + "surface", + "toll", + "tourism", + "tower:type", + "tracktype", + "tunnel", + "water", + "waterway", + "wetland", + "width", + "wood", - "height", - "min_height", - "roof:shape", - "roof:height", - "rank" + "height", + "min_height", + "roof:shape", + "roof:height", + "rank" }; public final static int MAX_KEY = keys.length - 1; // most popular values for the selected key (created from taginfo db) public final static String[] values = { - "yes", - "residential", - "service", - "unclassified", - "stream", - "track", - "water", - "footway", - "tertiary", - "private", - "tree", - "path", - "forest", - "secondary", - "house", - "no", - "asphalt", - "wood", - "grass", - "paved", - "primary", - "unpaved", - "bus_stop", - "parking", - "parking_aisle", - "rail", - "driveway", - "8", - "administrative", - "locality", - "turning_circle", - "crossing", - "village", - "fence", - "grade2", - "coastline", - "grade3", - "farmland", - "hamlet", - "hut", - "meadow", - "wetland", - "cycleway", - "river", - "school", - "trunk", - "gravel", - "place_of_worship", - "farm", - "grade1", - "traffic_signals", - "wall", - "garage", - "gate", - "motorway", - "living_street", - "pitch", - "grade4", - "industrial", - "road", - "ground", - "scrub", - "motorway_link", - "steps", - "ditch", - "swimming_pool", - "grade5", - "park", - "apartments", - "restaurant", - "designated", - "bench", - "survey_point", - "pedestrian", - "hedge", - "reservoir", - "riverbank", - "alley", - "farmyard", - "peak", - "level_crossing", - "roof", - "dirt", - "drain", - "garages", - "entrance", - "street_lamp", - "deciduous", - "fuel", - "trunk_link", - "information", - "playground", - "supermarket", - "primary_link", - "concrete", - "mixed", - "permissive", - "orchard", - "grave_yard", - "canal", - "garden", - "spur", - "paving_stones", - "rock", - "bollard", - "convenience", - "cemetery", - "post_box", - "commercial", - "pier", - "bank", - "hotel", - "cliff", - "retail", - "construction", - "-1", - "fast_food", - "coniferous", - "cafe", - "6", - "kindergarten", - "tower", - "hospital", - "yard", - "sand", - "public_building", - "cobblestone", - "destination", - "island", - "abandoned", - "vineyard", - "recycling", - "agricultural", - "isolated_dwelling", - "pharmacy", - "post_office", - "motorway_junction", - "pub", - "allotments", - "dam", - "secondary_link", - "lift_gate", - "siding", - "stop", - "main", - "farm_auxiliary", - "quarry", - "10", - "station", - "platform", - "taxiway", - "limited", - "sports_centre", - "cutline", - "detached", - "storage_tank", - "basin", - "bicycle_parking", - "telephone", - "terrace", - "town", - "suburb", - "bus", - "compacted", - "toilets", - "heath", - "works", - "tram", - "beach", - "culvert", - "fire_station", - "recreation_ground", - "bakery", - "police", - "atm", - "clothes", - "tertiary_link", - "waste_basket", - "attraction", - "viewpoint", - "bicycle", - "church", - "shelter", - "drinking_water", - "marsh", - "picnic_site", - "hairdresser", - "bridleway", - "retaining_wall", - "buffer_stop", - "nature_reserve", - "village_green", - "university", - "1", - "bar", - "townhall", - "mini_roundabout", - "camp_site", - "aerodrome", - "stile", - "9", - "car_repair", - "parking_space", - "library", - "pipeline", - "true", - "cycle_barrier", - "4", - "museum", - "spring", - "hunting_stand", - "disused", - "car", - "tram_stop", - "land", - "fountain", - "hiking", - "manufacture", - "vending_machine", - "kiosk", - "swamp", - "unknown", - "7", - "islet", - "shed", - "switch", - "rapids", - "office", - "bay", - "proposed", - "common", - "weir", - "grassland", - "customers", - "social_facility", - "hangar", - "doctors", - "stadium", - "give_way", - "greenhouse", - "guest_house", - "viaduct", - "doityourself", - "runway", - "bus_station", - "water_tower", - "golf_course", - "conservation", - "block", - "college", - "wastewater_plant", - "subway", - "halt", - "forestry", - "florist", - "butcher" + "yes", + "residential", + "service", + "unclassified", + "stream", + "track", + "water", + "footway", + "tertiary", + "private", + "tree", + "path", + "forest", + "secondary", + "house", + "no", + "asphalt", + "wood", + "grass", + "paved", + "primary", + "unpaved", + "bus_stop", + "parking", + "parking_aisle", + "rail", + "driveway", + "8", + "administrative", + "locality", + "turning_circle", + "crossing", + "village", + "fence", + "grade2", + "coastline", + "grade3", + "farmland", + "hamlet", + "hut", + "meadow", + "wetland", + "cycleway", + "river", + "school", + "trunk", + "gravel", + "place_of_worship", + "farm", + "grade1", + "traffic_signals", + "wall", + "garage", + "gate", + "motorway", + "living_street", + "pitch", + "grade4", + "industrial", + "road", + "ground", + "scrub", + "motorway_link", + "steps", + "ditch", + "swimming_pool", + "grade5", + "park", + "apartments", + "restaurant", + "designated", + "bench", + "survey_point", + "pedestrian", + "hedge", + "reservoir", + "riverbank", + "alley", + "farmyard", + "peak", + "level_crossing", + "roof", + "dirt", + "drain", + "garages", + "entrance", + "street_lamp", + "deciduous", + "fuel", + "trunk_link", + "information", + "playground", + "supermarket", + "primary_link", + "concrete", + "mixed", + "permissive", + "orchard", + "grave_yard", + "canal", + "garden", + "spur", + "paving_stones", + "rock", + "bollard", + "convenience", + "cemetery", + "post_box", + "commercial", + "pier", + "bank", + "hotel", + "cliff", + "retail", + "construction", + "-1", + "fast_food", + "coniferous", + "cafe", + "6", + "kindergarten", + "tower", + "hospital", + "yard", + "sand", + "public_building", + "cobblestone", + "destination", + "island", + "abandoned", + "vineyard", + "recycling", + "agricultural", + "isolated_dwelling", + "pharmacy", + "post_office", + "motorway_junction", + "pub", + "allotments", + "dam", + "secondary_link", + "lift_gate", + "siding", + "stop", + "main", + "farm_auxiliary", + "quarry", + "10", + "station", + "platform", + "taxiway", + "limited", + "sports_centre", + "cutline", + "detached", + "storage_tank", + "basin", + "bicycle_parking", + "telephone", + "terrace", + "town", + "suburb", + "bus", + "compacted", + "toilets", + "heath", + "works", + "tram", + "beach", + "culvert", + "fire_station", + "recreation_ground", + "bakery", + "police", + "atm", + "clothes", + "tertiary_link", + "waste_basket", + "attraction", + "viewpoint", + "bicycle", + "church", + "shelter", + "drinking_water", + "marsh", + "picnic_site", + "hairdresser", + "bridleway", + "retaining_wall", + "buffer_stop", + "nature_reserve", + "village_green", + "university", + "1", + "bar", + "townhall", + "mini_roundabout", + "camp_site", + "aerodrome", + "stile", + "9", + "car_repair", + "parking_space", + "library", + "pipeline", + "true", + "cycle_barrier", + "4", + "museum", + "spring", + "hunting_stand", + "disused", + "car", + "tram_stop", + "land", + "fountain", + "hiking", + "manufacture", + "vending_machine", + "kiosk", + "swamp", + "unknown", + "7", + "islet", + "shed", + "switch", + "rapids", + "office", + "bay", + "proposed", + "common", + "weir", + "grassland", + "customers", + "social_facility", + "hangar", + "doctors", + "stadium", + "give_way", + "greenhouse", + "guest_house", + "viaduct", + "doityourself", + "runway", + "bus_station", + "water_tower", + "golf_course", + "conservation", + "block", + "college", + "wastewater_plant", + "subway", + "halt", + "forestry", + "florist", + "butcher" }; public final static int MAX_VALUE = values.length - 1; diff --git a/vtm/src/org/oscim/tiling/source/oscimap4/TileDecoder.java b/vtm/src/org/oscim/tiling/source/oscimap4/TileDecoder.java index 75d7bf46..6d2bb862 100644 --- a/vtm/src/org/oscim/tiling/source/oscimap4/TileDecoder.java +++ b/vtm/src/org/oscim/tiling/source/oscimap4/TileDecoder.java @@ -75,7 +75,7 @@ public class TileDecoder extends PbfDecoder { @Override public boolean decode(Tile tile, ITileDataSink sink, InputStream is, int contentLength) - throws IOException { + throws IOException { int byteCount = readUnsignedInt(is, buffer); //Log.d(TAG, tile + " contentLength:" + byteCount); @@ -210,11 +210,11 @@ public class TileDecoder extends PbfDecoder { // FIXME filter out all variable tags // might depend on theme though if (key == Tag.TAG_KEY_NAME - || key == Tag.KEY_HEIGHT - || key == Tag.KEY_MIN_HEIGHT - || key == Tag.TAG_KEY_HOUSE_NUMBER - || key == Tag.TAG_KEY_REF - || key == Tag.TAG_KEY_ELE) + || key == Tag.KEY_HEIGHT + || key == Tag.KEY_MIN_HEIGHT + || key == Tag.TAG_KEY_HOUSE_NUMBER + || key == Tag.TAG_KEY_REF + || key == Tag.TAG_KEY_ELE) tag = new Tag(key, val, false); else tag = new Tag(key, val, true); @@ -303,7 +303,7 @@ public class TileDecoder extends PbfDecoder { if (cnt != coordCnt) { Log.d(TAG, mTile + " wrong number of coordintes " - + coordCnt + "/" + cnt); + + coordCnt + "/" + cnt); fail = true; } break; @@ -312,7 +312,6 @@ public class TileDecoder extends PbfDecoder { mElem.layer = decodeVarint32(); break; - default: Log.d(TAG, mTile + " invalid type for way: " + tag); } @@ -320,9 +319,9 @@ public class TileDecoder extends PbfDecoder { if (fail || numTags == 0 || numIndices == 0) { Log.d(TAG, mTile + " failed reading way: bytes:" + bytes + " index:" - + (Arrays.toString(index)) + " tag:" - + (mElem.tags.numTags > 0 ? Arrays.deepToString(mElem.tags.tags) : "null") - + " " + numIndices + " " + coordCnt); + + (Arrays.toString(index)) + " tag:" + + (mElem.tags.numTags > 0 ? Arrays.deepToString(mElem.tags.tags) : "null") + + " " + numIndices + " " + coordCnt); return false; } diff --git a/vtm/src/org/oscim/tiling/source/test/TestTileSource.java b/vtm/src/org/oscim/tiling/source/test/TestTileSource.java index 87d032fe..1089f8f9 100644 --- a/vtm/src/org/oscim/tiling/source/test/TestTileSource.java +++ b/vtm/src/org/oscim/tiling/source/test/TestTileSource.java @@ -73,7 +73,7 @@ public class TestTileSource extends TileSource { @Override public QueryResult executeQuery(MapTile tile, - ITileDataSink mapDataSink) { + ITileDataSink mapDataSink) { int size = Tile.SIZE; MapElement e = mElem; diff --git a/vtm/src/org/oscim/utils/FastMath.java b/vtm/src/org/oscim/utils/FastMath.java index d14fee02..22cac181 100644 --- a/vtm/src/org/oscim/utils/FastMath.java +++ b/vtm/src/org/oscim/utils/FastMath.java @@ -17,7 +17,7 @@ package org.oscim.utils; public class FastMath { /** * from http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog - * + * * @param v * ... * @return ... diff --git a/vtm/src/org/oscim/utils/GeometryUtils.java b/vtm/src/org/oscim/utils/GeometryUtils.java index 5035fa00..92a57084 100644 --- a/vtm/src/org/oscim/utils/GeometryUtils.java +++ b/vtm/src/org/oscim/utils/GeometryUtils.java @@ -32,8 +32,8 @@ public final class GeometryUtils { boolean inside = false; for (int i = offset, j = (end - 2); i < end; j = i, i += 2) { if (((vertices[i + 1] > y) != (vertices[j + 1] > y)) && - (x < (vertices[j] - vertices[i]) * (y - vertices[i + 1]) - / (vertices[j + 1] - vertices[i + 1]) + vertices[i])) + (x < (vertices[j] - vertices[i]) * (y - vertices[i + 1]) + / (vertices[j + 1] - vertices[i + 1]) + vertices[i])) inside = !inside; } return inside; diff --git a/vtm/src/org/oscim/utils/Interpolation.java b/vtm/src/org/oscim/utils/Interpolation.java index 2053ac53..1f45fcb7 100644 --- a/vtm/src/org/oscim/utils/Interpolation.java +++ b/vtm/src/org/oscim/utils/Interpolation.java @@ -19,11 +19,11 @@ package org.oscim.utils; /** * Takes a linear value in the range of 0-1 and outputs a (usually) non-linear, * interpolated value. - * + * * @author Nathan Sweet */ public abstract class Interpolation { - /** @param a Alpha value between 0 and 1.*/ + /** @param a Alpha value between 0 and 1. */ abstract public float apply(float a); /** @param a Alpha value between 0 and 1. */ @@ -226,12 +226,12 @@ public abstract class Interpolation { if (a <= 0.5f) { a *= 2; return (float) Math.pow(value, power * (a - 1)) * MathUtils.sin(a * 20) * 1.0955f - / 2; + / 2; } a = 1 - a; a *= 2; return 1 - (float) Math.pow(value, power * (a - 1)) * MathUtils.sin((a) * 20) * 1.0955f - / 2; + / 2; } } diff --git a/vtm/src/org/oscim/utils/LRUCache.java b/vtm/src/org/oscim/utils/LRUCache.java index 9a6aa83b..6f7c46e5 100644 --- a/vtm/src/org/oscim/utils/LRUCache.java +++ b/vtm/src/org/oscim/utils/LRUCache.java @@ -22,7 +22,7 @@ import java.util.Map; * automatically removed from the cache when * new mappings are added. This implementation uses an {@link LinkedHashMap} * internally. - * + * * @param * the type of the map key, see {@link Map}. * @param diff --git a/vtm/src/org/oscim/utils/LineClipper.java b/vtm/src/org/oscim/utils/LineClipper.java index aba3892b..2ce468f9 100644 --- a/vtm/src/org/oscim/utils/LineClipper.java +++ b/vtm/src/org/oscim/utils/LineClipper.java @@ -17,7 +17,7 @@ package org.oscim.utils; /** * from http://en.wikipedia.org/wiki/Cohen%E2%80%93 * Sutherland_algorithm - * + * * @adapted by Hannes Janetzek */ @@ -78,7 +78,8 @@ public class LineClipper { /** * @param x1 ... * @param y1 ... - * @return 0 if not intersection, 1 fully within, -1 clipped (and 'out' set to new points) + * @return 0 if not intersection, 1 fully within, -1 clipped (and 'out' set + * to new points) */ public int clipNext(int x1, int y1) { int accept; @@ -101,7 +102,7 @@ public class LineClipper { accept = 0; } else { accept = clip(mPrevX, mPrevY, x1, y1, xmin, ymin, xmax, ymax, mPrevOutcode, outcode, - this.out) ? -1 : 0; + this.out) ? -1 : 0; } mPrevOutcode = outcode; mPrevX = x1; @@ -114,7 +115,7 @@ public class LineClipper { // P0 = (x0, y0) to P1 = (x1, y1) against a rectangle with // diagonal from (xmin, ymin) to (xmax, ymax). private static boolean clip(int x0, int y0, int x1, int y1, - int xmin, int ymin, int xmax, int ymax, int outcode0, int outcode1, int[] out) { + int xmin, int ymin, int xmax, int ymax, int outcode0, int outcode1, int[] out) { boolean accept = false; diff --git a/vtm/src/org/oscim/utils/MathUtils.java b/vtm/src/org/oscim/utils/MathUtils.java index f7a762fd..6a7a011d 100644 --- a/vtm/src/org/oscim/utils/MathUtils.java +++ b/vtm/src/org/oscim/utils/MathUtils.java @@ -18,10 +18,13 @@ package org.oscim.utils; import java.util.Random; -/** Utility and fast math functions. +/** + * Utility and fast math functions. *

* Thanks to Riven on JavaGaming.org for the basis of sin/cos/atan2/floor/ceil. - * @author Nathan Sweet */ + * + * @author Nathan Sweet + */ public class MathUtils { static public final float nanoToSec = 1 / 1000000000f; @@ -48,9 +51,9 @@ public class MathUtils { static final float[] table = new float[SIN_COUNT]; static { for (int i = 0; i < SIN_COUNT; i++) - table[i] = (float)Math.sin((i + 0.5f) / SIN_COUNT * radFull); + table[i] = (float) Math.sin((i + 0.5f) / SIN_COUNT * radFull); for (int i = 0; i < 360; i += 90) - table[(int)(i * degToIndex) & SIN_MASK] = (float)Math.sin(i * degreesToRadians); + table[(int) (i * degToIndex) & SIN_MASK] = (float) Math.sin(i * degreesToRadians); } } @@ -58,30 +61,30 @@ public class MathUtils { static final float[] table = new float[SIN_COUNT]; static { for (int i = 0; i < SIN_COUNT; i++) - table[i] = (float)Math.cos((i + 0.5f) / SIN_COUNT * radFull); + table[i] = (float) Math.cos((i + 0.5f) / SIN_COUNT * radFull); for (int i = 0; i < 360; i += 90) - table[(int)(i * degToIndex) & SIN_MASK] = (float)Math.cos(i * degreesToRadians); + table[(int) (i * degToIndex) & SIN_MASK] = (float) Math.cos(i * degreesToRadians); } } /** Returns the sine in radians. */ - static public final float sin (float radians) { - return Sin.table[(int)(radians * radToIndex) & SIN_MASK]; + static public final float sin(float radians) { + return Sin.table[(int) (radians * radToIndex) & SIN_MASK]; } /** Returns the cosine in radians. */ - static public final float cos (float radians) { - return Cos.table[(int)(radians * radToIndex) & SIN_MASK]; + static public final float cos(float radians) { + return Cos.table[(int) (radians * radToIndex) & SIN_MASK]; } /** Returns the sine in radians. */ - static public final float sinDeg (float degrees) { - return Sin.table[(int)(degrees * degToIndex) & SIN_MASK]; + static public final float sinDeg(float degrees) { + return Sin.table[(int) (degrees * degToIndex) & SIN_MASK]; } /** Returns the cosine in radians. */ - static public final float cosDeg (float degrees) { - return Cos.table[(int)(degrees * degToIndex) & SIN_MASK]; + static public final float cosDeg(float degrees) { + return Cos.table[(int) (degrees * degToIndex) & SIN_MASK]; } // --- @@ -90,7 +93,7 @@ public class MathUtils { static private final int ATAN2_BITS2 = ATAN2_BITS << 1; static private final int ATAN2_MASK = ~(-1 << ATAN2_BITS2); static private final int ATAN2_COUNT = ATAN2_MASK + 1; - static final int ATAN2_DIM = (int)Math.sqrt(ATAN2_COUNT); + static final int ATAN2_DIM = (int) Math.sqrt(ATAN2_COUNT); static private final float INV_ATAN2_DIM_MINUS_1 = 1.0f / (ATAN2_DIM - 1); static private class Atan2 { @@ -98,16 +101,16 @@ public class MathUtils { static { for (int i = 0; i < ATAN2_DIM; i++) { for (int j = 0; j < ATAN2_DIM; j++) { - float x0 = (float)i / ATAN2_DIM; - float y0 = (float)j / ATAN2_DIM; - table[j * ATAN2_DIM + i] = (float)Math.atan2(y0, x0); + float x0 = (float) i / ATAN2_DIM; + float y0 = (float) j / ATAN2_DIM; + table[j * ATAN2_DIM + i] = (float) Math.atan2(y0, x0); } } } } /** Returns atan2 in radians from a lookup table. */ - static public final float atan2 (float y, float x) { + static public final float atan2(float y, float x) { float add, mul; if (x < 0) { if (y < 0) { @@ -126,8 +129,8 @@ public class MathUtils { add = 0; } float invDiv = 1 / ((x < y ? y : x) * INV_ATAN2_DIM_MINUS_1); - int xi = (int)(x * invDiv); - int yi = (int)(y * invDiv); + int xi = (int) (x * invDiv); + int yi = (int) (y * invDiv); return (Atan2.table[yi * ATAN2_DIM + xi] + add) * mul; } @@ -135,41 +138,51 @@ public class MathUtils { static public Random random = new Random(); - /** Returns a random number between 0 (inclusive) and the specified value (inclusive). */ - static public final int random (int range) { + /** + * Returns a random number between 0 (inclusive) and the specified value + * (inclusive). + */ + static public final int random(int range) { return random.nextInt(range + 1); } /** Returns a random number between start (inclusive) and end (inclusive). */ - static public final int random (int start, int end) { + static public final int random(int start, int end) { return start + random.nextInt(end - start + 1); } /** Returns a random boolean value. */ - static public final boolean randomBoolean () { + static public final boolean randomBoolean() { return random.nextBoolean(); } /** Returns random number between 0.0 (inclusive) and 1.0 (exclusive). */ - static public final float random () { + static public final float random() { return random.nextFloat(); } - /** Returns a random number between 0 (inclusive) and the specified value (exclusive). */ - static public final float random (float range) { + /** + * Returns a random number between 0 (inclusive) and the specified value + * (exclusive). + */ + static public final float random(float range) { return random.nextFloat() * range; } /** Returns a random number between start (inclusive) and end (exclusive). */ - static public final float random (float start, float end) { + static public final float random(float start, float end) { return start + random.nextFloat() * (end - start); } // --- - /** Returns the next power of two. Returns the specified value if the value is already a power of two. */ - static public int nextPowerOfTwo (int value) { - if (value == 0) return 1; + /** + * Returns the next power of two. Returns the specified value if the value + * is already a power of two. + */ + static public int nextPowerOfTwo(int value) { + if (value == 0) + return 1; value--; value |= value >> 1; value |= value >> 2; @@ -179,27 +192,33 @@ public class MathUtils { return value + 1; } - static public boolean isPowerOfTwo (int value) { + static public boolean isPowerOfTwo(int value) { return value != 0 && (value & value - 1) == 0; } // --- - static public int clamp (int value, int min, int max) { - if (value < min) return min; - if (value > max) return max; + static public int clamp(int value, int min, int max) { + if (value < min) + return min; + if (value > max) + return max; return value; } - static public short clamp (short value, short min, short max) { - if (value < min) return min; - if (value > max) return max; + static public short clamp(short value, short min, short max) { + if (value < min) + return min; + if (value > max) + return max; return value; } - static public float clamp (float value, float min, float max) { - if (value < min) return min; - if (value > max) return max; + static public float clamp(float value, float min, float max) { + if (value < min) + return min; + if (value > max) + return max; return value; } @@ -211,38 +230,56 @@ public class MathUtils { static private final double BIG_ENOUGH_CEIL = Double.longBitsToDouble(Double.doubleToLongBits(BIG_ENOUGH_INT + 1) - 1); static private final double BIG_ENOUGH_ROUND = BIG_ENOUGH_INT + 0.5f; - /** Returns the largest integer less than or equal to the specified float. This method will only properly floor floats from - * -(2^14) to (Float.MAX_VALUE - 2^14). */ - static public int floor (float x) { - return (int)(x + BIG_ENOUGH_FLOOR) - BIG_ENOUGH_INT; + /** + * Returns the largest integer less than or equal to the specified float. + * This method will only properly floor floats from + * -(2^14) to (Float.MAX_VALUE - 2^14). + */ + static public int floor(float x) { + return (int) (x + BIG_ENOUGH_FLOOR) - BIG_ENOUGH_INT; } - /** Returns the largest integer less than or equal to the specified float. This method will only properly floor floats that are - * positive. Note this method simply casts the float to int. */ - static public int floorPositive (float x) { - return (int)x; + /** + * Returns the largest integer less than or equal to the specified float. + * This method will only properly floor floats that are + * positive. Note this method simply casts the float to int. + */ + static public int floorPositive(float x) { + return (int) x; } - /** Returns the smallest integer greater than or equal to the specified float. This method will only properly ceil floats from - * -(2^14) to (Float.MAX_VALUE - 2^14). */ - static public int ceil (float x) { - return (int)(x + BIG_ENOUGH_CEIL) - BIG_ENOUGH_INT; + /** + * Returns the smallest integer greater than or equal to the specified + * float. This method will only properly ceil floats from + * -(2^14) to (Float.MAX_VALUE - 2^14). + */ + static public int ceil(float x) { + return (int) (x + BIG_ENOUGH_CEIL) - BIG_ENOUGH_INT; } - /** Returns the smallest integer greater than or equal to the specified float. This method will only properly ceil floats that - * are positive. */ - static public int ceilPositive (float x) { - return (int)(x + CEIL); + /** + * Returns the smallest integer greater than or equal to the specified + * float. This method will only properly ceil floats that + * are positive. + */ + static public int ceilPositive(float x) { + return (int) (x + CEIL); } - /** Returns the closest integer to the specified float. This method will only properly round floats from -(2^14) to - * (Float.MAX_VALUE - 2^14). */ - static public int round (float x) { - return (int)(x + BIG_ENOUGH_ROUND) - BIG_ENOUGH_INT; + /** + * Returns the closest integer to the specified float. This method will only + * properly round floats from -(2^14) to + * (Float.MAX_VALUE - 2^14). + */ + static public int round(float x) { + return (int) (x + BIG_ENOUGH_ROUND) - BIG_ENOUGH_INT; } - /** Returns the closest integer to the specified float. This method will only properly round floats that are positive. */ - static public int roundPositive (float x) { - return (int)(x + 0.5f); + /** + * Returns the closest integer to the specified float. This method will only + * properly round floats that are positive. + */ + static public int roundPositive(float x) { + return (int) (x + 0.5f); } } diff --git a/vtm/src/org/oscim/utils/OBB2D.java b/vtm/src/org/oscim/utils/OBB2D.java index 9bcceb89..11fcfc0b 100644 --- a/vtm/src/org/oscim/utils/OBB2D.java +++ b/vtm/src/org/oscim/utils/OBB2D.java @@ -16,7 +16,7 @@ package org.oscim.utils; /** * from http://www.flipcode.com/archives/2D_OBB_Intersection.shtml - * + * * @author Morgan McGuire morgan@cs.brown.edu * @author Hannes Janetzek */ @@ -134,14 +134,15 @@ public class OBB2D { computeAxes(); } - public void setNormalized(float cx, float cy, float vx, float vy, float width, float height, float dy) { + public void setNormalized(float cx, float cy, float vx, float vy, float width, float height, + float dy) { float ux = -vy; float uy = vx; float hw = width / 2; float hh = height / 2; - if (dy != 0){ + if (dy != 0) { cx += vx * dy + vy * dy; cy += -vy * dy + vx * dy; } diff --git a/vtm/src/org/oscim/utils/PausableThread.java b/vtm/src/org/oscim/utils/PausableThread.java index e84bf02f..0d9c4220 100644 --- a/vtm/src/org/oscim/utils/PausableThread.java +++ b/vtm/src/org/oscim/utils/PausableThread.java @@ -134,7 +134,7 @@ public abstract class PausableThread extends Thread { /** * Called when this thread is not paused and should do its work. - * + * * @throws InterruptedException * if the thread has been interrupted. */ diff --git a/vtm/src/org/oscim/utils/UTF8Decoder.java b/vtm/src/org/oscim/utils/UTF8Decoder.java index 63add61b..59d9ff2e 100644 --- a/vtm/src/org/oscim/utils/UTF8Decoder.java +++ b/vtm/src/org/oscim/utils/UTF8Decoder.java @@ -1,4 +1,3 @@ - package org.oscim.utils; /* @@ -29,7 +28,7 @@ public class UTF8Decoder { public String decode(byte[] data, int offset, int byteCount) { if ((offset | byteCount) < 0 || byteCount > data.length - offset) { throw new IllegalArgumentException("Brrr " + data.length - + " " + offset + " " + byteCount); + + " " + offset + " " + byteCount); } byte[] d = data; @@ -51,7 +50,7 @@ public class UTF8Decoder { int val = b0 & 0xff; v[s++] = (char) val; } else if (((b0 & 0xe0) == 0xc0) || ((b0 & 0xf0) == 0xe0) || - ((b0 & 0xf8) == 0xf0) || ((b0 & 0xfc) == 0xf8) || ((b0 & 0xfe) == 0xfc)) { + ((b0 & 0xf8) == 0xf0) || ((b0 & 0xfc) == 0xf8) || ((b0 & 0xfe) == 0xfc)) { int utfCount = 1; if ((b0 & 0xf0) == 0xe0) utfCount = 2; diff --git a/vtm/src/org/oscim/utils/async/AsyncExecutor.java b/vtm/src/org/oscim/utils/async/AsyncExecutor.java index 575e7c99..54b8a714 100644 --- a/vtm/src/org/oscim/utils/async/AsyncExecutor.java +++ b/vtm/src/org/oscim/utils/async/AsyncExecutor.java @@ -23,25 +23,29 @@ import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; /** - * Allows asnynchronous execution of {@link AsyncTask} instances on a separate thread. - * Needs to be disposed via a call to {@link #dispose()} when no longer used, in which + * Allows asnynchronous execution of {@link AsyncTask} instances on a separate + * thread. + * Needs to be disposed via a call to {@link #dispose()} when no longer used, in + * which * case the executor waits for running tasks to finish. Scheduled but not yet * running tasks will not be executed. + * * @author badlogic - * + * */ public class AsyncExecutor { private final ExecutorService executor; /** - * Creates a new AsynchExecutor that allows maxConcurrent - * {@link Runnable} instances to run in parallel. + * Creates a new AsynchExecutor that allows maxConcurrent {@link Runnable} + * instances to run in parallel. + * * @param maxConcurrent */ public AsyncExecutor(int maxConcurrent) { executor = Executors.newFixedThreadPool(maxConcurrent, new ThreadFactory() { @Override - public Thread newThread (Runnable r) { + public Thread newThread(Runnable r) { Thread thread = new Thread(r, "VtmAsyncExecutor"); thread.setDaemon(true); return thread; @@ -53,13 +57,14 @@ public class AsyncExecutor { * Submits a {@link Runnable} to be executed asynchronously. If * maxConcurrent runnables are already running, the runnable * will be queued. + * * @param task the task to execute asynchronously */ @SuppressWarnings({ "unchecked", "rawtypes" }) public AsyncResult submit(final AsyncTask task) { return new AsyncResult(executor.submit(new Callable() { @Override - public T call () throws Exception { + public T call() throws Exception { task.run(); return task.getResult(); } @@ -70,6 +75,7 @@ public class AsyncExecutor { * Submits a {@link Runnable} to be executed asynchronously. If * maxConcurrent runnables are already running, the runnable * will be queued. + * * @param task the task to execute asynchronously */ public void post(Runnable task) { @@ -81,7 +87,7 @@ public class AsyncExecutor { * then destroys any resources like threads. Can not be used * after this method is called. */ - public void dispose () { + public void dispose() { executor.shutdown(); try { executor.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS); diff --git a/vtm/src/org/oscim/utils/async/AsyncResult.java b/vtm/src/org/oscim/utils/async/AsyncResult.java index fc371566..19920ddb 100644 --- a/vtm/src/org/oscim/utils/async/AsyncResult.java +++ b/vtm/src/org/oscim/utils/async/AsyncResult.java @@ -18,23 +18,30 @@ package org.oscim.utils.async; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; -/** Returned by {@link AsyncExecutor#submit(AsyncTask)}, allows to poll for the result of the asynch workload. - * @author badlogic */ +/** + * Returned by {@link AsyncExecutor#submit(AsyncTask)}, allows to poll for the + * result of the asynch workload. + * + * @author badlogic + */ public class AsyncResult { private final Future future; - AsyncResult (Future future) { + AsyncResult(Future future) { this.future = future; } /** @return whether the {@link AsyncTask} is done */ - public boolean isDone () { + public boolean isDone() { return future.isDone(); } - /** @return waits if necessary for the computation to complete and then returns the result - * @throws GdxRuntimeException if there was an error */ - public T get () { + /** + * @return waits if necessary for the computation to complete and then + * returns the result + * @throws GdxRuntimeException if there was an error + */ + public T get() { try { return future.get(); } catch (InterruptedException ex) { diff --git a/vtm/src/org/oscim/utils/async/AsyncTask.java b/vtm/src/org/oscim/utils/async/AsyncTask.java index 6556132b..6709491f 100644 --- a/vtm/src/org/oscim/utils/async/AsyncTask.java +++ b/vtm/src/org/oscim/utils/async/AsyncTask.java @@ -17,11 +17,14 @@ package org.oscim.utils.async; /** - * Task to be submitted to an {@link AsyncExecutor}, returning a result of type T. + * Task to be submitted to an {@link AsyncExecutor}, returning a result of type + * T. + * * @author badlogic - * + * */ -public interface AsyncTask extends Runnable{ +public interface AsyncTask extends Runnable { public boolean cancel(); + public T getResult() throws Exception; } diff --git a/vtm/src/org/oscim/utils/async/ThreadUtils.java b/vtm/src/org/oscim/utils/async/ThreadUtils.java index 9533878f..5493a269 100644 --- a/vtm/src/org/oscim/utils/async/ThreadUtils.java +++ b/vtm/src/org/oscim/utils/async/ThreadUtils.java @@ -17,7 +17,7 @@ package org.oscim.utils.async; /** * Utilities for threaded programming. - * + * * @author badlogic */ public class ThreadUtils { diff --git a/vtm/src/org/oscim/utils/pool/Inlist.java b/vtm/src/org/oscim/utils/pool/Inlist.java index 97d640e3..99ea61fc 100644 --- a/vtm/src/org/oscim/utils/pool/Inlist.java +++ b/vtm/src/org/oscim/utils/pool/Inlist.java @@ -16,8 +16,9 @@ package org.oscim.utils.pool; /** * Utility class for making poolable objects. - * Instead of using an additional list to hold pool items just extend this class. - * + * Instead of using an additional list to hold pool items just extend this + * class. + * * Also handy for objects that exist in only *one list* at a time. * */ @@ -53,8 +54,7 @@ public class Inlist> { return list; } - - public static > T get(T list, int i){ + public static > T get(T list, int i) { if (i < 0) return null; @@ -67,19 +67,18 @@ public class Inlist> { return null; } -// public static > T insertAt(T list, T item, int i){ -// if (i < 0) -// return null; -// -// while (--i > 0 && list != null) -// list = list.next; -// -// if (i == 0) -// return list; -// -// return null; -// } - + // public static > T insertAt(T list, T item, int i){ + // if (i < 0) + // return null; + // + // while (--i > 0 && list != null) + // list = list.next; + // + // if (i == 0) + // return list; + // + // return null; + // } public static > T push(T list, T item) { item.next = list; @@ -120,8 +119,7 @@ public class Inlist> { if (list == null) throw new IllegalArgumentException("Inlist.prependRelative 'list' is null"); - - if (list == other){ + if (list == other) { item.next = list; return item; } diff --git a/vtm/src/org/oscim/utils/quadtree/QuadTree.java b/vtm/src/org/oscim/utils/quadtree/QuadTree.java index d8bfe19b..24926179 100644 --- a/vtm/src/org/oscim/utils/quadtree/QuadTree.java +++ b/vtm/src/org/oscim/utils/quadtree/QuadTree.java @@ -29,7 +29,7 @@ public class QuadTree { // number of children and grandchildren int refs = 0; - public T get(int i){ + public T get(int i) { switch (i) { case 0: return (child00 != null) ? child00.item : null;