mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-22 22:23:44 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -43,8 +43,7 @@ inline std::string const kTransfersFile = "transfers" + kTransitFileExtension;
|
||||
inline std::string const kGatesFile = "gates" + kTransitFileExtension;
|
||||
|
||||
// Route types shown on the subway layer.
|
||||
inline std::unordered_set<std::string> const kSubwayLayerTypes{"subway", "train", "light_rail",
|
||||
"monorail"};
|
||||
inline std::unordered_set<std::string> const kSubwayLayerTypes{"subway", "train", "light_rail", "monorail"};
|
||||
|
||||
// Unique id for transit entities. It is generated by gtfs_converter and is persistent between
|
||||
// re-runs. Generated based on the unique string hash of the GTFS entity. Lies in the interval
|
||||
@@ -59,10 +58,7 @@ using Translations = std::unordered_map<std::string, std::string>;
|
||||
struct TimeFromGateToStop
|
||||
{
|
||||
TimeFromGateToStop() = default;
|
||||
TimeFromGateToStop(TransitId stopId, uint32_t timeSeconds)
|
||||
: m_stopId(stopId), m_timeSeconds(timeSeconds)
|
||||
{
|
||||
}
|
||||
TimeFromGateToStop(TransitId stopId, uint32_t timeSeconds) : m_stopId(stopId), m_timeSeconds(timeSeconds) {}
|
||||
bool operator==(TimeFromGateToStop const & rhs) const
|
||||
{
|
||||
return std::tie(m_stopId, m_timeSeconds) == std::tie(rhs.m_stopId, rhs.m_timeSeconds);
|
||||
@@ -85,24 +81,22 @@ struct ShapeLink
|
||||
{
|
||||
ShapeLink() = default;
|
||||
ShapeLink(TransitId id, uint32_t startIndex, uint32_t endIndex)
|
||||
: m_shapeId(id), m_startIndex(startIndex), m_endIndex(endIndex)
|
||||
{
|
||||
}
|
||||
: m_shapeId(id)
|
||||
, m_startIndex(startIndex)
|
||||
, m_endIndex(endIndex)
|
||||
{}
|
||||
|
||||
bool operator==(ShapeLink const & rhs) const
|
||||
{
|
||||
return std::tie(m_shapeId, m_startIndex, m_endIndex) ==
|
||||
std::tie(rhs.m_shapeId, rhs.m_startIndex, rhs.m_endIndex);
|
||||
return std::tie(m_shapeId, m_startIndex, m_endIndex) == std::tie(rhs.m_shapeId, rhs.m_startIndex, rhs.m_endIndex);
|
||||
}
|
||||
|
||||
bool operator<(ShapeLink const & rhs) const
|
||||
{
|
||||
return std::tie(m_shapeId, m_startIndex, m_endIndex) <
|
||||
std::tie(rhs.m_shapeId, rhs.m_startIndex, rhs.m_endIndex);
|
||||
return std::tie(m_shapeId, m_startIndex, m_endIndex) < std::tie(rhs.m_shapeId, rhs.m_startIndex, rhs.m_endIndex);
|
||||
}
|
||||
|
||||
DECLARE_VISITOR_AND_DEBUG_PRINT(ShapeLink, visitor(m_shapeId, "id"),
|
||||
visitor(m_startIndex, "startIndex"),
|
||||
DECLARE_VISITOR_AND_DEBUG_PRINT(ShapeLink, visitor(m_shapeId, "id"), visitor(m_startIndex, "startIndex"),
|
||||
visitor(m_endIndex, "endIndex"))
|
||||
|
||||
TransitId m_shapeId = kInvalidTransitId;
|
||||
@@ -114,9 +108,10 @@ struct EdgeId
|
||||
{
|
||||
EdgeId() = default;
|
||||
EdgeId(TransitId fromStopId, TransitId toStopId, TransitId lineId)
|
||||
: m_fromStopId(fromStopId), m_toStopId(toStopId), m_lineId(lineId)
|
||||
{
|
||||
}
|
||||
: m_fromStopId(fromStopId)
|
||||
, m_toStopId(toStopId)
|
||||
, m_lineId(lineId)
|
||||
{}
|
||||
|
||||
bool operator==(EdgeId const & other) const
|
||||
{
|
||||
@@ -146,10 +141,7 @@ using IdEdgeSet = std::unordered_set<EdgeId, EdgeIdHasher>;
|
||||
struct EdgeData
|
||||
{
|
||||
EdgeData() = default;
|
||||
EdgeData(ShapeLink const & shapeLink, EdgeWeight const & weight)
|
||||
: m_shapeLink(shapeLink), m_weight(weight)
|
||||
{
|
||||
}
|
||||
EdgeData(ShapeLink const & shapeLink, EdgeWeight const & weight) : m_shapeLink(shapeLink), m_weight(weight) {}
|
||||
|
||||
explicit EdgeData(EdgeWeight const & weight) : m_weight(weight) {}
|
||||
|
||||
@@ -167,13 +159,9 @@ struct LineSegment
|
||||
explicit LineSegment(uint32_t startIdx) : m_startIdx(startIdx) {}
|
||||
LineSegment(uint32_t startIdx, uint32_t endIdx) : m_startIdx(startIdx), m_endIdx(endIdx) {}
|
||||
|
||||
bool operator==(LineSegment const & rhs) const
|
||||
{
|
||||
return m_startIdx == rhs.m_startIdx && m_endIdx == rhs.m_endIdx;
|
||||
}
|
||||
bool operator==(LineSegment const & rhs) const { return m_startIdx == rhs.m_startIdx && m_endIdx == rhs.m_endIdx; }
|
||||
|
||||
DECLARE_VISITOR_AND_DEBUG_PRINT(LineSegment, visitor(m_startIdx, "startIdx"),
|
||||
visitor(m_endIdx, "endIdx"))
|
||||
DECLARE_VISITOR_AND_DEBUG_PRINT(LineSegment, visitor(m_startIdx, "startIdx"), visitor(m_endIdx, "endIdx"))
|
||||
|
||||
uint32_t m_startIdx = 0;
|
||||
uint32_t m_endIdx = 0;
|
||||
@@ -184,18 +172,11 @@ using LineSegments = std::vector<LineSegment>;
|
||||
struct LineSegmentOrder
|
||||
{
|
||||
LineSegmentOrder() = default;
|
||||
LineSegmentOrder(LineSegment const & lineSegment, int order)
|
||||
: m_segment(lineSegment), m_order(order)
|
||||
{
|
||||
}
|
||||
LineSegmentOrder(LineSegment const & lineSegment, int order) : m_segment(lineSegment), m_order(order) {}
|
||||
|
||||
bool operator==(LineSegmentOrder const & rhs) const
|
||||
{
|
||||
return m_order == rhs.m_order && m_segment == rhs.m_segment;
|
||||
}
|
||||
bool operator==(LineSegmentOrder const & rhs) const { return m_order == rhs.m_order && m_segment == rhs.m_segment; }
|
||||
|
||||
DECLARE_VISITOR_AND_DEBUG_PRINT(LineSegmentOrder, visitor(m_segment, "segment"),
|
||||
visitor(m_order, "order"))
|
||||
DECLARE_VISITOR_AND_DEBUG_PRINT(LineSegmentOrder, visitor(m_segment, "segment"), visitor(m_order, "order"))
|
||||
|
||||
LineSegment m_segment;
|
||||
int m_order = 0;
|
||||
@@ -204,19 +185,16 @@ struct LineSegmentOrder
|
||||
using LineSegmentsOrder = std::vector<LineSegmentOrder>;
|
||||
|
||||
template <class T, class I>
|
||||
typename std::vector<T>::const_iterator FindById(std::vector<T> const & container, I const & id,
|
||||
bool exists = true)
|
||||
typename std::vector<T>::const_iterator FindById(std::vector<T> const & container, I const & id, bool exists = true)
|
||||
{
|
||||
auto const it = std::find_if(container.begin(), container.end(),
|
||||
[id](T const & obj) { return obj.GetId() == id; });
|
||||
auto const it = std::find_if(container.begin(), container.end(), [id](T const & obj) { return obj.GetId() == id; });
|
||||
|
||||
if (exists)
|
||||
CHECK(it != container.end(), (id));
|
||||
return it;
|
||||
}
|
||||
|
||||
inline std::vector<m2::PointD> GetPolylinePart(std::vector<m2::PointD> const & polyline,
|
||||
size_t startIdx, size_t endIdx)
|
||||
inline std::vector<m2::PointD> GetPolylinePart(std::vector<m2::PointD> const & polyline, size_t startIdx, size_t endIdx)
|
||||
{
|
||||
CHECK_GREATER(endIdx, startIdx, ());
|
||||
CHECK_GREATER(polyline.size(), endIdx, ());
|
||||
|
||||
Reference in New Issue
Block a user