diff --git a/routing_common/transit_types.cpp b/routing_common/transit_types.cpp index 9aebd3b4af..77db8c4f19 100644 --- a/routing_common/transit_types.cpp +++ b/routing_common/transit_types.cpp @@ -61,5 +61,24 @@ bool Stop::IsEqualForTesting(Stop const & stop) const return m_id == stop.m_id && m_featureId == stop.m_featureId && m_transferId == stop.m_transferId && m_lineIds == stop.m_lineIds && my::AlmostEqualAbs(m_point, stop.m_point, kPointsEqualEpsilon); } + +// Edge ------------------------------------------------------------------------------------------- +Edge::Edge(StopId startStopId, StopId finishStopId, double weight, LineId lineId, bool transfer, + vector const & shapeIds) + : m_startStopId(startStopId) + , m_finishStopId(finishStopId) + , m_weight(weight) + , m_lineId(lineId) + , m_transfer(transfer) + , m_shapeIds(shapeIds) +{ +} + +bool Edge::IsEqualForTesting(Edge const & edge) const +{ + return m_startStopId == edge.m_startStopId && m_finishStopId == edge.m_finishStopId && + m_weight == edge.m_weight && m_lineId == edge.m_lineId && m_transfer == edge.m_transfer && + m_shapeIds == edge.m_shapeIds; +} } // namespace transit } // namespace routing diff --git a/routing_common/transit_types.hpp b/routing_common/transit_types.hpp index 4dab968907..c681f1ceae 100644 --- a/routing_common/transit_types.hpp +++ b/routing_common/transit_types.hpp @@ -17,12 +17,16 @@ using StopId = uint64_t; using TransferId = uint64_t; using NetworkId = uint32_t; using FeatureId = uint32_t; +using ShapeId = uint32_t; +using Weight = double; LineId constexpr kInvalidLineId = std::numeric_limits::max(); StopId constexpr kInvalidStopId = std::numeric_limits::max(); TransferId constexpr kInvalidTransferId = std::numeric_limits::max(); NetworkId constexpr kInvalidNetworkId = std::numeric_limits::max(); FeatureId constexpr kInvalidFeatureId = std::numeric_limits::max(); +ShapeId constexpr kInvalidShapeId = std::numeric_limits::max(); +Weight constexpr kInvalidWeight = std::numeric_limits::max(); struct TransitHeader { @@ -78,6 +82,28 @@ private: // and deserialization. }; +class Edge +{ +public: + Edge() = default; + Edge(StopId startStopId, StopId finishStopId, double weight, LineId lineId, bool transfer, + std::vector const & shapeIds); + + bool IsEqualForTesting(Edge const & edge) const; + DECLARE_VISITOR(visitor(m_startStopId, "start_stop_id"), visitor(m_finishStopId, "finish_stop_id"), + visitor(m_weight, "weight"), visitor(m_lineId, "line_id"), + visitor(m_transfer, "transfer"), visitor(m_shapeIds, "shape_ids")) + DECLARE_DEBUG_PRINT(Edge) + +private: + StopId m_startStopId = kInvalidStopId; + StopId m_finishStopId = kInvalidStopId; + double m_weight = kInvalidWeight; + LineId m_lineId = kInvalidLineId; + bool m_transfer = false; + std::vector m_shapeIds; +}; + // @TODO(bykoianko) Data structures and methods for other transit data should be implemented in here. } // namespace transit } // namespace routing