MCPcopy Create free account
hub / github.com/comaps/comaps / ProcessLineStyle

Method ProcessLineStyle

libs/drape_frontend/rule_drawer.cpp:337–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337void RuleDrawer::ProcessLineStyle(FeatureType & f, Stylist const & s, TInsertShapeFn const & insertShape)
338{
339 ApplyLineFeatureGeometry applyGeom(m_context->GetTileKey(), insertShape, f, m_currentScaleGtoP);
340 f.ForEachPoint(applyGeom, m_zoomLevel);
341
342 if (applyGeom.HasGeometry())
343 applyGeom.ProcessLineRules(s.m_lineRules);
344
345 if (s.m_pathtextRule || s.m_shieldRule)
346 {
347 std::vector<m2::SharedSpline> clippedSplines;
348
349 auto const metalineSpline = m_context->GetMetalineManager()->GetMetaline(f.GetID());
350 if (metalineSpline.IsNull())
351 {
352 // There is no metaline for this feature.
353 clippedSplines = applyGeom.GetClippedSplines();
354 }
355 else if (m_usedMetalines.insert(metalineSpline.Get()).second)
356 {
357 // Generate additional by metaline, mark metaline spline as used.
358 clippedSplines = m2::ClipSplineByRect(m_globalRect, metalineSpline);
359 }
360
361 if (!clippedSplines.empty())
362 {
363 ApplyLineFeatureAdditional applyAdditional(m_context->GetTileKey(), insertShape, f, m_currentScaleGtoP,
364 s.GetCaptionDescription(), std::move(clippedSplines));
365 applyAdditional.ProcessAdditionalLineRules(s.m_pathtextRule, s.m_shieldRule, m_context->GetTextureManager(),
366 s.m_roadShields, m_generatedRoadShields);
367 }
368 }
369
370 if (m_context->IsTrafficEnabled() && m_zoomLevel >= kRoadClass0ZoomLevel)
371 {
372 using ftypes::HighwayClass;
373 struct Checker
374 {
375 std::vector<HighwayClass> m_highwayClasses;
376 int m_zoomLevel;
377 df::RoadClass m_roadClass;
378 };
379 static Checker const checkers[] = {
380 {{HighwayClass::Motorway, HighwayClass::Trunk, HighwayClass::Primary},
381 kRoadClass0ZoomLevel,
382 df::RoadClass::Class0},
383 {{HighwayClass::Secondary, HighwayClass::Tertiary}, kRoadClass1ZoomLevel, df::RoadClass::Class1},
384 {{HighwayClass::LivingStreet, HighwayClass::Service, HighwayClass::ServiceMinor},
385 kRoadClass2ZoomLevel,
386 df::RoadClass::Class2}};
387
388 bool const oneWay = ftypes::IsOneWayChecker::Instance()(f);
389 auto const highwayClass = ftypes::GetHighwayClass(feature::TypesHolder(f));
390 for (size_t i = 0; i < ARRAY_SIZE(checkers); ++i)
391 {
392 auto const & classes = checkers[i].m_highwayClasses;
393 if (find(classes.begin(), classes.end(), highwayClass) != classes.end() && m_zoomLevel >= checkers[i].m_zoomLevel)
394 {

Callers

nothing calls this directly

Calls 15

ClipSplineByRectFunction · 0.85
GetHighwayClassFunction · 0.85
findFunction · 0.85
assign_rangeFunction · 0.85
ExtractTrafficGeometryFunction · 0.85
ProcessLineRulesMethod · 0.80
GetMetalineMethod · 0.80
GetMetalineManagerMethod · 0.80
IsNullMethod · 0.80
GetTextureManagerMethod · 0.80
TypesHolderClass · 0.50

Tested by

no test coverage detected