diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-03-11 10:26:19 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-03-13 17:14:53 +0200 |
commit | 8be135231d9efe41a3b12037518d02b36104e8cf (patch) | |
tree | efecd5380232f899aed2cd5824dc16f057f0469a /include/mbgl/style/expression/formatted.hpp | |
parent | 8a51362bccbd6487dd1ed8518443b16ba6114fd8 (diff) | |
download | qtlocation-mapboxgl-8be135231d9efe41a3b12037518d02b36104e8cf.tar.gz |
[core] Add possibility of overriding paint properties inside format expression #14062
* [core] Add format override expression and formatted section to evaluation context
* [core] Add textColor to TaggedString's formatted section
* [core] Add FormatSectionOverrides and introduce overridable properties
* [core] Populate symbol layer paint properties for text sections
* [core] Add benchmark for style that uses text-color override
* [core] Add unit test for FormatOverrideExpression
* [core] Add unit test for FormatSectionOverrides
Diffstat (limited to 'include/mbgl/style/expression/formatted.hpp')
-rw-r--r-- | include/mbgl/style/expression/formatted.hpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/include/mbgl/style/expression/formatted.hpp b/include/mbgl/style/expression/formatted.hpp index 9e7e7308cb..f4f08e9197 100644 --- a/include/mbgl/style/expression/formatted.hpp +++ b/include/mbgl/style/expression/formatted.hpp @@ -1,9 +1,9 @@ #pragma once #include <mbgl/style/conversion.hpp> +#include <mbgl/util/color.hpp> #include <mbgl/util/font_stack.hpp> #include <mbgl/util/optional.hpp> -#include <mbgl/util/variant.hpp> #include <vector> #include <string> @@ -12,15 +12,25 @@ namespace mbgl { namespace style { namespace expression { +extern const char* const kFormattedSectionFontScale; +extern const char* const kFormattedSectionTextFont; +extern const char* const kFormattedSectionTextColor; + struct FormattedSection { - FormattedSection(std::string text_, optional<double> fontScale_, optional<FontStack> fontStack_) + FormattedSection(std::string text_, + optional<double> fontScale_, + optional<FontStack> fontStack_, + optional<Color> textColor_) : text(std::move(text_)) , fontScale(std::move(fontScale_)) , fontStack(std::move(fontStack_)) + , textColor(std::move(textColor_)) {} + std::string text; optional<double> fontScale; optional<FontStack> fontStack; + optional<Color> textColor; }; class Formatted { @@ -28,7 +38,7 @@ public: Formatted() = default; Formatted(const char* plainU8String) { - sections.emplace_back(std::string(plainU8String), nullopt, nullopt); + sections.emplace_back(std::string(plainU8String), nullopt, nullopt, nullopt); } Formatted(std::vector<FormattedSection> sections_) |