add GeometryBuffer class to pass data from MapDatabase to TileGenerator

This commit is contained in:
Hannes Janetzek
2013-03-19 00:40:12 +01:00
parent 64da69e5cf
commit 8c8750a833
12 changed files with 380 additions and 449 deletions

View File

@@ -0,0 +1,42 @@
package org.oscim.core;
public class GeometryBuffer {
public float[] points;
public short[] index;
public int indexPos;
public int pointPos;
public GeometryBuffer(float[] points, short[] index){
this.points = points;
this.index = index;
}
public GeometryBuffer(int numPoints, int numIndices) {
this.points = new float[numPoints * 2];
this.index = new short[numIndices];
}
public float[] ensurePointSize(int size, boolean copy){
if (size * 2 < points.length)
return points;
float[] tmp = new float[size * 2 + 1024];
if (copy)
System.arraycopy(tmp, 0, points, 0, points.length);
points = tmp;
return points;
}
public short[] ensureIndexSize(int size, boolean copy){
if (size < index.length)
return index;
short[] tmp = new short[size + 128];
if (copy)
System.arraycopy(tmp, 0, index, 0, index.length);
index = tmp;
return index;
}
}