#pragma once #include "routing/edge_estimator.hpp" #include "routing/fake_ending.hpp" #include "routing/fake_graph.hpp" #include "routing/fake_vertex.hpp" #include "routing/road_graph.hpp" #include "routing/route_weight.hpp" #include "routing/segment.hpp" #include "transit/transit_graph_data.hpp" #include "transit/transit_types.hpp" #include #include #include #include #include namespace routing { class IndexGraph; class TransitGraph final { public: using GateEndings = std::map; static bool IsTransitFeature(uint32_t featureId); static bool IsTransitSegment(Segment const & segment); TransitGraph(NumMwmId numMwmId, std::shared_ptr estimator); Junction const & GetJunction(Segment const & segment, bool front) const; RouteWeight CalcSegmentWeight(Segment const & segment) const; RouteWeight GetTransferPenalty(Segment const & from, Segment const & to) const; void GetTransitEdges(Segment const & segment, bool isOutgoing, std::vector & edges) const; std::set const & GetFake(Segment const & real) const; bool FindReal(Segment const & fake, Segment & real) const; void Fill(transit::GraphData const & transitData, GateEndings const & gateEndings); bool IsGate(Segment const & segment) const; bool IsEdge(Segment const & segment) const; transit::Gate const & GetGate(Segment const & segment) const; transit::Edge const & GetEdge(Segment const & segment) const; private: using StopToSegmentsMap = std::map>; Segment GetTransitSegment(uint32_t segmentIdx) const; Segment GetNewTransitSegment() const; // Adds gate to fake graph. Also adds gate to temporary stopToBack, stopToFront maps used while // TransitGraph::Fill. void AddGate(transit::Gate const & gate, FakeEnding const & ending, std::map const & stopCoords, bool isEnter, StopToSegmentsMap & stopToBack, StopToSegmentsMap & stopToFront); // Adds transit edge to fake graph, returns corresponding transit segment. Also adds gate to // temporary stopToBack, stopToFront maps used while TransitGraph::Fill. Segment AddEdge(transit::Edge const & edge, std::map const & stopCoords, StopToSegmentsMap & stopToBack, StopToSegmentsMap & stopToFront); // Adds connections to fake graph. void AddConnections(StopToSegmentsMap const & connections, StopToSegmentsMap const & stopToBack, StopToSegmentsMap const & stopToFront, bool isOutgoing); NumMwmId const m_mwmId = kFakeNumMwmId; std::shared_ptr m_estimator; FakeGraph m_fake; std::map m_segmentToEdge; std::map m_segmentToGate; std::map m_transferPenalties; }; void MakeGateEndings(std::vector const & gates, NumMwmId mwmId, IndexGraph & indexGraph, TransitGraph::GateEndings & gateEndings); } // namespace routing