summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2017-10-02 11:10:01 -0700
committerChris Loer <chris.loer@gmail.com>2017-10-02 11:10:01 -0700
commitce4cc65486b9676cfecb7e771ff8af3db2b9d408 (patch)
treeee5c43dd98178346f3e04600019773fecf3d81e7
parent3d2e4e5b5a85cde38b40cc2d8b70215bbc53ff04 (diff)
downloadqtlocation-mapboxgl-ce4cc65486b9676cfecb7e771ff8af3db2b9d408.tar.gz
Prepare for viewport-collision work: remove "straight" option for line-placed icons.
-rw-r--r--src/mbgl/text/collision_feature.cpp14
-rw-r--r--src/mbgl/text/collision_feature.hpp11
2 files changed, 5 insertions, 20 deletions
diff --git a/src/mbgl/text/collision_feature.cpp b/src/mbgl/text/collision_feature.cpp
index 3eb08da8d1..c6224d72af 100644
--- a/src/mbgl/text/collision_feature.cpp
+++ b/src/mbgl/text/collision_feature.cpp
@@ -12,8 +12,7 @@ CollisionFeature::CollisionFeature(const GeometryCoordinates& line,
const float boxScale,
const float padding,
const style::SymbolPlacementType placement,
- IndexedSubfeature indexedFeature_,
- const AlignmentType alignment)
+ IndexedSubfeature indexedFeature_)
: indexedFeature(std::move(indexedFeature_)) {
if (top == 0 && bottom == 0 && left == 0 && right == 0) return;
@@ -31,16 +30,7 @@ CollisionFeature::CollisionFeature(const GeometryCoordinates& line,
height = std::max(10.0f * boxScale, height);
GeometryCoordinate anchorPoint = convertPoint<int16_t>(anchor.point);
-
- if (alignment == AlignmentType::Straight) {
- // used for icon labels that are aligned with the line, but don't curve along it
- 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);
- } else {
- // used for text labels that curve along a line
- bboxifyLabel(line, anchorPoint, anchor.segment, length, height);
- }
+ bboxifyLabel(line, anchorPoint, anchor.segment, length, height);
} else {
boxes.emplace_back(anchor.point, Point<float>{ 0, 0 }, x1, y1, x2, y2, std::numeric_limits<float>::infinity());
}
diff --git a/src/mbgl/text/collision_feature.hpp b/src/mbgl/text/collision_feature.hpp
index 3b6e461a26..91cd98ec6f 100644
--- a/src/mbgl/text/collision_feature.hpp
+++ b/src/mbgl/text/collision_feature.hpp
@@ -38,10 +38,6 @@ public:
class CollisionFeature {
public:
- enum class AlignmentType : bool {
- Straight = false,
- Curved
- };
// for text
CollisionFeature(const GeometryCoordinates& line,
@@ -51,7 +47,7 @@ public:
const float padding,
const style::SymbolPlacementType placement,
const IndexedSubfeature& indexedFeature_)
- : CollisionFeature(line, anchor, shapedText.top, shapedText.bottom, shapedText.left, shapedText.right, boxScale, padding, placement, indexedFeature_, AlignmentType::Curved) {}
+ : CollisionFeature(line, anchor, shapedText.top, shapedText.bottom, shapedText.left, shapedText.right, boxScale, padding, placement, indexedFeature_) {}
// for icons
CollisionFeature(const GeometryCoordinates& line,
@@ -66,7 +62,7 @@ public:
(shapedIcon ? shapedIcon->bottom() : 0),
(shapedIcon ? shapedIcon->left() : 0),
(shapedIcon ? shapedIcon->right() : 0),
- boxScale, padding, placement, indexedFeature_, AlignmentType::Straight) {}
+ boxScale, padding, placement, indexedFeature_) {}
CollisionFeature(const GeometryCoordinates& line,
const Anchor&,
@@ -77,8 +73,7 @@ public:
const float boxScale,
const float padding,
const style::SymbolPlacementType,
- IndexedSubfeature,
- const AlignmentType);
+ IndexedSubfeature);
std::vector<CollisionBox> boxes;
IndexedSubfeature indexedFeature;