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

Method AddEdgePTForSubroute

libs/map/transit/transit_display.cpp:379–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377}
378
379void TransitRouteDisplay::AddEdgePTForSubroute(routing::RouteSegment const & segment, df::Subroute & subroute,
380 SubrouteParams & sp, SubrouteSegmentParams & ssp)
381{
382 CHECK_EQUAL(ssp.m_displayInfo.m_transitVersion, ::transit::TransitVersion::AllPublicTransport,
383 (segment.GetSegment()));
384
385 auto const & edge = ssp.m_transitInfo.GetEdgePT();
386
387 auto const currentLineId = edge.m_lineId;
388 auto const & line = ssp.m_displayInfo.m_linesPT.at(currentLineId);
389
390 auto const it = ssp.m_displayInfo.m_routesPT.find(line.GetRouteId());
391 CHECK(it != ssp.m_displayInfo.m_routesPT.end(), (line.GetRouteId()));
392 auto const & route = it->second;
393
394 auto const currentColor = df::GetTransitColorName(route.GetColor());
395 sp.m_transitType = GetTransitType(route.GetType());
396
397 m_routeInfo.AddStep(
398 TransitStepInfo(sp.m_transitType, ssp.m_distance, ssp.m_time, route.GetTitle(), ColorToARGB(currentColor)));
399
400 auto const & stop1 = ssp.m_displayInfo.m_stopsPT.at(edge.m_stop1Id);
401 auto const & stop2 = ssp.m_displayInfo.m_stopsPT.at(edge.m_stop2Id);
402
403 bool const isTransfer1 = !stop1.GetTransferIds().empty();
404 bool const isTransfer2 = !stop2.GetTransferIds().empty();
405
406 sp.m_marker.m_distance = sp.m_prevDistance;
407 sp.m_marker.m_scale = kStopMarkerScale;
408 sp.m_marker.m_innerColor = currentColor;
409
410 if (isTransfer1)
411 {
412 auto itTransfer = ssp.m_displayInfo.m_transfersPT.find(stop1.GetTransferIds().front());
413 ASSERT(itTransfer != ssp.m_displayInfo.m_transfersPT.end(), ());
414 sp.m_marker.m_position = itTransfer->second.GetPoint();
415 }
416 else
417 {
418 sp.m_marker.m_position = stop1.GetPoint();
419 }
420
421 sp.m_transitMarkInfo.m_point = sp.m_marker.m_position;
422
423 if (sp.m_pendingEntrance)
424 {
425 sp.m_transitMarkInfo.m_type = TransitMarkInfo::Type::KeyStop;
426 sp.m_transitMarkInfo.m_symbolName = kTransitSymbols.at(sp.m_transitType);
427 sp.m_transitMarkInfo.m_color = currentColor;
428 AddTransitGateSegment(sp.m_marker.m_position, currentColor, subroute);
429 sp.m_pendingEntrance = false;
430 }
431
432 auto const id1 = isTransfer1 ? stop1.GetTransferIds().front() : stop1.GetId();
433 auto const id2 = isTransfer2 ? stop2.GetTransferIds().front() : stop2.GetId();
434
435 if (id1 != id2)
436 AddTransitShapes(edge.m_shapeLink, ssp.m_displayInfo.m_shapesPT, currentColor, subroute);

Callers

nothing calls this directly

Calls 15

GetTransitColorNameFunction · 0.85
GetTransitTypeFunction · 0.85
ColorToARGBFunction · 0.85
ASSERTFunction · 0.85
AddTransitGateSegmentFunction · 0.85
AddTransitShapesFunction · 0.85
GetTransitTextColorNameFunction · 0.85
SubrouteMarkerClass · 0.85
TransitMarkInfoClass · 0.85
GetSegmentMethod · 0.80
atMethod · 0.80
GetRouteIdMethod · 0.80

Tested by

no test coverage detected