| 494 | } |
| 495 | |
| 496 | void TransitGraph::AddStop(::transit::experimental::Stop const & stop, FakeEnding const & ending, |
| 497 | std::map<transit::StopId, LatLonWithAltitude> const & stopCoords, |
| 498 | StopToSegmentsMap & stopToBack, StopToSegmentsMap & stopToFront) |
| 499 | { |
| 500 | CHECK_EQUAL(m_transitVersion, ::transit::TransitVersion::AllPublicTransport, (stop)); |
| 501 | |
| 502 | Segment const dummy = Segment(); |
| 503 | for (bool isEnter : {true, false}) |
| 504 | { |
| 505 | for (auto const & projection : ending.m_projections) |
| 506 | { |
| 507 | // Add projection edges |
| 508 | auto const projectionSegment = GetNewTransitSegment(); |
| 509 | FakeVertex projectionVertex( |
| 510 | projection.m_segment.GetMwmId(), isEnter ? projection.m_junction : ending.m_originJunction, |
| 511 | isEnter ? ending.m_originJunction : projection.m_junction, FakeVertex::Type::PureFake); |
| 512 | m_fake.AddStandaloneVertex(projectionSegment, projectionVertex); |
| 513 | |
| 514 | // Add fake parts of real |
| 515 | FakeVertex forwardPartOfReal( |
| 516 | projection.m_segment.GetMwmId(), isEnter ? projection.m_segmentBack : projection.m_junction, |
| 517 | isEnter ? projection.m_junction : projection.m_segmentFront, FakeVertex::Type::PartOfReal); |
| 518 | auto const fakeForwardSegment = GetNewTransitSegment(); |
| 519 | m_fake.AddVertex(projectionSegment, fakeForwardSegment, forwardPartOfReal, !isEnter /* isOutgoing */, |
| 520 | true /* isPartOfReal */, projection.m_segment); |
| 521 | |
| 522 | if (!projection.m_isOneWay) |
| 523 | { |
| 524 | FakeVertex backwardPartOfReal( |
| 525 | projection.m_segment.GetMwmId(), isEnter ? projection.m_segmentFront : projection.m_junction, |
| 526 | isEnter ? projection.m_junction : projection.m_segmentBack, FakeVertex::Type::PartOfReal); |
| 527 | auto const fakeBackwardSegment = GetNewTransitSegment(); |
| 528 | m_fake.AddVertex(projectionSegment, fakeBackwardSegment, backwardPartOfReal, !isEnter /* isOutgoing */, |
| 529 | true /* isPartOfReal */, projection.m_segment.GetReversed()); |
| 530 | } |
| 531 | |
| 532 | // Connect stop to graph. |
| 533 | auto const stopId = stop.GetId(); |
| 534 | auto const stopSegment = GetNewTransitSegment(); |
| 535 | auto const stopIt = stopCoords.find(stopId); |
| 536 | CHECK(stopIt != stopCoords.end(), ("Stop", stopId, "does not exist.")); |
| 537 | FakeVertex stopVertex(projection.m_segment.GetMwmId(), isEnter ? ending.m_originJunction : stopIt->second, |
| 538 | isEnter ? stopIt->second : ending.m_originJunction, FakeVertex::Type::PureFake); |
| 539 | m_fake.AddVertex(projectionSegment, stopSegment, stopVertex, isEnter /* isOutgoing */, false /* isPartOfReal */, |
| 540 | dummy /* realSegment */); |
| 541 | m_segmentToStopPT[stopSegment] = stop; |
| 542 | if (isEnter) |
| 543 | stopToFront[stopId].insert(stopSegment); |
| 544 | else |
| 545 | stopToBack[stopId].insert(stopSegment); |
| 546 | } |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | Segment TransitGraph::AddEdge(transit::Edge const & edge, map<transit::StopId, LatLonWithAltitude> const & stopCoords, |
| 551 | StopToSegmentsMap & stopToBack, StopToSegmentsMap & stopToFront) |
nothing calls this directly
no test coverage detected