mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-04-20 00:31:00 +00:00
More plumbing for additional geometry dimensions
This commit is contained in:
parent
a3c52c8e14
commit
ee3f35363b
@ -81,7 +81,22 @@ void parse_geometry(int t, json_object *j, drawvec &out, int op, const char *fna
|
||||
}
|
||||
|
||||
draw d(op, x, y);
|
||||
out.push_back(draw(op, x, y));
|
||||
|
||||
size_t maybe_attr = 3;
|
||||
if (j->length > 2 && j->array[2]->type == JSON_NUMBER) {
|
||||
d.elevation = j->array[2]->number;
|
||||
maybe_attr = 4;
|
||||
}
|
||||
|
||||
if (j->length > maybe_attr) {
|
||||
if (j->array[maybe_attr]->type == JSON_HASH) {
|
||||
char *s = json_stringify(j->array[maybe_attr]);
|
||||
d.attributes = std::string(s);
|
||||
free(s); // stringify
|
||||
}
|
||||
}
|
||||
|
||||
out.push_back(d);
|
||||
} else {
|
||||
fprintf(stderr, "%s:%d: malformed point\n", fname, line);
|
||||
json_context(j);
|
||||
|
13
tile.cpp
13
tile.cpp
@ -294,7 +294,10 @@ void rewrite(drawvec &geom, int z, int nextzoom, int maxzoom, long long *bbox, u
|
||||
|
||||
drawvec geom2;
|
||||
for (size_t i = 0; i < geom.size(); i++) {
|
||||
geom2.push_back(draw(geom[i].op, (geom[i].x + sx) >> geometry_scale, (geom[i].y + sy) >> geometry_scale));
|
||||
draw d = geom[i];
|
||||
d.x = (geom[i].x + sx) >> geometry_scale;
|
||||
d.y = (geom[i].y + sy) >> geometry_scale;
|
||||
geom2.push_back(d);
|
||||
}
|
||||
|
||||
for (xo = bbox2[0]; xo <= bbox2[2]; xo++) {
|
||||
@ -1237,13 +1240,17 @@ bool clip_to_tile(serial_feature &sf, int z, long long buffer) {
|
||||
|
||||
if (sf.bbox[0] <= (1LL << 32) * buffer / 256) {
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
sf.geometry.push_back(draw(sf.geometry[i].op, sf.geometry[i].x + (1LL << 32), sf.geometry[i].y));
|
||||
draw d = sf.geometry[i];
|
||||
d.x += 1LL << 32;
|
||||
sf.geometry.push_back(d);
|
||||
}
|
||||
}
|
||||
|
||||
if (sf.bbox[2] >= (1LL << 32) - ((1LL << 32) * buffer / 256)) {
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
sf.geometry.push_back(draw(sf.geometry[i].op, sf.geometry[i].x - (1LL << 32), sf.geometry[i].y));
|
||||
draw d = sf.geometry[i];
|
||||
d.x -= 1LL << 32;
|
||||
sf.geometry.push_back(d);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user