mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 13:23:59 +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:
@@ -23,8 +23,8 @@ class Edge
|
||||
{
|
||||
enum class Type
|
||||
{
|
||||
Real, // An edge that corresponds to some real segment.
|
||||
FakeWithRealPart, // A fake edge that is a part of some real segment.
|
||||
Real, // An edge that corresponds to some real segment.
|
||||
FakeWithRealPart, // A fake edge that is a part of some real segment.
|
||||
FakeWithoutRealPart // A fake edge that is not part of any real segment.
|
||||
};
|
||||
|
||||
@@ -33,17 +33,13 @@ public:
|
||||
|
||||
using JunctionPointT = geometry::PointWithAltitude;
|
||||
|
||||
static Edge MakeReal(FeatureID featureId, bool forward, uint32_t segId,
|
||||
JunctionPointT const & startJunction,
|
||||
static Edge MakeReal(FeatureID featureId, bool forward, uint32_t segId, JunctionPointT const & startJunction,
|
||||
JunctionPointT const & endJunction);
|
||||
static Edge MakeFakeWithRealPart(FeatureID featureId, uint32_t fakeSegmentId,
|
||||
bool forward, uint32_t segId,
|
||||
JunctionPointT const & startJunction,
|
||||
JunctionPointT const & endJunction);
|
||||
static Edge MakeFake(JunctionPointT const & startJunction,
|
||||
JunctionPointT const & endJunction);
|
||||
static Edge MakeFake(JunctionPointT const & startJunction,
|
||||
JunctionPointT const & endJunction, Edge const & prototype);
|
||||
static Edge MakeFakeWithRealPart(FeatureID featureId, uint32_t fakeSegmentId, bool forward, uint32_t segId,
|
||||
JunctionPointT const & startJunction, JunctionPointT const & endJunction);
|
||||
static Edge MakeFake(JunctionPointT const & startJunction, JunctionPointT const & endJunction);
|
||||
static Edge MakeFake(JunctionPointT const & startJunction, JunctionPointT const & endJunction,
|
||||
Edge const & prototype);
|
||||
|
||||
inline FeatureID const & GetFeatureId() const { return m_featureId; }
|
||||
inline bool IsForward() const { return m_forward; }
|
||||
@@ -56,13 +52,10 @@ public:
|
||||
inline m2::PointD const & GetStartPoint() const { return m_startJunction.GetPoint(); }
|
||||
inline m2::PointD const & GetEndPoint() const { return m_endJunction.GetPoint(); }
|
||||
|
||||
inline bool IsFake() const { return m_type != Type::Real; }
|
||||
inline bool IsFake() const { return m_type != Type::Real; }
|
||||
inline bool HasRealPart() const { return m_type != Type::FakeWithoutRealPart; }
|
||||
|
||||
inline m2::PointD GetDirection() const
|
||||
{
|
||||
return GetEndJunction().GetPoint() - GetStartJunction().GetPoint();
|
||||
}
|
||||
inline m2::PointD GetDirection() const { return GetEndJunction().GetPoint() - GetStartJunction().GetPoint(); }
|
||||
|
||||
Type GetType() const { return m_type; }
|
||||
|
||||
@@ -119,19 +112,16 @@ public:
|
||||
using EdgeVector = std::vector<Edge>;
|
||||
|
||||
/// Finds all nearest outgoing edges, that route to the junction.
|
||||
virtual void GetOutgoingEdges(JunctionPointT const & junction,
|
||||
EdgeListT & edges) const = 0;
|
||||
virtual void GetOutgoingEdges(JunctionPointT const & junction, EdgeListT & edges) const = 0;
|
||||
|
||||
/// Finds all nearest ingoing edges, that route to the junction.
|
||||
virtual void GetIngoingEdges(JunctionPointT const & junction,
|
||||
EdgeListT & edges) const = 0;
|
||||
virtual void GetIngoingEdges(JunctionPointT const & junction, EdgeListT & edges) const = 0;
|
||||
|
||||
/// @return Types for the specified edge
|
||||
virtual void GetEdgeTypes(Edge const & edge, feature::TypesHolder & types) const = 0;
|
||||
|
||||
/// @return Types for specified junction
|
||||
virtual void GetJunctionTypes(JunctionPointT const & junction,
|
||||
feature::TypesHolder & types) const = 0;
|
||||
virtual void GetJunctionTypes(JunctionPointT const & junction, feature::TypesHolder & types) const = 0;
|
||||
|
||||
virtual void GetRouteEdges(EdgeVector & routeEdges) const;
|
||||
|
||||
@@ -159,8 +149,7 @@ public:
|
||||
{
|
||||
RoadInfo();
|
||||
RoadInfo(RoadInfo && ri);
|
||||
RoadInfo(bool bidirectional, double speedKMPH,
|
||||
std::initializer_list<JunctionPointT> const & points);
|
||||
RoadInfo(bool bidirectional, double speedKMPH, std::initializer_list<JunctionPointT> const & points);
|
||||
RoadInfo(RoadInfo const &) = default;
|
||||
RoadInfo & operator=(RoadInfo const &) = default;
|
||||
|
||||
@@ -171,11 +160,8 @@ public:
|
||||
|
||||
struct FullRoadInfo
|
||||
{
|
||||
FullRoadInfo(FeatureID const & featureId, RoadInfo const & roadInfo)
|
||||
: m_featureId(featureId)
|
||||
, m_roadInfo(roadInfo)
|
||||
{
|
||||
}
|
||||
FullRoadInfo(FeatureID const & featureId, RoadInfo const & roadInfo) : m_featureId(featureId), m_roadInfo(roadInfo)
|
||||
{}
|
||||
|
||||
FeatureID m_featureId;
|
||||
RoadInfo m_roadInfo;
|
||||
@@ -185,23 +171,21 @@ public:
|
||||
class ICrossEdgesLoader
|
||||
{
|
||||
public:
|
||||
ICrossEdgesLoader(JunctionPointT const & cross, IRoadGraph::Mode mode,
|
||||
EdgeListT & edges)
|
||||
: m_cross(cross), m_mode(mode), m_edges(edges)
|
||||
{
|
||||
}
|
||||
ICrossEdgesLoader(JunctionPointT const & cross, IRoadGraph::Mode mode, EdgeListT & edges)
|
||||
: m_cross(cross)
|
||||
, m_mode(mode)
|
||||
, m_edges(edges)
|
||||
{}
|
||||
|
||||
virtual ~ICrossEdgesLoader() = default;
|
||||
|
||||
void operator()(FeatureID const & featureId, PointWithAltitudeVec const & junctions,
|
||||
bool bidirectional)
|
||||
void operator()(FeatureID const & featureId, PointWithAltitudeVec const & junctions, bool bidirectional)
|
||||
{
|
||||
LoadEdges(featureId, junctions, bidirectional);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void LoadEdges(FeatureID const & featureId, PointWithAltitudeVec const & junctions,
|
||||
bool bidirectional) = 0;
|
||||
virtual void LoadEdges(FeatureID const & featureId, PointWithAltitudeVec const & junctions, bool bidirectional) = 0;
|
||||
|
||||
protected:
|
||||
template <typename TFn>
|
||||
@@ -237,65 +221,59 @@ public:
|
||||
class CrossOutgoingLoader : public ICrossEdgesLoader
|
||||
{
|
||||
public:
|
||||
CrossOutgoingLoader(JunctionPointT const & cross, IRoadGraph::Mode mode,
|
||||
EdgeListT & edges)
|
||||
CrossOutgoingLoader(JunctionPointT const & cross, IRoadGraph::Mode mode, EdgeListT & edges)
|
||||
: ICrossEdgesLoader(cross, mode, edges)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
private:
|
||||
// ICrossEdgesLoader overrides:
|
||||
void LoadEdges(FeatureID const & featureId, PointWithAltitudeVec const & junctions,
|
||||
bool bidirectional) override;
|
||||
void LoadEdges(FeatureID const & featureId, PointWithAltitudeVec const & junctions, bool bidirectional) override;
|
||||
};
|
||||
|
||||
class CrossIngoingLoader : public ICrossEdgesLoader
|
||||
{
|
||||
public:
|
||||
CrossIngoingLoader(JunctionPointT const & cross, IRoadGraph::Mode mode,
|
||||
EdgeListT & edges)
|
||||
CrossIngoingLoader(JunctionPointT const & cross, IRoadGraph::Mode mode, EdgeListT & edges)
|
||||
: ICrossEdgesLoader(cross, mode, edges)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
private:
|
||||
// ICrossEdgesLoader overrides:
|
||||
void LoadEdges(FeatureID const & featureId, PointWithAltitudeVec const & junctions,
|
||||
bool bidirectional) override;
|
||||
void LoadEdges(FeatureID const & featureId, PointWithAltitudeVec const & junctions, bool bidirectional) override;
|
||||
};
|
||||
|
||||
void GetOutgoingEdges(JunctionPointT const & junction,
|
||||
EdgeListT & edges) const override;
|
||||
void GetOutgoingEdges(JunctionPointT const & junction, EdgeListT & edges) const override;
|
||||
|
||||
void GetIngoingEdges(JunctionPointT const & junction,
|
||||
EdgeListT & edges) const override;
|
||||
void GetIngoingEdges(JunctionPointT const & junction, EdgeListT & edges) const override;
|
||||
|
||||
/// Removes all fake turns and vertices from the graph.
|
||||
void ResetFakes();
|
||||
|
||||
/// Adds fake edges from fake position rp to real vicinity
|
||||
/// positions.
|
||||
void AddFakeEdges(JunctionPointT const & junction,
|
||||
std::vector<std::pair<Edge, JunctionPointT>> const & vicinities);
|
||||
void AddFakeEdges(JunctionPointT const & junction, std::vector<std::pair<Edge, JunctionPointT>> const & vicinities);
|
||||
void AddOutgoingFakeEdge(Edge const & e);
|
||||
void AddIngoingFakeEdge(Edge const & e);
|
||||
|
||||
/// Calls edgesLoader on each feature which is close to cross.
|
||||
virtual void ForEachFeatureClosestToCross(m2::PointD const & cross,
|
||||
ICrossEdgesLoader & edgesLoader) const = 0;
|
||||
virtual void ForEachFeatureClosestToCross(m2::PointD const & cross, ICrossEdgesLoader & edgesLoader) const = 0;
|
||||
|
||||
/// Finds the closest edges to the center of |rect|.
|
||||
/// @return Array of pairs of Edge and projection point on the Edge. If there is no the closest edges
|
||||
/// then returns empty array.
|
||||
using EdgeProjectionT = std::pair<Edge, JunctionPointT>;
|
||||
virtual void FindClosestEdges(m2::RectD const & /*rect*/, uint32_t /*count*/,
|
||||
std::vector<EdgeProjectionT> & /*vicinities*/) const {};
|
||||
std::vector<EdgeProjectionT> & /*vicinities*/) const
|
||||
{}
|
||||
|
||||
/// \returns Vector of pairs FeatureID and corresponding RoadInfo for road features
|
||||
/// lying in |rect|.
|
||||
/// \note |RoadInfo::m_speedKMPH| is set to |kInvalidSpeedKMPH|.
|
||||
virtual std::vector<FullRoadInfo> FindRoads(
|
||||
m2::RectD const & /*rect*/, IsGoodFeatureFn const & /*isGoodFeature*/) const { return {}; }
|
||||
virtual std::vector<FullRoadInfo> FindRoads(m2::RectD const & /*rect*/,
|
||||
IsGoodFeatureFn const & /*isGoodFeature*/) const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
/// @return Types for the specified feature
|
||||
virtual void GetFeatureTypes(FeatureID const & featureId, feature::TypesHolder & types) const = 0;
|
||||
@@ -309,11 +287,9 @@ public:
|
||||
virtual void ClearState() {}
|
||||
|
||||
/// \brief Finds all outgoing regular (non-fake) edges for junction.
|
||||
void GetRegularOutgoingEdges(JunctionPointT const & junction,
|
||||
EdgeListT & edges) const;
|
||||
void GetRegularOutgoingEdges(JunctionPointT const & junction, EdgeListT & edges) const;
|
||||
/// \brief Finds all ingoing regular (non-fake) edges for junction.
|
||||
void GetRegularIngoingEdges(JunctionPointT const & junction,
|
||||
EdgeListT & edges) const;
|
||||
void GetRegularIngoingEdges(JunctionPointT const & junction, EdgeListT & edges) const;
|
||||
/// \brief Finds all outgoing fake edges for junction.
|
||||
void GetFakeOutgoingEdges(JunctionPointT const & junction, EdgeListT & edges) const;
|
||||
/// \brief Finds all ingoing fake edges for junction.
|
||||
@@ -327,16 +303,12 @@ private:
|
||||
void ForEachFakeEdge(Fn && fn)
|
||||
{
|
||||
for (auto const & m : m_fakeIngoingEdges)
|
||||
{
|
||||
for (auto const & e : m.second)
|
||||
fn(e);
|
||||
}
|
||||
|
||||
for (auto const & m : m_fakeOutgoingEdges)
|
||||
{
|
||||
for (auto const & e : m.second)
|
||||
fn(e);
|
||||
}
|
||||
}
|
||||
|
||||
/// \note |m_fakeIngoingEdges| and |m_fakeOutgoingEdges| map junctions to sorted vectors.
|
||||
|
||||
Reference in New Issue
Block a user