diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-06-10 12:04:32 +0300 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-08-13 13:32:56 +0300 |
commit | be974ea65ca48b7f49ef00148193fb30861938d3 (patch) | |
tree | 5b34a16e22c03253f9f57c8c0c9242bdedf2dfa9 /src | |
parent | 9aa529576f4d0565bb81369f03a1fecdb8dd0886 (diff) | |
download | qtlocation-mapboxgl-be974ea65ca48b7f49ef00148193fb30861938d3.tar.gz |
[core] Rotate text collision box based on text-rotation value
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/layout/symbol_instance.cpp | 9 | ||||
-rw-r--r-- | 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); |