From ad35cccdbc5dc3b204844d37b13ec6037fe05887 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 15 Sep 2016 12:33:37 -0700 Subject: [PATCH] [core] Use consistent terms: "text" and "icon" --- src/mbgl/layout/merge_lines.cpp | 8 ++++---- src/mbgl/layout/symbol_feature.hpp | 4 ++-- src/mbgl/layout/symbol_layout.cpp | 18 +++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/mbgl/layout/merge_lines.cpp b/src/mbgl/layout/merge_lines.cpp index ce6b5f30d..f4fdb8261 100644 --- a/src/mbgl/layout/merge_lines.cpp +++ b/src/mbgl/layout/merge_lines.cpp @@ -65,12 +65,12 @@ void mergeLines(std::vector &features) { SymbolFeature &feature = features[k]; GeometryCollection &geometry = feature.geometry; - if (!feature.label) { + if (!feature.text) { continue; } - const auto leftKey = getKey(*feature.label, geometry, Side::Left); - const auto rightKey = getKey(*feature.label, geometry, Side::Right); + const auto leftKey = getKey(*feature.text, geometry, Side::Left); + const auto rightKey = getKey(*feature.text, geometry, Side::Right); const auto left = rightIndex.find(leftKey); const auto right = leftIndex.find(rightKey); @@ -85,7 +85,7 @@ void mergeLines(std::vector &features) { leftIndex.erase(leftKey); rightIndex.erase(rightKey); - rightIndex[getKey(*feature.label, features[i].geometry, Side::Right)] = i; + rightIndex[getKey(*feature.text, features[i].geometry, Side::Right)] = i; } else if (left != rightIndex.end()) { // found mergeable line adjacent to the start of the current line, merge diff --git a/src/mbgl/layout/symbol_feature.hpp b/src/mbgl/layout/symbol_feature.hpp index fa5af9786..99db4f9ac 100644 --- a/src/mbgl/layout/symbol_feature.hpp +++ b/src/mbgl/layout/symbol_feature.hpp @@ -10,8 +10,8 @@ namespace mbgl { class SymbolFeature { public: GeometryCollection geometry; - optional label; - optional sprite; + optional text; + optional icon; std::size_t index; }; diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp index 84fd9393a..4c448d180 100644 --- a/src/mbgl/layout/symbol_layout.cpp +++ b/src/mbgl/layout/symbol_layout.cpp @@ -89,19 +89,19 @@ SymbolLayout::SymbolLayout(std::string bucketName_, u8string = platform::lowercase(u8string); } - ft.label = util::utf8_to_utf32::convert(u8string); + ft.text = util::utf8_to_utf32::convert(u8string); // Loop through all characters of this text and collect unique codepoints. - for (char32_t chr : *ft.label) { + for (char32_t chr : *ft.text) { ranges.insert(getGlyphRange(chr)); } } if (hasIcon) { - ft.sprite = util::replaceTokens(layout.iconImage, getValue); + ft.icon = util::replaceTokens(layout.iconImage, getValue); } - if (ft.label || ft.sprite) { + if (ft.text || ft.icon) { auto &multiline = ft.geometry; GeometryCollection geometryCollection = feature->getGeometries(); @@ -191,9 +191,9 @@ void SymbolLayout::prepare(uintptr_t tileUID, GlyphPositions face; // if feature has text, shape the text - if (feature.label) { + if (feature.text) { shapedText = glyphSet->getShaping( - /* string */ *feature.label, + /* string */ *feature.text, /* maxWidth: ems */ layout.symbolPlacement != SymbolPlacementType::Line ? layout.textMaxWidth * 24 : 0, /* lineHeight: ems */ layout.textLineHeight * 24, @@ -205,13 +205,13 @@ void SymbolLayout::prepare(uintptr_t tileUID, // Add the glyphs we need for this label to the glyph atlas. if (shapedText) { - glyphAtlas.addGlyphs(tileUID, *feature.label, layout.textFont, **glyphSet, face); + glyphAtlas.addGlyphs(tileUID, *feature.text, layout.textFont, **glyphSet, face); } } // if feature has icon, get sprite atlas position - if (feature.sprite) { - auto image = spriteAtlas.getImage(*feature.sprite, SpritePatternMode::Single); + if (feature.icon) { + auto image = spriteAtlas.getImage(*feature.icon, SpritePatternMode::Single); if (image) { shapedIcon = shapeIcon(*image, layout); assert((*image).spriteImage);