Merge branch 'master' into earcut-polygon

Conflicts:
	tile.cc
This commit is contained in:
Eric Fischer
2016-04-26 12:09:56 -07:00
18 changed files with 6701 additions and 17 deletions
+43 -8
View File
@@ -510,7 +510,7 @@ void *partial_feature_worker(void *v) {
geom = remove_noop(geom, t, 32 - z - line_detail);
}
geom = simplify_lines(geom, z, line_detail);
geom = simplify_lines(geom, z, line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]));
}
}
@@ -545,7 +545,6 @@ void *partial_feature_worker(void *v) {
if (additional[A_DEBUG_POLYGON]) {
check_polygon(geoms[i], before);
}
geoms[i] = close_poly(geoms[i]);
}
}
@@ -765,18 +764,45 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
}
}
if (quick != 1) {
// Can't accept the quick check if guaranteeing no duplication, since the
// overlap might have been in the buffer.
if (quick != 1 || prevent[P_DUPLICATION]) {
drawvec clipped;
// Do the clipping, even if we are going to include the whole feature,
// so that we can know whether the feature itself, or only the feature's
// bounding box, touches the tile.
if (t == VT_LINE) {
geom = clip_lines(geom, z, line_detail, buffer);
clipped = clip_lines(geom, z, line_detail, buffer);
}
if (t == VT_POLYGON) {
geom = simple_clip_poly(geom, z, line_detail, buffer);
clipped = simple_clip_poly(geom, z, line_detail, buffer);
}
if (t == VT_POINT) {
geom = clip_point(geom, z, line_detail, buffer);
clipped = clip_point(geom, z, line_detail, buffer);
}
geom = remove_noop(geom, t, 0);
clipped = remove_noop(clipped, t, 0);
// Must clip at z0 even if we don't want clipping, to handle features
// that are duplicated across the date line
if (prevent[P_DUPLICATION] && z != 0) {
if (point_within_tile((bbox[0] + bbox[2]) / 2, (bbox[1] + bbox[3]) / 2, z, line_detail, buffer)) {
// geom is unchanged
} else {
geom.clear();
}
} else if (prevent[P_CLIPPING] && z != 0) {
if (clipped.size() == 0) {
geom.clear();
} else {
// geom is unchanged
}
} else {
geom = clipped;
}
}
if (geom.size() > 0) {
@@ -954,7 +980,16 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
for (size_t x = 0; x < features[j].size(); x++) {
if (features[j][x].coalesced && features[j][x].type == VT_LINE) {
features[j][x].geom = remove_noop(features[j][x].geom, features[j][x].type, 0);
features[j][x].geom = simplify_lines(features[j][x].geom, 32, 0);
features[j][x].geom = simplify_lines(features[j][x].geom, 32, 0,
!(prevent[P_CLIPPING] || prevent[P_DUPLICATION]));
}
if (features[j][x].type == VT_POLYGON) {
if (features[j][x].coalesced) {
features[j][x].geom = clean_or_clip_poly(features[j][x].geom, 0, 0, 0, false);
}
features[j][x].geom = close_poly(features[j][x].geom);
}
if (features[j][x].geom.size() > 0) {