| 742 | } |
| 743 | |
| 744 | void TransitSchemeBuilder::AddShape(TransitDisplayInfo const & transitDisplayInfo, routing::transit::StopId stop1Id, |
| 745 | routing::transit::StopId stop2Id, routing::transit::LineId lineId, |
| 746 | MwmSchemeData & scheme) |
| 747 | { |
| 748 | auto const stop1It = transitDisplayInfo.m_stopsSubway.find(stop1Id); |
| 749 | ASSERT(stop1It != transitDisplayInfo.m_stopsSubway.end(), (stop1Id)); |
| 750 | |
| 751 | auto const stop2It = transitDisplayInfo.m_stopsSubway.find(stop2Id); |
| 752 | ASSERT(stop2It != transitDisplayInfo.m_stopsSubway.end(), (stop2Id)); |
| 753 | |
| 754 | auto const transfer1Id = stop1It->second.GetTransferId(); |
| 755 | auto const transfer2Id = stop2It->second.GetTransferId(); |
| 756 | |
| 757 | auto shapeId = routing::transit::ShapeId(transfer1Id != routing::transit::kInvalidTransferId ? transfer1Id : stop1Id, |
| 758 | transfer2Id != routing::transit::kInvalidTransferId ? transfer2Id : stop2Id); |
| 759 | auto it = transitDisplayInfo.m_shapesSubway.find(shapeId); |
| 760 | bool isForward = true; |
| 761 | if (it == transitDisplayInfo.m_shapesSubway.end()) |
| 762 | { |
| 763 | isForward = false; |
| 764 | shapeId = routing::transit::ShapeId(shapeId.GetStop2Id(), shapeId.GetStop1Id()); |
| 765 | it = transitDisplayInfo.m_shapesSubway.find(shapeId); |
| 766 | } |
| 767 | |
| 768 | if (it == transitDisplayInfo.m_shapesSubway.end()) |
| 769 | return; |
| 770 | |
| 771 | auto const itScheme = scheme.m_shapesSubway.find(shapeId); |
| 772 | if (itScheme == scheme.m_shapesSubway.end()) |
| 773 | { |
| 774 | auto const & polyline = transitDisplayInfo.m_shapesSubway.at(it->first).GetPolyline(); |
| 775 | if (isForward) |
| 776 | scheme.m_shapesSubway[shapeId].m_forwardLines.push_back(lineId); |
| 777 | else |
| 778 | scheme.m_shapesSubway[shapeId].m_backwardLines.push_back(lineId); |
| 779 | scheme.m_shapesSubway[shapeId].m_polyline = polyline; |
| 780 | } |
| 781 | else |
| 782 | { |
| 783 | for (auto id : itScheme->second.m_forwardLines) |
| 784 | if (GetRouteId(id) == GetRouteId(lineId)) |
| 785 | return; |
| 786 | for (auto id : itScheme->second.m_backwardLines) |
| 787 | if (GetRouteId(id) == GetRouteId(lineId)) |
| 788 | return; |
| 789 | |
| 790 | if (isForward) |
| 791 | itScheme->second.m_forwardLines.push_back(lineId); |
| 792 | else |
| 793 | itScheme->second.m_backwardLines.push_back(lineId); |
| 794 | } |
| 795 | } |
| 796 | |
| 797 | void TransitSchemeBuilder::PrepareSchemeSubway(MwmSchemeData & scheme) |
| 798 | { |
nothing calls this directly
no test coverage detected