summaryrefslogtreecommitdiff
path: root/src/mbgl/text/collision_feature.cpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-02-18 17:09:26 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-03-01 20:58:54 +0000
commitf3fc87261c2f2db71ac9d63b680417836885da13 (patch)
treeac96b0dda727b5a262b664c121ae5579f9c0d645 /src/mbgl/text/collision_feature.cpp
parent411a562061f404fa7174222f38a1a9a13a396fd9 (diff)
downloadqtlocation-mapboxgl-f3fc87261c2f2db71ac9d63b680417836885da13.tar.gz
[core] Coordinate is now GeometryCoordinate
Also introduced GeometryCoordinates (vector of GeometryCoordinate items), to better cope with GeometryCollection.
Diffstat (limited to 'src/mbgl/text/collision_feature.cpp')
-rw-r--r--src/mbgl/text/collision_feature.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mbgl/text/collision_feature.cpp b/src/mbgl/text/collision_feature.cpp
index 186fb39b5d..42f1119b33 100644
--- a/src/mbgl/text/collision_feature.cpp
+++ b/src/mbgl/text/collision_feature.cpp
@@ -3,7 +3,7 @@
namespace mbgl {
-CollisionFeature::CollisionFeature(const std::vector<Coordinate> &line, const Anchor &anchor,
+CollisionFeature::CollisionFeature(const GeometryCoordinates &line, const Anchor &anchor,
const float top, const float bottom, const float left, const float right,
const float boxScale, const float padding, const bool alongLine, const bool straight) {
@@ -22,12 +22,12 @@ CollisionFeature::CollisionFeature(const std::vector<Coordinate> &line, const An
height = std::max(10.0f * boxScale, height);
- Coordinate anchorPoint(int16_t(anchor.x), int16_t(anchor.y));
+ GeometryCoordinate anchorPoint(int16_t(anchor.x), int16_t(anchor.y));
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 std::vector<Coordinate> newLine({ anchorPoint - vector, anchorPoint + vector });
+ const GeometryCoordinates newLine({ anchorPoint - vector, anchorPoint + vector });
bboxifyLabel(newLine, anchorPoint, 0, length, height);
} else {
// used for text labels that curve along a line
@@ -38,8 +38,8 @@ CollisionFeature::CollisionFeature(const std::vector<Coordinate> &line, const An
}
}
-void CollisionFeature::bboxifyLabel(const std::vector<Coordinate> &line,
- Coordinate &anchorPoint, const int segment, const float labelLength, const float boxSize) {
+void CollisionFeature::bboxifyLabel(const GeometryCoordinates &line,
+ GeometryCoordinate &anchorPoint, const int segment, const float labelLength, const float boxSize) {
const float step = boxSize / 2;
const unsigned int nBoxes = std::floor(labelLength / step);
@@ -48,7 +48,7 @@ void CollisionFeature::bboxifyLabel(const std::vector<Coordinate> &line,
// box is at the edge of the label.
const float firstBoxOffset = -boxSize / 2;
- Coordinate &p = anchorPoint;
+ GeometryCoordinate &p = anchorPoint;
int index = segment + 1;
float anchorDistance = firstBoxOffset;