Take another opportunity to simplify lines after coalescing features

This commit is contained in:
Eric Fischer 2014-10-18 11:40:09 -07:00
parent 151f0c116c
commit 043b35eede

10
tile.cc
View File

@ -662,6 +662,7 @@ struct coalesce {
std::vector<int> meta;
unsigned long long index;
char *metasrc;
bool coalesced;
bool operator< (const coalesce &o) const {
int cmp = coalindexcmp(this, &o);
@ -952,6 +953,7 @@ long long write_tile(struct index *start, struct index *end, char *metabase, uns
c.index = i->index;
c.geom = geom;
c.metasrc = meta;
c.coalesced = false;
decode_meta(&meta, &keys, &values, file_keys, &c.meta, NULL);
features.push_back(c);
@ -974,12 +976,20 @@ long long write_tile(struct index *start, struct index *end, char *metabase, uns
for (z = 0; z < features[x].geom.size(); z++) {
out[y].geom.push_back(features[x].geom[z]);
}
out[y].coalesced = true;
} else {
out.push_back(features[x]);
}
}
features = out;
for (x = 0; x < features.size(); x++) {
if (features[x].coalesced && features[x].type == VT_LINE) {
features[x].geom = remove_noop(features[x].geom, features[x].type);
features[x].geom = simplify_lines(features[x].geom, 32, 0);
}
}
mapnik::vector::tile tile = create_tile(layername, line_detail, features, &count, &keys, &values);
pool_free(&keys);