[core] Normalize tile coordinates in VectorTile (#4966)

Previously, vector tile coordinates were being normalized to util::EXTENT in each place they were used, and for annotation and GeoJSON sources that don't require normalization.
This commit is contained in:
John Firebaugh
2016-05-11 13:54:05 -07:00
parent 5f1144f05a
commit 1a030e7c33
12 changed files with 9 additions and 54 deletions

View File

@@ -114,6 +114,7 @@ GeometryCollection VectorTileFeature::getGeometries() const {
uint32_t length = 0;
int32_t x = 0;
int32_t y = 0;
const float scale = float(util::EXTENT) / layer.extent;
GeometryCollection lines;
@@ -139,7 +140,7 @@ GeometryCollection VectorTileFeature::getGeometries() const {
line = &lines.back();
}
line->emplace_back(x, y);
line->emplace_back(::round(x * scale), ::round(y * scale));
} else if (cmd == 7) { // closePolygon
if (!line->empty()) {
@@ -154,10 +155,6 @@ GeometryCollection VectorTileFeature::getGeometries() const {
return lines;
}
uint32_t VectorTileFeature::getExtent() const {
return layer.extent;
}
VectorTile::VectorTile(std::shared_ptr<const std::string> data_)
: data(std::move(data_)) {
}