Improve code / xml formatting, #54

This commit is contained in:
Emux 2016-07-12 19:25:33 +03:00
parent e793e8851b
commit 43ca550832
133 changed files with 2803 additions and 2791 deletions

View File

@ -5,98 +5,98 @@ import com.badlogic.gdx.jnigen.BuildTarget.TargetOs;
import com.badlogic.gdx.jnigen.NativeCodeGenerator; import com.badlogic.gdx.jnigen.NativeCodeGenerator;
public class JniBuilder { public class JniBuilder {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String[] headers = { ".", "libtess2/Include" }; String[] headers = {".", "libtess2/Include"};
String[] sources = { String[] sources = {
"gl/utils.c", "gl/utils.c",
"libtess2/Source/bucketalloc.c", "libtess2/Source/bucketalloc.c",
"libtess2/Source/dict.c", "libtess2/Source/dict.c",
"libtess2/Source/geom.c", "libtess2/Source/geom.c",
"libtess2/Source/mesh.c", "libtess2/Source/mesh.c",
"libtess2/Source/priorityq.c", "libtess2/Source/priorityq.c",
"libtess2/Source/sweep.c", "libtess2/Source/sweep.c",
"libtess2/Source/tess.c", "libtess2/Source/tess.c",
}; };
String cflags = " -Wall -std=c99 -O2 -ffast-math"; String cflags = " -Wall -std=c99 -O2 -ffast-math";
cflags += " -DNDEBUG"; /* disable debug in libtess2 */ cflags += " -DNDEBUG"; /* disable debug in libtess2 */
//BuildTarget win32home = BuildTarget //BuildTarget win32home = BuildTarget
// .newDefaultTarget(TargetOs.Windows, false); // .newDefaultTarget(TargetOs.Windows, false);
//win32home.compilerPrefix = ""; //win32home.compilerPrefix = "";
//win32home.buildFileName = "build-windows32home.xml"; //win32home.buildFileName = "build-windows32home.xml";
//win32home.excludeFromMasterBuildFile = true; //win32home.excludeFromMasterBuildFile = true;
//win32home.headerDirs = headers; //win32home.headerDirs = headers;
//win32home.cIncludes = sources; //win32home.cIncludes = sources;
//win32home.cFlags += cflags; //win32home.cFlags += cflags;
//win32home.cppFlags += cflags; //win32home.cppFlags += cflags;
BuildTarget win32 = BuildTarget BuildTarget win32 = BuildTarget
.newDefaultTarget(TargetOs.Windows, false); .newDefaultTarget(TargetOs.Windows, false);
win32.headerDirs = headers; win32.headerDirs = headers;
win32.cIncludes = sources; win32.cIncludes = sources;
win32.cFlags += cflags; win32.cFlags += cflags;
win32.cppFlags += cflags; win32.cppFlags += cflags;
BuildTarget win64 = BuildTarget BuildTarget win64 = BuildTarget
.newDefaultTarget(TargetOs.Windows, true); .newDefaultTarget(TargetOs.Windows, true);
win64.headerDirs = headers; win64.headerDirs = headers;
win64.cIncludes = sources; win64.cIncludes = sources;
win64.cFlags += cflags; win64.cFlags += cflags;
win64.cppFlags += cflags; win64.cppFlags += cflags;
BuildTarget lin32 = BuildTarget BuildTarget lin32 = BuildTarget
.newDefaultTarget(TargetOs.Linux, false); .newDefaultTarget(TargetOs.Linux, false);
lin32.headerDirs = headers; lin32.headerDirs = headers;
lin32.cIncludes = sources; lin32.cIncludes = sources;
lin32.cFlags += cflags; lin32.cFlags += cflags;
lin32.cppFlags += cflags; lin32.cppFlags += cflags;
BuildTarget lin64 = BuildTarget BuildTarget lin64 = BuildTarget
.newDefaultTarget(TargetOs.Linux, true); .newDefaultTarget(TargetOs.Linux, true);
lin64.headerDirs = headers; lin64.headerDirs = headers;
lin64.cIncludes = sources; lin64.cIncludes = sources;
lin64.cFlags += cflags; lin64.cFlags += cflags;
lin64.cppFlags += cflags; lin64.cppFlags += cflags;
BuildTarget mac = BuildTarget BuildTarget mac = BuildTarget
.newDefaultTarget(TargetOs.MacOsX, false); .newDefaultTarget(TargetOs.MacOsX, false);
mac.headerDirs = headers; mac.headerDirs = headers;
mac.cIncludes = sources; mac.cIncludes = sources;
mac.cFlags += cflags; mac.cFlags += cflags;
mac.cppFlags += cflags; mac.cppFlags += cflags;
mac.linkerFlags += " -framework CoreServices -framework Carbon"; mac.linkerFlags += " -framework CoreServices -framework Carbon";
BuildTarget android = BuildTarget BuildTarget android = BuildTarget
.newDefaultTarget(TargetOs.Android, false); .newDefaultTarget(TargetOs.Android, false);
android.headerDirs = headers; android.headerDirs = headers;
android.cIncludes = sources; android.cIncludes = sources;
android.cFlags += cflags; android.cFlags += cflags;
android.cppFlags += cflags; android.cppFlags += cflags;
android.linkerFlags += " -llog"; android.linkerFlags += " -llog";
BuildTarget ios = BuildTarget.newDefaultTarget(TargetOs.IOS, false); BuildTarget ios = BuildTarget.newDefaultTarget(TargetOs.IOS, false);
ios.headerDirs = headers; ios.headerDirs = headers;
ios.cIncludes = sources; ios.cIncludes = sources;
ios.cFlags += cflags; ios.cFlags += cflags;
ios.cppFlags += cflags; ios.cppFlags += cflags;
new NativeCodeGenerator().generate(); new NativeCodeGenerator().generate();
new AntScriptGenerator() new AntScriptGenerator()
.generate(new BuildConfig("vtm-jni"), .generate(new BuildConfig("vtm-jni"),
android, android,
lin64, lin64,
lin32, lin32,
mac, mac,
ios, ios,
//win32home, //win32home,
win32, win32,
win64 win64
); );
// BuildExecutor.executeAnt("jni/build-windows32home.xml", "-v clean"); // BuildExecutor.executeAnt("jni/build-windows32home.xml", "-v clean");
// BuildExecutor.executeAnt("jni/build-linux64.xml", "-v"); // BuildExecutor.executeAnt("jni/build-linux64.xml", "-v");
// BuildExecutor.executeAnt("jni/build.xml", "pack-natives -v"); // BuildExecutor.executeAnt("jni/build.xml", "pack-natives -v");
} }
} }

View File

@ -1,265 +1,277 @@
package org.oscim.utils; package org.oscim.utils;
public class TessJNI { public class TessJNI {
private long inst; private long inst;
public TessJNI() { public TessJNI() {
inst = newTess(0); inst = newTess(0);
} }
public TessJNI(int bucketSize) { public TessJNI(int bucketSize) {
inst = newTess(bucketSize); inst = newTess(bucketSize);
} }
@Override @Override
protected void finalize() { protected void finalize() {
dispose(); dispose();
} }
public void dispose() { public void dispose() {
if (inst != 0) { if (inst != 0) {
freeTess(inst); freeTess(inst);
inst = 0; inst = 0;
} }
} }
protected long instance() { protected long instance() {
return inst; return inst;
} }
/** /**
* See OpenGL Red Book for description of the winding rules * See OpenGL Red Book for description of the winding rules
* http://www.glprogramming.com/red/chapter11.html * http://www.glprogramming.com/red/chapter11.html
*/ */
public static final class WindingRule { public static final class WindingRule {
public static final int ODD = 0; public static final int ODD = 0;
public static final int NONZERO = 1; public static final int NONZERO = 1;
public static final int POSITIVE = 2; public static final int POSITIVE = 2;
public static final int NEGATIVE = 3; public static final int NEGATIVE = 3;
public static final int ABS_GEQ_TWO = 4; public static final int ABS_GEQ_TWO = 4;
} }
public static final class ElementType { public static final class ElementType {
public static final int POLYGONS = 0; public static final int POLYGONS = 0;
public static final int CONNECTED_POLYGONS = 1; public static final int CONNECTED_POLYGONS = 1;
public static final int BOUNDARY_CONTOURS = 2; public static final int BOUNDARY_CONTOURS = 2;
} }
public void addContour2D(float[] points) { public void addContour2D(float[] points) {
addContour2D(points, 0, points.length >> 1); addContour2D(points, 0, points.length >> 1);
} }
public void addContour2D(float[] points, int offset, int length) { public void addContour2D(float[] points, int offset, int length) {
if (length < 6) if (length < 6)
return; return;
if ((length % 2 != 0) || (offset % 2 != 0) || (points.length >> 1) < (offset + length)) if ((length % 2 != 0) || (offset % 2 != 0) || (points.length >> 1) < (offset + length))
throw new IllegalArgumentException("Invalid input: length:" + length throw new IllegalArgumentException("Invalid input: length:" + length
+ ", offset:" + offset + ", offset:" + offset
+ ", points.length:" + points.length); + ", points.length:" + points.length);
addContour(inst, 2, points, 8, offset, length); addContour(inst, 2, points, 8, offset, length);
} }
public void addContour2D(int[] index, float[] contour) { public void addContour2D(int[] index, float[] contour) {
addMultiContour2D(inst, index, contour, 0, index.length); addMultiContour2D(inst, index, contour, 0, index.length);
} }
public void addContour2D(int[] index, float[] contour, int idxStart, int idxEnd) { public void addContour2D(int[] index, float[] contour, int idxStart, int idxEnd) {
addMultiContour2D(inst, index, contour, idxStart, idxEnd); addMultiContour2D(inst, index, contour, idxStart, idxEnd);
} }
public boolean tesselate() { public boolean tesselate() {
return tessContour2D(inst, return tessContour2D(inst,
TessJNI.WindingRule.POSITIVE, TessJNI.WindingRule.POSITIVE,
TessJNI.ElementType.POLYGONS, TessJNI.ElementType.POLYGONS,
3, 2) == 1; 3, 2) == 1;
} }
public boolean tesselate(int windingRule, int elementType) { public boolean tesselate(int windingRule, int elementType) {
return tessContour2D(inst, windingRule, elementType, 3, 2) == 1; return tessContour2D(inst, windingRule, elementType, 3, 2) == 1;
} }
public int getVertexCount() { public int getVertexCount() {
return getVertexCount(inst); return getVertexCount(inst);
} }
public int getElementCount() { public int getElementCount() {
return getElementCount(inst); return getElementCount(inst);
} }
public void getVertices(float[] out, int offset, int length) { public void getVertices(float[] out, int offset, int length) {
getVertices(inst, out, offset, length); getVertices(inst, out, offset, length);
} }
public void getVertices(short[] out, int offset, int length, float scale) { public void getVertices(short[] out, int offset, int length, float scale) {
getVerticesS(inst, out, offset, length, scale); getVerticesS(inst, out, offset, length, scale);
} }
public void getElements(int[] out, int offset, int length) { public void getElements(int[] out, int offset, int length) {
getElements(inst, out, offset, length); getElements(inst, out, offset, length);
} }
public void getElements(short[] out, int offset, int length) { public void getElements(short[] out, int offset, int length) {
getElementsS(inst, out, offset, length); getElementsS(inst, out, offset, length);
} }
public void getVertexIndices(int[] out, int offset, int length) { public void getVertexIndices(int[] out, int offset, int length) {
getVertexIndices(inst, out, offset, length); getVertexIndices(inst, out, offset, length);
} }
public void getElementsWithInputVertexIds(short[] dst, int dstOffset, int offset, int length) { public void getElementsWithInputVertexIds(short[] dst, int dstOffset, int offset, int length) {
getElementsWithInputVertexIds(inst, dst, dstOffset, offset, length); getElementsWithInputVertexIds(inst, dst, dstOffset, offset, length);
} }
// @formatter:off // @formatter:off
/*JNI /*JNI
#include <tesselator.h> #include <tesselator.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
void* heapAlloc( void* userData, unsigned int size ){ void* heapAlloc( void* userData, unsigned int size ){
TESS_NOTUSED( userData ); TESS_NOTUSED( userData );
return malloc( size ); return malloc( size );
} }
void* heapRealloc( void *userData, void* ptr, unsigned int size ){ void* heapRealloc( void *userData, void* ptr, unsigned int size ){
TESS_NOTUSED( userData ); TESS_NOTUSED( userData );
return realloc( ptr, size ); return realloc( ptr, size );
} }
void heapFree( void* userData, void* ptr ){ void heapFree( void* userData, void* ptr ){
TESS_NOTUSED( userData ); TESS_NOTUSED( userData );
free( ptr ); free( ptr );
} }
*/ */
static native long newTess(int size); /* { static native long newTess(int size); /* {
if (size <= 0) if (size <= 0)
return (long)tessNewTess(0); return (long)tessNewTess(0);
if (size > 10) if (size > 10)
size = 10; size = 10;
TESSalloc ma; TESSalloc ma;
memset(&ma, 0, sizeof(ma)); memset(&ma, 0, sizeof(ma));
ma.memalloc = heapAlloc; ma.memalloc = heapAlloc;
ma.memfree = heapFree; ma.memfree = heapFree;
ma.memrealloc = heapRealloc; ma.memrealloc = heapRealloc;
//ma.userData = (void*)&allocated; //ma.userData = (void*)&allocated;
ma.meshEdgeBucketSize = 2 << size; // 512 ma.meshEdgeBucketSize = 2 << size; // 512
ma.meshVertexBucketSize = 2 << size; // 512 ma.meshVertexBucketSize = 2 << size; // 512
ma.meshFaceBucketSize = 1 << size; // 256 ma.meshFaceBucketSize = 1 << size; // 256
ma.dictNodeBucketSize = 2 << size; // 512 ma.dictNodeBucketSize = 2 << size; // 512
ma.regionBucketSize = 1 << size; // 256 ma.regionBucketSize = 1 << size; // 256
ma.extraVertices = 8; ma.extraVertices = 8;
//ma.extraVertices = 256; //ma.extraVertices = 256;
return (long)tessNewTess(&ma); return (long)tessNewTess(&ma);
} */ } */
static native void freeTess(long inst); /* {
tessDeleteTess((TESStesselator*) inst); static native void freeTess(long inst); /* {
} */ tessDeleteTess((TESStesselator*) inst);
/** } */
* Adds a contour to be tesselated.
* The type of the vertex coordinates is assumed to be TESSreal. /**
* * Adds a contour to be tesselated.
* @param tess - pointer to tesselator object. * The type of the vertex coordinates is assumed to be TESSreal.
* @param size - number of coordinates per vertex. Must be 2 or 3. *
* @param pointer - pointer to the first coordinate of the first vertex in the array. * @param tess - pointer to tesselator object.
* @param stride - defines offset in bytes between consecutive vertices. * @param size - number of coordinates per vertex. Must be 2 or 3.
* @param count - number of vertices in contour. * @param pointer - pointer to the first coordinate of the first vertex in the array.
*/ * @param stride - defines offset in bytes between consecutive vertices.
static native void addContour(long inst, int size, float[] contour, int stride, int offset, int count);/* { * @param count - number of vertices in contour.
tessAddContour((TESStesselator*) inst, size, contour + (offset * stride), stride, count); */
} */ static native void addContour(long inst, int size, float[] contour, int stride, int offset, int count);/* {
static native void addMultiContour2D(long inst, int[] index, float[] contour, int idxStart, int idxCount);/* { tessAddContour((TESStesselator*) inst, size, contour + (offset * stride), stride, count);
TESStesselator* tess = (TESStesselator*) inst; } */
int offset = 0;
// start at 0 to get the correct offset in contour.. static native void addMultiContour2D(long inst, int[] index, float[] contour, int idxStart, int idxCount);/* {
for (int i = 0; i < idxStart + idxCount; i++){ TESStesselator* tess = (TESStesselator*) inst;
int len = index[i]; int offset = 0;
if ((len % 2 != 0) || (len < 0)) // start at 0 to get the correct offset in contour..
break; for (int i = 0; i < idxStart + idxCount; i++){
if (len < 6 || i < idxStart) { int len = index[i];
offset += len; if ((len % 2 != 0) || (len < 0))
continue; break;
} if (len < 6 || i < idxStart) {
tessAddContour(tess, 2, contour + offset, 8, len >> 1); offset += len;
offset += len; continue;
} }
} */ tessAddContour(tess, 2, contour + offset, 8, len >> 1);
/** offset += len;
* Tesselate contours. }
* } */
* @param tess - pointer to tesselator object.
* @param windingRule - winding rules used for tesselation, must be one of TessWindingRule. /**
* @param elementType - defines the tesselation result element type, must be one of TessElementType. * Tesselate contours.
* @param polySize - defines maximum vertices per polygons if output is polygons. *
* @param vertexSize - defines the number of coordinates in tesselation result vertex, must be 2 or 3. * @param tess - pointer to tesselator object.
* @param normal - defines the normal of the input contours, of null the normal is calculated automatically. * @param windingRule - winding rules used for tesselation, must be one of TessWindingRule.
* @return 1 if succeed, 0 if failed. * @param elementType - defines the tesselation result element type, must be one of TessElementType.
*/ * @param polySize - defines maximum vertices per polygons if output is polygons.
static native int tessContour2D(long inst, int windingRule, int elementType, int polySize, int vertexSize);/*{ * @param vertexSize - defines the number of coordinates in tesselation result vertex, must be 2 or 3.
return tessTesselate((TESStesselator*) inst, windingRule, elementType, polySize, vertexSize, 0); * @param normal - defines the normal of the input contours, of null the normal is calculated automatically.
} */ * @return 1 if succeed, 0 if failed.
static native int getVertexCount(long inst); /*{ */
return tessGetVertexCount((TESStesselator*) inst); static native int tessContour2D(long inst, int windingRule, int elementType, int polySize, int vertexSize);/*{
}*/ return tessTesselate((TESStesselator*) inst, windingRule, elementType, polySize, vertexSize, 0);
/** } */
* Returns pointer to first coordinate of first vertex.
*/ static native int getVertexCount(long inst); /*{
static native boolean getVertices(long inst, float[] out, int offset, int length);/*{ return tessGetVertexCount((TESStesselator*) inst);
const TESSreal* vertices = tessGetVertices((TESStesselator*) inst); }*/
if (!vertices)
return 0; /**
memcpy(out, vertices + offset, length * sizeof(TESSreal)); * Returns pointer to first coordinate of first vertex.
return 1; */
}*/ static native boolean getVertices(long inst, float[] out, int offset, int length);/*{
/** const TESSreal* vertices = tessGetVertices((TESStesselator*) inst);
* Returns pointer to first coordinate of first vertex. if (!vertices)
*/ return 0;
static native void getVerticesS(long inst, short[] out, int offset, int length, float scale);/*{ memcpy(out, vertices + offset, length * sizeof(TESSreal));
const TESSreal* vertices = tessGetVertices((TESStesselator*) inst); return 1;
for(int i = 0; i < length; i++) }*/
out[i] = (short)(vertices[offset++] * scale + 0.5f);
}*/ /**
/** * Returns pointer to first coordinate of first vertex.
* Returns pointer to first vertex index. */
* static native void getVerticesS(long inst, short[] out, int offset, int length, float scale);/*{
* Vertex indices can be used to map the generated vertices to the original vertices. const TESSreal* vertices = tessGetVertices((TESStesselator*) inst);
* Every point added using tessAddContour() will get a new index starting at 0. for(int i = 0; i < length; i++)
* New vertices generated at the intersections of segments are assigned value TESS_UNDEF. out[i] = (short)(vertices[offset++] * scale + 0.5f);
*/ }*/
static native boolean getVertexIndices(long inst, int[] out, int offset, int length);/* {
const TESSindex* indices = tessGetVertexIndices((TESStesselator*) inst); /**
if (!indices) * Returns pointer to first vertex index.
return 0; * <p/>
memcpy(out, indices + offset, length * sizeof(TESSindex)); * Vertex indices can be used to map the generated vertices to the original vertices.
return 1; * Every point added using tessAddContour() will get a new index starting at 0.
} */ * New vertices generated at the intersections of segments are assigned value TESS_UNDEF.
/** */
* Returns number of elements in the the tesselated output. static native boolean getVertexIndices(long inst, int[] out, int offset, int length);/* {
*/ const TESSindex* indices = tessGetVertexIndices((TESStesselator*) inst);
static native int getElementCount(long inst);/*{ if (!indices)
return tessGetElementCount((TESStesselator*) inst); return 0;
}*/ memcpy(out, indices + offset, length * sizeof(TESSindex));
/** return 1;
* Returns pointer to the first element. } */
*/
static native boolean getElements(long inst, int[] out, int offset, int length);/*{ /**
const TESSindex* elements = tessGetElements((TESStesselator*) inst); * Returns number of elements in the the tesselated output.
if (!elements) */
return 0; static native int getElementCount(long inst);/*{
memcpy(out, elements + offset, length * sizeof(TESSindex)); return tessGetElementCount((TESStesselator*) inst);
return 1; }*/
}*/
/** /**
* Returns pointer to the first element. * Returns pointer to the first element.
*/ */
static native void getElementsS(long inst, short[] out, int offset, int length);/*{ static native boolean getElements(long inst, int[] out, int offset, int length);/*{
const TESSindex* elements = tessGetElements((TESStesselator*) inst); const TESSindex* elements = tessGetElements((TESStesselator*) inst);
for(int i = 0; i < length; i++) if (!elements)
out[i] = (short)elements[offset++]; return 0;
}*/ memcpy(out, elements + offset, length * sizeof(TESSindex));
/** return 1;
* Returns list of triangles indices (or to the first element of convex polygons). }*/
*/
static native void getElementsWithInputVertexIds(long inst, short[] out, int dstOffset, int offset, int length);/*{ /**
const TESSindex* elements = tessGetElements((TESStesselator*) inst); * Returns pointer to the first element.
const TESSindex* indices = tessGetVertexIndices((TESStesselator*) inst); */
for(int i = 0; i < length; i++) static native void getElementsS(long inst, short[] out, int offset, int length);/*{
out[dstOffset++] = (short)(indices[elements[offset++]]); const TESSindex* elements = tessGetElements((TESStesselator*) inst);
}*/ for(int i = 0; i < length; i++)
out[i] = (short)elements[offset++];
}*/
/**
* Returns list of triangles indices (or to the first element of convex polygons).
*/
static native void getElementsWithInputVertexIds(long inst, short[] out, int dstOffset, int offset, int length);/*{
const TESSindex* elements = tessGetElements((TESStesselator*) inst);
const TESSindex* indices = tessGetVertexIndices((TESStesselator*) inst);
for(int i = 0; i < length; i++)
out[dstOffset++] = (short)(indices[elements[offset++]]);
}*/
} }

View File

@ -61,7 +61,7 @@ public class BaseMapActivity extends MapActivity {
} }
mBaseLayer = mMap.setBaseMap(mTileSource); mBaseLayer = mMap.setBaseMap(mTileSource);
/* set initial position on first run */ /* set initial position on first run */
MapPosition pos = new MapPosition(); MapPosition pos = new MapPosition();
mMap.getMapPosition(pos); mMap.getMapPosition(pos);
if (pos.x == 0.5 && pos.y == 0.5) if (pos.x == 0.5 && pos.y == 0.5)

View File

@ -98,8 +98,8 @@ public class BitmapTileMapActivity extends MapActivity {
} else { } else {
//mMapView.map().setMapPosition(p); //mMapView.map().setMapPosition(p);
p.setScale(2 + (1 << (int) (Math.random() * 13))); p.setScale(2 + (1 << (int) (Math.random() * 13)));
// p.setX((p.getX() + (Math.random() * 4 - 2) / p.getScale())); // p.setX((p.getX() + (Math.random() * 4 - 2) / p.getScale()));
// p.setY((p.getY() + (Math.random() * 4 - 2) / p.getScale())); // p.setY((p.getY() + (Math.random() * 4 - 2) / p.getScale()));
p.setX(MercatorProjection.longitudeToX(Math.random() * 180)); p.setX(MercatorProjection.longitudeToX(Math.random() * 180));
p.setY(MercatorProjection.latitudeToY(Math.random() * 60)); p.setY(MercatorProjection.latitudeToY(Math.random() * 60));

View File

@ -62,9 +62,9 @@ public class JeoIndoorMapActivity extends BaseMapActivity {
showToast("load data"); showToast("load data");
InputStream is = null; InputStream is = null;
try { try {
// File file = new File(Environment.getExternalStorageDirectory() // File file = new File(Environment.getExternalStorageDirectory()
// .getAbsolutePath(), "osmindoor.json"); // .getAbsolutePath(), "osmindoor.json");
// is = new FileInputStream(file); // is = new FileInputStream(file);
URL url = new URL(PATH); URL url = new URL(PATH);
URLConnection conn = url.openConnection(); URLConnection conn = url.openConnection();
@ -83,11 +83,11 @@ public class JeoIndoorMapActivity extends BaseMapActivity {
mMap.layers().add(new BuildingLayer(mMap, mBaseLayer)); mMap.layers().add(new BuildingLayer(mMap, mBaseLayer));
mMap.layers().add(new LabelLayer(mMap, mBaseLayer)); mMap.layers().add(new LabelLayer(mMap, mBaseLayer));
// mMap.layers().add(new TileGridLayer(mMap)); // mMap.layers().add(new TileGridLayer(mMap));
// String file = Environment.getExternalStorageDirectory().getAbsolutePath(); // String file = Environment.getExternalStorageDirectory().getAbsolutePath();
// VectorDataset data = (VectorDataset) JeoTest.getJsonData(file + "/states.json", true); // VectorDataset data = (VectorDataset) JeoTest.getJsonData(file + "/states.json", true);
// Style style = JeoTest.getStyle(); // Style style = JeoTest.getStyle();
// mMap.layers().add(new JeoVectorLayer(mMap, data, style)); // mMap.layers().add(new JeoVectorLayer(mMap, data, style));
} }
void loadJson(InputStream is) { void loadJson(InputStream is) {
@ -171,7 +171,7 @@ public class JeoIndoorMapActivity extends BaseMapActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
/* ignore saved position */ /* ignore saved position */
//mMap.setMapPosition(49.417, 8.673, 1 << 17); //mMap.setMapPosition(49.417, 8.673, 1 << 17);
mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16); mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16);
} }

View File

@ -50,7 +50,7 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
/* directly load bitmap from resources */ /* directly load bitmap from resources */
Bitmap bitmap = drawableToBitmap(getResources(), R.drawable.marker_poi); Bitmap bitmap = drawableToBitmap(getResources(), R.drawable.marker_poi);
MarkerSymbol symbol; MarkerSymbol symbol;
@ -59,7 +59,7 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity
else else
symbol = new MarkerSymbol(bitmap, 0.5f, 0.5f, false); symbol = new MarkerSymbol(bitmap, 0.5f, 0.5f, false);
/* another option: use some bitmap drawable */ /* another option: use some bitmap drawable */
Drawable d = getResources().getDrawable(R.drawable.ic_launcher); Drawable d = getResources().getDrawable(R.drawable.ic_launcher);
if (BILLBOARDS) if (BILLBOARDS)
mFocusMarker = new MarkerSymbol(drawableToBitmap(d), mFocusMarker = new MarkerSymbol(drawableToBitmap(d),
@ -91,7 +91,7 @@ public class MarkerOverlayActivity extends BitmapTileMapActivity
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
/* ignore saved position */ /* ignore saved position */
mMap.setMapPosition(0, 0, 1 << 2); mMap.setMapPosition(0, 0, 1 << 2);
} }

View File

@ -70,7 +70,7 @@ public class PathOverlayActivity extends BitmapTileMapActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
/* ignore saved position */ /* ignore saved position */
mMap.setMapPosition(0, 0, 1 << 2); mMap.setMapPosition(0, 0, 1 << 2);
} }

