[styles] Add pill shapes for road shields (and reorganized the existing logic)

Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
Yannik Bloscheck
2025-10-20 21:29:44 +02:00
committed by Yannik Bloscheck
parent 8e5c1a4d17
commit f6e7580aff
3 changed files with 176 additions and 71 deletions

View File

@@ -51,11 +51,11 @@ double const kMinVisibleFontSize = 8.0;
df::ColorConstant const kPoiDeletedMaskColor = "PoiDeletedMask"; df::ColorConstant const kPoiDeletedMaskColor = "PoiDeletedMask";
df::ColorConstant const kRoadShieldBlackTextColor = "RoadShieldBlackText"; df::ColorConstant const kRoadShieldBlackTextColor = "RoadShieldBlackText";
df::ColorConstant const kRoadShieldWhiteTextColor = "RoadShieldWhiteText"; df::ColorConstant const kRoadShieldWhiteTextColor = "RoadShieldWhiteText";
df::ColorConstant const kRoadShieldUKYellowTextColor = "RoadShieldUKYellowText";
df::ColorConstant const kRoadShieldGreenBackgroundColor = "RoadShieldGreenBackground"; df::ColorConstant const kRoadShieldGreenBackgroundColor = "RoadShieldGreenBackground";
df::ColorConstant const kRoadShieldBlueBackgroundColor = "RoadShieldBlueBackground"; df::ColorConstant const kRoadShieldBlueBackgroundColor = "RoadShieldBlueBackground";
df::ColorConstant const kRoadShieldRedBackgroundColor = "RoadShieldRedBackground"; df::ColorConstant const kRoadShieldRedBackgroundColor = "RoadShieldRedBackground";
df::ColorConstant const kRoadShieldOrangeBackgroundColor = "RoadShieldOrangeBackground"; df::ColorConstant const kRoadShieldOrangeBackgroundColor = "RoadShieldOrangeBackground";
df::ColorConstant const kRoadShieldUKYellowTextColor = "RoadShieldUKYellowText";
uint32_t const kPathTextBaseTextIndex = 128; uint32_t const kPathTextBaseTextIndex = 128;
uint32_t const kShieldBaseTextIndex = 0; uint32_t const kShieldBaseTextIndex = 0;
@@ -217,31 +217,32 @@ std::string GetRoadShieldSymbolName(ftypes::RoadShield const & shield, double fo
bool IsColoredRoadShield(ftypes::RoadShield const & shield) bool IsColoredRoadShield(ftypes::RoadShield const & shield)
{ {
return shield.m_type == ftypes::RoadShieldType::Default || shield.m_type == ftypes::RoadShieldType::UK_Highway || return shield.m_type == ftypes::RoadShieldType::Default ||
shield.m_type == ftypes::RoadShieldType::Generic_White || shield.m_type == ftypes::RoadShieldType::Generic_White ||
shield.m_type == ftypes::RoadShieldType::Generic_Blue ||
shield.m_type == ftypes::RoadShieldType::Generic_Green || shield.m_type == ftypes::RoadShieldType::Generic_Green ||
shield.m_type == ftypes::RoadShieldType::Generic_Blue ||
shield.m_type == ftypes::RoadShieldType::Generic_Red || shield.m_type == ftypes::RoadShieldType::Generic_Red ||
shield.m_type == ftypes::RoadShieldType::Generic_Orange; shield.m_type == ftypes::RoadShieldType::Generic_Orange ||
shield.m_type == ftypes::RoadShieldType::Generic_White_Bordered ||
shield.m_type == ftypes::RoadShieldType::Generic_Green_Bordered ||
shield.m_type == ftypes::RoadShieldType::Generic_Blue_Bordered ||
shield.m_type == ftypes::RoadShieldType::Generic_Red_Bordered ||
shield.m_type == ftypes::RoadShieldType::Generic_Orange_Bordered ||
shield.m_type == ftypes::RoadShieldType::UK_Highway;
} }
void UpdateRoadShieldTextFont(dp::FontDecl & font, ftypes::RoadShield const & shield) bool IsColoredPillRoadShield(ftypes::RoadShield const & shield)
{ {
font.m_outlineColor = dp::Color::Transparent(); return shield.m_type == ftypes::RoadShieldType::Generic_Pill_White ||
shield.m_type == ftypes::RoadShieldType::Generic_Pill_Green ||
using ftypes::RoadShieldType; shield.m_type == ftypes::RoadShieldType::Generic_Pill_Blue ||
shield.m_type == ftypes::RoadShieldType::Generic_Pill_Red ||
static base::SmallMapBase<RoadShieldType, df::ColorConstant> kColors = { shield.m_type == ftypes::RoadShieldType::Generic_Pill_Orange ||
{RoadShieldType::Generic_Green, kRoadShieldWhiteTextColor}, shield.m_type == ftypes::RoadShieldType::Generic_Pill_White_Bordered ||
{RoadShieldType::Generic_Blue, kRoadShieldWhiteTextColor}, shield.m_type == ftypes::RoadShieldType::Generic_Pill_Green_Bordered ||
{RoadShieldType::UK_Highway, kRoadShieldUKYellowTextColor}, shield.m_type == ftypes::RoadShieldType::Generic_Pill_Blue_Bordered ||
{RoadShieldType::US_Interstate, kRoadShieldWhiteTextColor}, shield.m_type == ftypes::RoadShieldType::Generic_Pill_Red_Bordered ||
{RoadShieldType::US_Highway, kRoadShieldBlackTextColor}, shield.m_type == ftypes::RoadShieldType::Generic_Pill_Orange_Bordered;
{RoadShieldType::Generic_Red, kRoadShieldWhiteTextColor},
{RoadShieldType::Generic_Orange, kRoadShieldBlackTextColor}};
if (auto const * cl = kColors.Find(shield.m_type); cl)
font.m_color = df::GetColorConstant(*cl);
} }
dp::Color GetRoadShieldColor(dp::Color const & baseColor, ftypes::RoadShield const & shield) dp::Color GetRoadShieldColor(dp::Color const & baseColor, ftypes::RoadShield const & shield)
@@ -251,9 +252,56 @@ dp::Color GetRoadShieldColor(dp::Color const & baseColor, ftypes::RoadShield con
static base::SmallMapBase<ftypes::RoadShieldType, df::ColorConstant> kColors = { static base::SmallMapBase<ftypes::RoadShieldType, df::ColorConstant> kColors = {
{RoadShieldType::Generic_Green, kRoadShieldGreenBackgroundColor}, {RoadShieldType::Generic_Green, kRoadShieldGreenBackgroundColor},
{RoadShieldType::Generic_Blue, kRoadShieldBlueBackgroundColor}, {RoadShieldType::Generic_Blue, kRoadShieldBlueBackgroundColor},
{RoadShieldType::UK_Highway, kRoadShieldGreenBackgroundColor},
{RoadShieldType::Generic_Red, kRoadShieldRedBackgroundColor}, {RoadShieldType::Generic_Red, kRoadShieldRedBackgroundColor},
{RoadShieldType::Generic_Orange, kRoadShieldOrangeBackgroundColor}}; {RoadShieldType::Generic_Orange, kRoadShieldOrangeBackgroundColor},
{RoadShieldType::Generic_Green_Bordered, kRoadShieldGreenBackgroundColor},
{RoadShieldType::Generic_Blue_Bordered, kRoadShieldBlueBackgroundColor},
{RoadShieldType::Generic_Red_Bordered, kRoadShieldRedBackgroundColor},
{RoadShieldType::Generic_Orange_Bordered, kRoadShieldOrangeBackgroundColor},
{RoadShieldType::Generic_Pill_Green, kRoadShieldGreenBackgroundColor},
{RoadShieldType::Generic_Pill_Blue, kRoadShieldBlueBackgroundColor},
{RoadShieldType::Generic_Pill_Red, kRoadShieldRedBackgroundColor},
{RoadShieldType::Generic_Pill_Orange, kRoadShieldOrangeBackgroundColor},
{RoadShieldType::Generic_Pill_Green_Bordered, kRoadShieldGreenBackgroundColor},
{RoadShieldType::Generic_Pill_Blue_Bordered, kRoadShieldBlueBackgroundColor},
{RoadShieldType::Generic_Pill_Red_Bordered, kRoadShieldRedBackgroundColor},
{RoadShieldType::Generic_Pill_Orange_Bordered, kRoadShieldOrangeBackgroundColor},
{RoadShieldType::UK_Highway, kRoadShieldGreenBackgroundColor}};
if (auto const * cl = kColors.Find(shield.m_type); cl)
return df::GetColorConstant(*cl);
return baseColor;
}
dp::Color GetRoadShieldTextColor(dp::Color const & baseColor, ftypes::RoadShield const & shield)
{
using ftypes::RoadShieldType;
static base::SmallMapBase<ftypes::RoadShieldType, df::ColorConstant> kColors = {
{RoadShieldType::Generic_White, kRoadShieldBlackTextColor},
{RoadShieldType::Generic_Green, kRoadShieldWhiteTextColor},
{RoadShieldType::Generic_Blue, kRoadShieldWhiteTextColor},
{RoadShieldType::Generic_Red, kRoadShieldWhiteTextColor},
{RoadShieldType::Generic_Orange, kRoadShieldBlackTextColor},
{RoadShieldType::Generic_White_Bordered, kRoadShieldBlackTextColor},
{RoadShieldType::Generic_Green_Bordered, kRoadShieldWhiteTextColor},
{RoadShieldType::Generic_Blue_Bordered, kRoadShieldWhiteTextColor},
{RoadShieldType::Generic_Red_Bordered, kRoadShieldWhiteTextColor},
{RoadShieldType::Generic_Orange_Bordered, kRoadShieldBlackTextColor},
{RoadShieldType::Generic_Pill_White, kRoadShieldBlackTextColor},
{RoadShieldType::Generic_Pill_Green, kRoadShieldWhiteTextColor},
{RoadShieldType::Generic_Pill_Blue, kRoadShieldWhiteTextColor},
{RoadShieldType::Generic_Pill_Red, kRoadShieldWhiteTextColor},
{RoadShieldType::Generic_Pill_Orange, kRoadShieldBlackTextColor},
{RoadShieldType::Generic_Pill_White_Bordered, kRoadShieldBlackTextColor},
{RoadShieldType::Generic_Pill_Green_Bordered, kRoadShieldWhiteTextColor},
{RoadShieldType::Generic_Pill_Blue_Bordered, kRoadShieldWhiteTextColor},
{RoadShieldType::Generic_Pill_Red_Bordered, kRoadShieldWhiteTextColor},
{RoadShieldType::Generic_Pill_Orange_Bordered, kRoadShieldBlackTextColor},
{RoadShieldType::US_Interstate, kRoadShieldWhiteTextColor},
{RoadShieldType::US_Highway, kRoadShieldBlackTextColor},
{RoadShieldType::UK_Highway, kRoadShieldUKYellowTextColor}};
if (auto const * cl = kColors.Find(shield.m_type); cl) if (auto const * cl = kColors.Find(shield.m_type); cl)
return df::GetColorConstant(*cl); return df::GetColorConstant(*cl);
@@ -263,8 +311,11 @@ dp::Color GetRoadShieldColor(dp::Color const & baseColor, ftypes::RoadShield con
float GetRoadShieldOutlineWidth(float baseWidth, ftypes::RoadShield const & shield) float GetRoadShieldOutlineWidth(float baseWidth, ftypes::RoadShield const & shield)
{ {
if (shield.m_type == ftypes::RoadShieldType::UK_Highway || shield.m_type == ftypes::RoadShieldType::Generic_Blue || if (shield.m_type == ftypes::RoadShieldType::Generic_White || shield.m_type == ftypes::RoadShieldType::Generic_Green ||
shield.m_type == ftypes::RoadShieldType::Generic_Green || shield.m_type == ftypes::RoadShieldType::Generic_Red) shield.m_type == ftypes::RoadShieldType::Generic_Blue || shield.m_type == ftypes::RoadShieldType::Generic_Red ||
shield.m_type == ftypes::RoadShieldType::Generic_Orange || shield.m_type == ftypes::RoadShieldType::Generic_Pill_White || shield.m_type == ftypes::RoadShieldType::Generic_Pill_Green ||
shield.m_type == ftypes::RoadShieldType::Generic_Pill_Blue || shield.m_type == ftypes::RoadShieldType::Generic_Pill_Red ||
shield.m_type == ftypes::RoadShieldType::Generic_Pill_Orange || shield.m_type == ftypes::RoadShieldType::UK_Highway)
return 0.0f; return 0.0f;
return baseWidth; return baseWidth;
@@ -896,7 +947,8 @@ void ApplyLineFeatureAdditional::GetRoadShieldsViewParams(ref_ptr<dp::TextureMan
dp::FontDecl font; dp::FontDecl font;
ShieldRuleProtoToFontDecl(m_shieldRule, font); ShieldRuleProtoToFontDecl(m_shieldRule, font);
UpdateRoadShieldTextFont(font, shield); font.m_outlineColor = dp::Color::Transparent();
font.m_color = GetRoadShieldTextColor(font.m_color, shield);
FillCommonParams(textParams); FillCommonParams(textParams);
textParams.m_depthLayer = DepthLayer::OverlayLayer; textParams.m_depthLayer = DepthLayer::OverlayLayer;
@@ -939,6 +991,29 @@ void ApplyLineFeatureAdditional::GetRoadShieldsViewParams(ref_ptr<dp::TextureMan
symbolParams.m_outlineWidth = static_cast<float>(1.0 * mainScale); symbolParams.m_outlineWidth = static_cast<float>(1.0 * mainScale);
} }
symbolParams.m_sizeInPixels = shieldPixelSize; symbolParams.m_sizeInPixels = shieldPixelSize;
symbolParams.m_outlineColor = GetRoadShieldTextColor(symbolParams.m_outlineColor, shield);
symbolParams.m_outlineWidth = GetRoadShieldOutlineWidth(symbolParams.m_outlineWidth, shield);
symbolParams.m_color = GetRoadShieldColor(symbolParams.m_color, shield);
}
// A colored pill road shield.
if (IsColoredPillRoadShield(shield))
{
FillCommonParams(symbolParams);
symbolParams.m_depthLayer = DepthLayer::OverlayLayer;
symbolParams.m_depthTestEnabled = true;
symbolParams.m_depth = m_shieldDepth;
symbolParams.m_anchor = anchor;
symbolParams.m_offset = shieldOffset;
symbolParams.m_shape = ColoredSymbolViewParams::Shape::RoundedRectangle;
symbolParams.m_radiusInPixels = static_cast<float>(6.0 * mainScale);
symbolParams.m_color = ToDrapeColor(m_shieldRule->color());
if (m_shieldRule->stroke_color() != m_shieldRule->color())
{
symbolParams.m_outlineColor = ToDrapeColor(m_shieldRule->stroke_color());
symbolParams.m_outlineWidth = static_cast<float>(1.0 * mainScale);
}
symbolParams.m_sizeInPixels = shieldPixelSize;
symbolParams.m_outlineColor = GetRoadShieldTextColor(symbolParams.m_outlineColor, shield);
symbolParams.m_outlineWidth = GetRoadShieldOutlineWidth(symbolParams.m_outlineWidth, shield); symbolParams.m_outlineWidth = GetRoadShieldOutlineWidth(symbolParams.m_outlineWidth, shield);
symbolParams.m_color = GetRoadShieldColor(symbolParams.m_color, shield); symbolParams.m_color = GetRoadShieldColor(symbolParams.m_color, shield);
} }
@@ -1092,7 +1167,7 @@ void ApplyLineFeatureAdditional::ProcessAdditionalLineRules(PathTextRuleProto co
m_insertShape(make_unique_dp<TextShape>(shieldPos, textParams, m_tileKey, m2::PointF(0.0f, 0.0f) /* symbolSize */, m_insertShape(make_unique_dp<TextShape>(shieldPos, textParams, m_tileKey, m2::PointF(0.0f, 0.0f) /* symbolSize */,
m2::PointF(0.0f, 0.0f) /* symbolOffset */, dp::Center /* symbolAnchor */, m2::PointF(0.0f, 0.0f) /* symbolOffset */, dp::Center /* symbolAnchor */,
textIndex)); textIndex));
if (IsColoredRoadShield(shield)) if (IsColoredRoadShield(shield) || IsColoredPillRoadShield(shield))
m_insertShape(make_unique_dp<ColoredSymbolShape>(shieldPos, symbolParams, m_tileKey, textIndex)); m_insertShape(make_unique_dp<ColoredSymbolShape>(shieldPos, symbolParams, m_tileKey, textIndex));
else if (IsSymbolRoadShield(shield)) else if (IsSymbolRoadShield(shield))
m_insertShape(make_unique_dp<PoiSymbolShape>(shieldPos, poiParams, m_tileKey, textIndex)); m_insertShape(make_unique_dp<PoiSymbolShape>(shieldPos, poiParams, m_tileKey, textIndex));

View File

@@ -55,14 +55,14 @@ std::unordered_map<std::string, RoadShieldType> const kRoadNetworkShields = {
{"by:national", RoadShieldType::Generic_Red}, {"by:national", RoadShieldType::Generic_Red},
// https://github.com/organicmaps/organicmaps/issues/3083 // https://github.com/organicmaps/organicmaps/issues/3083
//{"by:regional", RoadShieldType::Generic_Red}, //{"by:regional", RoadShieldType::Generic_Red},
{"co:national", RoadShieldType::Generic_White}, {"co:national", RoadShieldType::Generic_White_Bordered},
{"cz:national", RoadShieldType::Generic_Red}, {"cz:national", RoadShieldType::Generic_Red},
{"cz:regional", RoadShieldType::Generic_Blue}, {"cz:regional", RoadShieldType::Generic_Blue},
// Estonia parser produces more specific shield types, incl. Generic_Orange. // Estonia parser produces more specific shield types, incl. Generic_Orange.
//{"ee:national", RoadShieldType::Generic_Red}, //{"ee:national", RoadShieldType::Generic_Red},
//{"ee:regional", RoadShieldType::Generic_White}, //{"ee:regional", RoadShieldType::Generic_White_Bordered},
{"in:ne", RoadShieldType::Generic_Blue}, {"in:ne", RoadShieldType::Generic_Blue},
{"in:nh", RoadShieldType::Generic_Orange}, {"in:nh", RoadShieldType::Generic_Orange_Bordered},
{"in:sh", RoadShieldType::Generic_Green}, {"in:sh", RoadShieldType::Generic_Green},
{"fr:a-road", RoadShieldType::Generic_Red}, {"fr:a-road", RoadShieldType::Generic_Red},
{"jp:national", RoadShieldType::Generic_Blue}, {"jp:national", RoadShieldType::Generic_Blue},
@@ -73,15 +73,15 @@ std::unordered_map<std::string, RoadShieldType> const kRoadNetworkShields = {
{"lv:national", RoadShieldType::Generic_Red}, {"lv:national", RoadShieldType::Generic_Red},
{"lv:regional", RoadShieldType::Generic_Blue}, {"lv:regional", RoadShieldType::Generic_Blue},
{"pl:national", RoadShieldType::Generic_Red}, {"pl:national", RoadShieldType::Generic_Red},
{"pl:regional", RoadShieldType::Generic_Orange}, {"pl:regional", RoadShieldType::Generic_Orange_Bordered},
{"pl:local", RoadShieldType::Generic_White}, {"pl:local", RoadShieldType::Generic_White_Bordered},
{"ua:national", RoadShieldType::Generic_Blue}, {"ua:national", RoadShieldType::Generic_Blue},
{"ua:regional", RoadShieldType::Generic_Blue}, {"ua:regional", RoadShieldType::Generic_Blue},
{"ua:territorial", RoadShieldType::Generic_White}, {"ua:territorial", RoadShieldType::Generic_White_Bordered},
{"ua:local", RoadShieldType::Generic_White}, {"ua:local", RoadShieldType::Generic_White_Bordered},
{"za:national", RoadShieldType::Generic_White}, {"za:national", RoadShieldType::Generic_White_Bordered},
{"za:regional", RoadShieldType::Generic_White}, {"za:regional", RoadShieldType::Generic_White_Bordered},
{"my:federal", RoadShieldType::Generic_Orange}, {"my:federal", RoadShieldType::Generic_Orange_Bordered},
// United States road networks. // United States road networks.
{"us:i", RoadShieldType::US_Interstate}, {"us:i", RoadShieldType::US_Interstate},
{"us:us", RoadShieldType::US_Highway}, {"us:us", RoadShieldType::US_Highway},
@@ -102,7 +102,7 @@ public:
if (network.size() == 5 && network.starts_with("US:")) if (network.size() == 5 && network.starts_with("US:"))
{ {
if (base::IsExist(kStatesCode, network.substr(3))) if (base::IsExist(kStatesCode, network.substr(3)))
return RoadShieldType::Generic_White; return RoadShieldType::Generic_White_Bordered;
} }
// Minimum length for the network tag is 4 (US:I). // Minimum length for the network tag is 4 (US:I).
@@ -226,7 +226,7 @@ public:
return RoadShield(RoadShieldType::US_Highway, roadNumber, additionalInfo); return RoadShield(RoadShieldType::US_Highway, roadNumber, additionalInfo);
if (base::IsExist(kStatesCode, shieldParts[0])) if (base::IsExist(kStatesCode, shieldParts[0]))
return RoadShield(RoadShieldType::Generic_White, roadNumber, additionalInfo); return RoadShield(RoadShieldType::Generic_White_Bordered, roadNumber, additionalInfo);
return RoadShield(RoadShieldType::Default, rawText); return RoadShield(RoadShieldType::Default, rawText);
} }
@@ -433,10 +433,10 @@ class AustriaRoadShieldParser : public SimpleRoadShieldParser
{ {
public: public:
explicit AustriaRoadShieldParser(std::string const & baseRoadNumber) explicit AustriaRoadShieldParser(std::string const & baseRoadNumber)
: SimpleRoadShieldParser(baseRoadNumber, {{"A", RoadShieldType::Generic_Blue}, : SimpleRoadShieldParser(baseRoadNumber, {{"A", RoadShieldType::Generic_Blue_Bordered},
{"S", RoadShieldType::Generic_Blue}, {"S", RoadShieldType::Generic_Blue_Bordered},
{"B", RoadShieldType::Generic_Blue}, {"B", RoadShieldType::Generic_Blue},
{"L", RoadShieldType::Generic_White}}) {"L", RoadShieldType::Generic_Pill_White_Bordered}})
{} {}
}; };
@@ -445,7 +445,7 @@ class BelgiumRoadShieldParser : public SimpleRoadShieldParser
public: public:
explicit BelgiumRoadShieldParser(std::string const & baseRoadNumber) explicit BelgiumRoadShieldParser(std::string const & baseRoadNumber)
: SimpleRoadShieldParser(baseRoadNumber, : SimpleRoadShieldParser(baseRoadNumber,
{{"A", RoadShieldType::Generic_White}, {"N", RoadShieldType::Generic_Blue}}) {{"A", RoadShieldType::Generic_White_Bordered}, {"N", RoadShieldType::Generic_Blue}})
{} {}
}; };
@@ -464,8 +464,8 @@ public:
explicit IrelandRoadShieldParser(std::string const & baseRoadNumber) explicit IrelandRoadShieldParser(std::string const & baseRoadNumber)
: SimpleRoadShieldParser(baseRoadNumber, {{"M", RoadShieldType::Generic_Blue}, : SimpleRoadShieldParser(baseRoadNumber, {{"M", RoadShieldType::Generic_Blue},
{"N", RoadShieldType::UK_Highway}, {"N", RoadShieldType::UK_Highway},
{"R", RoadShieldType::Generic_White}, {"R", RoadShieldType::Generic_White_Bordered},
{"L", RoadShieldType::Generic_White}}) {"L", RoadShieldType::Generic_White_Bordered}})
{} {}
}; };
@@ -501,8 +501,8 @@ class PortugalRoadShieldParser : public SimpleRoadShieldParser
public: public:
explicit PortugalRoadShieldParser(std::string const & baseRoadNumber) explicit PortugalRoadShieldParser(std::string const & baseRoadNumber)
: SimpleRoadShieldParser(baseRoadNumber, {{"A", RoadShieldType::Generic_Blue}, : SimpleRoadShieldParser(baseRoadNumber, {{"A", RoadShieldType::Generic_Blue},
{"N", RoadShieldType::Generic_White}, {"N", RoadShieldType::Generic_White_Bordered},
{"EN", RoadShieldType::Generic_White}, {"EN", RoadShieldType::Generic_White_Bordered},
{"R", RoadShieldType::Generic_Orange}, {"R", RoadShieldType::Generic_Orange},
{"EM", RoadShieldType::Generic_Orange}, {"EM", RoadShieldType::Generic_Orange},
{"CM", RoadShieldType::Generic_Orange}}) {"CM", RoadShieldType::Generic_Orange}})
@@ -601,9 +601,9 @@ class GermanyRoadShieldParser : public SimpleRoadShieldParser
public: public:
explicit GermanyRoadShieldParser(std::string const & baseRoadNumber) explicit GermanyRoadShieldParser(std::string const & baseRoadNumber)
: SimpleRoadShieldParser(baseRoadNumber, {{"A", RoadShieldType::Generic_Blue}, : SimpleRoadShieldParser(baseRoadNumber, {{"A", RoadShieldType::Generic_Blue},
{"B", RoadShieldType::Generic_Orange}, {"B", RoadShieldType::Generic_Orange_Bordered},
{"L", RoadShieldType::Generic_White}, {"L", RoadShieldType::Generic_White_Bordered},
{"K", RoadShieldType::Generic_White}}) {"K", RoadShieldType::Generic_White_Bordered}})
{} {}
}; };
@@ -646,7 +646,7 @@ public:
explicit NetherlandsRoadShieldParser(std::string const & baseRoadNumber) explicit NetherlandsRoadShieldParser(std::string const & baseRoadNumber)
: SimpleRoadShieldParser(baseRoadNumber, {{"A", RoadShieldType::Generic_Red}, : SimpleRoadShieldParser(baseRoadNumber, {{"A", RoadShieldType::Generic_Red},
{"E", RoadShieldType::Generic_Green}, {"E", RoadShieldType::Generic_Green},
{"N", RoadShieldType::Generic_Orange}}) {"N", RoadShieldType::Generic_Orange_Bordered}})
{} {}
}; };
@@ -655,8 +655,8 @@ class FinlandRoadShieldParser : public NumericRoadShieldParser
public: public:
explicit FinlandRoadShieldParser(std::string const & baseRoadNumber) explicit FinlandRoadShieldParser(std::string const & baseRoadNumber)
: NumericRoadShieldParser(baseRoadNumber, {{1, 30, RoadShieldType::Generic_Red}, : NumericRoadShieldParser(baseRoadNumber, {{1, 30, RoadShieldType::Generic_Red},
{40, 99, RoadShieldType::Generic_Orange}, {40, 99, RoadShieldType::Generic_Orange_Bordered},
{100, 999, RoadShieldType::Generic_White}, {100, 999, RoadShieldType::Generic_White_Bordered},
{1000, 9999, RoadShieldType::Generic_Blue}, {1000, 9999, RoadShieldType::Generic_Blue},
{10000, kAnyHigherRoadNumber, RoadShieldType::Hidden}}) {10000, kAnyHigherRoadNumber, RoadShieldType::Hidden}})
{} {}
@@ -667,10 +667,10 @@ class EstoniaRoadShieldParser : public NumericRoadShieldParser
public: public:
explicit EstoniaRoadShieldParser(std::string const & baseRoadNumber) explicit EstoniaRoadShieldParser(std::string const & baseRoadNumber)
: NumericRoadShieldParser(baseRoadNumber, {{1, 11, RoadShieldType::Generic_Red}, : NumericRoadShieldParser(baseRoadNumber, {{1, 11, RoadShieldType::Generic_Red},
{12, 91, RoadShieldType::Generic_Orange}, {12, 91, RoadShieldType::Generic_Orange_Bordered},
{92, 92, RoadShieldType::Generic_Red}, {92, 92, RoadShieldType::Generic_Red},
{93, 95, RoadShieldType::Generic_Orange}, {93, 95, RoadShieldType::Generic_Orange_Bordered},
{96, 999, RoadShieldType::Generic_White}, {96, 999, RoadShieldType::Generic_White_Bordered},
{1000, kAnyHigherRoadNumber, RoadShieldType::Hidden}}) {1000, kAnyHigherRoadNumber, RoadShieldType::Hidden}})
{} {}
}; };
@@ -681,7 +681,7 @@ public:
explicit MalaysiaRoadShieldParser(std::string const & baseRoadNumber) explicit MalaysiaRoadShieldParser(std::string const & baseRoadNumber)
: SimpleRoadShieldParser(baseRoadNumber, : SimpleRoadShieldParser(baseRoadNumber,
{{"AH", RoadShieldType::Generic_Blue}, {"E", RoadShieldType::Generic_Blue}}, {{"AH", RoadShieldType::Generic_Blue}, {"E", RoadShieldType::Generic_Blue}},
RoadShieldType::Generic_Orange) RoadShieldType::Generic_Orange_Bordered)
{} {}
}; };
@@ -689,13 +689,13 @@ class CyprusRoadShieldParser : public SimpleRoadShieldParser
{ {
public: public:
explicit CyprusRoadShieldParser(std::string const & baseRoadNumber) explicit CyprusRoadShieldParser(std::string const & baseRoadNumber)
: SimpleRoadShieldParser(baseRoadNumber, { // North Cuprus. : SimpleRoadShieldParser(baseRoadNumber, {// North Cyprus.
{"D.", RoadShieldType::Generic_Blue}, // White font. {"D.", RoadShieldType::Generic_Blue}, // White font.
{"GM.", RoadShieldType::Generic_White}, // Blue font. {"GM.", RoadShieldType::Generic_White_Bordered}, // Blue font.
{"GZ.", RoadShieldType::Generic_White}, // Blue font. {"GZ.", RoadShieldType::Generic_White_Bordered}, // Blue font.
{"GR.", RoadShieldType::Generic_White}, // Blue font. {"GR.", RoadShieldType::Generic_White_Bordered}, // Blue font.
{"LF.", RoadShieldType::Generic_White}, // Blue font. {"LF.", RoadShieldType::Generic_White_Bordered}, // Blue font.
{"İK.", RoadShieldType::Generic_White}, // Blue font. {"İK.", RoadShieldType::Generic_White_Bordered}, // Blue font.
// South Cyprus. // South Cyprus.
{"A", RoadShieldType::Generic_Green}, // Yellow font. Hexagon. {"A", RoadShieldType::Generic_Green}, // Yellow font. Hexagon.
{"B", RoadShieldType::Generic_Blue}, // Yellow font. {"B", RoadShieldType::Generic_Blue}, // Yellow font.
@@ -855,10 +855,25 @@ std::string DebugPrint(RoadShieldType shieldType)
{ {
case RoadShieldType::Default: return "default"; case RoadShieldType::Default: return "default";
case RoadShieldType::Generic_White: return "white"; case RoadShieldType::Generic_White: return "white";
case RoadShieldType::Generic_Blue: return "blue";
case RoadShieldType::Generic_Green: return "green"; case RoadShieldType::Generic_Green: return "green";
case RoadShieldType::Generic_Orange: return "orange"; case RoadShieldType::Generic_Blue: return "blue";
case RoadShieldType::Generic_Red: return "red"; case RoadShieldType::Generic_Red: return "red";
case RoadShieldType::Generic_Orange: return "orange";
case RoadShieldType::Generic_White_Bordered: return "white bordered";
case RoadShieldType::Generic_Green_Bordered: return "green bordered";
case RoadShieldType::Generic_Blue_Bordered: return "blue bordered";
case RoadShieldType::Generic_Red_Bordered: return "red bordered";
case RoadShieldType::Generic_Orange_Bordered: return "orange bordered";
case RoadShieldType::Generic_Pill_White: return "white pill";
case RoadShieldType::Generic_Pill_Green: return "green pill";
case RoadShieldType::Generic_Pill_Blue: return "blue pill";
case RoadShieldType::Generic_Pill_Red: return "red pill";
case RoadShieldType::Generic_Pill_Orange: return "orange pill";
case RoadShieldType::Generic_Pill_White_Bordered: return "white pill bordered";
case RoadShieldType::Generic_Pill_Green_Bordered: return "green pill bordered";
case RoadShieldType::Generic_Pill_Blue_Bordered: return "blue pill bordered";
case RoadShieldType::Generic_Pill_Red_Bordered: return "red pill bordered";
case RoadShieldType::Generic_Pill_Orange_Bordered: return "orange pill bordered";
case RoadShieldType::US_Interstate: return "US interstate"; case RoadShieldType::US_Interstate: return "US interstate";
case RoadShieldType::US_Highway: return "US highway"; case RoadShieldType::US_Highway: return "US highway";
case RoadShieldType::UK_Highway: return "UK highway"; case RoadShieldType::UK_Highway: return "UK highway";

View File

@@ -18,6 +18,21 @@ enum class RoadShieldType
Generic_Blue, Generic_Blue,
Generic_Red, Generic_Red,
Generic_Orange, Generic_Orange,
Generic_White_Bordered,
Generic_Green_Bordered,
Generic_Blue_Bordered,
Generic_Red_Bordered,
Generic_Orange_Bordered,
Generic_Pill_White,
Generic_Pill_Green,
Generic_Pill_Blue,
Generic_Pill_Red,
Generic_Pill_Orange,
Generic_Pill_White_Bordered,
Generic_Pill_Green_Bordered,
Generic_Pill_Blue_Bordered,
Generic_Pill_Red_Bordered,
Generic_Pill_Orange_Bordered,
US_Interstate, US_Interstate,
US_Highway, US_Highway,
UK_Highway, UK_Highway,