summaryrefslogtreecommitdiff
path: root/src/mbgl/text
diff options
context:
space:
mode:
authorAnsis Brammanis <brammanis@gmail.com>2016-01-28 21:41:20 -0800
committerAnsis Brammanis <brammanis@gmail.com>2016-02-02 14:49:03 -0800
commit4e0d1070f623811513e6800e4ac906d69958d66a (patch)
treefa10d0d169a26f680cd6dd2ead69e42bd541ce85 /src/mbgl/text
parentf1f53c36d0d392f83cf99859d993d70676048bdf (diff)
downloadqtlocation-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')
-rw-r--r--src/mbgl/text/collision_tile.cpp5
-rw-r--r--src/mbgl/text/collision_tile.hpp1
-rw-r--r--src/mbgl/text/get_anchors.cpp6
3 files changed, 6 insertions, 6 deletions
diff --git a/src/mbgl/text/collision_tile.cpp b/src/mbgl/text/collision_tile.cpp
index b24e2cfcdb..d02307d2ed 100644
--- a/src/mbgl/text/collision_tile.cpp
+++ b/src/mbgl/text/collision_tile.cpp
@@ -1,4 +1,5 @@
#include <mbgl/text/collision_tile.hpp>
+#include <mbgl/util/constants.hpp>
#include <cmath>
namespace mbgl {
@@ -10,11 +11,11 @@ CollisionTile::CollisionTile(PlacementConfig config_) : config(config_),
// left
CollisionBox(vec2<float>(0, 0), 0, -infinity, 0, infinity, infinity),
// right
- CollisionBox(vec2<float>(extent, 0), 0, -infinity, 0, infinity, infinity),
+ CollisionBox(vec2<float>(util::EXTENT, 0), 0, -infinity, 0, infinity, infinity),
// top
CollisionBox(vec2<float>(0, 0), -infinity, 0, infinity, 0, infinity),
// bottom
- CollisionBox(vec2<float>(0, extent), -infinity, 0, infinity, 0, infinity),
+ CollisionBox(vec2<float>(0, util::EXTENT), -infinity, 0, infinity, 0, infinity),
}}) {
tree.clear();
diff --git a/src/mbgl/text/collision_tile.hpp b/src/mbgl/text/collision_tile.hpp
index f535dfe4ff..eb5d4bc64c 100644
--- a/src/mbgl/text/collision_tile.hpp
+++ b/src/mbgl/text/collision_tile.hpp
@@ -55,7 +55,6 @@ private:
Tree tree;
std::array<float, 4> rotationMatrix;
std::array<float, 4> reverseRotationMatrix;
- const float extent = 4096;
std::array<CollisionBox, 4> edges;
};
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.