View File

@ -64,7 +64,7 @@ public class S3DBMapActivity extends BaseMapActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
/* ignore saved position */ /* ignore saved position */
mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16); mMap.setMapPosition(53.5620092, 9.9866457, 1 << 16);
} }
} }

View File

@ -69,8 +69,8 @@ public class SimpleMapActivity extends BaseMapActivity {
//mMapView.map().setMapPosition(p); //mMapView.map().setMapPosition(p);
p.setScale(2 + (1 << (int) (Math.random() * 13))); p.setScale(2 + (1 << (int) (Math.random() * 13)));
// p.setX((p.getX() + (Math.random() * 4 - 2) / p.getScale())); // p.setX((p.getX() + (Math.random() * 4 - 2) / p.getScale()));
// p.setY((p.getY() + (Math.random() * 4 - 2) / p.getScale())); // p.setY((p.getY() + (Math.random() * 4 - 2) / p.getScale()));
p.setX(MercatorProjection.longitudeToX(Math.random() * 180)); p.setX(MercatorProjection.longitudeToX(Math.random() * 180));
p.setY(MercatorProjection.latitudeToY(Math.random() * 60)); p.setY(MercatorProjection.latitudeToY(Math.random() * 60));

View File

@ -37,39 +37,39 @@ public class VectorLayerMapActivity extends BaseMapActivity {
VectorLayer vectorLayer = new VectorLayer(mMap); VectorLayer vectorLayer = new VectorLayer(mMap);
// Geometry g = new GeomBuilder() // Geometry g = new GeomBuilder()
// .point(8.8, 53.1) // .point(8.8, 53.1)
// .point() // .point()
// .buffer(1) // .buffer(1)
// .get(); // .get();
// //
// vectorLayer.add(new PolygonDrawable(g, defaultStyle())); // vectorLayer.add(new PolygonDrawable(g, defaultStyle()));
// //
// vectorLayer.add(new PointDrawable(53.1, 8.8, Style.builder() // vectorLayer.add(new PointDrawable(53.1, 8.8, Style.builder()
// .setBuffer(0.5) // .setBuffer(0.5)
// .setFillColor(Color.RED) // .setFillColor(Color.RED)
// .setFillAlpha(0.2) // .setFillAlpha(0.2)
// .build())); // .build()));
// //
// Style.Builder sb = Style.builder() // Style.Builder sb = Style.builder()
// .setBuffer(0.5) // .setBuffer(0.5)
// .setFillColor(Color.RED) // .setFillColor(Color.RED)
// .setFillAlpha(0.2); // .setFillAlpha(0.2);
// //
// Style style = sb.setFillAlpha(0.2).build(); // Style style = sb.setFillAlpha(0.2).build();
// //
// int tileSize = 5; // int tileSize = 5;
// for (int x = -180; x < 180; x += tileSize) { // for (int x = -180; x < 180; x += tileSize) {
// for (int y = -90; y < 90; y += tileSize) { // for (int y = -90; y < 90; y += tileSize) {
// // Style style = sb.setFillAlpha(FastMath.clamp(FastMath.length(x, y) / 180, 0.2, 1)) // // Style style = sb.setFillAlpha(FastMath.clamp(FastMath.length(x, y) / 180, 0.2, 1))
// // .build(); // // .build();
// //
// vectorLayer.add(new RectangleDrawable(FastMath.clamp(y, -85, 85), x, // vectorLayer.add(new RectangleDrawable(FastMath.clamp(y, -85, 85), x,
// FastMath.clamp(y + tileSize - 0.1, -85, 85), // FastMath.clamp(y + tileSize - 0.1, -85, 85),
// x + tileSize - 0.1, style)); // x + tileSize - 0.1, style));
// //
// } // }
// } // }
Style.Builder sb = Style.builder() Style.Builder sb = Style.builder()
.buffer(0.5) .buffer(0.5)

View File

@ -42,8 +42,8 @@ public class MapScaleBar extends Layer implements UpdateListener {
private static final int BITMAP_HEIGHT = 64; private static final int BITMAP_HEIGHT = 64;
private static final int BITMAP_WIDTH = 128; private static final int BITMAP_WIDTH = 128;
private static final double LATITUDE_REDRAW_THRESHOLD = 0.2; private static final double LATITUDE_REDRAW_THRESHOLD = 0.2;
// private static final int MARGIN_BOTTOM = 5; // private static final int MARGIN_BOTTOM = 5;
// private static final int MARGIN_LEFT = 5; // private static final int MARGIN_LEFT = 5;
private static final double METER_FOOT_RATIO = 0.3048; private static final double METER_FOOT_RATIO = 0.3048;
private static final int ONE_KILOMETER = 1000; private static final int ONE_KILOMETER = 1000;

View File

@ -63,13 +63,13 @@ public class MapView extends GLSurfaceView {
public MapView(Context context, AttributeSet attributeSet) { public MapView(Context context, AttributeSet attributeSet) {
super(context, attributeSet); super(context, attributeSet);
/* Not sure if this makes sense */ /* Not sure if this makes sense */
this.setWillNotDraw(true); this.setWillNotDraw(true);
this.setClickable(true); this.setClickable(true);
this.setFocusable(true); this.setFocusable(true);
this.setFocusableInTouchMode(true); this.setFocusableInTouchMode(true);
/* Setup android backedn */ /* Setup android backedn */
AndroidGraphics.init(); AndroidGraphics.init();
AndroidAssets.init(context); AndroidAssets.init(context);
GLAdapter.init(new AndroidGL()); GLAdapter.init(new AndroidGL());
@ -77,10 +77,10 @@ public class MapView extends GLSurfaceView {
DisplayMetrics metrics = getResources().getDisplayMetrics(); DisplayMetrics metrics = getResources().getDisplayMetrics();
CanvasAdapter.dpi = (int) Math.max(metrics.xdpi, metrics.ydpi); CanvasAdapter.dpi = (int) Math.max(metrics.xdpi, metrics.ydpi);
/* Initialize the Map */ /* Initialize the Map */
mMap = new AndroidMap(this); mMap = new AndroidMap(this);
/* Initialize Renderer */ /* Initialize Renderer */
setEGLConfigChooser(new GlConfigChooser()); setEGLConfigChooser(new GlConfigChooser());
setEGLContextClientVersion(2); setEGLContextClientVersion(2);

View File

@ -250,7 +250,7 @@ public class TileCache implements ITileCache {
public synchronized TileReader getTile(Tile tile) { public synchronized TileReader getTile(Tile tile) {
//if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) //if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB)
// return getTileApi11(tile); // return getTileApi11(tile);
mQueryVals[0] = String.valueOf(tile.zoomLevel); mQueryVals[0] = String.valueOf(tile.zoomLevel);
mQueryVals[1] = String.valueOf(tile.tileX); mQueryVals[1] = String.valueOf(tile.tileX);

View File

@ -16,11 +16,11 @@ public class GestureHandler implements OnGestureListener, OnDoubleTapListener {
mMap = map; mMap = map;
} }
/* GesturListener */ /* GesturListener */
@Override @Override
public boolean onSingleTapUp(MotionEvent e) { public boolean onSingleTapUp(MotionEvent e) {
// return mMap.handleGesture(Gesture.TAP, mMotionEvent.wrap(e)); // return mMap.handleGesture(Gesture.TAP, mMotionEvent.wrap(e));
return false; return false;
} }

View File

@ -234,7 +234,7 @@ public class TileDecoder extends PbfDecoder {
// FIXME, remove all tiles from cache then remove this below // FIXME, remove all tiles from cache then remove this below
//if (layer == 0) //if (layer == 0)
// layer = 5; // layer = 5;
mElem.type = polygon ? GeometryType.POLY : GeometryType.LINE; mElem.type = polygon ? GeometryType.POLY : GeometryType.LINE;
mElem.setLayer(layer); mElem.setLayer(layer);
mSink.process(mElem); mSink.process(mElem);

View File

@ -206,7 +206,7 @@ public class Triangulator {
int[] V = new int[n]; int[] V = new int[n];
/* we want a counter-clockwise polygon in V */ /* we want a counter-clockwise polygon in V */
if (0.0f < area(contour)) { if (0.0f < area(contour)) {
for (int v = 0; v < n; v++) for (int v = 0; v < n; v++)
@ -218,7 +218,7 @@ public class Triangulator {
int nv = n; int nv = n;
/* remove nv-2 Vertices, creating 1 triangle every time */ /* remove nv-2 Vertices, creating 1 triangle every time */
int count = 2 * nv; /* error detection */ int count = 2 * nv; /* error detection */
//for (int m = 0, v = nv - 1; nv > 2;) { //for (int m = 0, v = nv - 1; nv > 2;) {
@ -229,7 +229,7 @@ public class Triangulator {
return false; return false;
} }
/* three consecutive vertices in current polygon, <u,v,w> */ /* three consecutive vertices in current polygon, <u,v,w> */
int u = v; int u = v;
if (nv <= u) if (nv <= u)
u = 0; /* previous */ u = 0; /* previous */
@ -243,25 +243,25 @@ public class Triangulator {
if (snip(contour, u, v, w, nv, V)) { if (snip(contour, u, v, w, nv, V)) {
int a, b, c, s, t; int a, b, c, s, t;
/* true names of the vertices */ /* true names of the vertices */
a = V[u]; a = V[u];
b = V[v]; b = V[v];
c = V[w]; c = V[w];
/* output Triangle */ /* output Triangle */
result.add(contour.get(a)); result.add(contour.get(a));
result.add(contour.get(b)); result.add(contour.get(b));
result.add(contour.get(c)); result.add(contour.get(c));
//m++; //m++;
/* remove v from remaining polygon */ /* remove v from remaining polygon */
for (s = v, t = v + 1; t < nv; s++, t++) { for (s = v, t = v + 1; t < nv; s++, t++) {
V[s] = V[t]; V[s] = V[t];
} }
nv--; nv--;
/* resest error detection counter */ /* resest error detection counter */
count = 2 * nv; count = 2 * nv;
} }
} }
@ -355,7 +355,7 @@ public class Triangulator {
// * @param point The point to remove // * @param point The point to remove
// */ // */
//public void remove(Point point) { //public void remove(Point point) {
// points.remove(point); // points.remove(point);
//} //}
/** /**

View File

@ -88,15 +88,15 @@ public class OsmPbfParser extends BinaryParser {
long id = i.getId(); long id = i.getId();
double latf = parseLat(i.getLat()), lonf = parseLon(i.getLon()); double latf = parseLat(i.getLat()), lonf = parseLon(i.getLon());
// if (i.hasInfo()) { // if (i.hasInfo()) {
// Osmformat.Info info = i.getInfo(); // Osmformat.Info info = i.getInfo();
// tmp = new OsmNode(new CommonEntityData(id, info.getVersion(), getDate(info), // tmp = new OsmNode(new CommonEntityData(id, info.getVersion(), getDate(info),
// getUser(info), info.getChangeset(), tags), latf, lonf); // getUser(info), info.getChangeset(), tags), latf, lonf);
// } else { // } else {
tmp = new OsmNode(latf, lonf, tags, id); tmp = new OsmNode(latf, lonf, tags, id);
// tmp = new Node(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE, // tmp = new Node(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE,
// NOCHANGESET, tags), latf, lonf); // NOCHANGESET, tags), latf, lonf);
// } // }
//sink.process(new NodeContainer(tmp)); //sink.process(new NodeContainer(tmp));
mNodeMap.put(Long.valueOf(id), tmp); mNodeMap.put(Long.valueOf(id), tmp);
} }
@ -109,12 +109,12 @@ public class OsmPbfParser extends BinaryParser {
int j = 0; // Index into the keysvals array. int j = 0; // Index into the keysvals array.
// Stuff for dense info // Stuff for dense info
// long lasttimestamp = 0, lastchangeset = 0; // long lasttimestamp = 0, lastchangeset = 0;
// int lastuserSid = 0, lastuid = 0; // int lastuserSid = 0, lastuid = 0;
// DenseInfo di = null; // DenseInfo di = null;
// if (nodes.hasDenseinfo()) { // if (nodes.hasDenseinfo()) {
// di = nodes.getDenseinfo(); // di = nodes.getDenseinfo();
// } // }
for (int i = 0; i < nodes.getIdCount(); i++) { for (int i = 0; i < nodes.getIdCount(); i++) {
OsmNode tmp; OsmNode tmp;
@ -174,10 +174,10 @@ public class OsmPbfParser extends BinaryParser {
for (int j = 0; j < tagCnt; j++) { for (int j = 0; j < tagCnt; j++) {
tags.add(new Tag(getStringById(i.getKeys(j)), getStringById(i.getVals(j)))); tags.add(new Tag(getStringById(i.getKeys(j)), getStringById(i.getVals(j))));
} }
// List<Tag> tags = new ArrayList<Tag>(); // List<Tag> tags = new ArrayList<Tag>();
// for (int j = 0; j < ; j++) { // for (int j = 0; j < ; j++) {
// tags.add(new Tag(getStringById(i.getKeys(j)), getStringById(i.getVals(j)))); // tags.add(new Tag(getStringById(i.getKeys(j)), getStringById(i.getVals(j))));
// } // }
long lastId = 0; long lastId = 0;
List<OsmNode> nodes = new ArrayList<OsmNode>(); List<OsmNode> nodes = new ArrayList<OsmNode>();
@ -196,13 +196,13 @@ public class OsmPbfParser extends BinaryParser {
// long changesetId, Collection<Tag> tags, // long changesetId, Collection<Tag> tags,
// List<WayNode> wayNodes // List<WayNode> wayNodes
OsmWay tmp; OsmWay tmp;
// if (i.hasInfo()) { // if (i.hasInfo()) {
// Osmformat.Info info = i.getInfo(); // Osmformat.Info info = i.getInfo();
// tmp = new Way(new CommonEntityData(id, info.getVersion(), getDate(info), // tmp = new Way(new CommonEntityData(id, info.getVersion(), getDate(info),
// getUser(info), info.getChangeset(), tags), nodes); // getUser(info), info.getChangeset(), tags), nodes);
// } else { // } else {
tmp = new OsmWay(tags, id, nodes); tmp = new OsmWay(tags, id, nodes);
// } // }
mWayMap.put(Long.valueOf(id), tmp); mWayMap.put(Long.valueOf(id), tmp);
@ -225,25 +225,25 @@ public class OsmPbfParser extends BinaryParser {
List<OsmMember> nodes = new ArrayList<OsmMember>(); List<OsmMember> nodes = new ArrayList<OsmMember>();
int memberCnt = i.getMemidsCount(); int memberCnt = i.getMemidsCount();
// for (int j = 0; j < memberCnt; j++) { // for (int j = 0; j < memberCnt; j++) {
// long mid = lastMid + i.getMemids(j); // long mid = lastMid + i.getMemids(j);
// lastMid = mid; // lastMid = mid;
// String role = getStringById(i.getRolesSid(j)); // String role = getStringById(i.getRolesSid(j));
// //
// Osmformat.Relation.MemberType t = i.getTypes(j); // Osmformat.Relation.MemberType t = i.getTypes(j);
// //
// if (t == Osmformat.Relation.MemberType.NODE) { // if (t == Osmformat.Relation.MemberType.NODE) {
// etype = EntityType.Node; // etype = EntityType.Node;
// } else if (t == Osmformat.Relation.MemberType.WAY) { // } else if (t == Osmformat.Relation.MemberType.WAY) {
// etype = EntityType.Way; // etype = EntityType.Way;
// } else if (t == Osmformat.Relation.MemberType.RELATION) { // } else if (t == Osmformat.Relation.MemberType.RELATION) {
// etype = EntityType.Relation; // etype = EntityType.Relation;
// } else { // } else {
// assert false; // TODO; Illegal file? // assert false; // TODO; Illegal file?
// } // }
// //
// nodes.add(new OsmMember(mid, etype, role)); // nodes.add(new OsmMember(mid, etype, role));
// } // }
// long id, int version, TimestampContainer timestampContainer, // long id, int version, TimestampContainer timestampContainer,
// OsmUser user, // OsmUser user,
@ -251,15 +251,15 @@ public class OsmPbfParser extends BinaryParser {
// List<RelationMember> members // List<RelationMember> members
OsmRelation tmp = new OsmRelation(tags, id, memberCnt); OsmRelation tmp = new OsmRelation(tags, id, memberCnt);
// if (i.hasInfo()) { // if (i.hasInfo()) {
// Osmformat.Info info = i.getInfo(); // Osmformat.Info info = i.getInfo();
// tmp = new Relation(new CommonEntityData(id, info.getVersion(), getDate(info), // tmp = new Relation(new CommonEntityData(id, info.getVersion(), getDate(info),
// getUser(info), info.getChangeset(), tags), nodes); // getUser(info), info.getChangeset(), tags), nodes);
// } else { // } else {
// tmp = new Relation(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE, // tmp = new Relation(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE,
// NOCHANGESET, tags), nodes); // NOCHANGESET, tags), nodes);
// } // }
// sink.process(new RelationContainer(tmp)); // sink.process(new RelationContainer(tmp));
} }
} }
@ -294,34 +294,34 @@ public class OsmPbfParser extends BinaryParser {
public OsmData getData() { public OsmData getData() {
// for (Entry<OsmRelation, List<TmpRelation>> entry : relationMembersForRelation // for (Entry<OsmRelation, List<TmpRelation>> entry : relationMembersForRelation
// .entrySet()) { // .entrySet()) {
// //
// OsmRelation relation = entry.getKey(); // OsmRelation relation = entry.getKey();
// //
// for (TmpRelation member : entry.getValue()) { // for (TmpRelation member : entry.getValue()) {
// //
// OsmElement memberObject = null; // OsmElement memberObject = null;
// //
// if ("node".equals(member)) { // if ("node".equals(member)) {
// memberObject = nodesById.get(member.id); // memberObject = nodesById.get(member.id);
// } else if ("way".equals(member)) { // } else if ("way".equals(member)) {
// memberObject = waysById.get(member.id); // memberObject = waysById.get(member.id);
// } else if ("relation".equals(member)) { // } else if ("relation".equals(member)) {
// memberObject = relationsById.get(member.id); // memberObject = relationsById.get(member.id);
// } else { // } else {
// // log("missing relation " + member.id); // // log("missing relation " + member.id);
// continue; // continue;
// } // }
// //
// if (memberObject != null) { // if (memberObject != null) {
// OsmMember ownMember = new OsmMember(member.role, // OsmMember ownMember = new OsmMember(member.role,
// memberObject); // memberObject);
// //
// relation.relationMembers.add(ownMember); // relation.relationMembers.add(ownMember);
// } // }
// } // }
// } // }
// give up references to original collections // give up references to original collections

View File

@ -214,7 +214,7 @@ public class RenderTheme implements IRenderTheme {
//RGB c = r.color(f, CartoCSS.MARKER_FILL, RGB.black); //RGB c = r.color(f, CartoCSS.MARKER_FILL, RGB.black);
//out.println(c); //out.println(c);
//return new RenderInstruction[] { //return new RenderInstruction[] {
// new Caption(color(c), width) // new Caption(color(c), width)
//}; //};
} }

View File

@ -116,10 +116,10 @@ public class JtsPathLayer extends VectorLayer {
public void addGreatCircle(GeoPoint startPoint, GeoPoint endPoint) { public void addGreatCircle(GeoPoint startPoint, GeoPoint endPoint) {
synchronized (mPoints) { synchronized (mPoints) {
/* get the great circle path length in meters */ /* get the great circle path length in meters */
double length = startPoint.distanceTo(endPoint); double length = startPoint.distanceTo(endPoint);
/* add one point for every 100kms of the great circle path */ /* add one point for every 100kms of the great circle path */
int numberOfPoints = (int) (length / 100000); int numberOfPoints = (int) (length / 100000);
addGreatCircle(startPoint, endPoint, numberOfPoints); addGreatCircle(startPoint, endPoint, numberOfPoints);
@ -137,12 +137,12 @@ public class JtsPathLayer extends VectorLayer {
final int numberOfPoints) { final int numberOfPoints) {
/* adapted from page /* adapted from page
* http://compastic.blogspot.co.uk/2011/07/how-to-draw-great-circle-on-map * http://compastic.blogspot.co.uk/2011/07/how-to-draw-great-circle-on-map
* -in.html * -in.html
* which was adapted from page http://maps.forum.nu/gm_flight_path.html */ * which was adapted from page http://maps.forum.nu/gm_flight_path.html */
GeomBuilder gb = new GeomBuilder(); GeomBuilder gb = new GeomBuilder();
/* convert to radians */ /* convert to radians */
double lat1 = startPoint.getLatitude() * Math.PI / 180; double lat1 = startPoint.getLatitude() * Math.PI / 180;
double lon1 = startPoint.getLongitude() * Math.PI / 180; double lon1 = startPoint.getLongitude() * Math.PI / 180;
double lat2 = endPoint.getLatitude() * Math.PI / 180; double lat2 = endPoint.getLatitude() * Math.PI / 180;

View File

@ -88,7 +88,7 @@ public class VectorLayer extends AbstractVectorLayer<Drawable> {
Envelope e = geometry.getEnvelopeInternal(); Envelope e = geometry.getEnvelopeInternal();
Box bbox = new Box(e.getMinX(), e.getMinY(), e.getMaxX(), e.getMaxY()); Box bbox = new Box(e.getMinX(), e.getMinY(), e.getMaxX(), e.getMaxY());
//if ("Point".equals(geometry.getGeometryType())){ //if ("Point".equals(geometry.getGeometryType())){
// bbox. // bbox.
//} //}
bbox.scale(1E6); bbox.scale(1E6);
@ -158,15 +158,15 @@ public class VectorLayer extends AbstractVectorLayer<Drawable> {
if (Double.isNaN(bbox.xmin)) if (Double.isNaN(bbox.xmin))
return; return;
// mEnvelope = new GeomBuilder() // mEnvelope = new GeomBuilder()
// .point(bbox.xmin, bbox.ymin) // .point(bbox.xmin, bbox.ymin)
// .point(bbox.xmin, bbox.ymax) // .point(bbox.xmin, bbox.ymax)
// .point(bbox.xmax, bbox.ymax) // .point(bbox.xmax, bbox.ymax)
// .point(bbox.xmax, bbox.ymin) // .point(bbox.xmax, bbox.ymin)
// .point(bbox.xmin, bbox.ymin) // .point(bbox.xmin, bbox.ymin)
// .toPolygon(); // .toPolygon();
/* reduce lines points min distance */ /* reduce lines points min distance */
mMinX = ((bbox.xmax - bbox.xmin) / mMap.getWidth()); mMinX = ((bbox.xmax - bbox.xmin) / mMap.getWidth());
mMinY = ((bbox.ymax - bbox.ymin) / mMap.getHeight()); mMinY = ((bbox.ymax - bbox.ymin) / mMap.getHeight());
@ -177,7 +177,7 @@ public class VectorLayer extends AbstractVectorLayer<Drawable> {
int level = 0; int level = 0;
Style lastStyle = null; Style lastStyle = null;
/* go through features, find the matching style and draw */ /* go through features, find the matching style and draw */
synchronized (this) { synchronized (this) {
tmpDrawables.clear(); tmpDrawables.clear();
mDrawables.search(bbox, tmpDrawables); mDrawables.search(bbox, tmpDrawables);
@ -294,13 +294,13 @@ public class VectorLayer extends AbstractVectorLayer<Drawable> {
double x = (longitudeToX(px) - pos.x) * scale; double x = (longitudeToX(px) - pos.x) * scale;
double y = (latitudeToY(py) - pos.y) * scale; double y = (latitudeToY(py) - pos.y) * scale;
/* TODO in the next line I was only able to interpolate a function /* TODO in the next line I was only able to interpolate a function
* that makes up for the zoom level. The circle should not grow, it * that makes up for the zoom level. The circle should not grow, it
* should stickto the map. 0.01 / (1 << startLvl) makes it retain * should stickto the map. 0.01 / (1 << startLvl) makes it retain
* its size. Correction? */ * its size. Correction? */
int zoomScale = (1 << style.scalingZoomLevel); int zoomScale = (1 << style.scalingZoomLevel);
/* Keep the circle's size constant in relation to the underlying map */ /* Keep the circle's size constant in relation to the underlying map */
double radius = style.buffer; double radius = style.buffer;
if (pos.scale > zoomScale) if (pos.scale > zoomScale)

View File

@ -41,8 +41,8 @@ public class Style {
* <p/> * <p/>
* <pre> * <pre>
* { * {
* Style style = Style.builder() * Style style = Style.builder()
* .strokeWidth(1f).strokeColor(Color.BLACK).build(); * .strokeWidth(1f).strokeColor(Color.BLACK).build();
* } * }
* </pre> * </pre>
*/ */

View File

@ -66,7 +66,7 @@
<style-text style="italic" fill="#666666" id="street-label-sm-i" k="name" priority="3" size="18" <style-text style="italic" fill="#666666" id="street-label-sm-i" k="name" priority="3" size="18"
stroke="#e4e9cc" stroke-width="1.0" /> stroke="#e4e9cc" stroke-width="1.0" />
<!-- <style-text id="poi-label" k="name" size="16" fill="#000000" stroke="#e8ecd3" stroke-width="0.5" dy="2" dx="2" text-align="center" /> --> <!-- <style-text id="poi-label" k="name" size="16" fill="#000000" stroke="#e8ecd3" stroke-width="0.5" dy="2" dx="2" text-align="center" /> -->
<style-area fill="#afcfa2" id="park" /> <style-area fill="#afcfa2" id="park" />
<style-area id="park-2" src="patterns/park_texture_2.png" /> <style-area id="park-2" src="patterns/park_texture_2.png" />

View File

@ -75,14 +75,14 @@ public class HairLineTest extends GdxMap {
//g.translate(10, 10); //g.translate(10, 10);
//l1.addLine(g); //l1.addLine(g);
// int o = 0; // int o = 0;
// for (int k = 0; k < g.index.length && g.index[k] >= 0; k++) { // for (int k = 0; k < g.index.length && g.index[k] >= 0; k++) {
// //
// for (int j = 0; j < g.index[k];) // for (int j = 0; j < g.index[k];)
// ll.addPoint(g.points[o + j++], g.points[o + j++]); // ll.addPoint(g.points[o + j++], g.points[o + j++]);
// //
// o += g.index[k]; // o += g.index[k];
// } // }
} }
g = new GeometryBuffer(4, 2); g = new GeometryBuffer(4, 2);
g.clear(); g.clear();

View File

@ -63,11 +63,11 @@ public class PathLayerTest extends GdxMapApp {
for (double lon = -180; lon <= 180; lon += 2) { for (double lon = -180; lon <= 180; lon += 2) {
//pts.add(new GeoPoint(lat, lon)); //pts.add(new GeoPoint(lat, lon));
// double longitude = lon + (pos * 180); // double longitude = lon + (pos * 180);
// if (longitude < -180) // if (longitude < -180)
// longitude += 360; // longitude += 360;
// if (longitude > 180) // if (longitude > 180)
// longitude -= 360; // longitude -= 360;
double longitude = lon; double longitude = lon;
double latitude = lat + (pos * 90); double latitude = lat + (pos * 90);

View File

@ -27,9 +27,9 @@ import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
public class TileRenderTest extends GdxMapApp { public class TileRenderTest extends GdxMapApp {
static boolean loadOneTile = true; static boolean loadOneTile = true;
// static int tileX = 34365 >> 2; // static int tileX = 34365 >> 2;
// static int tileY = 21333 >> 2; // static int tileY = 21333 >> 2;
// static byte tileZ = 14; // static byte tileZ = 14;
static int tileX = 68747 >> 3; static int tileX = 68747 >> 3;
static int tileY = 42648 >> 3; static int tileY = 42648 >> 3;
@ -62,7 +62,7 @@ public class TileRenderTest extends GdxMapApp {
tile.node.parent = tile.node; tile.node.parent = tile.node;
tile.node.parent.parent = tile.node; tile.node.parent.parent = tile.node;
/* setup TileSet contatining one tile */ /* setup TileSet contatining one tile */
final TileSet tiles = new TileSet(); final TileSet tiles = new TileSet();
tiles.cnt = 1; tiles.cnt = 1;
tiles.tiles[0] = tile; tiles.tiles[0] = tile;
@ -74,7 +74,7 @@ public class TileRenderTest extends GdxMapApp {
tileManager = new TileManager(mMap, 100); tileManager = new TileManager(mMap, 100);
} }
/* get the loader created by VectorTileLayer ... */ /* get the loader created by VectorTileLayer ... */
final TestTileLoader[] tileLoader = {null}; final TestTileLoader[] tileLoader = {null};
TestVectorTileLayer tileLayer = new TestVectorTileLayer(mMap, tileManager); TestVectorTileLayer tileLayer = new TestVectorTileLayer(mMap, tileManager);
@ -89,7 +89,7 @@ public class TileRenderTest extends GdxMapApp {
//tileLayer.setRenderTheme(theme); //tileLayer.setRenderTheme(theme);
//tileLayer.setRenderTheme(new DebugTheme()); //tileLayer.setRenderTheme(new DebugTheme());
/* need to create the labellayer here to get the tileloaded event */ /* need to create the labellayer here to get the tileloaded event */
LabelLayer labelLayer = new LabelLayer(mMap, tileLayer); LabelLayer labelLayer = new LabelLayer(mMap, tileLayer);
//mMap.layers().add(tileLayer); //mMap.layers().add(tileLayer);
@ -169,7 +169,7 @@ public class TileRenderTest extends GdxMapApp {
@Override @Override
public void onMapEvent(Event event, MapPosition mapPosition) { public void onMapEvent(Event event, MapPosition mapPosition) {
/* ignore map events */ /* ignore map events */
if (event != Map.CLEAR_EVENT) if (event != Map.CLEAR_EVENT)
return; return;

View File

@ -35,19 +35,19 @@ public class VectorLayerTest extends GdxMapApp {
VectorLayer vectorLayer = new VectorLayer(mMap); VectorLayer vectorLayer = new VectorLayer(mMap);
// vectorLayer.add(new PointDrawable(0, 180, Style.builder() // vectorLayer.add(new PointDrawable(0, 180, Style.builder()
// .setBuffer(10) // .setBuffer(10)
// .setFillColor(Color.RED) // .setFillColor(Color.RED)
// .setFillAlpha(0.5) // .setFillAlpha(0.5)
// .build())); // .build()));
// //
// Geometry g = new GeomBuilder() // Geometry g = new GeomBuilder()
// .point(180, 0) // .point(180, 0)
// .point() // .point()
// .buffer(6) // .buffer(6)
// .get(); // .get();
// //
// vectorLayer.add(new PolygonDrawable(g, defaultStyle())); // vectorLayer.add(new PolygonDrawable(g, defaultStyle()));
// //
Style.Builder sb = Style.builder() Style.Builder sb = Style.builder()
@ -55,18 +55,18 @@ public class VectorLayerTest extends GdxMapApp {
.fillColor(Color.RED) .fillColor(Color.RED)
.fillAlpha(0.2); .fillAlpha(0.2);
// int tileSize = 5; // int tileSize = 5;
// for (int x = -180; x < 200; x += tileSize) { // for (int x = -180; x < 200; x += tileSize) {
// for (int y = -90; y < 90; y += tileSize) { // for (int y = -90; y < 90; y += tileSize) {
// // Style style = sb.setFillAlpha(FastMath.clamp(FastMath.length(x, y) / 180, 0.2, 1)) // // Style style = sb.setFillAlpha(FastMath.clamp(FastMath.length(x, y) / 180, 0.2, 1))
// // .build(); // // .build();
// //
// vectorLayer.add(new RectangleDrawable(FastMath.clamp(y, -85, 85), x, // vectorLayer.add(new RectangleDrawable(FastMath.clamp(y, -85, 85), x,
// FastMath.clamp(y + tileSize - 0.1, -85, 85), // FastMath.clamp(y + tileSize - 0.1, -85, 85),
// x + tileSize - 0.1, style)); // x + tileSize - 0.1, style));
// //
// } // }
// } // }
for (int i = 0; i < 1000; i++) { for (int i = 0; i < 1000; i++) {
Style style = sb.buffer(Math.random() * 1) Style style = sb.buffer(Math.random() * 1)

View File

@ -21,24 +21,24 @@ public class GdxModelLayer extends Layer implements Map.UpdateListener {
public GdxModelLayer(Map map) { public GdxModelLayer(Map map) {
super(map); super(map);
// tileLayer.addHook(new TileLoaderProcessHook() { // tileLayer.addHook(new TileLoaderProcessHook() {
// //
// @Override // @Override
// public boolean process(MapTile tile, ElementLayers layers, MapElement element) { // public boolean process(MapTile tile, ElementLayers layers, MapElement element) {
// //
// if (!element.tags.contains(TREE_TAG)) // if (!element.tags.contains(TREE_TAG))
// return false; // return false;
// //
// Poi3DTileData td = get(tile); // Poi3DTileData td = get(tile);
// PointF p = element.getPoint(0); // PointF p = element.getPoint(0);
// SymbolItem s = SymbolItem.pool.get(); // SymbolItem s = SymbolItem.pool.get();
// s.x = p.x; // s.x = p.x;
// s.y = p.y; // s.y = p.y;
// td.symbols.push(s); // td.symbols.push(s);
// //
// return true; // return true;
// } // }
// }); // });
//mTileLayer = tileLayer; //mTileLayer = tileLayer;
mRenderer = g3d = new GdxRenderer3D(mMap); mRenderer = g3d = new GdxRenderer3D(mMap);
@ -57,11 +57,11 @@ public class GdxModelLayer extends Layer implements Map.UpdateListener {
loading = true; loading = true;
} }
// TileSet mTileSet = new TileSet(); // TileSet mTileSet = new TileSet();
// TileSet mPrevTiles = new TileSet(); // TileSet mPrevTiles = new TileSet();
// //
// LinkedHashMap<Tile, Array<SharedModel>> mTileMap = // LinkedHashMap<Tile, Array<SharedModel>> mTileMap =
// new LinkedHashMap<Tile, Array<SharedModel>>(); // new LinkedHashMap<Tile, Array<SharedModel>>();
boolean loading; boolean loading;
Model mModel; Model mModel;
@ -92,14 +92,14 @@ public class GdxModelLayer extends Layer implements Map.UpdateListener {
@Override @Override
public void onMapEvent(Event ev, MapPosition pos) { public void onMapEvent(Event ev, MapPosition pos) {
// if (ev == Map.CLEAR_EVENT) { // if (ev == Map.CLEAR_EVENT) {
// mTileSet = new TileSet(); // mTileSet = new TileSet();
// mPrevTiles = new TileSet(); // mPrevTiles = new TileSet();
// mTileMap = new LinkedHashMap<Tile, Array<SharedModel>>(); // mTileMap = new LinkedHashMap<Tile, Array<SharedModel>>();
// synchronized (g3d) { // synchronized (g3d) {
// g3d.instances.clear(); // g3d.instances.clear();
// } // }
// } // }
// //
if (loading && assets.update()) { if (loading && assets.update()) {
doneLoading(); doneLoading();
@ -122,116 +122,116 @@ public class GdxModelLayer extends Layer implements Map.UpdateListener {
g3d.cam.setMapPosition(x * scale - pos.x, y * scale - pos.y, scale / pos.scale); g3d.cam.setMapPosition(x * scale - pos.x, y * scale - pos.y, scale / pos.scale);
// //
// // log.debug("update"); // // log.debug("update");
// //
// mTileLayer.tileRenderer().getVisibleTiles(mTileSet); // mTileLayer.tileRenderer().getVisibleTiles(mTileSet);
// //
// if (mTileSet.cnt == 0) { // if (mTileSet.cnt == 0) {
// mTileSet.releaseTiles(); // mTileSet.releaseTiles();
// return; // return;
// } // }
// //
// boolean changed = false; // boolean changed = false;
// //
// Array<SharedModel> added = new Array<SharedModel>(); // Array<SharedModel> added = new Array<SharedModel>();
// Array<SharedModel> removed = new Array<SharedModel>(); // Array<SharedModel> removed = new Array<SharedModel>();
// for (int i = 0; i < mTileSet.cnt; i++) { // for (int i = 0; i < mTileSet.cnt; i++) {
// MapTile t = mTileSet.tiles[i]; // MapTile t = mTileSet.tiles[i];
// if (mPrevTiles.contains(t)) // if (mPrevTiles.contains(t))
// continue; // continue;
// //
// Array<SharedModel> instances = new Array<SharedModel>(); // Array<SharedModel> instances = new Array<SharedModel>();
// //
// Poi3DTileData ld = (Poi3DTileData) t.getData(POI_DATA); // Poi3DTileData ld = (Poi3DTileData) t.getData(POI_DATA);
// if (ld == null) // if (ld == null)
// continue; // continue;
// //
// for (SymbolItem it : ld.symbols) { // for (SymbolItem it : ld.symbols) {
// //
// SharedModel inst = new SharedModel(mModel); // SharedModel inst = new SharedModel(mModel);
// inst.userData = it; // inst.userData = it;
// // float r = 0.5f + 0.5f * (float) Math.random(); // // float r = 0.5f + 0.5f * (float) Math.random();
// // float g = 0.5f + 0.5f * (float) Math.random(); // // float g = 0.5f + 0.5f * (float) Math.random();
// // float b = 0.5f + 0.5f * (float) Math.random(); // // float b = 0.5f + 0.5f * (float) Math.random();
// //
// // inst.transform.setTranslation(new Vector3(it.x, it.y, // // inst.transform.setTranslation(new Vector3(it.x, it.y,
// // 10)); // // 10));
// // inst.materials.get(0).set(ColorAttribute.createDiffuse(r, // // inst.materials.get(0).set(ColorAttribute.createDiffuse(r,
// // g, b, 0.8f)); // // g, b, 0.8f));
// instances.add(inst); // instances.add(inst);
// added.add(inst); // added.add(inst);
// } // }
// //
// if (instances.size == 0) // if (instances.size == 0)
// continue; // continue;
// //
// log.debug("add " + t + " " + instances.size); // log.debug("add " + t + " " + instances.size);
// //
// changed = true; // changed = true;
// //
// mTileMap.put(t, instances); // mTileMap.put(t, instances);
// } // }
// //
// for (int i = 0; i < mPrevTiles.cnt; i++) { // for (int i = 0; i < mPrevTiles.cnt; i++) {
// MapTile t = mPrevTiles.tiles[i]; // MapTile t = mPrevTiles.tiles[i];
// if (mTileSet.contains(t)) // if (mTileSet.contains(t))
// continue; // continue;
// //
// Array<SharedModel> instances = mTileMap.get(t); // Array<SharedModel> instances = mTileMap.get(t);
// if (instances == null) // if (instances == null)
// continue; // continue;
// //
// changed = true; // changed = true;
// //
// removed.addAll(instances); // removed.addAll(instances);
// mTileMap.remove(t); // mTileMap.remove(t);
// log.debug("remove " + t); // log.debug("remove " + t);
// } // }
// //
// mPrevTiles.releaseTiles(); // mPrevTiles.releaseTiles();
// //
// int zoom = mTileSet.tiles[0].zoomLevel; // int zoom = mTileSet.tiles[0].zoomLevel;
// //
// TileSet tmp = mPrevTiles; // TileSet tmp = mPrevTiles;
// mPrevTiles = mTileSet; // mPrevTiles = mTileSet;
// mTileSet = tmp; // mTileSet = tmp;
// //
// if (!changed) // if (!changed)
// return; // return;
// //
// // scale aka tree height // // scale aka tree height
// float scale = (float) (1f / (1 << (17 - zoom))) * 8; // float scale = (float) (1f / (1 << (17 - zoom))) * 8;
// //
// double tileX = (pos.x * (Tile.SIZE << zoom)); // double tileX = (pos.x * (Tile.SIZE << zoom));
// double tileY = (pos.y * (Tile.SIZE << zoom)); // double tileY = (pos.y * (Tile.SIZE << zoom));
// //
// synchronized (g3d) { // synchronized (g3d) {
// //
// for (Entry<Tile, Array<SharedModel>> e : mTileMap.entrySet()) { // for (Entry<Tile, Array<SharedModel>> e : mTileMap.entrySet()) {
// Tile t = e.getKey(); // Tile t = e.getKey();
// //
// float dx = (float) (t.tileX * Tile.SIZE - tileX); // float dx = (float) (t.tileX * Tile.SIZE - tileX);
// float dy = (float) (t.tileY * Tile.SIZE - tileY); // float dy = (float) (t.tileY * Tile.SIZE - tileY);
// //
// for (SharedModel inst : e.getValue()) { // for (SharedModel inst : e.getValue()) {
// SymbolItem it = (SymbolItem) inst.userData; // SymbolItem it = (SymbolItem) inst.userData;
// //
// // variable height // // variable height
// float s = scale + (it.x * it.y) % 3; // float s = scale + (it.x * it.y) % 3;
// float r = (it.x * it.y) % 360; // float r = (it.x * it.y) % 360;
// //
// inst.transform.idt(); // inst.transform.idt();
// inst.transform.scale(s, s, s); // inst.transform.scale(s, s, s);
// inst.transform.translate((dx + it.x) / s, (dy + it.y) / s, 0); // inst.transform.translate((dx + it.x) / s, (dy + it.y) / s, 0);
// inst.transform.rotate(0, 0, 1, r); // inst.transform.rotate(0, 0, 1, r);
// //
// // inst.transform.setToTranslationAndScaling((dx + // // inst.transform.setToTranslationAndScaling((dx +
// // it.x), (dy + it.y), // // it.x), (dy + it.y),
// // 0, s, s, s); // // 0, s, s, s);
// //
// } // }
// } // }
} }
} }

View File

@ -138,27 +138,27 @@ public class GdxModelRenderer extends LayerRenderer {
//renderContext.begin(); //renderContext.begin();
// if (shader == null) { // if (shader == null) {
// r = instances.get(0).getRenderable(r); // r = instances.get(0).getRenderable(r);
// DefaultShader.Config c = new DefaultShader.Config(); // DefaultShader.Config c = new DefaultShader.Config();
// c.numBones = 0; // c.numBones = 0;
// c.numDirectionalLights = 1; // c.numDirectionalLights = 1;
// r.environment = lights; // r.environment = lights;
// //
// shader = new DefaultShader(r, c); // shader = new DefaultShader(r, c);
// shader.init(); // shader.init();
// } // }
mBatch.begin(cam); mBatch.begin(cam);
//shader.begin(cam, renderContext); //shader.begin(cam, renderContext);
for (SharedModel instance : instances) { for (SharedModel instance : instances) {
instance.transform.getTranslation(tempVector); instance.transform.getTranslation(tempVector);
//instance.getRenderables(renderables, pool); //instance.getRenderables(renderables, pool);
// if (tempVector.x * tempVector.x + tempVector.y * tempVector.y > sqRadius) // if (tempVector.x * tempVector.x + tempVector.y * tempVector.y > sqRadius)
// continue; // continue;
// tempVector.scl(0.8f, 0.8f, 1); // tempVector.scl(0.8f, 0.8f, 1);
// if (!GeometryUtils.pointInPoly(tempVector.x, tempVector.y, mBox, 8, 0)) // if (!GeometryUtils.pointInPoly(tempVector.x, tempVector.y, mBox, 8, 0))
// continue; // continue;
mBatch.render(instance); mBatch.render(instance);

View File

@ -317,11 +317,11 @@ public class SharedModel implements RenderableProvider {
if (nodePart.invBoneBindTransforms != null) if (nodePart.invBoneBindTransforms != null)
nodePartBones.put(copy, nodePart.invBoneBindTransforms); nodePartBones.put(copy, nodePart.invBoneBindTransforms);
// final int index = materials.indexOf(nodePart.material, false); // final int index = materials.indexOf(nodePart.material, false);
// if (index < 0) // if (index < 0)
// materials.add(copy.material = nodePart.material.copy()); // materials.add(copy.material = nodePart.material.copy());
// else // else
// copy.material = materials.get(index); // copy.material = materials.get(index);
// //
copy.material = nodePart.material; copy.material = nodePart.material;
@ -502,29 +502,29 @@ public class SharedModel implements RenderableProvider {
return null; return null;
} }
// /** @param id The ID of the material to fetch. // /** @param id The ID of the material to fetch.
// * @return The {@link Material} with the specified id, or null if not available. */ // * @return The {@link Material} with the specified id, or null if not available. */
// public Material getMaterial(final String id) { // public Material getMaterial(final String id) {
// return getMaterial(id, true); // return getMaterial(id, true);
// } // }
// //
// /** @param id The ID of the material to fetch. // /** @param id The ID of the material to fetch.
// * @param ignoreCase whether to use case sensitivity when comparing the material id. // * @param ignoreCase whether to use case sensitivity when comparing the material id.
// * @return The {@link Material} with the specified id, or null if not available. */ // * @return The {@link Material} with the specified id, or null if not available. */
// public Material getMaterial(final String id, boolean ignoreCase) { // public Material getMaterial(final String id, boolean ignoreCase) {
// final int n = materials.size; // final int n = materials.size;
// Material material; // Material material;
// if (ignoreCase) { // if (ignoreCase) {
// for (int i = 0; i < n; i++) // for (int i = 0; i < n; i++)
// if ((material = materials.get(i)).id.equalsIgnoreCase(id)) // if ((material = materials.get(i)).id.equalsIgnoreCase(id))
// return material; // return material;
// } else { // } else {
// for (int i = 0; i < n; i++) // for (int i = 0; i < n; i++)
// if ((material = materials.get(i)).id.equals(id)) // if ((material = materials.get(i)).id.equals(id))
// return material; // return material;
// } // }
// return null; // return null;
// } // }
/** /**
* @param id The ID of the node to fetch. * @param id The ID of the node to fetch.

View File

@ -107,7 +107,7 @@ public class CustomRenderer extends LayerRenderer {
GLState.enableVertexArrays(hVertexPosition, -1); GLState.enableVertexArrays(hVertexPosition, -1);
/* apply view and projection matrices */ /* apply view and projection matrices */
// set mvp (tmp) matrix relative to mMapPosition // set mvp (tmp) matrix relative to mMapPosition
// i.e. fixed on the map // i.e. fixed on the map

View File

@ -31,11 +31,11 @@ public class HexagonRenderTest extends GdxMap {
GdxMapApp.run(new HexagonRenderTest(), null, 400); GdxMapApp.run(new HexagonRenderTest(), null, 400);
} }
/* This is an example how to integrate custom OpenGL drawing routines as map /* This is an example how to integrate custom OpenGL drawing routines as map
* overlay * overlay
* *
* based on chapter 2 from: * based on chapter 2 from:
* https://github.com/dalinaum/opengl-es-book-samples/tree/master/Android */ * https://github.com/dalinaum/opengl-es-book-samples/tree/master/Android */
static class HexagonRenderer extends BucketRenderer { static class HexagonRenderer extends BucketRenderer {
@ -65,8 +65,8 @@ public class HexagonRenderTest extends GdxMap {
} }
//if (mZoom != v.pos.zoomLevel) { //if (mZoom != v.pos.zoomLevel) {
// mMapPosition.copy(v.pos); // mMapPosition.copy(v.pos);
// mZoom = v.pos.zoomLevel; // mZoom = v.pos.zoomLevel;
//} //}
} }
@ -105,7 +105,7 @@ public class HexagonRenderTest extends GdxMap {
GLState.enableVertexArrays(hVertexPosition, -1); GLState.enableVertexArrays(hVertexPosition, -1);
/* apply view and projection matrices */ /* apply view and projection matrices */
// set mvp (tmp) matrix relative to mMapPosition // set mvp (tmp) matrix relative to mMapPosition
// i.e. fixed on the map // i.e. fixed on the map
setMatrix(v); setMatrix(v);
@ -123,7 +123,7 @@ public class HexagonRenderTest extends GdxMap {
gl.uniform2f(hCenterPosition, xx * (mCellScale * 1.5f), yy * mCellScale); gl.uniform2f(hCenterPosition, xx * (mCellScale * 1.5f), yy * mCellScale);
//float alpha = 1 + (float) Math.log10(FastMath.clamp( //float alpha = 1 + (float) Math.log10(FastMath.clamp(
// (float) Math.sqrt(xx * xx + yy * yy) / offset_y, 0.0f, 1.0f)) * 2; // (float) Math.sqrt(xx * xx + yy * yy) / offset_y, 0.0f, 1.0f)) * 2;
float alpha = (float) Math.sqrt(xx * xx + yy * yy) / offset_y; float alpha = (float) Math.sqrt(xx * xx + yy * yy) / offset_y;

View File

@ -67,23 +67,23 @@ public class OkHttpEngineTest {
assertThat(response).isEqualTo("TEST RESPONSE"); assertThat(response).isEqualTo("TEST RESPONSE");
} }
// @Test(expected = IOException.class) // @Test(expected = IOException.class)
// public void close_shouldCloseInputStream() throws Exception { // public void close_shouldCloseInputStream() throws Exception {
// engine.sendRequest(new Tile(1, 2, new Integer(3).byteValue())); // engine.sendRequest(new Tile(1, 2, new Integer(3).byteValue()));
// engine.close(); // engine.close();
// // Calling read after the stream is closed should throw an exception. // // Calling read after the stream is closed should throw an exception.
// InputStream responseStream = engine.read(); // InputStream responseStream = engine.read();
// responseStream.read(); // responseStream.read();
// } // }
// //
// @Test(expected = IOException.class) // @Test(expected = IOException.class)
// public void requestCompleted_shouldCloseInputStream() throws Exception { // public void requestCompleted_shouldCloseInputStream() throws Exception {
// engine.sendRequest(new Tile(1, 2, new Integer(3).byteValue())); // engine.sendRequest(new Tile(1, 2, new Integer(3).byteValue()));
// engine.requestCompleted(true); // engine.requestCompleted(true);
// // Calling read after the stream is closed should throw an exception. // // Calling read after the stream is closed should throw an exception.
// InputStream responseStream = engine.read(); // InputStream responseStream = engine.read();
// responseStream.read(); // responseStream.read();
// } // }
@Test @Test
public void requestCompleted_shouldReturnValueGiven() throws Exception { public void requestCompleted_shouldReturnValueGiven() throws Exception {

View File

@ -51,7 +51,7 @@ public class KeyMapTest {
Assert.assertTrue(it == it2); Assert.assertTrue(it == it2);
} }
/* replace the items with itself */ /* replace the items with itself */
for (Item it : items) { for (Item it : items) {
Item it2 = map2.put(it); Item it2 = map2.put(it);
Assert.assertTrue(it == it2); Assert.assertTrue(it == it2);

View File

@ -41,9 +41,9 @@ public class RTreeTest {
@Override @Override
public String toString() { public String toString() {
// return val + "/" // return val + "/"
// + Arrays.toString(min) + "/" // + Arrays.toString(min) + "/"
// + Arrays.toString(max); // + Arrays.toString(max);
return String.valueOf(val); return String.valueOf(val);
} }
} }
@ -82,8 +82,8 @@ public class RTreeTest {
min[0] = 0; min[0] = 0;
min[1] = 0; min[1] = 0;
// max[0] = 4; // max[0] = 4;
// max[1] = 4; // max[1] = 4;
final ArrayList<Item> results = new ArrayList<Item>(); final ArrayList<Item> results = new ArrayList<Item>();
@ -146,14 +146,14 @@ public class RTreeTest {
assertEquals(results.size(), numItems); assertEquals(results.size(), numItems);
// for (int i = 999; i >= 0; i--) { // for (int i = 999; i >= 0; i--) {
// Item it = results.remove(i); // Item it = results.remove(i);
// boolean removed = t.remove(it.min, it.max, it); // boolean removed = t.remove(it.min, it.max, it);
// //out.println("REMOVED: " + it + " " + removed); // //out.println("REMOVED: " + it + " " + removed);
// //
// Assert.assertEquals(i, t.count()); // Assert.assertEquals(i, t.count());
// } // }
// Assert.assertEquals(0, t.count()); // Assert.assertEquals(0, t.count());
} }
@Test @Test
@ -189,14 +189,14 @@ public class RTreeTest {
assertEquals(numItems, results.size()); assertEquals(numItems, results.size());
// for (int i = 999; i >= 0; i--) { // for (int i = 999; i >= 0; i--) {
// Item it = results.remove(i); // Item it = results.remove(i);
// boolean removed = t.remove(it.min, it.max, it); // boolean removed = t.remove(it.min, it.max, it);
// //out.println("REMOVED: " + it + " " + removed); // //out.println("REMOVED: " + it + " " + removed);
// //
// Assert.assertEquals(i, t.count()); // Assert.assertEquals(i, t.count());
// } // }
// Assert.assertEquals(0, t.count()); // Assert.assertEquals(0, t.count());
} }
@Test @Test
@ -220,22 +220,22 @@ public class RTreeTest {
Assert.assertEquals(10000, t.size()); Assert.assertEquals(10000, t.size());
/*SearchCb<RTreeTest.Item> cb = new SearchCb<RTreeTest.Item>() { /*SearchCb<RTreeTest.Item> cb = new SearchCb<RTreeTest.Item>() {
@Override @Override
public boolean call(Item item, Object context) { public boolean call(Item item, Object context) {
//out.println("found: " + item); //out.println("found: " + item);
//results.add(item); //results.add(item);
return true; return true;
} }
}; };
int counter = 0; int counter = 0;
for (int i = 0; i < 10000; i++) { for (int i = 0; i < 10000; i++) {
counter += t.search(min, max, cb, null); counter += t.search(min, max, cb, null);
} }
System.out.println("found: " + counter);*/ System.out.println("found: " + counter);*/
} }
@Test @Test

View File

@ -23,14 +23,14 @@ public class InlistTest {
list.push(new Thing(4)); list.push(new Thing(4));
list.push(new Thing(5)); list.push(new Thing(5));
/* iterate items */ /* iterate items */
int i = 5; int i = 5;
for (Thing it : list) for (Thing it : list)
assertEquals(it.value, i--); assertEquals(it.value, i--);
assertEquals(i, 0); assertEquals(i, 0);
/* iterate with insertion order */ /* iterate with insertion order */
list.reverse(); list.reverse();
i = 1; i = 1;
for (Thing it : list) for (Thing it : list)
@ -42,7 +42,7 @@ public class InlistTest {
List<Thing> list2 = new List<Thing>(); List<Thing> list2 = new List<Thing>();
/* pop list and append to list2 */ /* pop list and append to list2 */
for (int j = 5; j > 0; j--) { for (int j = 5; j > 0; j--) {
Thing t = list.pop(); Thing t = list.pop();
assertEquals(t.value, j); assertEquals(t.value, j);
@ -51,7 +51,7 @@ public class InlistTest {
list2.append(t); list2.append(t);
} }
/* check nothing to iterate */ /* check nothing to iterate */
for (Thing t : list) for (Thing t : list)
assert (t == null && t != null); assert (t == null && t != null);
@ -60,7 +60,7 @@ public class InlistTest {
list.push(new Thing(6)); list.push(new Thing(6));
/* move items from list2 to list */ /* move items from list2 to list */
list.appendList(list2.clear()); list.appendList(list2.clear());
assertNull(list2.head()); assertNull(list2.head());

View File

@ -65,10 +65,10 @@ public class GwtLauncher extends GwtApplication {
private static native int getWindowWidth() /*-{ private static native int getWindowWidth() /*-{
return $wnd.innerWidth; return $wnd.innerWidth;
}-*/; }-*/;
private static native int getWindowHeight() /*-{ private static native int getWindowHeight() /*-{
return $wnd.innerHeight; return $wnd.innerHeight;
}-*/; }-*/;
} }

View File

@ -103,31 +103,31 @@ public class SearchBox {
public final native String getId() public final native String getId()
/*-{ /*-{
return this.osm_id; return this.osm_id;
}-*/; }-*/;
public final native String name() /*-{ public final native String name() /*-{
return this.display_name; return this.display_name;
}-*/; }-*/;
public final native BBox getBBox() /*-{ public final native BBox getBBox() /*-{
return this.boundingbox return this.boundingbox
}-*/; }-*/;
public final native String getWkt() /*-{ public final native String getWkt() /*-{
return this.geotext; return this.geotext;
}-*/; }-*/;
private final native String latitude() /*-{ private final native String latitude() /*-{
return this.lat; return this.lat;
}-*/; }-*/;
private final native String longitude() /*-{ private final native String longitude() /*-{
return this.lon; return this.lon;
}-*/; }-*/;
public final native String getIcon() /*-{ public final native String getIcon() /*-{
return this.icon; return this.icon;
}-*/; }-*/;
@Override @Override
public double getLatitude() { public double getLatitude() {
@ -248,7 +248,7 @@ public class SearchBox {
mOverlay.clearPath(); mOverlay.clearPath();
//log.debug("selected " + d.getName() + " " + d.getLatitude() + " " //log.debug("selected " + d.getName() + " " + d.getLatitude() + " "
// + d.getLongitude()); // + d.getLongitude());
BoundingBox b = d.getBoundingBox(); BoundingBox b = d.getBoundingBox();
if (b != null) { if (b != null) {

View File

@ -220,21 +220,21 @@ public class WKTReader {
return neg ? -val : val; return neg ? -val : val;
} }
// public static void main(String[] args) { // public static void main(String[] args) {
// WKTReader r = new WKTReader(); // WKTReader r = new WKTReader();
// GeometryBuffer geom = new GeometryBuffer(10, 10); // GeometryBuffer geom = new GeometryBuffer(10, 10);
// try { // try {
// String wkt = "MULTIPOINT(0 0,1 0)"; // String wkt = "MULTIPOINT(0 0,1 0)";
// r.parse(wkt, geom); // r.parse(wkt, geom);
// for (int i = 0; i < geom.index.length; i++) { // for (int i = 0; i < geom.index.length; i++) {
// int len = geom.index[i]; // int len = geom.index[i];
// if (len < 0) // if (len < 0)
// break; // break;
// for (int p = 0; p < len; p += 2) // for (int p = 0; p < len; p += 2)
// System.out.println(len + ": " + geom.points[p] + "," + geom.points[p + 1]); // System.out.println(len + ": " + geom.points[p] + "," + geom.points[p + 1]);
// } // }
// } catch (Exception e) { // } catch (Exception e) {
// e.printStackTrace(); // e.printStackTrace();
// } // }
// } // }
} }

View File

@ -1,106 +1,106 @@
.header { .header {
background-color: #ddd; background-color: #ddd;
text-align: center; text-align: center;
} }
html,body { html,body {
height: 100%; height: 100%;
width: 100%; width: 100%;
margin: 0 0 0 0; margin: 0 0 0 0;
font-family: Arial, "MS Trebuchet", sans-serif; font-family: Arial, "MS Trebuchet", sans-serif;
} }
#credits { #credits {
position: absolute; position: absolute;
bottom: 0.2em; bottom: 0.2em;
right: 0.2em; right: 0.2em;
z-index: 20000; z-index: 20000;
color: white; color: white;
background-color: #000; background-color: #000;
opacity: 0.5; opacity: 0.5;
padding: 0.2em 0.5em 0.2em 0.5em; padding: 0.2em 0.5em 0.2em 0.5em;
-moz-border-radius: 3px; -moz-border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
border-radius: 3px; border-radius: 3px;
font-size: 11px; font-size: 11px;
} }
#credits a { #credits a {
color: white; color: white;
text-decoration: none; text-decoration: none;
font-variant: small-caps; font-variant: small-caps;
} }
#search { #search {
z-index: 20000; z-index: 20000;
position: absolute; position: absolute;
top: 0.5em; top: 0.5em;
left: 0.5em; left: 0.5em;
background-color: rgba(0, 0, 0, 0.8); background-color: rgba(0, 0, 0, 0.8);
-moz-border-radius: 3px; -moz-border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
border-radius: 3px; border-radius: 3px;
visibility: hidden; visibility: hidden;
} }
#listContainer { #listContainer {
color: #FFFFFF; color: #FFFFFF;
} }
#nameFieldContainer,.gwt-TextBox { #nameFieldContainer,.gwt-TextBox {
width: 250px; width: 250px;
} }
/* Turn on a 16x16 scrollbar */ /* Turn on a 16x16 scrollbar */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 10px; width: 10px;
height: 0px; height: 0px;
} }
/* Turn on single button up on top, and down on bottom */ /* Turn on single button up on top, and down on bottom */
::-webkit-scrollbar-button:start:decrement,::-webkit-scrollbar-button:end:increment ::-webkit-scrollbar-button:start:decrement,::-webkit-scrollbar-button:end:increment
{ {
display: block; display: block;
} }
/* Turn off the down area up on top, and up area on bottom */ /* Turn off the down area up on top, and up area on bottom */
::-webkit-scrollbar-button:vertical:start:increment,::-webkit-scrollbar-button:vertical:end:decrement ::-webkit-scrollbar-button:vertical:start:increment,::-webkit-scrollbar-button:vertical:end:decrement
{ {
display: none; display: none;
} }
/* Place The scroll down button at the bottom */ /* Place The scroll down button at the bottom */
::-webkit-scrollbar-button:end:increment { ::-webkit-scrollbar-button:end:increment {
/*background-image: url(images/scroll_cntrl_dwn.png);*/ /*background-image: url(images/scroll_cntrl_dwn.png);*/
} }
/* Place The scroll up button at the up */ /* Place The scroll up button at the up */
::-webkit-scrollbar-button:start:decrement { ::-webkit-scrollbar-button:start:decrement {
/*background-image: url(images/scroll_cntrl_up.png);*/ /*background-image: url(images/scroll_cntrl_up.png);*/
} }
/* Top area above thumb and below up button */ /* Top area above thumb and below up button */
::-webkit-scrollbar-track-piece:vertical:start { ::-webkit-scrollbar-track-piece:vertical:start {
/*background-image: url(images/scroll_gutter_top.png), url(images/scroll_gutter_mid.png); /*background-image: url(images/scroll_gutter_top.png), url(images/scroll_gutter_mid.png);
background-repeat: no-repeat, repeat-y;*/ background-repeat: no-repeat, repeat-y;*/
} }
/* Bottom area below thumb and down button */ /* Bottom area below thumb and down button */
::-webkit-scrollbar-track-piece:vertical:end { ::-webkit-scrollbar-track-piece:vertical:end {
/*background-image: url(images/scroll_gutter_btm.png), url(images/scroll_gutter_mid.png); /*background-image: url(images/scroll_gutter_btm.png), url(images/scroll_gutter_mid.png);
background-repeat: no-repeat, repeat-y; background-repeat: no-repeat, repeat-y;
background-position: bottom left, 0 0;*/ background-position: bottom left, 0 0;*/
} }
/* The thumb itself */ /* The thumb itself */
::-webkit-scrollbar-thumb:vertical { ::-webkit-scrollbar-thumb:vertical {
height: 56px; height: 56px;
width: 12px; width: 12px;
/* -webkit-border-image: url(images/scroll_thumb.png) 8 0 8 0 stretch stretch;*/ /* -webkit-border-image: url(images/scroll_thumb.png) 8 0 8 0 stretch stretch;*/
background-color: #DDDDDD; background-color: #DDDDDD;
opacity: 0.5; opacity: 0.5;
} }

View File

@ -16,15 +16,15 @@
<link rel="stylesheet" type="text/css" href="default.css"> <link rel="stylesheet" type="text/css" href="default.css">
<script type="text/javascript"> <script type="text/javascript">
var mapconfig = { var mapconfig = {
tilesource : "oscimap4", tilesource : "oscimap4",
tileurl : "http://opensciencemap.org/tiles/vtm", tileurl : "http://opensciencemap.org/tiles/vtm",
zoom : 2, zoom : 2,
latitude : 0.0, latitude : 0.0,
longitude : 0.0, longitude : 0.0,
tileSize : 400 tileSize : 400
} }
//background : "naturalearth" //background : "naturalearth"
</script> </script>
@ -43,19 +43,19 @@
</div> </div>
<script type="text/Javascript"> <script type="text/Javascript">
function canvasResize() { function canvasResize() {
div = document.getElementById('canvas-area') div = document.getElementById('canvas-area')
canvas = document.getElementById('map-canvas') canvas = document.getElementById('map-canvas')
var w = div.scrollWidth; var w = div.scrollWidth;
var h = div.scrollHeight; var h = div.scrollHeight;
//console.log(div.clientHeight + " " + div.clientWidth) //console.log(div.clientHeight + " " + div.clientWidth)
canvas.width = w; canvas.width = w;
canvas.height = h; canvas.height = h;
canvas.style.width = w + 'px'; canvas.style.width = w + 'px';
canvas.style.height = h + 'px'; canvas.style.height = h + 'px';
} }
canvasResize(); canvasResize();
window.addEventListener('resize', canvasResize, false); window.addEventListener('resize', canvasResize, false);
</script> </script>
<script type="text/javascript" src="VtmWebApp/js/_tessellate.js"></script> <script type="text/javascript" src="VtmWebApp/js/_tessellate.js"></script>

View File

@ -75,10 +75,10 @@ public class GwtLauncher extends GwtApplication {
private static native int getWindowWidth() /*-{ private static native int getWindowWidth() /*-{
return $wnd.innerWidth; return $wnd.innerWidth;
}-*/; }-*/;
private static native int getWindowHeight() /*-{ private static native int getWindowHeight() /*-{
return $wnd.innerHeight; return $wnd.innerHeight;
}-*/; }-*/;
} }

View File

@ -66,7 +66,7 @@ public class GwtMap extends GdxMap {
private final native void createLayersN()/*-{ private final native void createLayersN()/*-{
$wnd.createLayers(); $wnd.createLayers();
}-*/; }-*/;
@Override @Override
protected void createLayers() { protected void createLayers() {

View File

@ -15,8 +15,8 @@ public class JsBitmapTileLayer extends BitmapTileLayer implements ExportOverlay<
super(map, tileSource); super(map, tileSource);
} }
// @ExportConstructor // @ExportConstructor
// public static BitmapTileLayer constructor(Map map, TileSource tileSource) { // public static BitmapTileLayer constructor(Map map, TileSource tileSource) {
// return new JsBitmapTileLayer(map, tileSource); // return new JsBitmapTileLayer(map, tileSource);
// } // }
} }

View File

@ -19,9 +19,9 @@ public class JsBitmapTileSource extends BitmapTileSource implements
public ITileDataSource getDataSource() { public ITileDataSource getDataSource() {
return null; return null;
} }
// @ExportConstructor // @ExportConstructor
// public static BitmapTileSource constructor(String url, int zoomMin, int zoomMax) { // public static BitmapTileSource constructor(String url, int zoomMin, int zoomMax) {
// return new JsBitmapTileSource(url, zoomMin, zoomMax); // return new JsBitmapTileSource(url, zoomMin, zoomMax);
// } // }
} }

View File

@ -53,7 +53,7 @@ public class JsMap implements Exportable {
mMap = map; mMap = map;
} }
// @ExportInstanceMethod("foo") // @ExportInstanceMethod("foo")
// public static String instanceMethod(Map instance, String surname) { // public static String instanceMethod(Map instance, String surname) {
// return instance.getName() + "-" + surname; // return instance.getName() + "-" + surname;
// } // }

View File

@ -122,8 +122,8 @@ public class JsOverlays implements Exportable {
} }
} }
// @ExportPackage("vtm") // @ExportPackage("vtm")
// @Export("Viewport") // @Export("Viewport")
// public interface XViewport extends ExportOverlay // public interface XViewport extends ExportOverlay
// //
} }

View File

@ -1,102 +1,102 @@
.header { .header {
background-color: #ddd; background-color: #ddd;
text-align: center; text-align: center;
} }
html,body { html,body {
height: 100%; height: 100%;
width: 100%; width: 100%;
margin: 0 0 0 0; margin: 0 0 0 0;
font-family: Arial, "MS Trebuchet", sans-serif; font-family: Arial, "MS Trebuchet", sans-serif;
} }
#credits { #credits {
position: absolute; position: absolute;
bottom: 0.2em; bottom: 0.2em;
right: 0.2em; right: 0.2em;
z-index: 20000; z-index: 20000;
color: white; color: white;
background-color: #000; background-color: #000;
opacity: 0.5; opacity: 0.5;
padding: 0.2em 0.5em 0.2em 0.5em; padding: 0.2em 0.5em 0.2em 0.5em;
-moz-border-radius: 3px; -moz-border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
border-radius: 3px; border-radius: 3px;
font-size: 11px; font-size: 11px;
} }
#credits a { #credits a {
color: white; color: white;
text-decoration: none; text-decoration: none;
font-variant: small-caps; font-variant: small-caps;
} }
#search { #search {
z-index: 20000; z-index: 20000;
position: absolute; position: absolute;
top: 0.5em; top: 0.5em;
left: 0.5em; left: 0.5em;
background-color: rgba(0, 0, 0, 0.8); background-color: rgba(0, 0, 0, 0.8);
-moz-border-radius: 3px; -moz-border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
border-radius: 3px; border-radius: 3px;
visibility: hidden; visibility: hidden;
} }
#listContainer { #listContainer {
color: #FFFFFF; color: #FFFFFF;
} }
#nameFieldContainer,.gwt-TextBox { #nameFieldContainer,.gwt-TextBox {
width: 250px; width: 250px;
} }
/* Turn on a 16x16 scrollbar */ /* Turn on a 16x16 scrollbar */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 10px; width: 10px;
height: 0px; height: 0px;
} }
/* Turn on single button up on top, and down on bottom */ /* Turn on single button up on top, and down on bottom */
::-webkit-scrollbar-button:start:decrement,::-webkit-scrollbar-button:end:increment ::-webkit-scrollbar-button:start:decrement,::-webkit-scrollbar-button:end:increment
{ {
display: block; display: block;
} }
/* Turn off the down area up on top, and up area on bottom */ /* Turn off the down area up on top, and up area on bottom */
::-webkit-scrollbar-button:vertical:start:increment,::-webkit-scrollbar-button:vertical:end:decrement ::-webkit-scrollbar-button:vertical:start:increment,::-webkit-scrollbar-button:vertical:end:decrement
{ {
display: none; display: none;
} }
/* Place The scroll down button at the bottom */ /* Place The scroll down button at the bottom */
::-webkit-scrollbar-button:end:increment { ::-webkit-scrollbar-button:end:increment {
/*background-image: url(images/scroll_cntrl_dwn.png);*/ /*background-image: url(images/scroll_cntrl_dwn.png);*/
} }
/* Place The scroll up button at the up */ /* Place The scroll up button at the up */
::-webkit-scrollbar-button:start:decrement { ::-webkit-scrollbar-button:start:decrement {
/*background-image: url(images/scroll_cntrl_up.png);*/ /*background-image: url(images/scroll_cntrl_up.png);*/
} }
/* Top area above thumb and below up button */ /* Top area above thumb and below up button */
::-webkit-scrollbar-track-piece:vertical:start { ::-webkit-scrollbar-track-piece:vertical:start {
/*background-image: url(images/scroll_gutter_top.png), url(images/scroll_gutter_mid.png); /*background-image: url(images/scroll_gutter_top.png), url(images/scroll_gutter_mid.png);
background-repeat: no-repeat, repeat-y;*/ background-repeat: no-repeat, repeat-y;*/
} }
/* Bottom area below thumb and down button */ /* Bottom area below thumb and down button */
::-webkit-scrollbar-track-piece:vertical:end { ::-webkit-scrollbar-track-piece:vertical:end {
/*background-image: url(images/scroll_gutter_btm.png), url(images/scroll_gutter_mid.png); /*background-image: url(images/scroll_gutter_btm.png), url(images/scroll_gutter_mid.png);
background-repeat: no-repeat, repeat-y; background-repeat: no-repeat, repeat-y;
background-position: bottom left, 0 0;*/ background-position: bottom left, 0 0;*/
} }
/* The thumb itself */ /* The thumb itself */
::-webkit-scrollbar-thumb:vertical { ::-webkit-scrollbar-thumb:vertical {
height: 56px; height: 56px;
width: 12px; width: 12px;
/* -webkit-border-image: url(images/scroll_thumb.png) 8 0 8 0 stretch stretch;*/ /* -webkit-border-image: url(images/scroll_thumb.png) 8 0 8 0 stretch stretch;*/
background-color: #DDDDDD; background-color: #DDDDDD;
opacity: 0.5; opacity: 0.5;
} }

