Clang-format

This commit is contained in:
Lev Dragunov 2015-05-19 16:37:31 +03:00 committed by Alex Zolotarev
parent 6f3b289bd1
commit 48b314b864
4 changed files with 52 additions and 58 deletions

View file

@ -11,16 +11,14 @@
namespace routing
{
bool IsRouteExist(InternalRouteResult const & r)
{
return !(INVALID_EDGE_WEIGHT == r.shortest_path_length ||
r.segment_end_coordinates.empty() ||
r.source_traversed_in_reverse.empty());
return !(INVALID_EDGE_WEIGHT == r.shortest_path_length || r.segment_end_coordinates.empty() ||
r.source_traversed_in_reverse.empty());
}
void GenerateRoutingTaskFromNodeId(NodeID const nodeId, bool const isStartNode,
PhantomNode & taskNode)
PhantomNode & taskNode)
{
taskNode.forward_node_id = isStartNode ? nodeId : INVALID_NODE_ID;
taskNode.reverse_node_id = isStartNode ? INVALID_NODE_ID : nodeId;
@ -31,7 +29,8 @@ void GenerateRoutingTaskFromNodeId(NodeID const nodeId, bool const isStartNode,
taskNode.name_id = 1;
}
void FindWeightsMatrix(const RoutingNodesT &sources, const RoutingNodesT &targets, RawDataFacadeT &facade, vector<EdgeWeight> &result)
void FindWeightsMatrix(const RoutingNodesT & sources, const RoutingNodesT & targets,
RawDataFacadeT & facade, vector<EdgeWeight> & result)
{
SearchEngineData engineData;
NMManyToManyRouting<RawDataFacadeT> pathFinder(&facade, engineData);
@ -51,7 +50,8 @@ void FindWeightsMatrix(const RoutingNodesT &sources, const RoutingNodesT &target
result.swap(*resultTable);
}
bool FindSingleRoute(const FeatureGraphNode &source, const FeatureGraphNode &target, RawDataFacadeT &facade, RawRoutingResult &rawRoutingResult)
bool FindSingleRoute(const FeatureGraphNode & source, const FeatureGraphNode & target,
RawDataFacadeT & facade, RawRoutingResult & rawRoutingResult)
{
SearchEngineData engineData;
InternalRouteResult result;
@ -74,7 +74,7 @@ bool FindSingleRoute(const FeatureGraphNode &source, const FeatureGraphNode &tar
rawRoutingResult.m_sourceEdge = source;
rawRoutingResult.m_targetEdge = target;
rawRoutingResult.m_shortestPathLength = result.shortest_path_length;
for (auto const & path: result.unpacked_path_segments)
for (auto const & path : result.unpacked_path_segments)
{
vector<RawPathData> data;
data.reserve(path.size());
@ -116,4 +116,4 @@ FeatureGraphNode::FeatureGraphNode()
m_segPt = m2::PointD::Zero();
}
} // namespace routing
} // namespace routing

View file

@ -11,7 +11,6 @@
namespace routing
{
/// Single graph node representation for routing task
struct FeatureGraphNode
{
@ -19,12 +18,12 @@ struct FeatureGraphNode
OsrmMappingTypes::FtSeg m_seg;
m2::PointD m_segPt;
/*!
* \brief GenerateRoutingTaskFromNodeId fill taskNode with values for making route
* \param nodeId osrm node idetifier
* \param isStartNode true if this node will first in the path
* \param taskNode output point task for router
*/
/*!
* \brief GenerateRoutingTaskFromNodeId fill taskNode with values for making route
* \param nodeId osrm node idetifier
* \param isStartNode true if this node will first in the path
* \param taskNode output point task for router
*/
FeatureGraphNode(NodeID const nodeId, bool const isStartNode);
/// \brief Invalid graph node constructor
@ -37,22 +36,19 @@ struct FeatureGraphNode
*/
struct RawPathData
{
RawPathData()
: node(SPECIAL_NODEID), segment_duration(INVALID_EDGE_WEIGHT)
{
}
RawPathData() : node(SPECIAL_NODEID), segment_duration(INVALID_EDGE_WEIGHT) {}
RawPathData(NodeID node,
EdgeWeight segment_duration)
: node(node), segment_duration(segment_duration)
{
}
NodeID node;
EdgeWeight segment_duration;
RawPathData(NodeID node, EdgeWeight segment_duration)
: node(node), segment_duration(segment_duration)
{
}
NodeID node;
EdgeWeight segment_duration;
};
/*!
* \brief The OSRM routing result struct. Contains the routing result, it's cost and source and target edges.
* \brief The OSRM routing result struct. Contains the routing result, it's cost and source and
* target edges.
* \property m_shortestPathLength Length of a founded route.
* \property m_unpackedPathSegments Segments of a founded route.
* \property sourceEdge Source graph node of a route.
@ -70,17 +66,20 @@ struct RawRoutingResult
using RoutingNodesT = vector<FeatureGraphNode>;
using RawDataFacadeT = OsrmRawDataFacade<QueryEdge::EdgeData>;
/*!
* \brief FindWeightsMatrix Find weights matrix from sources to targets. WARNING it finds only weights, not pathes.
* \param sources Sources graph nodes vector. Each source is the representation of a start OSRM node.
* \param targets Targets graph nodes vector. Each target is the representation of a finish OSRM node.
* \brief FindWeightsMatrix Find weights matrix from sources to targets. WARNING it finds only
* weights, not pathes.
* \param sources Sources graph nodes vector. Each source is the representation of a start OSRM
* node.
* \param targets Targets graph nodes vector. Each target is the representation of a finish OSRM
* node.
* \param facade Osrm data facade reference.
* \param packed Result vector with weights. Source nodes are rows.
* cost(source1 -> target1) cost(source1 -> target2) cost(source2 -> target1) cost(source2 -> target2)
* cost(source1 -> target1) cost(source1 -> target2) cost(source2 -> target1) cost(source2 ->
* target2)
*/
void FindWeightsMatrix(RoutingNodesT const & sources, RoutingNodesT const & targets,
RawDataFacadeT & facade, vector<EdgeWeight> & result);
RawDataFacadeT & facade, vector<EdgeWeight> & result);
/*! Find single shortest path in a single MWM between 2 OSRM nodes
* \param source Source OSRM graph node to make path.
@ -89,7 +88,7 @@ void FindWeightsMatrix(RoutingNodesT const & sources, RoutingNodesT const & targ
* \param rawRoutingResult Routing result structure.
* \return true when path exists, false otherwise.
*/
bool FindSingleRoute(FeatureGraphNode const & source, FeatureGraphNode const & target, RawDataFacadeT & facade,
RawRoutingResult & rawRoutingResult);
bool FindSingleRoute(FeatureGraphNode const & source, FeatureGraphNode const & target,
RawDataFacadeT & facade, RawRoutingResult & rawRoutingResult);
} // namespace routing
} // namespace routing

View file

@ -27,10 +27,8 @@
#include "3party/osrm/osrm-backend/data_structures/query_edge.hpp"
#include "3party/osrm/osrm-backend/data_structures/internal_route_result.hpp"
#include "3party/osrm/osrm-backend/descriptors/description_factory.hpp"
#define INTERRUPT_WHEN_CANCELLED() \
do \
{ \
@ -49,8 +47,6 @@ double const FEATURES_NEAR_TURN_M = 3.0;
// TODO (ldragunov) Switch all RawRouteData and incapsulate to own omim types.
using RawRouteData = InternalRouteResult;
namespace
{
class AbsentCountryChecker
@ -425,8 +421,9 @@ void OsrmRouter::ClearState()
m_indexManager.Clear();
}
bool OsrmRouter::FindRouteFromCases(FeatureGraphNodeVecT const & source, FeatureGraphNodeVecT const & target, DataFacadeT & facade,
RawRoutingResult & rawRoutingResult)
bool OsrmRouter::FindRouteFromCases(FeatureGraphNodeVecT const & source,
FeatureGraphNodeVecT const & target, DataFacadeT & facade,
RawRoutingResult & rawRoutingResult)
{
/// @todo (ldargunov) make more complex nearest edge turnaround
for (auto targetEdge = target.cbegin(); targetEdge != target.cend(); ++targetEdge)
@ -479,7 +476,8 @@ OsrmRouter::ResultCode OsrmRouter::MakeRouteFromCrossesPath(CheckedPathT const &
ASSERT(mwmMapping->IsValid(), ());
MappingGuard mwmMappingGuard(mwmMapping);
UNUSED_VALUE(mwmMappingGuard);
if (!FindSingleRoute(cross.startNode, cross.targetNode, mwmMapping->m_dataFacade, routingResult))
if (!FindSingleRoute(cross.startNode, cross.targetNode, mwmMapping->m_dataFacade,
routingResult))
{
return OsrmRouter::RouteNotFound;
}
@ -666,7 +664,8 @@ OsrmRouter::ResultCode OsrmRouter::CalculateRoute(m2::PointD const & startPoint,
{
indexPair.second->FreeCrossContext();
});
if (!FindRouteFromCases(startTask, m_CachedTargetTask, startMapping->m_dataFacade, routingResult))
if (!FindRouteFromCases(startTask, m_CachedTargetTask, startMapping->m_dataFacade,
routingResult))
{
return RouteNotFound;
}
@ -992,14 +991,12 @@ OsrmRouter::ResultCode OsrmRouter::MakeTurnAnnotation(RawRoutingResult const & r
t.m_index = points.size() - 1;
GetTurnDirection(routingResult.unpacked_path_segments[i][j - 1],
routingResult.unpacked_path_segments[i][j],
mapping, t);
routingResult.unpacked_path_segments[i][j], mapping, t);
if (t.m_turn != turns::TurnDirection::NoTurn)
{
// adding lane info
t.m_lanes =
turns::GetLanesInfo(routingResult.unpacked_path_segments[i][j - 1].node,
*mapping, GetLastSegmentPointIndex, *m_pIndex);
t.m_lanes = turns::GetLanesInfo(routingResult.unpacked_path_segments[i][j - 1].node, *mapping,
GetLastSegmentPointIndex, *m_pIndex);
turnsDir.push_back(move(t));
}
@ -1251,8 +1248,7 @@ size_t OsrmRouter::NumberOfIngoingAndOutgoingSegments(m2::PointD const & junctio
}
// @todo(vbykoianko) Move this method and all dependencies to turns_generator.cpp
void OsrmRouter::GetTurnDirection(RawPathData const & node1,
RawPathData const & node2,
void OsrmRouter::GetTurnDirection(RawPathData const & node1, RawPathData const & node2,
RoutingMappingPtrT const & routingMapping, TurnItem & turn)
{
ASSERT(routingMapping.get(), ());

View file

@ -86,8 +86,9 @@ public:
* \param rawRoutingResult: routing result store
* \return true when path exists, false otherwise.
*/
static bool FindRouteFromCases(FeatureGraphNodeVecT const & source, FeatureGraphNodeVecT const & target, DataFacadeT & facade,
RawRoutingResult & rawRoutingResult);
static bool FindRouteFromCases(FeatureGraphNodeVecT const & source,
FeatureGraphNodeVecT const & target, DataFacadeT & facade,
RawRoutingResult & rawRoutingResult);
protected:
IRouter::ResultCode FindPhantomNodes(string const & fName, m2::PointD const & point,
@ -154,10 +155,8 @@ private:
void GetPossibleTurns(NodeID node, m2::PointD const & p1, m2::PointD const & p,
RoutingMappingPtrT const & routingMapping,
turns::TTurnCandidates & candidates);
void GetTurnDirection(RawPathData const & node1,
RawPathData const & node2,
RoutingMappingPtrT const & routingMapping,
TurnItem & turn);
void GetTurnDirection(RawPathData const & node1, RawPathData const & node2,
RoutingMappingPtrT const & routingMapping, TurnItem & turn);
m2::PointD GetPointForTurnAngle(OsrmMappingTypes::FtSeg const & seg,
FeatureType const & ft, m2::PointD const & turnPnt,
size_t (*GetPndInd)(const size_t, const size_t, const size_t)) const;