Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapsforge: large query zoom levels have polygon artifacts #391

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vtm/src/org/oscim/layers/tile/vector/VectorTileLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public void renderArea(AreaStyle area, int level) {
} else {
PolygonBucket pb = mBuckets.getPolygonBucket(nLevel);
pb.area = area;
pb.addPolygon(mElement.points, mElement.index);
pb.addPolygon(mElement);
}
}

Expand Down
17 changes: 11 additions & 6 deletions vtm/src/org/oscim/renderer/bucket/PolygonBucket.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.oscim.theme.styles.AreaStyle;
import org.oscim.utils.ArrayUtils;
import org.oscim.utils.geom.LineClipper;
import org.oscim.utils.geom.TileClipper;
import org.oscim.utils.math.Interpolation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -54,25 +55,29 @@ public final class PolygonBucket extends RenderBucket {

public static boolean enableTexture = true;

private final TileClipper clipper;

private float xmin = Short.MAX_VALUE;
private float ymin = Short.MAX_VALUE;
private float xmax = Short.MIN_VALUE;
private float ymax = Short.MIN_VALUE;

public AreaStyle area;

PolygonBucket(int layer) {
super(RenderBucket.POLYGON, true, false);
level = layer;
clipper = new TileClipper(Tile.SIZE * (-2), Tile.SIZE * (-2), Tile.SIZE * 2, Tile.SIZE * 2);;
}

public void addPolygon(GeometryBuffer geom) {
clipper.clip(geom);
addPolygon(geom.points, geom.index);
}

float xmin = Short.MAX_VALUE;
float ymin = Short.MAX_VALUE;
float xmax = Short.MIN_VALUE;
float ymax = Short.MIN_VALUE;

final float[] bbox = new float[8];

public void addPolygon(float[] points, int[] index) {
private void addPolygon(float[] points, int[] index) {
short center = (short) ((Tile.SIZE >> 1) * COORD_SCALE);

boolean outline = area.strokeWidth > 0;
Expand Down