View File

@ -1,42 +1,42 @@
var mapconfig = { var mapconfig = {
zoom : 12, zoom : 12,
latitude : 53.075, latitude : 53.075,
longitude : 8.8080, longitude : 8.8080,
tileSize : 400 tileSize : 400
} }
function createLayers() { function createLayers() {
var m = map.map(); var m = map.map();
// var t = map.loadTheme("DEFAULT"); // var t = map.loadTheme("DEFAULT");
// var ts = new vtm.OSciMap4TileSource(); // var ts = new vtm.OSciMap4TileSource();
// var l = new vtm.OsmTileLayer(m); // var l = new vtm.OsmTileLayer(m);
// l.setTileSource(ts) // l.setTileSource(ts)
// l.setRenderTheme(t) // l.setRenderTheme(t)
var s = new vtm.BitmapTileSource("http://a.tile.stamen.com/toner", 0, 18); var s = new vtm.BitmapTileSource("http://a.tile.stamen.com/toner", 0, 18);
var l = new vtm.BitmapTileLayer(m, s); var l = new vtm.BitmapTileLayer(m, s);
map.addLayer(l) map.addLayer(l)
// map.addLayer(new vtm.BuildingLayer(m, l)) // map.addLayer(new vtm.BuildingLayer(m, l))
// map.addLayer(new vtm.LabelLayer(m, l)) // map.addLayer(new vtm.LabelLayer(m, l))
t = map.loadTheme("TRONRENDER") t = map.loadTheme("TRONRENDER")
ts = new vtm.OsmLanduseJsonTileSource() ts = new vtm.OsmLanduseJsonTileSource()
l = new vtm.VectorTileLayer(m, ts) l = new vtm.VectorTileLayer(m, ts)
l.setRenderTheme(t) l.setRenderTheme(t)
map.addLayer(l) map.addLayer(l)
} }
function canvasResize() { function canvasResize() {
div = document.getElementById('canvas-area') div = document.getElementById('canvas-area')
canvas = document.getElementById('map-canvas') canvas = document.getElementById('map-canvas')
var w = div.scrollWidth; var w = div.scrollWidth;
var h = div.scrollHeight; var h = div.scrollHeight;
// console.log(div.clientHeight + " " + div.clientWidth) // console.log(div.clientHeight + " " + div.clientWidth)
canvas.width = w; canvas.width = w;
canvas.height = h; canvas.height = h;
canvas.style.width = w + 'px'; canvas.style.width = w + 'px';
canvas.style.height = h + 'px'; canvas.style.height = h + 'px';
} }
canvasResize(); canvasResize();
window.addEventListener('resize', canvasResize, false); window.addEventListener('resize', canvasResize, false);

