From be974ea65ca48b7f49ef00148193fb30861938d3 Mon Sep 17 00:00:00 2001 From: Alexander Shalamov Date: Mon, 10 Jun 2019 12:04:32 +0300 Subject: [core] Rotate text collision box based on text-rotation value --- src/mbgl/layout/symbol_instance.cpp | 9 +++++---- src/mbgl/layout/symbol_instance.hpp | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mbgl/layout/symbol_instance.cpp b/src/mbgl/layout/symbol_instance.cpp index 8e8286bbd7..113bf5bd35 100644 --- a/src/mbgl/layout/symbol_instance.cpp +++ b/src/mbgl/layout/symbol_instance.cpp @@ -81,7 +81,8 @@ SymbolInstance::SymbolInstance(Anchor& anchor_, const std::size_t dataFeatureIndex_, std::u16string key_, const float overscaling, - const float rotate, + const float iconRotation, + const float textRotation, float radialTextOffset_, bool allowVerticalPlacement) : sharedData(std::move(sharedData_)), @@ -91,8 +92,8 @@ SymbolInstance::SymbolInstance(Anchor& anchor_, hasIcon(shapedIcon), // Create the collision features that will be used to check whether this symbol instance can be placed // As a collision approximation, we can use either the vertical or any of the horizontal versions of the feature - textCollisionFeature(sharedData->line, anchor, getAnyShaping(shapedTextOrientations), textBoxScale_, textPadding, textPlacement, indexedFeature, overscaling, rotate), - iconCollisionFeature(sharedData->line, anchor, shapedIcon, iconBoxScale, iconPadding, indexedFeature, rotate), + textCollisionFeature(sharedData->line, anchor, getAnyShaping(shapedTextOrientations), textBoxScale_, textPadding, textPlacement, indexedFeature, overscaling, textRotation), + iconCollisionFeature(sharedData->line, anchor, shapedIcon, iconBoxScale, iconPadding, indexedFeature, iconRotation), writingModes(WritingModeType::None), layoutFeatureIndex(layoutFeatureIndex_), dataFeatureIndex(dataFeatureIndex_), @@ -105,7 +106,7 @@ SymbolInstance::SymbolInstance(Anchor& anchor_, if (allowVerticalPlacement && shapedTextOrientations.vertical) { const float verticalPointLabelAngle = 90.0f; - verticalTextCollisionFeature = CollisionFeature(line(), anchor, shapedTextOrientations.vertical, textBoxScale_, textPadding, textPlacement, indexedFeature, overscaling, rotate + verticalPointLabelAngle); + verticalTextCollisionFeature = CollisionFeature(line(), anchor, shapedTextOrientations.vertical, textBoxScale_, textPadding, textPlacement, indexedFeature, overscaling, textRotation + verticalPointLabelAngle); } rightJustifiedGlyphQuadsSize = sharedData->rightJustifiedGlyphQuads.size(); diff --git a/src/mbgl/layout/symbol_instance.hpp b/src/mbgl/layout/symbol_instance.hpp index 693d8917c7..2c6aad653f 100644 --- a/src/mbgl/layout/symbol_instance.hpp +++ b/src/mbgl/layout/symbol_instance.hpp @@ -59,7 +59,8 @@ public: const std::size_t dataFeatureIndex, std::u16string key, const float overscaling, - const float rotate, + const float iconRotation, + const float textRotation, float radialTextOffset, bool allowVerticalPlacement); -- cgit v1.2.1