From ce4cc65486b9676cfecb7e771ff8af3db2b9d408 Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Mon, 2 Oct 2017 11:10:01 -0700 Subject: Prepare for viewport-collision work: remove "straight" option for line-placed icons. --- src/mbgl/text/collision_feature.cpp | 14 ++------------ src/mbgl/text/collision_feature.hpp | 11 +++-------- 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(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(util::unit(convertPoint(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{ 0, 0 }, x1, y1, x2, y2, std::numeric_limits::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 boxes; IndexedSubfeature indexedFeature; -- cgit v1.2.1