View File

@ -37,10 +37,10 @@ public class GdxGL extends GwtGL20 implements GL {
this.gl = gl; this.gl = gl;
} }
// @Override // @Override
// public void glGetShaderSource(int shader, int bufsize, Buffer length, String source) { // public void glGetShaderSource(int shader, int bufsize, Buffer length, String source) {
// //
// } // }
@Override @Override
public void glTexImage2D(int target, int level, int internalformat, int width, int height, public void glTexImage2D(int target, int level, int internalformat, int width, int height,

View File

@ -24,26 +24,26 @@ public class MapConfig extends JavaScriptObject {
public static native MapConfig get()/*-{ public static native MapConfig get()/*-{
return $wnd.mapconfig; return $wnd.mapconfig;
}-*/; }-*/;
public final native double getLatitude() /*-{ public final native double getLatitude() /*-{
return this.latitude || 0; return this.latitude || 0;
}-*/; }-*/;
public final native double getLongitude() /*-{ public final native double getLongitude() /*-{
return this.longitude || 0; return this.longitude || 0;
}-*/; }-*/;
public final native int getZoom() /*-{ public final native int getZoom() /*-{
return this.zoom || 2; return this.zoom || 2;
}-*/; }-*/;
public final native String getTileSource() /*-{ public final native String getTileSource() /*-{
return this.tilesource; return this.tilesource;
}-*/; }-*/;
public final native int getTileSize() /*-{ public final native int getTileSize() /*-{
return this.tileSize || 256; return this.tileSize || 256;
}-*/; }-*/;
} }

View File

@ -59,10 +59,10 @@ public class MapUrl extends Timer {
rotation = Float.parseFloat(p.substring(4)); rotation = Float.parseFloat(p.substring(4));
else if (p.startsWith("tilt=")) else if (p.startsWith("tilt="))
tilt = Float.parseFloat(p.substring(5)); tilt = Float.parseFloat(p.substring(5));
// else if (p.startsWith("theme=")) // else if (p.startsWith("theme="))
// themeName = p.substring(6); // themeName = p.substring(6);
// else if (p.startsWith("map=")) // else if (p.startsWith("map="))
// mapName = p.substring(4); // mapName = p.substring(4);
else { else {
String[] opt = p.split("="); String[] opt = p.split("=");
if (opt.length > 1) if (opt.length > 1)

View File

@ -332,19 +332,19 @@ public abstract class GwtApplication implements EntryPoint, Application {
**/ **/
private static native AgentInfo computeAgentInfo() /*-{ private static native AgentInfo computeAgentInfo() /*-{
var userAgent = navigator.userAgent.toLowerCase(); var userAgent = navigator.userAgent.toLowerCase();
return { return {
// browser type flags // browser type flags
isFirefox : userAgent.indexOf("firefox") != -1, isFirefox : userAgent.indexOf("firefox") != -1,
isChrome : userAgent.indexOf("chrome") != -1, isChrome : userAgent.indexOf("chrome") != -1,
isSafari : userAgent.indexOf("safari") != -1, isSafari : userAgent.indexOf("safari") != -1,
isOpera : userAgent.indexOf("opera") != -1, isOpera : userAgent.indexOf("opera") != -1,
isIE : userAgent.indexOf("msie") != -1, isIE : userAgent.indexOf("msie") != -1,
// OS type flags // OS type flags
isMacOS : userAgent.indexOf("mac") != -1, isMacOS : userAgent.indexOf("mac") != -1,
isLinux : userAgent.indexOf("linux") != -1, isLinux : userAgent.indexOf("linux") != -1,
isWindows : userAgent.indexOf("win") != -1 isWindows : userAgent.indexOf("win") != -1
}; };
}-*/; }-*/;
/** /**
* Returned by {@link #agentInfo}. Kindly borrowed from PlayN. * Returned by {@link #agentInfo}. Kindly borrowed from PlayN.
@ -352,35 +352,35 @@ public abstract class GwtApplication implements EntryPoint, Application {
public static class AgentInfo extends JavaScriptObject { public static class AgentInfo extends JavaScriptObject {
public final native boolean isFirefox() /*-{ public final native boolean isFirefox() /*-{
return this.isFirefox; return this.isFirefox;
}-*/; }-*/;
public final native boolean isChrome() /*-{ public final native boolean isChrome() /*-{
return this.isChrome; return this.isChrome;
}-*/; }-*/;
public final native boolean isSafari() /*-{ public final native boolean isSafari() /*-{
return this.isSafari; return this.isSafari;
}-*/; }-*/;
public final native boolean isOpera() /*-{ public final native boolean isOpera() /*-{
return this.isOpera; return this.isOpera;
}-*/; }-*/;
public final native boolean isIE() /*-{ public final native boolean isIE() /*-{
return this.isIE; return this.isIE;
}-*/; }-*/;
public final native boolean isMacOS() /*-{ public final native boolean isMacOS() /*-{
return this.isMacOS; return this.isMacOS;
}-*/; }-*/;
public final native boolean isLinux() /*-{ public final native boolean isLinux() /*-{
return this.isLinux; return this.isLinux;
}-*/; }-*/;
public final native boolean isWindows() /*-{ public final native boolean isWindows() /*-{
return this.isWindows; return this.isWindows;
}-*/; }-*/;
protected AgentInfo() { protected AgentInfo() {
} }

View File

