diff options
author | Ansis Brammanis <brammanis@gmail.com> | 2016-01-28 21:41:20 -0800 |
---|---|---|
committer | Ansis Brammanis <brammanis@gmail.com> | 2016-02-02 14:49:03 -0800 |
commit | 4e0d1070f623811513e6800e4ac906d69958d66a (patch) | |
tree | fa10d0d169a26f680cd6dd2ead69e42bd541ce85 /src/mbgl/text/get_anchors.cpp | |
parent | f1f53c36d0d392f83cf99859d993d70676048bdf (diff) | |
download | qtlocation-mapboxgl-4e0d1070f623811513e6800e4ac906d69958d66a.tar.gz |
[core] support tiles with non-4096 extents
Convert all geometries to the maximum extent supported by our buffers
and then use that constant extent everywhere else.
Diffstat (limited to 'src/mbgl/text/get_anchors.cpp')
-rw-r--r-- | src/mbgl/text/get_anchors.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mbgl/text/get_anchors.cpp b/src/mbgl/text/get_anchors.cpp index 2f991d8e87..1a2142bfb2 100644 --- a/src/mbgl/text/get_anchors.cpp +++ b/src/mbgl/text/get_anchors.cpp @@ -1,6 +1,6 @@ #include <mbgl/text/get_anchors.hpp> #include <mbgl/text/check_max_angle.hpp> - +#include <mbgl/util/constants.hpp> #include <mbgl/util/interpolate.hpp> #include <cmath> @@ -31,7 +31,7 @@ Anchors resample(const std::vector<Coordinate> &line, const float offset, const x = util::interpolate(float(a.x), float(b.x), t), y = util::interpolate(float(a.y), float(b.y), t); - if (x >= 0 && x < 4096 && y >= 0 && y < 4096) { + if (x >= 0 && x < util::EXTENT && y >= 0 && y < util::EXTENT) { Anchor anchor(::round(x), ::round(y), angle, 0.5f, i); if (!angleWindowSize || checkMaxAngle(line, anchor, labelLength, angleWindowSize, maxAngle)) { @@ -71,7 +71,7 @@ Anchors getAnchors(const std::vector<Coordinate> &line, float spacing, const float labelLength = fmax(textRight - textLeft, iconRight - iconLeft); // Is the line continued from outside the tile boundary? - const bool continuedLine = (line[0].x == 0 || line[0].x == 4096 || line[0].y == 0 || line[0].y == 4096); + const bool continuedLine = (line[0].x == 0 || line[0].x == util::EXTENT || line[0].y == 0 || line[0].y == util::EXTENT); // Is the label long, relative to the spacing? // If so, adjust the spacing so there is always a minimum space of `spacing / 4` between label edges. |