summaryrefslogtreecommitdiff
path: root/src/mbgl/tile/vector_tile.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-05-11 13:54:05 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-05-11 13:54:05 -0700
commit1a030e7c3347f08329d2787cde37cfa0958baad4 (patch)
treee9ec309eda3de6edc411824e76df632730d41064 /src/mbgl/tile/vector_tile.cpp
parent5f1144f05a8391cf2c01dc7a67312a27ef32805b (diff)
downloadqtlocation-mapboxgl-1a030e7c3347f08329d2787cde37cfa0958baad4.tar.gz
[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.
Diffstat (limited to 'src/mbgl/tile/vector_tile.cpp')
-rw-r--r--src/mbgl/tile/vector_tile.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/mbgl/tile/vector_tile.cpp b/src/mbgl/tile/vector_tile.cpp
index 27edd85324..343224052a 100644
--- a/src/mbgl/tile/vector_tile.cpp
+++ b/src/mbgl/tile/vector_tile.cpp
@@ -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_)) {
}