diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-11-14 16:58:25 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-12-02 17:11:49 +0200 |
commit | 26bf566f535e55c6d82830e3b0f5a2702a0fec42 (patch) | |
tree | fde3beaa430e06151b68f6c346bc7b103debd28b /src/mbgl/layout | |
parent | 2c49c4374cb9e3654c1d347b1071542918ce5fd2 (diff) | |
download | qtlocation-mapboxgl-26bf566f535e55c6d82830e3b0f5a2702a0fec42.tar.gz |
[core] Use new 'SymbolTextAndIcon' program to draw icons in text
Diffstat (limited to 'src/mbgl/layout')
-rw-r--r-- | src/mbgl/layout/symbol_layout.cpp | 19 | ||||
-rw-r--r-- | src/mbgl/layout/symbol_layout.hpp | 1 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp index c03ad8835f..4c5836df21 100644 --- a/src/mbgl/layout/symbol_layout.cpp +++ b/src/mbgl/layout/symbol_layout.cpp @@ -486,7 +486,9 @@ void SymbolLayout::prepareSymbols(const GlyphMap& glyphMap, } // if either shapedText or icon position is present, add the feature - if (getDefaultHorizontalShaping(shapedTextOrientations) || shapedIcon) { + const Shaping& defaultShaping = getDefaultHorizontalShaping(shapedTextOrientations); + iconsInText = defaultShaping ? defaultShaping.iconsInText : false; + if (defaultShaping || shapedIcon) { addFeature(std::distance(features.begin(), it), feature, shapedTextOrientations, @@ -711,10 +713,19 @@ std::vector<float> CalculateTileDistances(const GeometryCoordinates& line, const } void SymbolLayout::createBucket(const ImagePositions&, std::unique_ptr<FeatureIndex>&, std::unordered_map<std::string, LayerRenderData>& renderData, const bool firstLoad, const bool showCollisionBoxes) { - auto bucket = std::make_shared<SymbolBucket>(layout, layerPaintProperties, textSize, iconSize, zoom, iconsNeedLinear, - sortFeaturesByY, bucketLeaderID, std::move(symbolInstances), tilePixelRatio, + auto bucket = std::make_shared<SymbolBucket>(layout, + layerPaintProperties, + textSize, + iconSize, + zoom, + iconsNeedLinear, + sortFeaturesByY, + bucketLeaderID, + std::move(symbolInstances), + tilePixelRatio, allowVerticalPlacement, - std::move(placementModes)); + std::move(placementModes), + iconsInText); for (SymbolInstance &symbolInstance : bucket->symbolInstances) { const bool hasText = symbolInstance.hasText(); diff --git a/src/mbgl/layout/symbol_layout.hpp b/src/mbgl/layout/symbol_layout.hpp index 86bfd46a31..8f6e4595e3 100644 --- a/src/mbgl/layout/symbol_layout.hpp +++ b/src/mbgl/layout/symbol_layout.hpp @@ -109,6 +109,7 @@ private: bool iconsNeedLinear = false; bool sortFeaturesByY = false; bool allowVerticalPlacement = false; + bool iconsInText = false; std::vector<style::TextWritingModeType> placementModes; style::TextSize::UnevaluatedType textSize; |