@ -96,15 +96,15 @@ public class GwtGraphics implements Graphics {
public static native double getDevicePixelRatioJSNI() /*-{ public static native double getDevicePixelRatioJSNI() /*-{
return $wnd.devicePixelRatio || 1.0; return $wnd.devicePixelRatio || 1.0;
}-*/; }-*/;
public static native int getWindowWidthJSNI() /*-{ public static native int getWindowWidthJSNI() /*-{
return $wnd.innerWidth; return $wnd.innerWidth;
}-*/; }-*/;
public static native int getWindowHeightJSNI() /*-{ public static native int getWindowHeightJSNI() /*-{
return $wnd.innerHeight; return $wnd.innerHeight;
}-*/; }-*/;
public WebGLRenderingContext getContext() { public WebGLRenderingContext getContext() {
return context; return context;
@ -173,22 +173,22 @@ public class GwtGraphics implements Graphics {
} }
private native int getScreenWidthJSNI() /*-{ private native int getScreenWidthJSNI() /*-{
return $wnd.screen.width; return $wnd.screen.width;
}-*/; }-*/;
private native int getScreenHeightJSNI() /*-{ private native int getScreenHeightJSNI() /*-{
return $wnd.screen.height; return $wnd.screen.height;
}-*/; }-*/;
private native boolean isFullscreenJSNI() /*-{ private native boolean isFullscreenJSNI() /*-{
if ("webkitIsFullScreen" in $doc) { if ("webkitIsFullScreen" in $doc) {
return $doc.webkitIsFullScreen; return $doc.webkitIsFullScreen;
} }
if ("mozFullScreen" in $doc) { if ("mozFullScreen" in $doc) {
return $doc.mozFullScreen; return $doc.mozFullScreen;
} }
return false return false
}-*/; }-*/;
private void fullscreenChanged() { private void fullscreenChanged() {
if (!isFullscreen()) { if (!isFullscreen()) {
@ -198,39 +198,39 @@ public class GwtGraphics implements Graphics {
} }
private native boolean setFullscreenJSNI(GwtGraphics graphics, CanvasElement element) /*-{ private native boolean setFullscreenJSNI(GwtGraphics graphics, CanvasElement element) /*-{
if (element.webkitRequestFullScreen) { if (element.webkitRequestFullScreen) {
element.width = $wnd.screen.width; element.width = $wnd.screen.width;
element.height = $wnd.screen.height; element.height = $wnd.screen.height;
element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
$doc $doc
.addEventListener( .addEventListener(
"webkitfullscreenchange", "webkitfullscreenchange",
function() { function() {
graphics.@com.badlogic.gdx.backends.gwt.GwtGraphics::fullscreenChanged()(); graphics.@com.badlogic.gdx.backends.gwt.GwtGraphics::fullscreenChanged()();
}, false); }, false);
return true; return true;
} }
if (element.mozRequestFullScreen) { if (element.mozRequestFullScreen) {
element.width = $wnd.screen.width; element.width = $wnd.screen.width;
element.height = $wnd.screen.height; element.height = $wnd.screen.height;
element.mozRequestFullScreen(); element.mozRequestFullScreen();
$doc $doc
.addEventListener( .addEventListener(
"mozfullscreenchange", "mozfullscreenchange",
function() { function() {
graphics.@com.badlogic.gdx.backends.gwt.GwtGraphics::fullscreenChanged()(); graphics.@com.badlogic.gdx.backends.gwt.GwtGraphics::fullscreenChanged()();
}, false); }, false);
return true; return true;
} }
return false; return false;
}-*/; }-*/;
private native void exitFullscreen() /*-{ private native void exitFullscreen() /*-{
if ($doc.webkitExitFullscreen) if ($doc.webkitExitFullscreen)
$doc.webkitExitFullscreen(); $doc.webkitExitFullscreen();
if ($doc.mozExitFullscreen) if ($doc.mozExitFullscreen)
$doc.mozExitFullscreen(); $doc.mozExitFullscreen();
}-*/; }-*/;
@Override @Override
public DisplayMode getDesktopDisplayMode() { public DisplayMode getDesktopDisplayMode() {

View File

@ -271,22 +271,22 @@ public class GwtInput implements Input {
*/ */
private native boolean isCursorCatchedJSNI() /*-{ private native boolean isCursorCatchedJSNI() /*-{
if (!navigator.pointer) { if (!navigator.pointer) {
navigator.pointer = navigator.webkitPointer || navigator.mozPointer; navigator.pointer = navigator.webkitPointer || navigator.mozPointer;
} }
if (navigator.pointer) { if (navigator.pointer) {
if (typeof (navigator.pointer.isLocked) === "boolean") { if (typeof (navigator.pointer.isLocked) === "boolean") {
// Chrome initially launched with this interface // Chrome initially launched with this interface
return navigator.pointer.isLocked; return navigator.pointer.isLocked;
} else if (typeof (navigator.pointer.isLocked) === "function") { } else if (typeof (navigator.pointer.isLocked) === "function") {
// Some older builds might provide isLocked as a function // Some older builds might provide isLocked as a function
return navigator.pointer.isLocked(); return navigator.pointer.isLocked();
} else if (typeof (navigator.pointer.islocked) === "function") { } else if (typeof (navigator.pointer.islocked) === "function") {
// For compatibility with early Firefox build // For compatibility with early Firefox build
return navigator.pointer.islocked(); return navigator.pointer.islocked();
} }
} }
return false; return false;
}-*/; }-*/;
/** /**
* from https://github.com/toji/game-shim/blob/master/game-shim.js * from https://github.com/toji/game-shim/blob/master/game-shim.js
@ -295,40 +295,40 @@ public class GwtInput implements Input {
*/ */
private native void setCursorCatchedJSNI(CanvasElement element) /*-{ private native void setCursorCatchedJSNI(CanvasElement element) /*-{
// Navigator pointer is not the right interface according to spec. // Navigator pointer is not the right interface according to spec.
// Here for backwards compatibility only // Here for backwards compatibility only
if (!navigator.pointer) { if (!navigator.pointer) {
navigator.pointer = navigator.webkitPointer || navigator.mozPointer; navigator.pointer = navigator.webkitPointer || navigator.mozPointer;
} }
// element.requestPointerLock // element.requestPointerLock
if (!element.requestPointerLock) { if (!element.requestPointerLock) {
element.requestPointerLock = (function() { element.requestPointerLock = (function() {
return element.webkitRequestPointerLock return element.webkitRequestPointerLock
|| element.mozRequestPointerLock || function() { || element.mozRequestPointerLock || function() {
if (navigator.pointer) { if (navigator.pointer) {
navigator.pointer.lock(element); navigator.pointer.lock(element);
} }
}; };
})(); })();
} }
element.requestPointerLock(); element.requestPointerLock();
}-*/; }-*/;
/** /**
* from https://github.com/toji/game-shim/blob/master/game-shim.js * from https://github.com/toji/game-shim/blob/master/game-shim.js
*/ */
private native void exitCursorCatchedJSNI() /*-{ private native void exitCursorCatchedJSNI() /*-{
if (!$doc.exitPointerLock) { if (!$doc.exitPointerLock) {
$doc.exitPointerLock = (function() { $doc.exitPointerLock = (function() {
return $doc.webkitExitPointerLock || $doc.mozExitPointerLock return $doc.webkitExitPointerLock || $doc.mozExitPointerLock
|| function() { || function() {
if (navigator.pointer) { if (navigator.pointer) {
var elem = this; var elem = this;
navigator.pointer.unlock(); navigator.pointer.unlock();
} }
}; };
})(); })();
} }
}-*/; }-*/;
/** /**
* from https://github.com/toji/game-shim/blob/master/game-shim.js * from https://github.com/toji/game-shim/blob/master/game-shim.js
@ -337,8 +337,8 @@ public class GwtInput implements Input {
* @return movement in x direction * @return movement in x direction
*/ */
private native float getMovementXJSNI(NativeEvent event) /*-{ private native float getMovementXJSNI(NativeEvent event) /*-{
return event.movementX || event.webkitMovementX || 0; return event.movementX || event.webkitMovementX || 0;
}-*/; }-*/;
/** /**
* from https://github.com/toji/game-shim/blob/master/game-shim.js * from https://github.com/toji/game-shim/blob/master/game-shim.js
@ -347,12 +347,12 @@ public class GwtInput implements Input {
* @return movement in y direction * @return movement in y direction
*/ */
private native float getMovementYJSNI(NativeEvent event) /*-{ private native float getMovementYJSNI(NativeEvent event) /*-{
return event.movementY || event.webkitMovementY || 0; return event.movementY || event.webkitMovementY || 0;
}-*/; }-*/;
private static native boolean isTouchScreen() /*-{ private static native boolean isTouchScreen() /*-{
return (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0)); return (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0));
}-*/; }-*/;
/** /**
* works only for Chrome > Version 18 with enabled Mouse Lock enable in * works only for Chrome > Version 18 with enabled Mouse Lock enable in
@ -384,55 +384,55 @@ public class GwtInput implements Input {
// kindly borrowed from our dear playn friends... // kindly borrowed from our dear playn friends...
static native void addEventListener(JavaScriptObject target, String name, GwtInput handler, static native void addEventListener(JavaScriptObject target, String name, GwtInput handler,
boolean capture) /*-{ boolean capture) /*-{
target target
.addEventListener( .addEventListener(
name, name,
function(e) { function(e) {
handler.@com.badlogic.gdx.backends.gwt.GwtInput::handleEvent(Lcom/google/gwt/dom/client/NativeEvent;)(e); handler.@com.badlogic.gdx.backends.gwt.GwtInput::handleEvent(Lcom/google/gwt/dom/client/NativeEvent;)(e);
}, capture); }, capture);
}-*/; }-*/;
private static native float getMouseWheelVelocity(NativeEvent evt) /*-{ private static native float getMouseWheelVelocity(NativeEvent evt) /*-{
var delta = 0.0; var delta = 0.0;
var agentInfo = @com.badlogic.gdx.backends.gwt.GwtApplication::agentInfo()(); var agentInfo = @com.badlogic.gdx.backends.gwt.GwtApplication::agentInfo()();
if (agentInfo.isFirefox) { if (agentInfo.isFirefox) {
if (agentInfo.isMacOS) { if (agentInfo.isMacOS) {
delta = 1.0 * evt.detail; delta = 1.0 * evt.detail;
} else { } else {
delta = 1.0 * evt.detail / 3; delta = 1.0 * evt.detail / 3;
} }
} else if (agentInfo.isOpera) { } else if (agentInfo.isOpera) {
if (agentInfo.isLinux) { if (agentInfo.isLinux) {
delta = -1.0 * evt.wheelDelta / 80; delta = -1.0 * evt.wheelDelta / 80;
} else { } else {
// on mac // on mac
delta = -1.0 * evt.wheelDelta / 40; delta = -1.0 * evt.wheelDelta / 40;
} }
} else if (agentInfo.isChrome || agentInfo.isSafari) { } else if (agentInfo.isChrome || agentInfo.isSafari) {
delta = -1.0 * evt.wheelDelta / 120; delta = -1.0 * evt.wheelDelta / 120;
// handle touchpad for chrome // handle touchpad for chrome
if (Math.abs(delta) < 1) { if (Math.abs(delta) < 1) {
if (agentInfo.isWindows) { if (agentInfo.isWindows) {
delta = -1.0 * evt.wheelDelta; delta = -1.0 * evt.wheelDelta;
} else if (agentInfo.isMacOS) { } else if (agentInfo.isMacOS) {
delta = -1.0 * evt.wheelDelta / 3; delta = -1.0 * evt.wheelDelta / 3;
} }
} }
} }
return delta; return delta;
}-*/; }-*/;
/** /**
* Kindly borrowed from PlayN. * Kindly borrowed from PlayN.
**/ **/
protected static native String getMouseWheelEvent() /*-{ protected static native String getMouseWheelEvent() /*-{
if (navigator.userAgent.toLowerCase().indexOf('firefox') != -1) { if (navigator.userAgent.toLowerCase().indexOf('firefox') != -1) {
return "DOMMouseScroll"; return "DOMMouseScroll";
} else { } else {
return "mousewheel"; return "mousewheel";
} }
}-*/; }-*/;
/** /**
* Kindly borrowed from PlayN. * Kindly borrowed from PlayN.
@ -452,15 +452,15 @@ public class GwtInput implements Input {
private void hookEvents() { private void hookEvents() {
addEventListener(canvas, "mousedown", this, true); addEventListener(canvas, "mousedown", this, true);
// addEventListener(Document.get(), "mousedown", this, true); // addEventListener(Document.get(), "mousedown", this, true);
addEventListener(canvas, "mouseup", this, true); addEventListener(canvas, "mouseup", this, true);
// addEventListener(Document.get(), "mouseup", this, true); // addEventListener(Document.get(), "mouseup", this, true);
addEventListener(canvas, "mousemove", this, true); addEventListener(canvas, "mousemove", this, true);
// addEventListener(Document.get(), "mousemove", this, true); // addEventListener(Document.get(), "mousemove", this, true);
addEventListener(canvas, getMouseWheelEvent(), this, true); addEventListener(canvas, getMouseWheelEvent(), this, true);
// addEventListener(Document.get(), "keydown", this, false); // addEventListener(Document.get(), "keydown", this, false);
// addEventListener(Document.get(), "keyup", this, false); // addEventListener(Document.get(), "keyup", this, false);
// addEventListener(Document.get(), "keypress", this, false); // addEventListener(Document.get(), "keypress", this, false);
addEventListener(canvas, "keydown", this, false); addEventListener(canvas, "keydown", this, false);
addEventListener(canvas, "keyup", this, false); addEventListener(canvas, "keyup", this, false);
addEventListener(canvas, "keypress", this, false); addEventListener(canvas, "keypress", this, false);

View File

@ -379,25 +379,25 @@ public class GLMatrix {
System.arraycopy(tmp, 0, mata, 0, 16); System.arraycopy(tmp, 0, mata, 0, 16);
} }
// @Override // @Override
// public void finalize() { // public void finalize() {
// if (pointer != 0) // if (pointer != 0)
// delete(pointer); // delete(pointer);
// } // }
/* Copyright (C) 2007 The Android Open Source Project /* Copyright (C) 2007 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. */ * limitations under the License. */
/** /**
* Define a projection matrix in terms of six clip planes * Define a projection matrix in terms of six clip planes

View File

@ -118,8 +118,8 @@ public class LwHttp implements HttpEngine {
@Override @Override
public boolean requestCompleted(boolean success) { public boolean requestCompleted(boolean success) {
// mHttpRequest.clearOnReadyStateChange(); // mHttpRequest.clearOnReadyStateChange();
// mHttpRequest = null; // mHttpRequest = null;
return true; return true;
} }

View File

@ -87,11 +87,11 @@ public class BitmapTileSource extends UrlTileSource {
final Image img = new Image(); final Image img = new Image();
img.setVisible(false); img.setVisible(false);
/* As if researching CORS issues doesnt result in /* As if researching CORS issues doesnt result in
* enough headache... * enough headache...
* *
* Here are some more special Chrome/Webkit quirks: * Here are some more special Chrome/Webkit quirks:
* MUST SET CORS BEFORE URL! */ * MUST SET CORS BEFORE URL! */
img.getElement().setAttribute("crossorigin", "anonymous"); img.getElement().setAttribute("crossorigin", "anonymous");
img.setUrl(uri); img.setUrl(uri);

View File

@ -124,17 +124,17 @@ public class Tessellator {
return 0; return 0;
} }
// if (vo.length() != plen) { // if (vo.length() != plen) {
// // TODO handle different output points // // TODO handle different output points
// log.debug(" + io.length()); // log.debug(" + io.length());
// //
// //for (int i = 0; i < vo.length(); i += 2) // //for (int i = 0; i < vo.length(); i += 2)
// // log.debug(vo.get(i) + " " + vo.get(i + 1)); // // log.debug(vo.get(i) + " " + vo.get(i + 1));
// //for (int i = ppos; i < ppos + plen; i += 2) // //for (int i = ppos; i < ppos + plen; i += 2)
// // log.debug( points[i]+ " " + points[i + 1]); // // log.debug( points[i]+ " " + points[i + 1]);
// //
// return 0; // return 0;
// } // }
int numIndices = io.length(); int numIndices = io.length();
@ -164,17 +164,17 @@ public class Tessellator {
static native Int32Array tessellate(JsArrayNumber points, int pOffset, int pLength, 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, return $wnd.tessellate(points, pOffset, pOffset + pLength, bounds,
bOffset, bOffset + bLength, false); bOffset, bOffset + bLength, false);
}-*/; }-*/;
static native TessResult tessellate2(JsArrayNumber points, int pOffset, int pLength, static native TessResult tessellate2(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, return $wnd.tessellate(points, pOffset, pOffset + pLength, bounds,
bOffset, bOffset + bLength, true); bOffset, bOffset + bLength, true);
}-*/; }-*/;
static final class TessResult extends JavaScriptObject { static final class TessResult extends JavaScriptObject {
protected TessResult() { protected TessResult() {
@ -182,10 +182,10 @@ public class Tessellator {
native Float32Array getPoints(JavaScriptObject result)/*-{ native Float32Array getPoints(JavaScriptObject result)/*-{
return result.vertices; return result.vertices;
}-*/; }-*/;
native Int32Array getIndices(JavaScriptObject result)/*-{ native Int32Array getIndices(JavaScriptObject result)/*-{
return result.triangles; return result.triangles;
}-*/; }-*/;
} }
} }

View File

@ -1,107 +1,107 @@
tessellate = (function() { tessellate = (function() {
Module.TOTAL_MEMORY = 1024 * 1024; Module.TOTAL_MEMORY = 1024 * 1024;
var c_tessellate = Module.cwrap('tessellate', 'void', [ 'number', 'number', var c_tessellate = Module.cwrap('tessellate', 'void', [ 'number', 'number',
'number', 'number', 'number', 'number' ]); 'number', 'number', 'number', 'number' ]);
// special tessellator for extrusion layer - only returns triangle indices // special tessellator for extrusion layer - only returns triangle indices
var tessellate = function(vertices, v_start, v_end, boundaries, b_start, var tessellate = function(vertices, v_start, v_end, boundaries, b_start,
b_end, mode) { b_end, mode) {
var i; var i;
var v_len = (v_end - v_start); var v_len = (v_end - v_start);
var b_len = (b_end - b_start); var b_len = (b_end - b_start);
var p = Module._malloc(v_len * 8); var p = Module._malloc(v_len * 8);
for (i = 0; i < v_len; ++i) for (i = 0; i < v_len; ++i)
Module.setValue(p + i * 8, vertices[v_start + i], 'double'); Module.setValue(p + i * 8, vertices[v_start + i], 'double');
var contours = Module._malloc((b_len + 1) * 4); var contours = Module._malloc((b_len + 1) * 4);
// pointer to first contour // pointer to first contour
Module.setValue(contours + 0, p + 0, 'i32'); Module.setValue(contours + 0, p + 0, 'i32');
var offset = p; var offset = p;
// pointer to further contours + end // pointer to further contours + end
for (i = 0; i < b_len; ++i) { for (i = 0; i < b_len; ++i) {
offset += 8 * boundaries[b_start + i]; offset += 8 * boundaries[b_start + i];
Module.setValue(contours + 4 * (i + 1), offset, 'i32'); Module.setValue(contours + 4 * (i + 1), offset, 'i32');
} }
var ppcoordinates_out = Module._malloc(4); var ppcoordinates_out = Module._malloc(4);
var pptris_out = Module._malloc(4); var pptris_out = Module._malloc(4);
var pnverts = Module._malloc(4); var pnverts = Module._malloc(4);
var pntris = Module._malloc(4); var pntris = Module._malloc(4);
c_tessellate(ppcoordinates_out, pnverts, pptris_out, pntris, contours, c_tessellate(ppcoordinates_out, pnverts, pptris_out, pntris, contours,
contours + 4 * (b_len + 1)); contours + 4 * (b_len + 1));
var pcoordinates_out = Module.getValue(ppcoordinates_out, 'i32'); var pcoordinates_out = Module.getValue(ppcoordinates_out, 'i32');
var ptris_out = Module.getValue(pptris_out, 'i32'); var ptris_out = Module.getValue(pptris_out, 'i32');
var nverts = Module.getValue(pnverts, 'i32'); var nverts = Module.getValue(pnverts, 'i32');
var ntris = Module.getValue(pntris, 'i32'); var ntris = Module.getValue(pntris, 'i32');
var result_triangles = null; var result_triangles = null;
var result_vertices = null; var result_vertices = null;
if (mode){ if (mode){
result_triangles = new Int32Array(ntris * 3); result_triangles = new Int32Array(ntris * 3);
for (i = 0; i < 3 * ntris; ++i) for (i = 0; i < 3 * ntris; ++i)
result_triangles[i] = Module.getValue(ptris_out + i * 4, 'i32'); result_triangles[i] = Module.getValue(ptris_out + i * 4, 'i32');
result_vertices = new Float32Array(nverts * 2); result_vertices = new Float32Array(nverts * 2);
for (i = 0; i < 2 * nverts; ++i) for (i = 0; i < 2 * nverts; ++i)
result_vertices[i] = Module.getValue(pcoordinates_out + i * 8, 'double'); result_vertices[i] = Module.getValue(pcoordinates_out + i * 8, 'double');
} else { } else {
if (nverts * 2 == v_len) { if (nverts * 2 == v_len) {
result_triangles = new Int32Array(ntris * 3); result_triangles = new Int32Array(ntris * 3);
for (i = 0; i < 3 * ntris; ++i) { for (i = 0; i < 3 * ntris; ++i) {
result_triangles[i] = Module.getValue(ptris_out + i * 4, 'i32') * 2; result_triangles[i] = Module.getValue(ptris_out + i * 4, 'i32') * 2;
} }
// when a ring has an odd number of points one (or rather two) // when a ring has an odd number of points one (or rather two)
// additional vertices will be added. so the following rings // additional vertices will be added. so the following rings
// needs extra offset... // needs extra offset...
var start = 0; var start = 0;
for ( var j = 0, m = b_len - 1; j < m; j++) { for ( var j = 0, m = b_len - 1; j < m; j++) {
start += boundaries[b_start + j]; start += boundaries[b_start + j];
// even number of points? // even number of points?
if (!((boundaries[b_start + j] >> 1) & 1)) if (!((boundaries[b_start + j] >> 1) & 1))
continue; continue;
for ( var n = ntris * 3, tri = 0; tri < n; tri++) for ( var n = ntris * 3, tri = 0; tri < n; tri++)
if (result_triangles[tri] >= start) if (result_triangles[tri] >= start)
result_triangles[tri] += 2; result_triangles[tri] += 2;
start += 2; start += 2;
} }
} }
} }
Module._free(pnverts); Module._free(pnverts);
Module._free(pntris); Module._free(pntris);
Module._free(ppcoordinates_out); Module._free(ppcoordinates_out);
Module._free(pcoordinates_out); Module._free(pcoordinates_out);
Module._free(pptris_out); Module._free(pptris_out);
Module._free(ptris_out); Module._free(ptris_out);
Module._free(p); Module._free(p);
Module._free(contours); Module._free(contours);
if (mode) if (mode)
return { vertices: result_vertices, triangles: result_triangles }; return { vertices: result_vertices, triangles: result_triangles };
else else
return result_triangles; return result_triangles;
}; };
return tessellate; return tessellate;
})(); })();

View File

@ -27,15 +27,15 @@ public class Feature extends GeoJsonObject {
public final native Geometry<?> getGeometry() /*-{ public final native Geometry<?> getGeometry() /*-{
return this.geometry; return this.geometry;
}-*/; }-*/;
public final native String getId() /*-{ public final native String getId() /*-{
return this.id; return this.id;
}-*/; }-*/;
public final native void setId(String id) /*-{ public final native void setId(String id) /*-{
this.id = id; this.id = id;
}-*/; }-*/;
public final Map<String, Object> getProperties(HashMap<String, Object> map) { public final Map<String, Object> getProperties(HashMap<String, Object> map) {
map.clear(); map.clear();
@ -45,8 +45,8 @@ public class Feature extends GeoJsonObject {
} }
public final native void fromJavascriptObject(HashMap<String, Object> s) /*-{ public final native void fromJavascriptObject(HashMap<String, Object> s) /*-{
for(var key in this.properties) { for(var key in this.properties) {
s.@java.util.HashMap::put(Ljava/lang/Object;Ljava/lang/Object;)(key, Object(this.properties[key])); s.@java.util.HashMap::put(Ljava/lang/Object;Ljava/lang/Object;)(key, Object(this.properties[key]));
} }
}-*/; }-*/;
} }

View File

@ -33,6 +33,6 @@ public class FeatureCollection extends JavaScriptObject {
public final native JsArray<Feature> getFeaturesInternal()/*-{ public final native JsArray<Feature> getFeaturesInternal()/*-{
return this.features; return this.features;
}-*/; }-*/;
} }

View File

@ -26,9 +26,9 @@ public abstract class GeoJsonObject extends JavaScriptObject {
public final native double[] getBbox()/*-{ public final native double[] getBbox()/*-{
return bbox; return bbox;
}-*/; }-*/;
public final native void setBbox(double[] bbox) /*-{ public final native void setBbox(double[] bbox) /*-{
this.bbox = bbox; this.bbox = bbox;
}-*/; }-*/;
} }

View File

@ -65,12 +65,12 @@ public class GeoJsonTileDecoder implements ITileDecoder {
mapElement.clear(); mapElement.clear();
mapElement.tags.clear(); mapElement.tags.clear();
/* add tag information */ /* add tag information */
mTileSource.decodeTags(mapElement, f.getProperties(mProperties)); mTileSource.decodeTags(mapElement, f.getProperties(mProperties));
if (mapElement.tags.numTags == 0) if (mapElement.tags.numTags == 0)
continue; continue;
/* add geometry information */ /* add geometry information */
decodeGeometry(f.getGeometry()); decodeGeometry(f.getGeometry());
if (mapElement.type == GeometryType.NONE) if (mapElement.type == GeometryType.NONE)

View File

@ -27,9 +27,9 @@ public abstract class Geometry<T extends JavaScriptObject> extends JsArray<T> {
public final native String type()/*-{ public final native String type()/*-{
return this.type return this.type
}-*/; }-*/;
public final native JsArray<T> getCoordinates() /*-{ public final native JsArray<T> getCoordinates() /*-{
return this.coordinates; return this.coordinates;
}-*/; }-*/;
} }

View File

@ -83,19 +83,19 @@ public class JsArrayCollection<T> extends AbstractCollection<T> {
public native final JsArr<T> slice(int start, int end)/*-{ public native final JsArr<T> slice(int start, int end)/*-{
return this.slice(start, end); return this.slice(start, end);
}-*/; }-*/;
public static final native <T> JsArr<T> create() /*-{ public static final native <T> JsArr<T> create() /*-{
return []; return [];
}-*/; }-*/;
public final native int size() /*-{ public final native int size() /*-{
return this.length; return this.length;
}-*/; }-*/;
public final native T get(int i) /*-{ public final native T get(int i) /*-{
return this[i]; return this[i];
}-*/; }-*/;
} }
} }

View File

@ -10,9 +10,9 @@ public class LngLat extends JavaScriptObject {
public final native double getLongitude() /*-{ public final native double getLongitude() /*-{
return this[0]; return this[0];
}-*/; }-*/;
public final native double getLatitude() /*-{ public final native double getLatitude() /*-{
return this[1]; return this[1];
}-*/; }-*/;
} }

View File

@ -23,10 +23,10 @@ public class MultiLineString extends Geometry<LineString> {
public final native LineString getGeometryN(int i) /*-{ public final native LineString getGeometryN(int i) /*-{
return this[i]; return this[i];
}-*/; }-*/;
public final native int getNumGeometries() /*-{ public final native int getNumGeometries() /*-{
return this.length; return this.length;
}-*/; }-*/;
} }

View File

@ -23,10 +23,10 @@ public class MultiPolygon extends Geometry<Polygon> {
public final native Polygon getGeometryN(int i) /*-{ public final native Polygon getGeometryN(int i) /*-{
return this[i]; return this[i];
}-*/; }-*/;
public final native int getNumGeometries() /*-{ public final native int getNumGeometries() /*-{
return this.length; return this.length;
}-*/; }-*/;
} }

View File

@ -23,14 +23,14 @@ public class Polygon extends Geometry<LineString> {
public final native LineString getExteriorRing()/*-{ public final native LineString getExteriorRing()/*-{
return this[0]; return this[0];
}-*/; }-*/;
public final native LineString getRing(int i) /*-{ public final native LineString getRing(int i) /*-{
return this[i]; return this[i];
}-*/; }-*/;
public final native int getNumRings() /*-{ public final native int getNumRings() /*-{
return this.length; return this.length;
}-*/; }-*/;
} }

View File

