| 387 | } |
| 388 | |
| 389 | void TransitGraph::AddGate(transit::Gate const & gate, FakeEnding const & ending, |
| 390 | map<transit::StopId, LatLonWithAltitude> const & stopCoords, bool isEnter, |
| 391 | StopToSegmentsMap & stopToBack, StopToSegmentsMap & stopToFront) |
| 392 | { |
| 393 | CHECK_EQUAL(m_transitVersion, ::transit::TransitVersion::OnlySubway, (gate)); |
| 394 | |
| 395 | Segment const dummy = Segment(); |
| 396 | for (auto const & projection : ending.m_projections) |
| 397 | { |
| 398 | // Add projection edges |
| 399 | auto const projectionSegment = GetNewTransitSegment(); |
| 400 | FakeVertex projectionVertex(projection.m_segment.GetMwmId(), |
| 401 | isEnter ? projection.m_junction : ending.m_originJunction, |
| 402 | isEnter ? ending.m_originJunction : projection.m_junction, FakeVertex::Type::PureFake); |
| 403 | m_fake.AddStandaloneVertex(projectionSegment, projectionVertex); |
| 404 | |
| 405 | // Add fake parts of real |
| 406 | FakeVertex forwardPartOfReal( |
| 407 | projection.m_segment.GetMwmId(), isEnter ? projection.m_segmentBack : projection.m_junction, |
| 408 | isEnter ? projection.m_junction : projection.m_segmentFront, FakeVertex::Type::PartOfReal); |
| 409 | auto const fakeForwardSegment = GetNewTransitSegment(); |
| 410 | m_fake.AddVertex(projectionSegment, fakeForwardSegment, forwardPartOfReal, !isEnter /* isOutgoing */, |
| 411 | true /* isPartOfReal */, projection.m_segment); |
| 412 | |
| 413 | if (!projection.m_isOneWay) |
| 414 | { |
| 415 | FakeVertex backwardPartOfReal( |
| 416 | projection.m_segment.GetMwmId(), isEnter ? projection.m_segmentFront : projection.m_junction, |
| 417 | isEnter ? projection.m_junction : projection.m_segmentBack, FakeVertex::Type::PartOfReal); |
| 418 | auto const fakeBackwardSegment = GetNewTransitSegment(); |
| 419 | m_fake.AddVertex(projectionSegment, fakeBackwardSegment, backwardPartOfReal, !isEnter /* isOutgoing */, |
| 420 | true /* isPartOfReal */, projection.m_segment.GetReversed()); |
| 421 | } |
| 422 | |
| 423 | // Connect gate to stops |
| 424 | for (auto const stopId : gate.GetStopIds()) |
| 425 | { |
| 426 | auto const gateSegment = GetNewTransitSegment(); |
| 427 | auto const stopIt = stopCoords.find(stopId); |
| 428 | CHECK(stopIt != stopCoords.end(), ("Stop", stopId, "does not exist.")); |
| 429 | FakeVertex gateVertex(projection.m_segment.GetMwmId(), isEnter ? ending.m_originJunction : stopIt->second, |
| 430 | isEnter ? stopIt->second : ending.m_originJunction, FakeVertex::Type::PureFake); |
| 431 | m_fake.AddVertex(projectionSegment, gateSegment, gateVertex, isEnter /* isOutgoing */, false /* isPartOfReal */, |
| 432 | dummy /* realSegment */); |
| 433 | m_segmentToGateSubway[gateSegment] = gate; |
| 434 | if (isEnter) |
| 435 | stopToFront[stopId].insert(gateSegment); |
| 436 | else |
| 437 | stopToBack[stopId].insert(gateSegment); |
| 438 | } |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | void TransitGraph::AddGate(::transit::experimental::Gate const & gate, FakeEnding const & ending, |
| 443 | std::map<transit::StopId, LatLonWithAltitude> const & stopCoords, bool isEnter, |
nothing calls this directly
no test coverage detected