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

Method AddEdgeSubwayForSubroute

libs/map/transit/transit_display.cpp:260–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260void TransitRouteDisplay::AddEdgeSubwayForSubroute(routing::RouteSegment const & segment, df::Subroute & subroute,
261 SubrouteParams & sp, SubrouteSegmentParams & ssp)
262{
263 CHECK_EQUAL(ssp.m_displayInfo.m_transitVersion, ::transit::TransitVersion::OnlySubway, ());
264
265 auto const & edge = ssp.m_transitInfo.GetEdgeSubway();
266
267 auto const currentLineId = edge.m_lineId;
268
269 auto const & line = ssp.m_displayInfo.m_linesSubway.at(currentLineId);
270 auto const currentColor = df::GetTransitColorName(line.GetColor());
271 sp.m_transitType = GetTransitType(line.GetType());
272
273 m_routeInfo.AddStep(
274 TransitStepInfo(sp.m_transitType, ssp.m_distance, ssp.m_time, line.GetNumber(), ColorToARGB(currentColor)));
275
276 auto const & stop1 = ssp.m_displayInfo.m_stopsSubway.at(edge.m_stop1Id);
277 auto const & stop2 = ssp.m_displayInfo.m_stopsSubway.at(edge.m_stop2Id);
278 bool const isTransfer1 = stop1.GetTransferId() != routing::transit::kInvalidTransferId;
279 bool const isTransfer2 = stop2.GetTransferId() != routing::transit::kInvalidTransferId;
280
281 sp.m_marker.m_distance = sp.m_prevDistance;
282 sp.m_marker.m_scale = kStopMarkerScale;
283 sp.m_marker.m_innerColor = currentColor;
284 if (isTransfer1)
285 {
286 auto const & transferData = ssp.m_displayInfo.m_transfersSubway.at(stop1.GetTransferId());
287 sp.m_marker.m_position = transferData.GetPoint();
288 }
289 else
290 {
291 sp.m_marker.m_position = stop1.GetPoint();
292 }
293 sp.m_transitMarkInfo.m_point = sp.m_marker.m_position;
294
295 if (sp.m_pendingEntrance)
296 {
297 sp.m_transitMarkInfo.m_type = TransitMarkInfo::Type::KeyStop;
298 sp.m_transitMarkInfo.m_symbolName = kTransitSymbols.at(sp.m_transitType);
299 sp.m_transitMarkInfo.m_color = currentColor;
300 AddTransitGateSegment(sp.m_marker.m_position, currentColor, subroute);
301 sp.m_pendingEntrance = false;
302 }
303
304 auto const id1 = isTransfer1 ? stop1.GetTransferId() : stop1.GetId();
305 auto const id2 = isTransfer2 ? stop2.GetTransferId() : stop2.GetId();
306
307 if (id1 != id2)
308 {
309 bool const isInverted = id1 > id2;
310 AddTransitShapes(edge.m_shapeIds, ssp.m_displayInfo.m_shapesSubway, currentColor, isInverted, subroute);
311 }
312
313 CHECK_GREATER(subroute.m_polyline.GetSize(), 1, ());
314 auto const & p1 = *(subroute.m_polyline.End() - 2);
315 auto const & p2 = *(subroute.m_polyline.End() - 1);
316 m2::PointD currentDir = (p2 - p1).Normalize();
317

Callers

nothing calls this directly

Calls 15

GetTransitColorNameFunction · 0.85
GetTransitTypeFunction · 0.85
ColorToARGBFunction · 0.85
AddTransitGateSegmentFunction · 0.85
AddTransitShapesFunction · 0.85
GetTransitTextColorNameFunction · 0.85
SubrouteMarkerClass · 0.85
TransitMarkInfoClass · 0.85
TransitTitleClass · 0.85
atMethod · 0.80
TransitStepInfoClass · 0.70

Tested by

no test coverage detected