@ -212,18 +212,18 @@ public class GeometryBuffer {
public GeometryBuffer startLine() { public GeometryBuffer startLine() {
setOrCheckMode(GeometryType.LINE); setOrCheckMode(GeometryType.LINE);
/* ignore */ /* ignore */
if (index[indexPos] > 0) { if (index[indexPos] > 0) {
/* start next */ /* start next */
if ((index[0] >= 0) && (++indexPos >= index.length)) if ((index[0] >= 0) && (++indexPos >= index.length))
ensureIndexSize(indexPos, true); ensureIndexSize(indexPos, true);
/* initialize with zero points */ /* initialize with zero points */
index[indexPos] = 0; index[indexPos] = 0;
} }
/* set new end marker */ /* set new end marker */
if (index.length > indexPos + 1) if (index.length > indexPos + 1)
index[indexPos + 1] = -1; index[indexPos + 1] = -1;
return this; return this;
@ -243,14 +243,14 @@ public class GeometryBuffer {
/* end polygon */ /* end polygon */
index[++indexPos] = 0; index[++indexPos] = 0;
/* next polygon start */ /* next polygon start */
indexPos++; indexPos++;
} }
/* initialize with zero points */ /* initialize with zero points */
index[indexPos] = 0; index[indexPos] = 0;
/* set new end marker */ /* set new end marker */
if (index.length > indexPos + 1) if (index.length > indexPos + 1)
index[indexPos + 1] = -1; index[indexPos + 1] = -1;
@ -266,10 +266,10 @@ public class GeometryBuffer {
if ((indexPos + 2) > index.length) if ((indexPos + 2) > index.length)
ensureIndexSize(indexPos + 1, true); ensureIndexSize(indexPos + 1, true);
/* initialize with zero points */ /* initialize with zero points */
index[++indexPos] = 0; index[++indexPos] = 0;
/* set new end marker */ /* set new end marker */
if (index.length > indexPos + 1) if (index.length > indexPos + 1)
index[indexPos + 1] = -1; index[indexPos + 1] = -1;
} }
@ -378,7 +378,7 @@ public class GeometryBuffer {
float px = points[inPos++]; float px = points[inPos++];
float py = points[inPos++]; float py = points[inPos++];
/* add first point */ /* add first point */
points[outPos++] = px; points[outPos++] = px;
points[outPos++] = py; points[outPos++] = py;
int cnt = 2; int cnt = 2;

View File

@ -172,7 +172,7 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen
pivotY = mPrevY1 - mMap.getHeight() / 2; pivotY = mPrevY1 - mMap.getHeight() / 2;
} }
/* handle double tap zoom */ /* handle double tap zoom */
mMap.animator().animateZoom(300, 2, pivotX, pivotY); mMap.animator().animateZoom(300, 2, pivotX, pivotY);
} else if (mStartMove > 0) { } else if (mStartMove > 0) {
@ -181,7 +181,7 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen
float vx = mTracker.getVelocityX(); float vx = mTracker.getVelocityX();
float vy = mTracker.getVelocityY(); float vy = mTracker.getVelocityY();
/* reduce velocity for short moves */ /* reduce velocity for short moves */
float t = e.getTime() - mStartMove; float t = e.getTime() - mStartMove;
if (t < FLING_MIN_THREHSHOLD) { if (t < FLING_MIN_THREHSHOLD) {
t = t / FLING_MIN_THREHSHOLD; t = t / FLING_MIN_THREHSHOLD;
@ -227,9 +227,9 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen
mPrevX1 = x1; mPrevX1 = x1;
mPrevY1 = y1; mPrevY1 = y1;
/* double-tap drag zoom */ /* double-tap drag zoom */
if (mDoubleTap) { if (mDoubleTap) {
/* just ignore first move event to set mPrevX/Y */ /* just ignore first move event to set mPrevX/Y */
if (!mDown) { if (!mDown) {
mDown = true; mDown = true;
return; return;
@ -248,7 +248,7 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen
return; return;
} }
/* simple move */ /* simple move */
if (!mEnableMove) if (!mEnableMove)
return; return;
@ -290,7 +290,7 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen
if (mDoTilt) { if (mDoTilt) {
tiltBy = my / 5; tiltBy = my / 5;
} else if (Math.abs(my) > (dpi / PINCH_TILT_THRESHOLD)) { } else if (Math.abs(my) > (dpi / PINCH_TILT_THRESHOLD)) {
/* enter exclusive tilt mode */ /* enter exclusive tilt mode */
mCanScale = false; mCanScale = false;
mCanRotate = false; mCanRotate = false;
mDoTilt = true; mDoTilt = true;
@ -317,25 +317,25 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen
} else { } else {
r = Math.abs(r); r = Math.abs(r);
if (r > PINCH_ROTATE_THRESHOLD) { if (r > PINCH_ROTATE_THRESHOLD) {
/* start rotate, disable tilt */ /* start rotate, disable tilt */
mDoRotate = true; mDoRotate = true;
mCanTilt = false; mCanTilt = false;
mAngle = rad; mAngle = rad;
} else if (!mDoScale) { } else if (!mDoScale) {
/* reduce pinch trigger by the amount of rotation */ /* reduce pinch trigger by the amount of rotation */
deltaPinch *= 1 - (r / PINCH_ROTATE_THRESHOLD); deltaPinch *= 1 - (r / PINCH_ROTATE_THRESHOLD);
} else { } else {
mPrevPinchWidth = pinchWidth; mPrevPinchWidth = pinchWidth;
} }
} }
} else if (mDoScale && mEnableRotate) { } else if (mDoScale && mEnableRotate) {
/* re-enable rotation when higher threshold is reached */ /* re-enable rotation when higher threshold is reached */
double rad = Math.atan2(dy, dx); double rad = Math.atan2(dy, dx);
double r = rad - mAngle; double r = rad - mAngle;
if (r > PINCH_ROTATE_THRESHOLD2) { if (r > PINCH_ROTATE_THRESHOLD2) {
/* start rotate again */ /* start rotate again */
mDoRotate = true; mDoRotate = true;
mCanRotate = true; mCanRotate = true;
mAngle = rad; mAngle = rad;
@ -344,7 +344,7 @@ public class MapEventLayer extends Layer implements InputListener, GestureListen
if (mCanScale || mDoRotate) { if (mCanScale || mDoRotate) {
if (!(mDoScale || mDoRotate)) { if (!(mDoScale || mDoRotate)) {
/* enter exclusive scale mode */ /* enter exclusive scale mode */
if (Math.abs(deltaPinch) > (dpi / PINCH_ZOOM_THRESHOLD)) { if (Math.abs(deltaPinch) > (dpi / PINCH_ZOOM_THRESHOLD)) {
if (!mDoRotate) { if (!mDoRotate) {

View File

@ -129,10 +129,10 @@ public class PathLayer extends Layer {
public void addGreatCircle(GeoPoint startPoint, GeoPoint endPoint) { public void addGreatCircle(GeoPoint startPoint, GeoPoint endPoint) {
synchronized (mPoints) { synchronized (mPoints) {
/* get the great circle path length in meters */ /* get the great circle path length in meters */
double length = startPoint.distanceTo(endPoint); double length = startPoint.distanceTo(endPoint);
/* add one point for every 100kms of the great circle path */ /* add one point for every 100kms of the great circle path */
int numberOfPoints = (int) (length / 100000); int numberOfPoints = (int) (length / 100000);
addGreatCircle(startPoint, endPoint, numberOfPoints); addGreatCircle(startPoint, endPoint, numberOfPoints);

View File

@ -117,10 +117,10 @@ public class ItemizedLayer<Item extends MarkerItem> extends MarkerLayer<Item>
* easily override behavior without resorting to overriding the * easily override behavior without resorting to overriding the
* ItemGestureListener methods. * ItemGestureListener methods.
*/ */
// @Override // @Override
// public boolean onTap(MotionEvent event, MapPosition pos) { // public boolean onTap(MotionEvent event, MapPosition pos) {
// return activateSelectedItems(event, mActiveItemSingleTap); // return activateSelectedItems(event, mActiveItemSingleTap);
// } // }
protected boolean onSingleTapUpHelper(int index, Item item) { protected boolean onSingleTapUpHelper(int index, Item item) {
return mOnItemGestureListener.onItemSingleTapUp(index, item); return mOnItemGestureListener.onItemSingleTapUp(index, item);
} }
@ -175,7 +175,7 @@ public class ItemizedLayer<Item extends MarkerItem> extends MarkerLayer<Item>
int inside = -1; int inside = -1;
double insideY = -Double.MAX_VALUE; double insideY = -Double.MAX_VALUE;
/* squared dist: 50*50 pixel ~ 2mm on 400dpi */ /* squared dist: 50*50 pixel ~ 2mm on 400dpi */
double dist = 2500; double dist = 2500;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {

View File

@ -101,7 +101,7 @@ public class MarkerRenderer extends BucketRenderer {
float cos = (float) Math.cos(angle); float cos = (float) Math.cos(angle);
float sin = (float) Math.sin(angle); float sin = (float) Math.sin(angle);
/* check visibility */ /* check visibility */
for (InternalItem it : mItems) { for (InternalItem it : mItems) {
it.changes = false; it.changes = false;
it.x = (float) ((it.px - mx) * scale); it.x = (float) ((it.px - mx) * scale);
@ -131,10 +131,10 @@ public class MarkerRenderer extends BucketRenderer {
//log.debug(numVisible + " " + changedVisible + " " + changesInvisible); //log.debug(numVisible + " " + changedVisible + " " + changesInvisible);
/* only update when zoomlevel changed, new items are visible /* only update when zoomlevel changed, new items are visible
* or more than 10 of the current items became invisible */ * or more than 10 of the current items became invisible */
//if ((numVisible == 0) && (changedVisible == 0 && changesInvisible < 10)) //if ((numVisible == 0) && (changedVisible == 0 && changesInvisible < 10))
// return; // return;
buckets.clear(); buckets.clear();
if (numVisible == 0) { if (numVisible == 0) {
@ -182,7 +182,7 @@ public class MarkerRenderer extends BucketRenderer {
tmp[i] = it; tmp[i] = it;
it.item = mMarkerLayer.createItem(i); it.item = mMarkerLayer.createItem(i);
/* pre-project points */ /* pre-project points */
MercatorProjection.project(it.item.getPoint(), mMapPoint); MercatorProjection.project(it.item.getPoint(), mMapPoint);
it.px = mMapPoint.x; it.px = mMapPoint.x;
it.py = mMapPoint.y; it.py = mMapPoint.y;
@ -228,24 +228,24 @@ public class MarkerRenderer extends BucketRenderer {
} }
}; };
// /** // /**
// * Returns the Item at the given index. // * Returns the Item at the given index.
// * // *
// * @param position // * @param position
// * the position of the item to return // * the position of the item to return
// * @return the Item of the given index. // * @return the Item of the given index.
// */ // */
// public final Item getItem(int position) { // public final Item getItem(int position) {
// //
// synchronized (lock) { // synchronized (lock) {
// InternalItem item = mItems; // InternalItem item = mItems;
// for (int i = mSize - position - 1; i > 0 && item != null; i--) // for (int i = mSize - position - 1; i > 0 && item != null; i--)
// item = item.next; // item = item.next;
// //
// if (item != null) // if (item != null)
// return item.item; // return item.item;
// //
// return null; // return null;
// } // }
// } // }
} }

View File

@ -247,7 +247,7 @@ public class MapTile extends Tile {
node.child(i).refs--; node.child(i).refs--;
} }
/* removed all proxy references for this tile */ /* removed all proxy references for this tile */
proxy = 0; proxy = 0;
if (state == DEADBEEF) { if (state == DEADBEEF) {
@ -411,9 +411,9 @@ public class MapTile extends Tile {
if (state == newState) if (state == newState)
return; return;
/* Renderer could have uploaded the tile while the layer /* Renderer could have uploaded the tile while the layer
* was cleared. This prevents to set tile to READY state. */ * was cleared. This prevents to set tile to READY state. */
/* All other state changes are on the main-thread. */ /* All other state changes are on the main-thread. */
if (state == DEADBEEF) if (state == DEADBEEF)
return; return;

View File

@ -198,28 +198,28 @@ public class TileManager {
mIndex.drop(); mIndex.drop();
/* Pass VBOs and VertexItems back to pools */ /* Pass VBOs and VertexItems back to pools */
for (int i = 0; i < mTilesEnd; i++) { for (int i = 0; i < mTilesEnd; i++) {
MapTile t = mTiles[i]; MapTile t = mTiles[i];
if (t == null) if (t == null)
continue; continue;
/* Check if tile is used by another thread */ /* Check if tile is used by another thread */
if (!t.isLocked()) if (!t.isLocked())
t.clear(); t.clear();
/* In case the tile is still loading or used by /* In case the tile is still loading or used by
* another thread: clear when returned from loader * another thread: clear when returned from loader
* or becomes unlocked */ * or becomes unlocked */
t.setState(DEADBEEF); t.setState(DEADBEEF);
} }
/* clear references to cached MapTiles */ /* clear references to cached MapTiles */
Arrays.fill(mTiles, null); Arrays.fill(mTiles, null);
mTilesEnd = 0; mTilesEnd = 0;
mTilesCount = 0; mTilesCount = 0;
/* set up TileSet large enough to hold current tiles */ /* set up TileSet large enough to hold current tiles */
int num = Math.max(mMap.getWidth(), mMap.getHeight()); int num = Math.max(mMap.getWidth(), mMap.getHeight());
int size = Tile.SIZE >> 1; int size = Tile.SIZE >> 1;
int numTiles = (num * num) / (size * size) * 4; int numTiles = (num * num) / (size * size) * 4;
@ -244,11 +244,11 @@ public class TileManager {
init(); init();
} }
/* clear JobQueue and set tiles to state == NONE. /* clear JobQueue and set tiles to state == NONE.
* one could also append new tiles and sort in JobQueue * one could also append new tiles and sort in JobQueue
* but this has the nice side-effect that MapWorkers dont * but this has the nice side-effect that MapWorkers dont
* start with old jobs while new jobs are calculated, which * start with old jobs while new jobs are calculated, which
* should increase the chance that they are free when new * should increase the chance that they are free when new
* jobs come in. */ * jobs come in. */
jobQueue.clear(); jobQueue.clear();
if (pos.zoomLevel < mMinZoom) { if (pos.zoomLevel < mMinZoom) {
@ -263,29 +263,29 @@ public class TileManager {
int tileZoom = clamp(pos.zoomLevel, mMinZoom, mMaxZoom); int tileZoom = clamp(pos.zoomLevel, mMinZoom, mMaxZoom);
if (mZoomTable == null) { if (mZoomTable == null) {
/* greater 1 when zoomed in further than /* greater 1 when zoomed in further than
* tile zoomlevel, so [1..2] while whithin * tile zoomlevel, so [1..2] while whithin
* min/maxZoom */ * min/maxZoom */
double scaleDiv = pos.scale / (1 << tileZoom); double scaleDiv = pos.scale / (1 << tileZoom);
mLoadParent = scaleDiv < 1.5; mLoadParent = scaleDiv < 1.5;
int zoomDiff = tileZoom - mPrevZoomlevel; int zoomDiff = tileZoom - mPrevZoomlevel;
if (zoomDiff == 1) { if (zoomDiff == 1) {
/* dont switch zoomlevel up yet */ /* dont switch zoomlevel up yet */
if (scaleDiv < mLevelUpThreshold) { if (scaleDiv < mLevelUpThreshold) {
tileZoom = mPrevZoomlevel; tileZoom = mPrevZoomlevel;
mLoadParent = false; mLoadParent = false;
} }
} else if (zoomDiff == -1) { } else if (zoomDiff == -1) {
/* dont switch zoomlevel down yet */ /* dont switch zoomlevel down yet */
if (scaleDiv > mLevelDownThreshold) { if (scaleDiv > mLevelDownThreshold) {
tileZoom = mPrevZoomlevel; tileZoom = mPrevZoomlevel;
mLoadParent = true; mLoadParent = true;
} }
} }
// log.debug("p:{} {}:{}=>{} | {} <> {}", mLoadParent, // log.debug("p:{} {}:{}=>{} | {} <> {}", mLoadParent,
// mPrevZoomlevel, pos.zoomLevel, tileZoom, // mPrevZoomlevel, pos.zoomLevel, tileZoom,
// scaleDiv, (pos.scale / (1 << tileZoom))); // scaleDiv, (pos.scale / (1 << tileZoom)));
} else { } else {
mLoadParent = false; mLoadParent = false;
int match = 0; int match = 0;
@ -302,8 +302,8 @@ public class TileManager {
mViewport.getMapExtents(mMapPlane, Tile.SIZE / 2); mViewport.getMapExtents(mMapPlane, Tile.SIZE / 2);
/* scan visible tiles. callback function calls 'addTile' /* scan visible tiles. callback function calls 'addTile'
* which updates mNewTiles */ * which updates mNewTiles */
mNewTiles.cnt = 0; mNewTiles.cnt = 0;
mScanBox.scan(pos.x, pos.y, pos.scale, tileZoom, mMapPlane); mScanBox.scan(pos.x, pos.y, pos.scale, tileZoom, mMapPlane);
@ -318,7 +318,7 @@ public class TileManager {
Arrays.sort(newTiles, 0, newCnt, TileSet.coordComparator); Arrays.sort(newTiles, 0, newCnt, TileSet.coordComparator);
if (!changed) { if (!changed) {
/* compare if any tile has changed */ /* compare if any tile has changed */
for (int i = 0; i < newCnt; i++) { for (int i = 0; i < newCnt; i++) {
if (newTiles[i] != curTiles[i]) { if (newTiles[i] != curTiles[i]) {
changed = true; changed = true;
@ -329,13 +329,13 @@ public class TileManager {
if (changed) { if (changed) {
synchronized (mTilelock) { synchronized (mTilelock) {
/* lock new tiles */ /* lock new tiles */
mNewTiles.lockTiles(); mNewTiles.lockTiles();
/* unlock previous tiles */ /* unlock previous tiles */
mCurrentTiles.releaseTiles(); mCurrentTiles.releaseTiles();
/* swap newTiles with currentTiles */ /* swap newTiles with currentTiles */
TileSet tmp = mCurrentTiles; TileSet tmp = mCurrentTiles;
mCurrentTiles = mNewTiles; mCurrentTiles = mNewTiles;
mNewTiles = tmp; mNewTiles = tmp;
@ -343,11 +343,11 @@ public class TileManager {
mUpdateSerial++; mUpdateSerial++;
} }
/* request rendering as tiles changed */ /* request rendering as tiles changed */
mMap.render(); mMap.render();
} }
/* Add tile jobs to queue */ /* Add tile jobs to queue */
if (mJobs.isEmpty()) if (mJobs.isEmpty())
return false; return false;
@ -355,7 +355,7 @@ public class TileManager {
jobs = mJobs.toArray(jobs); jobs = mJobs.toArray(jobs);
updateDistances(jobs, jobs.length, pos); updateDistances(jobs, jobs.length, pos);
/* sets tiles to state == LOADING */ /* sets tiles to state == LOADING */
jobQueue.setJobs(jobs); jobQueue.setJobs(jobs);
mJobs.clear(); mJobs.clear();
@ -369,7 +369,7 @@ public class TileManager {
} }
} }
/* limit cache items */ /* limit cache items */
int remove = mTilesCount - (mCacheLimit - mCacheReduce); int remove = mTilesCount - (mCacheLimit - mCacheReduce);
if (remove > CACHE_THRESHOLD || mTilesToUpload > MAX_TILES_IN_QUEUE) { if (remove > CACHE_THRESHOLD || mTilesToUpload > MAX_TILES_IN_QUEUE) {
@ -411,7 +411,7 @@ public class TileManager {
if (tileSet.serial == mUpdateSerial) if (tileSet.serial == mUpdateSerial)
return false; return false;
/* do not flip mNew/mCurrentTiles while copying */ /* do not flip mNew/mCurrentTiles while copying */
synchronized (mTilelock) { synchronized (mTilelock) {
tileSet.setTiles(mCurrentTiles); tileSet.setTiles(mCurrentTiles);
tileSet.serial = mUpdateSerial; tileSet.serial = mUpdateSerial;
@ -434,13 +434,13 @@ public class TileManager {
} }
if (mLoadParent && (zoomLevel > mMinZoom) && (mZoomTable == null)) { if (mLoadParent && (zoomLevel > mMinZoom) && (mZoomTable == null)) {
/* prefetch parent */ /* prefetch parent */
MapTile p = tile.node.parent(); MapTile p = tile.node.parent();
if (p == null) { if (p == null) {
TileNode n = mIndex.add(x >> 1, y >> 1, zoomLevel - 1); TileNode n = mIndex.add(x >> 1, y >> 1, zoomLevel - 1);
p = n.item = new MapTile(n, x >> 1, y >> 1, zoomLevel - 1); p = n.item = new MapTile(n, x >> 1, y >> 1, zoomLevel - 1);
addToCache(p); addToCache(p);
/* this prevents to add tile twice to queue */ /* this prevents to add tile twice to queue */
p.setState(LOADING); p.setState(LOADING);
mJobs.add(p); mJobs.add(p);
} else if (!p.isActive()) { } else if (!p.isActive()) {
@ -456,8 +456,8 @@ public class TileManager {
if (mTilesEnd == mTiles.length) { if (mTilesEnd == mTiles.length) {
if (mTilesEnd > mTilesCount) { if (mTilesEnd > mTilesCount) {
TileDistanceSort.sort(mTiles, 0, mTilesEnd); TileDistanceSort.sort(mTiles, 0, mTilesEnd);
/* sorting also repacks the 'sparse' filled array /* sorting also repacks the 'sparse' filled array
* so end of mTiles is at mTilesCount now */ * so end of mTiles is at mTilesCount now */
mTilesEnd = mTilesCount; mTilesEnd = mTilesCount;
} }
@ -474,8 +474,8 @@ public class TileManager {
} }
private boolean removeFromCache(MapTile t) { private boolean removeFromCache(MapTile t) {
/* TODO check valid states here:When in CANCEL state tile belongs to /* TODO check valid states here:When in CANCEL state tile belongs to
* TileLoader thread, defer clearing to jobCompleted() */ * TileLoader thread, defer clearing to jobCompleted() */
if (dbg) if (dbg)
log.debug("remove from cache {} {} {}", log.debug("remove from cache {} {} {}",
@ -497,10 +497,10 @@ public class TileManager {
private void limitCache(MapPosition pos, int remove) { private void limitCache(MapPosition pos, int remove) {
MapTile[] tiles = mTiles; MapTile[] tiles = mTiles;
/* count tiles that have new data */ /* count tiles that have new data */
int newTileCnt = 0; int newTileCnt = 0;
/* remove tiles that were never loaded */ /* remove tiles that were never loaded */
for (int i = 0; i < mTilesEnd; i++) { for (int i = 0; i < mTilesEnd; i++) {
MapTile t = tiles[i]; MapTile t = tiles[i];
if (t == null) if (t == null)
@ -516,7 +516,7 @@ public class TileManager {
continue; continue;
} }
/* make sure tile cannot be used by GL or MapWorker Thread */ /* make sure tile cannot be used by GL or MapWorker Thread */
if (t.state(NONE) && removeFromCache(t)) { if (t.state(NONE) && removeFromCache(t)) {
tiles[i] = null; tiles[i] = null;
remove--; remove--;
@ -529,16 +529,16 @@ public class TileManager {
updateDistances(tiles, mTilesEnd, pos); updateDistances(tiles, mTilesEnd, pos);
TileDistanceSort.sort(tiles, 0, mTilesEnd); TileDistanceSort.sort(tiles, 0, mTilesEnd);
/* sorting also repacks the 'sparse' filled array /* sorting also repacks the 'sparse' filled array
* so end of mTiles is at mTilesCount now */ * so end of mTiles is at mTilesCount now */
mTilesEnd = mTilesCount; mTilesEnd = mTilesCount;
/* start with farest away tile */ /* start with farest away tile */
for (int i = mTilesCount - 1; i >= 0 && remove > 0; i--) { for (int i = mTilesCount - 1; i >= 0 && remove > 0; i--) {
MapTile t = tiles[i]; MapTile t = tiles[i];
/* dont remove tile used by TileRenderer, or somewhere else /* dont remove tile used by TileRenderer, or somewhere else
* try again in next run. */ * try again in next run. */
if (t.isLocked()) { if (t.isLocked()) {
if (dbg) if (dbg)
log.debug("{} locked (state={}, d={})", log.debug("{} locked (state={}, d={})",
@ -550,7 +550,7 @@ public class TileManager {
continue; continue;
} }
/* cancel loading of tiles that should not even be cached */ /* cancel loading of tiles that should not even be cached */
if (t.state(LOADING)) { if (t.state(LOADING)) {
t.setState(CANCEL); t.setState(CANCEL);
if (dbg) if (dbg)
@ -558,7 +558,7 @@ public class TileManager {
continue; continue;
} }
/* clear new and unused tile */ /* clear new and unused tile */
if (t.state(NEW_DATA)) { if (t.state(NEW_DATA)) {
newTileCnt--; newTileCnt--;
if (dbg) if (dbg)
@ -596,11 +596,11 @@ public class TileManager {
*/ */
public void jobCompleted(MapTile tile, QueryResult result) { public void jobCompleted(MapTile tile, QueryResult result) {
/* send TILE_LOADED event on main-loop */ /* send TILE_LOADED event on main-loop */
mMap.post(new JobCompletedEvent(tile, result)); mMap.post(new JobCompletedEvent(tile, result));
/* locked means the tile is visible or referenced by /* locked means the tile is visible or referenced by
* a tile that might be visible. */ * a tile that might be visible. */
if (tile.isLocked()) { if (tile.isLocked()) {
if (result == QueryResult.DELAYED && tile.isLocked()) if (result == QueryResult.DELAYED && tile.isLocked())
mMap.updateMap(false); mMap.updateMap(false);
@ -631,7 +631,7 @@ public class TileManager {
tile, result, tile, result,
tile.state()); tile.state());
/* got orphaned tile */ /* got orphaned tile */
if (tile.state(DEADBEEF)) { if (tile.state(DEADBEEF)) {
tile.clear(); tile.clear();
return; return;
@ -642,7 +642,7 @@ public class TileManager {
} }
private static void updateDistances(MapTile[] tiles, int size, MapPosition pos) { private static void updateDistances(MapTile[] tiles, int size, MapPosition pos) {
/* TODO there is probably a better quad-tree distance function */ /* TODO there is probably a better quad-tree distance function */
int zoom = 20; int zoom = 20;
long x = (long) (pos.x * (1 << zoom)); long x = (long) (pos.x * (1 << zoom));
long y = (long) (pos.y * (1 << zoom)); long y = (long) (pos.y * (1 << zoom));
@ -696,7 +696,7 @@ public class TileManager {
int xx = x; int xx = x;
if (x < 0 || x >= xmax) { if (x < 0 || x >= xmax) {
/* flip-around date line */ /* flip-around date line */
if (x < 0) if (x < 0)
xx = xmax + x; xx = xmax + x;
else else
@ -706,7 +706,7 @@ public class TileManager {
continue; continue;
} }
/* check if tile is already added */ /* check if tile is already added */
for (int i = 0; i < cnt; i++) for (int i = 0; i < cnt; i++)
if (tiles[i].tileX == xx && tiles[i].tileY == y) { if (tiles[i].tileX == xx && tiles[i].tileY == y) {
tile = tiles[i]; tile = tiles[i];

View File

@ -88,11 +88,11 @@ public abstract class TileRenderer extends LayerRenderer {
return; return;
} }
/* keep constant while rendering frame */ /* keep constant while rendering frame */
mLayerAlpha = mAlpha; mLayerAlpha = mAlpha;
mOverdrawColor = mOverdraw; mOverdrawColor = mOverdraw;
/* get current tiles to draw */ /* get current tiles to draw */
synchronized (tilelock) { synchronized (tilelock) {
boolean tilesChanged = mTileManager.getActiveTiles(mDrawTiles); boolean tilesChanged = mTileManager.getActiveTiles(mDrawTiles);
@ -102,10 +102,10 @@ public abstract class TileRenderer extends LayerRenderer {
return; return;
} }
/* update isVisible flag true for tiles that intersect view */ /* update isVisible flag true for tiles that intersect view */
if (tilesChanged || v.changed()) { if (tilesChanged || v.changed()) {
/* lock tiles while updating isVisible state */ /* lock tiles while updating isVisible state */
mProxyTileCnt = 0; mProxyTileCnt = 0;
MapTile[] tiles = mDrawTiles.tiles; MapTile[] tiles = mDrawTiles.tiles;
@ -114,7 +114,7 @@ public abstract class TileRenderer extends LayerRenderer {
for (int i = 0; i < mDrawTiles.cnt; i++) for (int i = 0; i < mDrawTiles.cnt; i++)
tiles[i].isVisible = false; tiles[i].isVisible = false;
/* check visibile tiles */ /* check visibile tiles */
mScanBox.scan(v.pos.x, v.pos.y, v.pos.scale, tileZoom, v.plane); mScanBox.scan(v.pos.x, v.pos.y, v.pos.scale, tileZoom, v.plane);
} }
} }
@ -128,8 +128,8 @@ public abstract class TileRenderer extends LayerRenderer {
public void clearTiles() { public void clearTiles() {
synchronized (tilelock) { synchronized (tilelock) {
/* Clear all references to MapTiles as all current /* Clear all references to MapTiles as all current
* tiles will also be removed from TileManager. */ * tiles will also be removed from TileManager. */
mDrawTiles.releaseTiles(); mDrawTiles.releaseTiles();
mDrawTiles.tiles = new MapTile[1]; mDrawTiles.tiles = new MapTile[1];
mDrawTiles.cnt = 0; mDrawTiles.cnt = 0;
@ -156,7 +156,7 @@ public abstract class TileRenderer extends LayerRenderer {
continue; continue;
} }
/* load tile that is referenced by this holder */ /* load tile that is referenced by this holder */
MapTile proxy = tile.holder; MapTile proxy = tile.holder;
if (proxy != null && proxy.state(NEW_DATA)) { if (proxy != null && proxy.state(NEW_DATA)) {
uploadCnt += uploadTileData(proxy); uploadCnt += uploadTileData(proxy);
@ -164,11 +164,11 @@ public abstract class TileRenderer extends LayerRenderer {
continue; continue;
} }
/* check near relatives than can serve as proxy */ /* check near relatives than can serve as proxy */
proxy = tile.getProxy(PROXY_PARENT, NEW_DATA); proxy = tile.getProxy(PROXY_PARENT, NEW_DATA);
if (proxy != null) { if (proxy != null) {
uploadCnt += uploadTileData(proxy); uploadCnt += uploadTileData(proxy);
/* dont load child proxies */ /* dont load child proxies */
continue; continue;
} }
@ -188,7 +188,7 @@ public abstract class TileRenderer extends LayerRenderer {
tile.setState(READY); tile.setState(READY);
RenderBuckets buckets = tile.getBuckets(); RenderBuckets buckets = tile.getBuckets();
/* tile might only contain label layers */ /* tile might only contain label layers */
if (buckets == null) if (buckets == null)
return 0; return 0;
@ -217,18 +217,18 @@ public abstract class TileRenderer extends LayerRenderer {
int prevSerial = tileSet.serial; int prevSerial = tileSet.serial;
/* ensure tiles keep visible state */ /* ensure tiles keep visible state */
synchronized (tilelock) { synchronized (tilelock) {
MapTile[] newTiles = mDrawTiles.tiles; MapTile[] newTiles = mDrawTiles.tiles;
int cnt = mDrawTiles.cnt; int cnt = mDrawTiles.cnt;
/* ensure same size */ /* ensure same size */
if (tileSet.tiles.length != newTiles.length) { if (tileSet.tiles.length != newTiles.length) {
tileSet.tiles = new MapTile[newTiles.length]; tileSet.tiles = new MapTile[newTiles.length];
} }
/* lock tiles to not be removed from cache */ /* lock tiles to not be removed from cache */
tileSet.cnt = 0; tileSet.cnt = 0;
for (int i = 0; i < cnt; i++) { for (int i = 0; i < cnt; i++) {
MapTile t = newTiles[i]; MapTile t = newTiles[i];
@ -236,7 +236,7 @@ public abstract class TileRenderer extends LayerRenderer {
t.lock(); t.lock();
} }
/* unlock previous tiles */ /* unlock previous tiles */
tileSet.releaseTiles(); tileSet.releaseTiles();
for (int i = 0; i < cnt; i++) { for (int i = 0; i < cnt; i++) {
@ -271,8 +271,8 @@ public abstract class TileRenderer extends LayerRenderer {
t.isVisible = true; t.isVisible = true;
} }
/* add placeholder tiles to show both sides /* add placeholder tiles to show both sides
* of date line. a little too complicated... */ * of date line. a little too complicated... */
int xmax = 1 << mZoom; int xmax = 1 << mZoom;
if (x1 >= 0 && x2 < xmax) if (x1 >= 0 && x2 < xmax)
return; return;
@ -326,7 +326,7 @@ public abstract class TileRenderer extends LayerRenderer {
public static long getMinFade(MapTile tile, int proxyLevel) { public static long getMinFade(MapTile tile, int proxyLevel) {
long minFade = MapRenderer.frametime - 50; long minFade = MapRenderer.frametime - 50;
/* check children for grandparent, parent or current */ /* check children for grandparent, parent or current */
if (proxyLevel <= 0) { if (proxyLevel <= 0) {
for (int c = 0; c < 4; c++) { for (int c = 0; c < 4; c++) {
MapTile ci = tile.node.child(c); MapTile ci = tile.node.child(c);
@ -336,9 +336,9 @@ public abstract class TileRenderer extends LayerRenderer {
if (ci.fadeTime > 0 && ci.fadeTime < minFade) if (ci.fadeTime > 0 && ci.fadeTime < minFade)
minFade = ci.fadeTime; minFade = ci.fadeTime;
/* when drawing the parent of the current level /* when drawing the parent of the current level
* we also check if the children of current level * we also check if the children of current level
* are visible */ * are visible */
if (proxyLevel >= -1) { if (proxyLevel >= -1) {
long m = getMinFade(ci, proxyLevel - 1); long m = getMinFade(ci, proxyLevel - 1);
if (m < minFade) if (m < minFade)
@ -347,7 +347,7 @@ public abstract class TileRenderer extends LayerRenderer {
} }
} }
/* check parents for child, current or parent */ /* check parents for child, current or parent */
TileNode p = tile.node.parent; TileNode p = tile.node.parent;
for (int i = proxyLevel; i >= -1; i--) { for (int i = proxyLevel; i >= -1; i--) {

View File

@ -81,7 +81,7 @@ public final class TileSet {
/* lock tiles (and their proxies) to not be removed from cache */ /* lock tiles (and their proxies) to not be removed from cache */
source.lockTiles(); source.lockTiles();
/* unlock previous tiles */ /* unlock previous tiles */
releaseTiles(); releaseTiles();
if (source.tiles.length != tiles.length) { if (source.tiles.length != tiles.length) {

View File

@ -47,7 +47,7 @@ public class VectorTileRenderer extends TileRenderer {
@Override @Override
public synchronized void render(GLViewport v) { public synchronized void render(GLViewport v) {
/* discard depth projection from tilt, depth buffer /* discard depth projection from tilt, depth buffer
* is used for clipping */ * is used for clipping */
mClipProj.copy(v.proj); mClipProj.copy(v.proj);
mClipProj.setValue(10, 0); mClipProj.setValue(10, 0);
@ -71,9 +71,9 @@ public class VectorTileRenderer extends TileRenderer {
gl.depthMask(true); gl.depthMask(true);
gl.clear(GL.DEPTH_BUFFER_BIT); gl.clear(GL.DEPTH_BUFFER_BIT);
/* always write depth for non-proxy tiles /* always write depth for non-proxy tiles
* this is used in drawProxies pass to not * this is used in drawProxies pass to not
* draw where tiles were already drawn */ * draw where tiles were already drawn */
gl.depthFunc(GL.ALWAYS); gl.depthFunc(GL.ALWAYS);
mClipMode = PolygonBucket.CLIP_DEPTH; mClipMode = PolygonBucket.CLIP_DEPTH;
@ -83,24 +83,24 @@ public class VectorTileRenderer extends TileRenderer {
} }
} }
/* draw visible tiles */ /* draw visible tiles */
for (int i = 0; i < tileCnt; i++) { for (int i = 0; i < tileCnt; i++) {
MapTile t = tiles[i]; MapTile t = tiles[i];
if (t.isVisible && t.state(READY)) if (t.isVisible && t.state(READY))
drawTile(t, v, 0); drawTile(t, v, 0);
} }
/* draw parent or children as proxy for visibile tiles that dont /* draw parent or children as proxy for visibile tiles that dont
* have data yet. Proxies are clipped to the region where nothing * have data yet. Proxies are clipped to the region where nothing
* was drawn to depth buffer. * was drawn to depth buffer.
* TODO draw proxies for placeholder */ * TODO draw proxies for placeholder */
if (!drawProxies) if (!drawProxies)
return; return;
/* only draw where no other tile is drawn */ /* only draw where no other tile is drawn */
gl.depthFunc(GL.LESS); gl.depthFunc(GL.LESS);
/* draw child or parent proxies */ /* draw child or parent proxies */
boolean preferParent = (v.pos.getZoomScale() < 1.5) boolean preferParent = (v.pos.getZoomScale() < 1.5)
|| (v.pos.zoomLevel < tiles[0].zoomLevel); || (v.pos.zoomLevel < tiles[0].zoomLevel);
@ -127,7 +127,7 @@ public class VectorTileRenderer extends TileRenderer {
} }
} }
/* draw grandparents */ /* draw grandparents */
for (int i = 0; i < tileCnt; i++) { for (int i = 0; i < tileCnt; i++) {
MapTile t = tiles[i]; MapTile t = tiles[i];
if ((!t.isVisible) || (t.lastDraw == mDrawSerial)) if ((!t.isVisible) || (t.lastDraw == mDrawSerial))
@ -137,19 +137,19 @@ public class VectorTileRenderer extends TileRenderer {
gl.depthMask(false); gl.depthMask(false);
/* make sure stencil buffer write is disabled */ /* make sure stencil buffer write is disabled */
//GL.stencilMask(0x00); //GL.stencilMask(0x00);
} }
private void drawTile(MapTile tile, GLViewport v, int proxyLevel) { private void drawTile(MapTile tile, GLViewport v, int proxyLevel) {
/* ensure to draw parents only once */ /* ensure to draw parents only once */
if (tile.lastDraw == mDrawSerial) if (tile.lastDraw == mDrawSerial)
return; return;
tile.lastDraw = mDrawSerial; tile.lastDraw = mDrawSerial;
/* use holder proxy when it is set */ /* use holder proxy when it is set */
RenderBuckets buckets = (tile.holder == null) RenderBuckets buckets = (tile.holder == null)
? tile.getBuckets() ? tile.getBuckets()
: tile.holder.getBuckets(); : tile.holder.getBuckets();
@ -160,14 +160,14 @@ public class VectorTileRenderer extends TileRenderer {
} }
MapPosition pos = v.pos; MapPosition pos = v.pos;
/* place tile relative to map position */ /* place tile relative to map position */
int z = tile.zoomLevel; int z = tile.zoomLevel;
float div = FastMath.pow(z - pos.zoomLevel); float div = FastMath.pow(z - pos.zoomLevel);
double tileScale = Tile.SIZE * pos.scale; double tileScale = Tile.SIZE * pos.scale;
float x = (float) ((tile.x - pos.x) * tileScale); float x = (float) ((tile.x - pos.x) * tileScale);
float y = (float) ((tile.y - pos.y) * tileScale); float y = (float) ((tile.y - pos.y) * tileScale);
/* scale relative to zoom-level of this tile */ /* scale relative to zoom-level of this tile */
float scale = (float) (pos.scale / (1 << z)); float scale = (float) (pos.scale / (1 << z));
v.mvp.setTransScale(x, y, scale / COORD_SCALE); v.mvp.setTransScale(x, y, scale / COORD_SCALE);
@ -186,7 +186,7 @@ public class VectorTileRenderer extends TileRenderer {
case POLYGON: case POLYGON:
b = PolygonBucket.Renderer.draw(b, v, div, first); b = PolygonBucket.Renderer.draw(b, v, div, first);
first = false; first = false;
/* set test for clip to tile region */ /* set test for clip to tile region */
gl.stencilFunc(GL.EQUAL, 0x80, 0x80); gl.stencilFunc(GL.EQUAL, 0x80, 0x80);
break; break;
case LINE: case LINE:
@ -205,13 +205,13 @@ public class VectorTileRenderer extends TileRenderer {
b = BitmapBucket.Renderer.draw(b, v, 1, mLayerAlpha); b = BitmapBucket.Renderer.draw(b, v, 1, mLayerAlpha);
break; break;
default: default:
/* just in case */ /* just in case */
log.error("unknown layer {}", b.type); log.error("unknown layer {}", b.type);
b = b.next; b = b.next;
break; break;
} }
/* make sure buffers are bound again */ /* make sure buffers are bound again */
buckets.bind(); buckets.bind();
} }
@ -231,7 +231,7 @@ public class VectorTileRenderer extends TileRenderer {
if (tile.holder == null) { if (tile.holder == null) {
fadeTime = getMinFade(tile, proxyLevel); fadeTime = getMinFade(tile, proxyLevel);
} else { } else {
/* need to use time from original tile */ /* need to use time from original tile */
fadeTime = tile.holder.fadeTime; fadeTime = tile.holder.fadeTime;
if (fadeTime == 0) if (fadeTime == 0)
fadeTime = getMinFade(tile.holder, proxyLevel); fadeTime = getMinFade(tile.holder, proxyLevel);

View File

@ -117,30 +117,30 @@ public class BitmapTileLayer extends TileLayer {
*/ */
final TexturePool pool = new TexturePool(POOL_FILL) { final TexturePool pool = new TexturePool(POOL_FILL) {
// int sum = 0; // int sum = 0;
// //
// public TextureItem release(TextureItem item) { // public TextureItem release(TextureItem item) {
// log.debug(getFill() + " " + sum + " release tex " + item.id); // log.debug(getFill() + " " + sum + " release tex " + item.id);
// return super.release(item); // return super.release(item);
// }; // };
// //
// public synchronized TextureItem get() { // public synchronized TextureItem get() {
// log.debug(getFill() + " " + sum + " get tex "); // log.debug(getFill() + " " + sum + " get tex ");
// //
// return super.get(); // return super.get();
// }; // };
// //
// protected TextureItem createItem() { // protected TextureItem createItem() {
// log.debug(getFill() + " " + (sum++) + " create tex "); // log.debug(getFill() + " " + (sum++) + " create tex ");
// //
// return super.createItem(); // return super.createItem();
// }; // };
// //
// protected void freeItem(TextureItem t) { // protected void freeItem(TextureItem t) {
// log.debug(getFill() + " " + (sum--) + " free tex "); // log.debug(getFill() + " " + (sum--) + " free tex ");
// super.freeItem(t); // super.freeItem(t);
// //
// }; // };
}; };
} }

View File

@ -87,7 +87,7 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook {
if (v != null) if (v != null)
minHeight = Integer.parseInt(v); minHeight = Integer.parseInt(v);
/* 12m default */ /* 12m default */
if (height == 0) if (height == 0)
height = 12 * 100; height = 12 * 100;
@ -130,27 +130,27 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook {
get(tile).setBuckets(null); get(tile).setBuckets(null);
} }
// private int multi; // private int multi;
// @Override // @Override
// public void onInputEvent(Event event, MotionEvent e) { // public void onInputEvent(Event event, MotionEvent e) {
// int action = e.getAction() & MotionEvent.ACTION_MASK; // int action = e.getAction() & MotionEvent.ACTION_MASK;
// if (action == MotionEvent.ACTION_POINTER_DOWN) { // if (action == MotionEvent.ACTION_POINTER_DOWN) {
// multi++; // multi++;
// } else if (action == MotionEvent.ACTION_POINTER_UP) { // } else if (action == MotionEvent.ACTION_POINTER_UP) {
// multi--; // multi--;
// if (!mActive && mAlpha > 0) { // if (!mActive && mAlpha > 0) {
// // finish hiding // // finish hiding
// //log.debug("add multi hide timer " + mAlpha); // //log.debug("add multi hide timer " + mAlpha);
// addShowTimer(mFadeTime * mAlpha, false); // addShowTimer(mFadeTime * mAlpha, false);
// } // }
// } else if (action == MotionEvent.ACTION_CANCEL) { // } else if (action == MotionEvent.ACTION_CANCEL) {
// multi = 0; // multi = 0;
// log.debug("cancel " + multi); // log.debug("cancel " + multi);
// if (mTimer != null) { // if (mTimer != null) {
// mTimer.cancel(); // mTimer.cancel();
// mTimer = null; // mTimer = null;
// } // }
// } // }
// } // }
} }

View File

@ -54,7 +54,7 @@ public class BuildingRenderer extends ExtrusionRenderer {
int diff = (v.pos.zoomLevel - mZoomMin); int diff = (v.pos.zoomLevel - mZoomMin);
/* if below min zoom or already faded out */ /* if below min zoom or already faded out */
if (diff < -1) { if (diff < -1) {
mAlpha = 0; mAlpha = 0;
mShow = false; mShow = false;
@ -100,12 +100,12 @@ public class BuildingRenderer extends ExtrusionRenderer {
MapTile[] tiles = mTileSet.tiles; MapTile[] tiles = mTileSet.tiles;
TileDistanceSort.sort(tiles, 0, mTileSet.cnt); TileDistanceSort.sort(tiles, 0, mTileSet.cnt);
/* keep a list of tiles available for rendering */ /* keep a list of tiles available for rendering */
int maxTiles = mTileSet.cnt * 4; int maxTiles = mTileSet.cnt * 4;
if (mExtrusionBucketSet.length < maxTiles) if (mExtrusionBucketSet.length < maxTiles)
mExtrusionBucketSet = new ExtrusionBuckets[maxTiles]; mExtrusionBucketSet = new ExtrusionBuckets[maxTiles];
/* compile one tile max per frame */ /* compile one tile max per frame */
boolean compiled = false; boolean compiled = false;
int activeTiles = 0; int activeTiles = 0;
@ -134,9 +134,9 @@ public class BuildingRenderer extends ExtrusionRenderer {
if (t == null) if (t == null)
continue; continue;
// for (MapTile c : mTiles) // for (MapTile c : mTiles)
// if (c == t) // if (c == t)
// continue O; // continue O;
ExtrusionBuckets ebs = getBuckets(t); ExtrusionBuckets ebs = getBuckets(t);
if (ebs == null) if (ebs == null)
@ -151,7 +151,7 @@ public class BuildingRenderer extends ExtrusionRenderer {
} }
} }
} else if (zoom == mZoomMin - 1) { } else if (zoom == mZoomMin - 1) {
/* check if proxy children are ready */ /* check if proxy children are ready */
for (int i = 0; i < mTileSet.cnt; i++) { for (int i = 0; i < mTileSet.cnt; i++) {
MapTile t = tiles[i]; MapTile t = tiles[i];
for (byte j = 0; j < 4; j++) { for (byte j = 0; j < 4; j++) {
@ -169,7 +169,7 @@ public class BuildingRenderer extends ExtrusionRenderer {
} }
} }
/* load more tiles on next frame */ /* load more tiles on next frame */
if (compiled) if (compiled)
MapRenderer.animate(); MapRenderer.animate();
@ -189,7 +189,7 @@ public class BuildingRenderer extends ExtrusionRenderer {
public void render(GLViewport v) { public void render(GLViewport v) {
super.render(v); super.render(v);
/* release lock on tile data */ /* release lock on tile data */
mTileRenderer.releaseTiles(mTileSet); mTileRenderer.releaseTiles(mTileSet);
} }

View File

@ -111,7 +111,7 @@ class S3DBTileLoader extends TileLoader {
boolean isRoof = element.tags.containsKey(ROOF_KEY); boolean isRoof = element.tags.containsKey(ROOF_KEY);
//if (isRoof) //if (isRoof)
// log.debug(element.tags.toString()); // log.debug(element.tags.toString());
int c = 0; int c = 0;
if (element.tags.containsKey(COLOR_KEY)) { if (element.tags.containsKey(COLOR_KEY)) {

View File

@ -108,13 +108,13 @@ public class VectorTileLayer extends TileLayer {
public void setRenderTheme(IRenderTheme theme) { public void setRenderTheme(IRenderTheme theme) {
/* wait for loaders to finish all current jobs to /* wait for loaders to finish all current jobs to
* not change theme instance hold by loader instance * not change theme instance hold by loader instance
* while running */ * while running */
pauseLoaders(true); pauseLoaders(true);
mTileManager.clearJobs(); mTileManager.clearJobs();
mTheme = theme; mTheme = theme;
// for (TileLoader l : mTileLoader) // for (TileLoader l : mTileLoader)
// ((VectorTileLoader) l).setRenderTheme(theme); // ((VectorTileLoader) l).setRenderTheme(theme);
tileRenderer().setOverdrawColor(theme.getMapBackground()); tileRenderer().setOverdrawColor(theme.getMapBackground());
@ -203,8 +203,8 @@ public class VectorTileLayer extends TileLayer {
} }
public void callHooksComplete(MapTile tile, boolean success) { public void callHooksComplete(MapTile tile, boolean success) {
/* NB: cannot use internal iterater as this function /* NB: cannot use internal iterater as this function
* is called concurently by TileLoaders */ * is called concurently by TileLoaders */
LList<TileLoaderThemeHook> th = mLoaderThemeHooks.head(); LList<TileLoaderThemeHook> th = mLoaderThemeHooks.head();
while (th != null) { while (th != null) {

View File

@ -119,13 +119,13 @@ public class VectorTileLoader extends TileLoader implements RenderStyle.Callback
//mTileLayer.getLoaderHooks(); //mTileLayer.getLoaderHooks();
/* account for area changes with latitude */ /* account for area changes with latitude */
double lat = MercatorProjection.toLatitude(tile.y); double lat = MercatorProjection.toLatitude(tile.y);
mLineScale = (float) Math.pow(STROKE_INCREASE, tile.zoomLevel - STROKE_MIN_ZOOM); mLineScale = (float) Math.pow(STROKE_INCREASE, tile.zoomLevel - STROKE_MIN_ZOOM);
if (mLineScale < 1) if (mLineScale < 1)
mLineScale = 1; mLineScale = 1;
/* scale line width relative to latitude + PI * thumb */ /* scale line width relative to latitude + PI * thumb */
mLineScale *= 0.4f + 0.6f * ((float) Math.sin(Math.abs(lat) * (Math.PI / 180))); mLineScale *= 0.4f + 0.6f * ((float) Math.sin(Math.abs(lat) * (Math.PI / 180)));
mBuckets = new RenderBuckets(); mBuckets = new RenderBuckets();
tile.data = mBuckets; tile.data = mBuckets;
@ -150,7 +150,7 @@ public class VectorTileLoader extends TileLoader implements RenderStyle.Callback
mTileLayer.callHooksComplete(mTile, ok); mTileLayer.callHooksComplete(mTile, ok);
/* finish buckets- tessellate and cleanup on worker-thread */ /* finish buckets- tessellate and cleanup on worker-thread */
mBuckets.prepare(); mBuckets.prepare();
clearState(); clearState();
@ -205,7 +205,7 @@ public class VectorTileLoader extends TileLoader implements RenderStyle.Callback
mElement = element; mElement = element;
/* get and apply render instructions */ /* get and apply render instructions */
if (element.type == GeometryType.POINT) { if (element.type == GeometryType.POINT) {
renderNode(renderTheme.matchElement(element.type, tags, mTile.zoomLevel)); renderNode(renderTheme.matchElement(element.type, tags, mTile.zoomLevel));
} else { } else {
@ -265,7 +265,7 @@ public class VectorTileLoader extends TileLoader implements RenderStyle.Callback
lb.addLine(mElement); lb.addLine(mElement);
/* keep reference for outline layer(s) */ /* keep reference for outline layer(s) */
mCurLineBucket = lb; mCurLineBucket = lb;
} else { } else {

View File

@ -79,18 +79,18 @@ class Debug {
} }
public static void draw(MapPosition pos, GLViewport m, RenderBuckets layers) { public static void draw(MapPosition pos, GLViewport m, RenderBuckets layers) {
// if (layers.baseLayers != null) { // if (layers.baseLayers != null) {
// //setMatrix(pos, m, true); // //setMatrix(pos, m, true);
// //
// for (RenderElement l = layers.baseLayers; l != null;) { // for (RenderElement l = layers.baseLayers; l != null;) {
// if (l.type == RenderElement.POLYGON) { // if (l.type == RenderElement.POLYGON) {
// l = PolygonLayer.Renderer.draw(pos, l, m, true, 1, false); // l = PolygonLayer.Renderer.draw(pos, l, m, true, 1, false);
// } else { // } else {
// //float div = (float) (mMapPosition.scale / (1 << pos.zoomLevel)); // //float div = (float) (mMapPosition.scale / (1 << pos.zoomLevel));
// l = LineLayer.Renderer.draw(layers, l, pos, m, div); // l = LineLayer.Renderer.draw(layers, l, pos, m, div);
// } // }
// } // }
// } // }
} }
} }

View File

@ -103,22 +103,22 @@ public class LabelLayer extends Layer implements Map.UpdateListener, TileManager
mWorker.submit(MAX_RELABEL_DELAY); mWorker.submit(MAX_RELABEL_DELAY);
} }
// @Override // @Override
// public void onMotionEvent(MotionEvent e) { // public void onMotionEvent(MotionEvent e) {
// // int action = e.getAction() & MotionEvent.ACTION_MASK; // // int action = e.getAction() & MotionEvent.ACTION_MASK;
// // if (action == MotionEvent.ACTION_POINTER_DOWN) { // // if (action == MotionEvent.ACTION_POINTER_DOWN) {
// // multi++; // // multi++;
// // mTextRenderer.hold(true); // // mTextRenderer.hold(true);
// // } else if (action == MotionEvent.ACTION_POINTER_UP) { // // } else if (action == MotionEvent.ACTION_POINTER_UP) {
// // multi--; // // multi--;
// // if (multi == 0) // // if (multi == 0)
// // mTextRenderer.hold(false); // // mTextRenderer.hold(false);
// // } else if (action == MotionEvent.ACTION_CANCEL) { // // } else if (action == MotionEvent.ACTION_CANCEL) {
// // multi = 0; // // multi = 0;
// // log.debug("cancel " + multi); // // log.debug("cancel " + multi);
// // mTextRenderer.hold(false); // // mTextRenderer.hold(false);
// // } // // }
// } // }
@Override @Override
public void onTileManagerEvent(Event e, MapTile tile) { public void onTileManagerEvent(Event e, MapTile tile) {

View File

@ -177,11 +177,11 @@ public class LabelPlacement {
if (ti.text.caption) if (ti.text.caption)
continue; continue;
/* acquire a TextItem to add to TextLayer */ /* acquire a TextItem to add to TextLayer */
if (l == null) if (l == null)
l = getLabel(); l = getLabel();
/* check if path at current scale is long enough */ /* check if path at current scale is long enough */
if (!dbg && ti.width > ti.length * scale) if (!dbg && ti.width > ti.length * scale)
continue; continue;
@ -277,7 +277,7 @@ public class LabelPlacement {
boolean updateLabels(LabelTask work) { boolean updateLabels(LabelTask work) {
/* get current tiles */ /* get current tiles */
boolean changedTiles = mTileRenderer.getVisibleTiles(mTileSet); boolean changedTiles = mTileRenderer.getVisibleTiles(mTileSet);
if (mTileSet.cnt == 0) { if (mTileSet.cnt == 0) {
@ -287,7 +287,7 @@ public class LabelPlacement {
MapPosition pos = work.pos; MapPosition pos = work.pos;
boolean changedPos = mMap.viewport().getMapPosition(pos); boolean changedPos = mMap.viewport().getMapPosition(pos);
/* do not loop! */ /* do not loop! */
if (!changedTiles && !changedPos) if (!changedTiles && !changedPos)
return false; return false;
@ -296,12 +296,12 @@ public class LabelPlacement {
MapTile[] tiles = mTileSet.tiles; MapTile[] tiles = mTileSet.tiles;
int zoom = tiles[0].zoomLevel; int zoom = tiles[0].zoomLevel;
/* estimation for visible area to be labeled */ /* estimation for visible area to be labeled */
int mw = (mMap.getWidth() + Tile.SIZE) / 2; int mw = (mMap.getWidth() + Tile.SIZE) / 2;
int mh = (mMap.getHeight() + Tile.SIZE) / 2; int mh = (mMap.getHeight() + Tile.SIZE) / 2;
mSquareRadius = mw * mw + mh * mh; mSquareRadius = mw * mw + mh * mh;
/* scale of tiles zoom-level relative to current position */ /* scale of tiles zoom-level relative to current position */
double scale = pos.scale / (1 << zoom); double scale = pos.scale / (1 << zoom);
double angle = Math.toRadians(pos.bearing); double angle = Math.toRadians(pos.bearing);
@ -317,14 +317,14 @@ public class LabelPlacement {
double tileX = (pos.x * (Tile.SIZE << zoom)); double tileX = (pos.x * (Tile.SIZE << zoom));
double tileY = (pos.y * (Tile.SIZE << zoom)); double tileY = (pos.y * (Tile.SIZE << zoom));
/* put current label to previous label */ /* put current label to previous label */
Label prevLabels = mLabels; Label prevLabels = mLabels;
/* new labels */ /* new labels */
mLabels = null; mLabels = null;
Label l = null; Label l = null;
/* add currently active labels first */ /* add currently active labels first */
for (l = prevLabels; l != null; ) { for (l = prevLabels; l != null; ) {
if (l.text.caption) { if (l.text.caption) {
@ -381,7 +381,7 @@ public class LabelPlacement {
l = mPool.releaseAndGetNext(l); l = mPool.releaseAndGetNext(l);
} }
/* add way labels */ /* add way labels */
for (int i = 0, n = mTileSet.cnt; i < n; i++) { for (int i = 0, n = mTileSet.cnt; i < n; i++) {
MapTile t = tiles[i]; MapTile t = tiles[i];
if (!t.state(READY | NEW_DATA)) if (!t.state(READY | NEW_DATA))
@ -394,7 +394,7 @@ public class LabelPlacement {
l = addWayLabels(t, l, dx, dy, scale); l = addWayLabels(t, l, dx, dy, scale);
} }
/* add caption */ /* add caption */
for (int i = 0, n = mTileSet.cnt; i < n; i++) { for (int i = 0, n = mTileSet.cnt; i < n; i++) {
MapTile t = tiles[i]; MapTile t = tiles[i];
if (!t.state(READY | NEW_DATA)) if (!t.state(READY | NEW_DATA))
@ -421,7 +421,7 @@ public class LabelPlacement {
continue; continue;
} }
/* flip way label orientation */ /* flip way label orientation */
if (cos * (ti.x2 - ti.x1) - sin * (ti.y2 - ti.y1) < 0) { if (cos * (ti.x2 - ti.x1) - sin * (ti.y2 - ti.y1) < 0) {
float tmp = ti.x1; float tmp = ti.x1;
ti.x1 = ti.x2; ti.x1 = ti.x2;
@ -433,7 +433,7 @@ public class LabelPlacement {
} }
} }
/* add symbol items */ /* add symbol items */
for (int i = 0, n = mTileSet.cnt; i < n; i++) { for (int i = 0, n = mTileSet.cnt; i < n; i++) {
MapTile t = tiles[i]; MapTile t = tiles[i];
if (!t.state(READY | NEW_DATA)) if (!t.state(READY | NEW_DATA))
@ -466,15 +466,15 @@ public class LabelPlacement {
} }
} }
/* temporary used Label */ /* temporary used Label */
l = (Label) mPool.release(l); l = (Label) mPool.release(l);
/* draw text to bitmaps and create vertices */ /* draw text to bitmaps and create vertices */
work.textLayer.labels = groupLabels(mLabels); work.textLayer.labels = groupLabels(mLabels);
work.textLayer.prepare(); work.textLayer.prepare();
work.textLayer.labels = null; work.textLayer.labels = null;
/* remove tile locks */ /* remove tile locks */
mTileRenderer.releaseTiles(mTileSet); mTileRenderer.releaseTiles(mTileSet);
return true; return true;
@ -495,7 +495,7 @@ public class LabelPlacement {
TextStyle t = cur.text; TextStyle t = cur.text;
float w = cur.width; float w = cur.width;
/* iterate through following */ /* iterate through following */
for (Label l = (Label) cur.next; l != null; l = (Label) l.next) { for (Label l = (Label) cur.next; l != null; l = (Label) l.next) {
if (w != l.width || t != l.text || !cur.string.equals(l.string)) { if (w != l.width || t != l.text || !cur.string.equals(l.string)) {
@ -508,18 +508,18 @@ public class LabelPlacement {
} }
l.string = cur.string; l.string = cur.string;
/* insert l after cur */ /* insert l after cur */
Label tmp = (Label) cur.next; Label tmp = (Label) cur.next;
cur.next = l; cur.next = l;
/* continue outer loop at l */ /* continue outer loop at l */
cur = l; cur = l;
/* remove l from previous place */ /* remove l from previous place */
p.next = l.next; p.next = l.next;
l.next = tmp; l.next = tmp;
/* continue from previous */ /* continue from previous */
l = p; l = p;
} }
} }

View File

@ -52,32 +52,32 @@ public final class WayDecorator {
//int clip; //int clip;
//if ((clip = clipper.clipNext(curX, curY)) != 0) { //if ((clip = clipper.clipNext(curX, curY)) != 0) {
// if (clip < 0) { // if (clip < 0) {
// prevX = clipper.out[0]; // prevX = clipper.out[0];
// prevY = clipper.out[1]; // prevY = clipper.out[1];
// curX = clipper.out[2]; // curX = clipper.out[2];
// curY = clipper.out[3]; // curY = clipper.out[3];
// //
// if (prevX == min) // if (prevX == min)
// edge |= 1 << 0; // edge |= 1 << 0;
// else if (prevX == max) // else if (prevX == max)
// edge |= 1 << 1; // edge |= 1 << 1;
// //
// if (prevY == min) // if (prevY == min)
// edge |= 1 << 2; // edge |= 1 << 2;
// else if (prevY == max) // else if (prevY == max)
// edge |= 1 << 3; // edge |= 1 << 3;
// //
// if (curX == min) // if (curX == min)
// edge |= 1 << 4; // edge |= 1 << 4;
// else if (curX == max) // else if (curX == max)
// edge |= 1 << 5; // edge |= 1 << 5;
// //
// if (curY == min) // if (curY == min)
// edge |= 1 << 5; // edge |= 1 << 5;
// else if (curY == max) // else if (curY == max)
// edge |= 1 << 6; // edge |= 1 << 6;
// } // }
//} //}
int last = i; int last = i;
@ -101,13 +101,13 @@ public final class WayDecorator {
float nextY = coordinates[j + 1]; float nextY = coordinates[j + 1];
//if ((clip = clipper.clipNext(nextX, nextY)) != 0) { //if ((clip = clipper.clipNext(nextX, nextY)) != 0) {
// if (clip < 0) { // if (clip < 0) {
// curX = clipper.out[0]; // curX = clipper.out[0];
// curY = clipper.out[1]; // curY = clipper.out[1];
// // TODO break when cur has changed // // TODO break when cur has changed
// nextX = clipper.out[2]; // nextX = clipper.out[2];
// nextY = clipper.out[3]; // nextY = clipper.out[3];
// } // }
//} //}
float wx = nextX - curX; float wx = nextX - curX;
@ -146,15 +146,15 @@ public final class WayDecorator {
last = j - 2; last = j - 2;
//if (clip < 0) { //if (clip < 0) {
// if (nextX == min) // if (nextX == min)
// edge |= 1 << 4; // edge |= 1 << 4;
// else if (nextX == max) // else if (nextX == max)
// edge |= 1 << 5; // edge |= 1 << 5;
// //
// if (nextY == min) // if (nextY == min)
// edge |= 1 << 6; // edge |= 1 << 6;
// else if (nextY == max) // else if (nextY == max)
// edge |= 1 << 7; // edge |= 1 << 7;
//} //}
} }
@ -198,8 +198,8 @@ public final class WayDecorator {
// link items together // link items together
//if (t != null) { //if (t != null) {
// t.n1 = n; // t.n1 = n;
// n.n2 = t; // n.n2 = t;
//} //}
t = n; t = n;

View File

@ -95,42 +95,42 @@ public abstract class AbstractVectorLayer<T> extends Layer implements UpdateList
v.getMapPosition(t.position); v.getMapPosition(t.position);
} }
/* Hmm what is this for? */ /* Hmm what is this for? */
// double scale = t.position.scale * Tile.SIZE; // double scale = t.position.scale * Tile.SIZE;
// t.position.x = (long) (t.position.x * scale) / scale; // t.position.x = (long) (t.position.x * scale) / scale;
// t.position.y = (long) (t.position.y * scale) / scale; // t.position.y = (long) (t.position.y * scale) / scale;
bbox.map2mercator(); bbox.map2mercator();
// double xmin = bbox.xmin; // double xmin = bbox.xmin;
// double xmax = bbox.xmax; // double xmax = bbox.xmax;
// Box lbox = null; // Box lbox = null;
// Box rbox = null; // Box rbox = null;
// if (bbox.xmin < -180) { // if (bbox.xmin < -180) {
// bbox.xmin = -180; // bbox.xmin = -180;
// lbox = new Box(bbox); // lbox = new Box(bbox);
// } // }
// if (bbox.xmax > 180) { // if (bbox.xmax > 180) {
// bbox.xmax = 180; // bbox.xmax = 180;
// rbox = new Box(bbox); // rbox = new Box(bbox);
// } // }
processFeatures(t, bbox); processFeatures(t, bbox);
//if (lbox != null) { //if (lbox != null) {
// t.position.x += 1; // t.position.x += 1;
// lbox.xmax = 180; // lbox.xmax = 180;
// lbox.xmin = xmin + 180; // lbox.xmin = xmin + 180;
// processFeatures(t, lbox); // processFeatures(t, lbox);
// t.position.x -= 1; // t.position.x -= 1;
//} //}
// //
//if (rbox != null) { //if (rbox != null) {
// t.position.x -= 1; // t.position.x -= 1;
// rbox.xmin = -180; // rbox.xmin = -180;
// rbox.xmax = xmax - 180; // rbox.xmax = xmax - 180;
// processFeatures(t, rbox); // processFeatures(t, rbox);
// t.position.x += 1; // t.position.x += 1;
//} //}
t.buckets.prepare(); t.buckets.prepare();

View File

@ -67,7 +67,7 @@ public class Animator {
mMap.getMapPosition(mStartPos); mMap.getMapPosition(mStartPos);
/* TODO for large distance first scale out, then in /* TODO for large distance first scale out, then in
* calculate the maximum scale at which the BoundingBox * calculate the maximum scale at which the BoundingBox
* is completely visible */ * is completely visible */
double dx = Math.abs(longitudeToX(bbox.getMaxLongitude()) double dx = Math.abs(longitudeToX(bbox.getMaxLongitude())
- longitudeToX(bbox.getMinLongitude())); - longitudeToX(bbox.getMinLongitude()));
@ -211,8 +211,8 @@ public class Animator {
ViewController v = mMap.viewport(); ViewController v = mMap.viewport();
/* cancel animation when position was changed since last /* cancel animation when position was changed since last
* update, i.e. when it was modified outside the animator. */ * update, i.e. when it was modified outside the animator. */
if (v.getMapPosition(mCurPos)) { if (v.getMapPosition(mCurPos)) {
log.debug("cancel anim - changed"); log.debug("cancel anim - changed");
cancel(); cancel();
@ -255,7 +255,7 @@ public class Animator {
cancel(); cancel();
} }
/* remember current map position */ /* remember current map position */
final boolean changed = v.getMapPosition(mCurPos); final boolean changed = v.getMapPosition(mCurPos);
if (changed) { if (changed) {

View File

@ -37,13 +37,13 @@ public class ViewController extends Viewport {
mHeight = height; mHeight = height;
mWidth = width; mWidth = width;
/* setup projection matrix: /* setup projection matrix:
* 0. scale to window coordinates * 0. scale to window coordinates
* 1. translate to VIEW_DISTANCE * 1. translate to VIEW_DISTANCE
* 2. apply projection * 2. apply projection
* setup inverse projection: * setup inverse projection:
* 0. invert projection * 0. invert projection
* 1. invert translate to VIEW_DISTANCE */ * 1. invert translate to VIEW_DISTANCE */
float ratio = (mHeight / mWidth) * VIEW_SCALE; float ratio = (mHeight / mWidth) * VIEW_SCALE;
@ -55,14 +55,14 @@ public class ViewController extends Viewport {
mTmpMatrix.setTranslation(0, 0, -VIEW_DISTANCE); mTmpMatrix.setTranslation(0, 0, -VIEW_DISTANCE);
mProjMatrix.multiplyRhs(mTmpMatrix); mProjMatrix.multiplyRhs(mTmpMatrix);
/* set inverse projection matrix (without scaling) */ /* set inverse projection matrix (without scaling) */
mProjMatrix.get(mat); mProjMatrix.get(mat);
GLMatrix.invertM(mat, 0, mat, 0); GLMatrix.invertM(mat, 0, mat, 0);
mProjMatrixInverse.set(mat); mProjMatrixInverse.set(mat);
mProjMatrixUnscaled.copy(mProjMatrix); mProjMatrixUnscaled.copy(mProjMatrix);
/* scale to window coordinates */ /* scale to window coordinates */
mTmpMatrix.setScale(1 / mWidth, 1 / mWidth, 1 / mWidth); mTmpMatrix.setScale(1 / mWidth, 1 / mWidth, 1 / mWidth);
mProjMatrix.multiplyRhs(mTmpMatrix); mProjMatrix.multiplyRhs(mTmpMatrix);
@ -97,16 +97,16 @@ public class ViewController extends Viewport {
mPos.x = x; mPos.x = x;
mPos.y = y; mPos.y = y;
/* clamp latitude */ /* clamp latitude */
mPos.y = FastMath.clamp(mPos.y, 0, 1); mPos.y = FastMath.clamp(mPos.y, 0, 1);
/* wrap longitude */ /* wrap longitude */
while (mPos.x > 1) while (mPos.x > 1)
mPos.x -= 1; mPos.x -= 1;
while (mPos.x < 0) while (mPos.x < 0)
mPos.x += 1; mPos.x += 1;
/* limit longitude */ /* limit longitude */
if (mPos.x > mMaxX) if (mPos.x > mMaxX)
mPos.x = mMaxX; mPos.x = mMaxX;
else if (mPos.x < mMinX) else if (mPos.x < mMinX)
@ -228,24 +228,24 @@ public class ViewController extends Viewport {
mPos.copy(mapPosition); mPos.copy(mapPosition);
limitPosition(mPos); limitPosition(mPos);
// mPos.scale = clamp(mapPosition.scale, mMinScale, mMaxScale); // mPos.scale = clamp(mapPosition.scale, mMinScale, mMaxScale);
// mPos.x = mapPosition.x; // mPos.x = mapPosition.x;
// mPos.y = mapPosition.y; // mPos.y = mapPosition.y;
// mPos.tilt = limitTilt(mapPosition.tilt); // mPos.tilt = limitTilt(mapPosition.tilt);
// mPos.bearing = mapPosition.bearing; // mPos.bearing = mapPosition.bearing;
updateMatrices(); updateMatrices();
} }
private void updateMatrices() { private void updateMatrices() {
/* - view matrix: /* - view matrix:
* 0. apply rotate * 0. apply rotate
* 1. apply tilt */ * 1. apply tilt */
mRotationMatrix.setRotation(mPos.bearing, 0, 0, 1); mRotationMatrix.setRotation(mPos.bearing, 0, 0, 1);
mTmpMatrix.setRotation(mPos.tilt, 1, 0, 0); mTmpMatrix.setRotation(mPos.tilt, 1, 0, 0);
/* apply first rotation, then tilt */ /* apply first rotation, then tilt */
mRotationMatrix.multiplyLhs(mTmpMatrix); mRotationMatrix.multiplyLhs(mTmpMatrix);
mViewMatrix.copy(mRotationMatrix); mViewMatrix.copy(mRotationMatrix);

View File

@ -195,9 +195,9 @@ public class Viewport {
unproject(1, -1, box, 0); unproject(1, -1, box, 0);
/* top-left */ /* top-left */
unproject(-1, -1, box, 2); unproject(-1, -1, box, 2);
/* bottom-left */ /* bottom-left */
unproject(-1, 1, box, 4); unproject(-1, 1, box, 4);
/* bottom-right */ /* bottom-right */
unproject(1, 1, box, 6); unproject(1, 1, box, 6);
if (add == 0) if (add == 0)
@ -290,7 +290,7 @@ public class Viewport {
} }
protected void unprojectScreen(double x, double y, float[] out) { protected void unprojectScreen(double x, double y, float[] out) {
/* scale to -1..1 */ /* scale to -1..1 */
float mx = (float) (1 - (x / mWidth * 2)); float mx = (float) (1 - (x / mWidth * 2));
float my = (float) (1 - (y / mHeight * 2)); float my = (float) (1 - (y / mHeight * 2));

View File

@ -67,7 +67,7 @@ public final class BufferObject extends Inlist<BufferObject> {
GLState.bindBuffer(target, id); GLState.bindBuffer(target, id);
/* reuse memory allocated for vbo when possible and allocated /* reuse memory allocated for vbo when possible and allocated
* memory is less then four times the new data */ * memory is less then four times the new data */
if (!GLAdapter.NO_BUFFER_SUB_DATA && !clear && if (!GLAdapter.NO_BUFFER_SUB_DATA && !clear &&
(size > newSize) && (size < newSize * 4)) { (size > newSize) && (size < newSize * 4)) {
@ -125,7 +125,7 @@ public final class BufferObject extends Inlist<BufferObject> {
if (size != 0) { if (size != 0) {
/* find the item with minimal size greater 'size' bytes. */ /* find the item with minimal size greater 'size' bytes. */
BufferObject bo = pool[t]; BufferObject bo = pool[t];
/* actually points to BufferObject before min */ /* actually points to BufferObject before min */
BufferObject min = null; BufferObject min = null;
BufferObject prev = null; BufferObject prev = null;

View File

@ -78,12 +78,12 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
int sumIndices = eb.idx[0] + eb.idx[1] + eb.idx[2]; int sumIndices = eb.idx[0] + eb.idx[1] + eb.idx[2];
/* extrusion */ /* extrusion */
if (sumIndices > 0) if (sumIndices > 0)
gl.drawElements(GL.TRIANGLES, sumIndices, gl.drawElements(GL.TRIANGLES, sumIndices,
GL.UNSIGNED_SHORT, eb.off[0]); GL.UNSIGNED_SHORT, eb.off[0]);
/* mesh */ /* mesh */
if (eb.idx[4] > 0) { if (eb.idx[4] > 0) {
gl.drawElements(GL.TRIANGLES, eb.idx[4], gl.drawElements(GL.TRIANGLES, eb.idx[4],
GL.UNSIGNED_SHORT, eb.off[4]); GL.UNSIGNED_SHORT, eb.off[4]);
@ -106,7 +106,7 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
s.useProgram(); s.useProgram();
GLState.enableVertexArrays(s.aPos, -1); GLState.enableVertexArrays(s.aPos, -1);
/* only use face-culling when it's unlikely /* only use face-culling when it's unlikely
* that one'moves through the building' */ * that one'moves through the building' */
if (v.pos.zoomLevel < 18) if (v.pos.zoomLevel < 18)
gl.enable(GL.CULL_FACE); gl.enable(GL.CULL_FACE);
@ -140,7 +140,7 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
renderCombined(s.aPos, ebs[i]); renderCombined(s.aPos, ebs[i]);
} }
/* only draw to color buffer */ /* only draw to color buffer */
gl.colorMask(true, true, true, true); gl.colorMask(true, true, true, true);
gl.depthMask(false); gl.depthMask(false);
gl.depthFunc(GL.EQUAL); gl.depthFunc(GL.EQUAL);
@ -183,32 +183,32 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
gl.vertexAttribPointer(s.aLight, 2, GL.UNSIGNED_BYTE, gl.vertexAttribPointer(s.aLight, 2, GL.UNSIGNED_BYTE,
false, 8, eb.getVertexOffset() + 6); false, 8, eb.getVertexOffset() + 6);
/* draw extruded outlines */ /* draw extruded outlines */
if (eb.idx[0] > 0) { if (eb.idx[0] > 0) {
if (mTranslucent) { if (mTranslucent) {
gl.depthFunc(GL.EQUAL); gl.depthFunc(GL.EQUAL);
setMatrix(s, v, ebs[i]); setMatrix(s, v, ebs[i]);
} }
/* draw roof */ /* draw roof */
gl.uniform1i(s.uMode, 0); gl.uniform1i(s.uMode, 0);
gl.drawElements(GL.TRIANGLES, eb.idx[2], gl.drawElements(GL.TRIANGLES, eb.idx[2],
GL.UNSIGNED_SHORT, eb.off[2]); GL.UNSIGNED_SHORT, eb.off[2]);
/* draw sides 1 */ /* draw sides 1 */
gl.uniform1i(s.uMode, 1); gl.uniform1i(s.uMode, 1);
gl.drawElements(GL.TRIANGLES, eb.idx[0], gl.drawElements(GL.TRIANGLES, eb.idx[0],
GL.UNSIGNED_SHORT, eb.off[0]); GL.UNSIGNED_SHORT, eb.off[0]);
/* draw sides 2 */ /* draw sides 2 */
gl.uniform1i(s.uMode, 2); gl.uniform1i(s.uMode, 2);
gl.drawElements(GL.TRIANGLES, eb.idx[1], gl.drawElements(GL.TRIANGLES, eb.idx[1],
GL.UNSIGNED_SHORT, eb.off[1]); GL.UNSIGNED_SHORT, eb.off[1]);
if (mTranslucent) { if (mTranslucent) {
/* drawing gl_lines with the same coordinates /* drawing gl_lines with the same coordinates
* does not result in same depth values as * does not result in same depth values as
* polygons, so add offset and draw gl_lequal */ * polygons, so add offset and draw gl_lequal */
gl.depthFunc(GL.LEQUAL); gl.depthFunc(GL.LEQUAL);
v.mvp.addDepthOffset(100); v.mvp.addDepthOffset(100);
v.mvp.setAsUniform(s.uMVP); v.mvp.setAsUniform(s.uMVP);
@ -220,14 +220,14 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
GL.UNSIGNED_SHORT, eb.off[3]); GL.UNSIGNED_SHORT, eb.off[3]);
} }
/* draw triangle meshes */ /* draw triangle meshes */
if (eb.idx[4] > 0) { if (eb.idx[4] > 0) {
gl.drawElements(GL.TRIANGLES, eb.idx[4], gl.drawElements(GL.TRIANGLES, eb.idx[4],
GL.UNSIGNED_SHORT, eb.off[4]); GL.UNSIGNED_SHORT, eb.off[4]);
} }
} }
/* just a temporary reference! */ /* just a temporary reference! */
ebs[i] = null; ebs[i] = null;
} }
@ -259,8 +259,8 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
v.mvp.multiplyLhs(v.viewproj); v.mvp.multiplyLhs(v.viewproj);
if (mTranslucent) { if (mTranslucent) {
/* should avoid z-fighting of overlapping /* should avoid z-fighting of overlapping
* building from different tiles */ * building from different tiles */
int zoom = (1 << z); int zoom = (1 << z);
int delta = (int) (l.x * zoom) % 4 + (int) (l.y * zoom) % 4 * 4; int delta = (int) (l.x * zoom) % 4 + (int) (l.y * zoom) % 4 * 4;
v.mvp.addDepthOffset(delta); v.mvp.addDepthOffset(delta);

View File

@ -300,19 +300,19 @@ public class GLMatrix {
private native static ByteBuffer getBuffer(long self); private native static ByteBuffer getBuffer(long self);
/* Copyright (C) 2007 The Android Open Source Project /* Copyright (C) 2007 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. */ * limitations under the License. */
/** /**
* Define a projection matrix in terms of six clip planes * Define a projection matrix in terms of six clip planes

View File

@ -48,12 +48,12 @@ public class GridRenderer extends BucketRenderer {
public GridRenderer(int numLines, LineStyle lineStyle, TextStyle textStyle) { public GridRenderer(int numLines, LineStyle lineStyle, TextStyle textStyle) {
int size = Tile.SIZE; int size = Tile.SIZE;
/* not needed to set but we know: 16 lines 'a' two points */ /* not needed to set but we know: 16 lines 'a' two points */
mLines = new GeometryBuffer(2 * 16, 16); mLines = new GeometryBuffer(2 * 16, 16);
float pos = -size * 4; float pos = -size * 4;
/* 8 vertical lines */ /* 8 vertical lines */
for (int i = 0; i < 8 * numLines; i++) { for (int i = 0; i < 8 * numLines; i++) {
float x = pos + i * size / numLines; float x = pos + i * size / numLines;
mLines.startLine(); mLines.startLine();
@ -61,7 +61,7 @@ public class GridRenderer extends BucketRenderer {
mLines.addPoint(x, pos + size * 8); mLines.addPoint(x, pos + size * 8);
} }
/* 8 horizontal lines */ /* 8 horizontal lines */
for (int j = 0; j < 8 * numLines; j++) { for (int j = 0; j < 8 * numLines; j++) {
float y = pos + j * size / numLines; float y = pos + j * size / numLines;
mLines.startLine(); mLines.startLine();
@ -119,7 +119,7 @@ public class GridRenderer extends BucketRenderer {
int x = (int) (v.pos.x * z); int x = (int) (v.pos.x * z);
int y = (int) (v.pos.y * z); int y = (int) (v.pos.y * z);
/* update buckets when map moved by at least one tile */ /* update buckets when map moved by at least one tile */
if (x == mCurX && y == mCurY && z == mCurZ) if (x == mCurX && y == mCurY && z == mCurZ)
return; return;

View File

@ -66,7 +66,7 @@ public class MapRenderer {
mViewport = new GLViewport(); mViewport = new GLViewport();
mBufferPool = new NativeBufferPool(); mBufferPool = new NativeBufferPool();
/* FIXME should be done in 'destroy' method /* FIXME should be done in 'destroy' method
* clear all previous vbo refs */ * clear all previous vbo refs */
BufferObject.clear(); BufferObject.clear();
setBackgroundColor(Color.DKGRAY); setBackgroundColor(Color.DKGRAY);
@ -115,13 +115,13 @@ public class MapRenderer {
if (GLAdapter.debugView) { if (GLAdapter.debugView) {
/* modify this to scale only the view, to see /* modify this to scale only the view, to see
* which tiles are rendered */ * which tiles are rendered */
mViewport.mvp.setScale(0.5f, 0.5f, 1); mViewport.mvp.setScale(0.5f, 0.5f, 1);
mViewport.viewproj.multiplyLhs(mViewport.mvp); mViewport.viewproj.multiplyLhs(mViewport.mvp);
mViewport.proj.multiplyLhs(mViewport.mvp); mViewport.proj.multiplyLhs(mViewport.mvp);
} }
/* update layers */ /* update layers */
LayerRenderer[] layers = mMap.layers().getLayerRenderer(); LayerRenderer[] layers = mMap.layers().getLayerRenderer();
for (int i = 0, n = layers.length; i < n; i++) { for (int i = 0, n = layers.length; i < n; i++) {

View File

@ -203,7 +203,7 @@ public class OffscreenRenderer extends LayerRenderer {
mShader.useProgram(); mShader.useProgram();
/* bind depth texture */ /* bind depth texture */
if (useDepthTexture) { if (useDepthTexture) {
gl.activeTexture(GL.TEXTURE1); gl.activeTexture(GL.TEXTURE1);
GLState.bindTex2D(renderDepth); GLState.bindTex2D(renderDepth);

View File

@ -251,10 +251,10 @@ public class TextureAtlas extends Inlist<TextureAtlas> {
return new TextureAtlas(width, height); return new TextureAtlas(width, height);
} }
// /// FIXME // /// FIXME
// @Override // @Override
// protected void finalize(){ // protected void finalize(){
// if (texture != null) // if (texture != null)
// TextureItem.releaseTexture(texture); // TextureItem.releaseTexture(texture);
// } // }
} }

Some files were not shown because too many files have changed in this diff Show More