summaryrefslogtreecommitdiff
path: root/src/mbgl/text/collision_feature.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-03-16 17:45:00 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-05-05 11:30:53 -0700
commit9330d674a983652d248d6a43fa4adbf5970c3d30 (patch)
treebd9292fcdb14f416922197f36c7707bb52e13591 /src/mbgl/text/collision_feature.cpp
parentf89cfacab2457602c5bd81ab9da35cede23584e2 (diff)
downloadqtlocation-mapboxgl-9330d674a983652d248d6a43fa4adbf5970c3d30.tar.gz
[core] Use geometry.hpp's point
Diffstat (limited to 'src/mbgl/text/collision_feature.cpp')
-rw-r--r--src/mbgl/text/collision_feature.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mbgl/text/collision_feature.cpp b/src/mbgl/text/collision_feature.cpp
index 09c04ede78..8f0f099670 100644
--- a/src/mbgl/text/collision_feature.cpp
+++ b/src/mbgl/text/collision_feature.cpp
@@ -17,17 +17,17 @@ CollisionFeature::CollisionFeature(const GeometryCoordinates &line, const Anchor
if (alongLine) {
float height = y2 - y1;
- const float length = x2 - x1;
+ const double length = x2 - x1;
if (height <= 0.0f) return;
height = std::max(10.0f * boxScale, height);
- GeometryCoordinate anchorPoint(int16_t(anchor.x), int16_t(anchor.y));
+ GeometryCoordinate anchorPoint = convertPoint<int16_t>(anchor.point);
if (straight) {
// used for icon labels that are aligned with the line, but don't curve along it
- const vec2<double> vector = util::unit(vec2<double>(line[anchor.segment + 1] - line[anchor.segment])) * length;
+ const GeometryCoordinate vector = convertPoint<int16_t>(util::unit(convertPoint<double>(line[anchor.segment + 1] - line[anchor.segment])) * length);
const GeometryCoordinates newLine({ anchorPoint - vector, anchorPoint + vector });
bboxifyLabel(newLine, anchorPoint, 0, length, height, indexedFeature);
} else {
@@ -35,7 +35,7 @@ CollisionFeature::CollisionFeature(const GeometryCoordinates &line, const Anchor
bboxifyLabel(line, anchorPoint, anchor.segment, length, height, indexedFeature);
}
} else {
- boxes.emplace_back(anchor, x1, y1, x2, y2, std::numeric_limits<float>::infinity(), indexedFeature);
+ boxes.emplace_back(anchor.point, x1, y1, x2, y2, std::numeric_limits<float>::infinity(), indexedFeature);
}
}
@@ -89,7 +89,7 @@ void CollisionFeature::bboxifyLabel(const GeometryCoordinates &line,
const auto& p0 = line[index];
const auto& p1 = line[index + 1];
- vec2<float> boxAnchor = {
+ Point<float> boxAnchor = {
p0.x + segmentBoxDistance / segmentLength * (p1.x - p0.x),
p0.y + segmentBoxDistance / segmentLength * (p1.y - p0.y)
};