add LineLayer setExtents to not add caps outside visible region
This commit is contained in:
parent
bf8cc329cf
commit
9d078142aa
@ -23,6 +23,7 @@ import org.oscim.core.MapElement;
|
||||
import org.oscim.core.MercatorProjection;
|
||||
import org.oscim.core.Tag;
|
||||
import org.oscim.core.TagSet;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.layers.tile.MapTile;
|
||||
import org.oscim.layers.tile.TileLoader;
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer.TileLoaderProcessHook;
|
||||
@ -245,6 +246,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
||||
if (ll.line == null) {
|
||||
ll.line = line;
|
||||
ll.scale = line.fixed ? 1 : mLineScale;
|
||||
ll.setExtents(-4, Tile.SIZE + 4);
|
||||
}
|
||||
|
||||
if (line.outline) {
|
||||
|
||||
@ -24,7 +24,6 @@ import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.backend.canvas.Paint.Cap;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
import org.oscim.core.MercatorProjection;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.renderer.GLShader;
|
||||
import org.oscim.renderer.GLState;
|
||||
import org.oscim.renderer.GLUtils;
|
||||
@ -73,6 +72,8 @@ public final class LineLayer extends RenderElement {
|
||||
|
||||
public float heightOffset;
|
||||
|
||||
private int tmin = Integer.MIN_VALUE, tmax = Integer.MAX_VALUE;
|
||||
|
||||
LineLayer(int layer) {
|
||||
super(RenderElement.LINE);
|
||||
this.level = layer;
|
||||
@ -87,6 +88,11 @@ public final class LineLayer extends RenderElement {
|
||||
outlines = link;
|
||||
}
|
||||
|
||||
public void setExtents(int min, int max) {
|
||||
tmin = min;
|
||||
tmax = max;
|
||||
}
|
||||
|
||||
/**
|
||||
* For point reduction by minimal distance. Default is 1/8.
|
||||
*/
|
||||
@ -108,9 +114,6 @@ public final class LineLayer extends RenderElement {
|
||||
addLine(points, null, numPoints, closed);
|
||||
}
|
||||
|
||||
private static int tmax = Tile.SIZE + 4;
|
||||
private static int tmin = -4;
|
||||
|
||||
private void addLine(float[] points, short[] index, int numPoints, boolean closed) {
|
||||
|
||||
boolean rounded = false;
|
||||
@ -272,7 +275,6 @@ public final class LineLayer extends RenderElement {
|
||||
|
||||
curX = points[ipos++];
|
||||
curY = points[ipos++];
|
||||
|
||||
nextX = points[ipos++];
|
||||
nextY = points[ipos++];
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user