| 1144 | } |
| 1145 | |
| 1146 | void ApplyLineFeatureAdditional::ProcessAdditionalLineRules(PathTextRuleProto const * pathtextRule, |
| 1147 | ShieldRuleProto const * shieldRule, |
| 1148 | ref_ptr<dp::TextureManager> texMng, |
| 1149 | ftypes::RoadShieldsSetT const & roadShields, |
| 1150 | GeneratedRoadShields & generatedRoadShields) |
| 1151 | { |
| 1152 | ASSERT(pathtextRule || shieldRule, ()); |
| 1153 | |
| 1154 | auto const vs = static_cast<float>(df::VisualParams::Instance().GetVisualScale()); |
| 1155 | |
| 1156 | std::vector<m2::PointD> shieldPositions; |
| 1157 | ASSERT((shieldRule && !roadShields.empty()) || !(shieldRule && !roadShields.empty()), |
| 1158 | (roadShields.empty(), shieldRule == nullptr)); |
| 1159 | if (shieldRule) |
| 1160 | { |
| 1161 | m_shieldRule = shieldRule; |
| 1162 | m_shieldDepth = PriorityToDepth(shieldRule->priority(), drule::shield, 0); |
| 1163 | shieldPositions.reserve(m_clippedSplines.size() * 3); |
| 1164 | } |
| 1165 | |
| 1166 | if (pathtextRule) |
| 1167 | { |
| 1168 | ASSERT(!m_captions.GetMainText().empty(), ()); |
| 1169 | m_captionRule = &pathtextRule->primary(); |
| 1170 | ASSERT_GREATER_OR_EQUAL(m_captionRule->height(), kMinVisibleFontSize / df::kMaxVisualScale, ()); |
| 1171 | m_captionDepth = PriorityToDepth(pathtextRule->priority(), drule::pathtext, 0); |
| 1172 | |
| 1173 | dp::FontDecl fontDecl; |
| 1174 | CaptionDefProtoToFontDecl(m_captionRule, fontDecl); |
| 1175 | PathTextViewParams params; |
| 1176 | FillCommonParams(params); |
| 1177 | params.m_depthLayer = DepthLayer::OverlayLayer; |
| 1178 | params.m_depthTestEnabled = false; |
| 1179 | params.m_depth = m_captionDepth; |
| 1180 | params.m_mainText = m_captions.GetMainText(); |
| 1181 | params.m_mainTextLanguageIndex = m_captions.m_mainTextLanguageIndex; |
| 1182 | params.m_auxText = m_captions.GetAuxText(); |
| 1183 | params.m_auxTextLanguageIndex = m_captions.m_auxTextLanguageIndex; |
| 1184 | params.m_textFont = fontDecl; |
| 1185 | params.m_baseGtoPScale = m_currentScaleGtoP; |
| 1186 | |
| 1187 | uint32_t textIndex = kPathTextBaseTextIndex; |
| 1188 | for (auto const & spline : m_clippedSplines) |
| 1189 | { |
| 1190 | PathTextViewParams p = params; |
| 1191 | auto shape = make_unique_dp<PathTextShape>(spline, p, m_tileKey, textIndex); |
| 1192 | |
| 1193 | if (!shape->CalculateLayout(texMng)) |
| 1194 | continue; |
| 1195 | |
| 1196 | // Position shields inbetween captions. |
| 1197 | // If there is only one center position then the shield and the caption will compete for it. |
| 1198 | if (m_shieldRule) |
| 1199 | CalculateRoadShieldPositions(shape->GetOffsets(), spline, shieldPositions); |
| 1200 | |
| 1201 | m_insertShape(std::move(shape)); |
| 1202 | textIndex++; |
| 1203 | } |
no test coverage detected