Apply clang-format
This commit is contained in:
@@ -162,9 +162,10 @@ class BinaryHeap
|
||||
return inserted_nodes[heap[1].index].node;
|
||||
}
|
||||
|
||||
Weight MinKey() const {
|
||||
BOOST_ASSERT(heap.size() > 1);
|
||||
return heap[1].weight;
|
||||
Weight MinKey() const
|
||||
{
|
||||
BOOST_ASSERT(heap.size() > 1);
|
||||
return heap[1].weight;
|
||||
}
|
||||
|
||||
NodeID DeleteMin()
|
||||
|
||||
@@ -8,48 +8,47 @@ struct FixedPointCoordinate;
|
||||
|
||||
namespace coordinate_calculation
|
||||
{
|
||||
double
|
||||
haversine_distance(const int lat1, const int lon1, const int lat2, const int lon2);
|
||||
double haversine_distance(const int lat1, const int lon1, const int lat2, const int lon2);
|
||||
|
||||
double haversine_distance(const FixedPointCoordinate &first_coordinate,
|
||||
const FixedPointCoordinate &second_coordinate);
|
||||
double haversine_distance(const FixedPointCoordinate &first_coordinate,
|
||||
const FixedPointCoordinate &second_coordinate);
|
||||
|
||||
double great_circle_distance(const FixedPointCoordinate &first_coordinate,
|
||||
double great_circle_distance(const FixedPointCoordinate &first_coordinate,
|
||||
const FixedPointCoordinate &second_coordinate);
|
||||
|
||||
double great_circle_distance(const int lat1, const int lon1, const int lat2, const int lon2);
|
||||
double great_circle_distance(const int lat1, const int lon1, const int lat2, const int lon2);
|
||||
|
||||
void lat_or_lon_to_string(const int value, std::string &output);
|
||||
void lat_or_lon_to_string(const int value, std::string &output);
|
||||
|
||||
double perpendicular_distance(const FixedPointCoordinate &segment_source,
|
||||
const FixedPointCoordinate &segment_target,
|
||||
const FixedPointCoordinate &query_location);
|
||||
double perpendicular_distance(const FixedPointCoordinate &segment_source,
|
||||
const FixedPointCoordinate &segment_target,
|
||||
const FixedPointCoordinate &query_location);
|
||||
|
||||
double perpendicular_distance(const FixedPointCoordinate &segment_source,
|
||||
const FixedPointCoordinate &segment_target,
|
||||
const FixedPointCoordinate &query_location,
|
||||
FixedPointCoordinate &nearest_location,
|
||||
double &ratio);
|
||||
double perpendicular_distance(const FixedPointCoordinate &segment_source,
|
||||
const FixedPointCoordinate &segment_target,
|
||||
const FixedPointCoordinate &query_location,
|
||||
FixedPointCoordinate &nearest_location,
|
||||
double &ratio);
|
||||
|
||||
double perpendicular_distance_from_projected_coordinate(
|
||||
const FixedPointCoordinate &segment_source,
|
||||
const FixedPointCoordinate &segment_target,
|
||||
const FixedPointCoordinate &query_location,
|
||||
const std::pair<double, double> &projected_coordinate);
|
||||
double perpendicular_distance_from_projected_coordinate(
|
||||
const FixedPointCoordinate &segment_source,
|
||||
const FixedPointCoordinate &segment_target,
|
||||
const FixedPointCoordinate &query_location,
|
||||
const std::pair<double, double> &projected_coordinate);
|
||||
|
||||
double perpendicular_distance_from_projected_coordinate(
|
||||
const FixedPointCoordinate &segment_source,
|
||||
const FixedPointCoordinate &segment_target,
|
||||
const FixedPointCoordinate &query_location,
|
||||
const std::pair<double, double> &projected_coordinate,
|
||||
FixedPointCoordinate &nearest_location,
|
||||
double &ratio);
|
||||
double perpendicular_distance_from_projected_coordinate(
|
||||
const FixedPointCoordinate &segment_source,
|
||||
const FixedPointCoordinate &segment_target,
|
||||
const FixedPointCoordinate &query_location,
|
||||
const std::pair<double, double> &projected_coordinate,
|
||||
FixedPointCoordinate &nearest_location,
|
||||
double &ratio);
|
||||
|
||||
double deg_to_rad(const double degree);
|
||||
double rad_to_deg(const double radian);
|
||||
double deg_to_rad(const double degree);
|
||||
double rad_to_deg(const double radian);
|
||||
|
||||
double bearing(const FixedPointCoordinate &first_coordinate,
|
||||
const FixedPointCoordinate &second_coordinate);
|
||||
double bearing(const FixedPointCoordinate &first_coordinate,
|
||||
const FixedPointCoordinate &second_coordinate);
|
||||
}
|
||||
|
||||
#endif // COORDINATE_CALCULATION
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
#include <unordered_map>
|
||||
|
||||
// generate boost::program_options object for the routing part
|
||||
bool GenerateDataStoreOptions(const int argc, const char *argv[], std::unordered_map<std::string, boost::filesystem::path> &paths)
|
||||
bool GenerateDataStoreOptions(const int argc,
|
||||
const char *argv[],
|
||||
std::unordered_map<std::string, boost::filesystem::path> &paths)
|
||||
{
|
||||
// declare a group of options that will be allowed only on command line
|
||||
boost::program_options::options_description generic_options("Options");
|
||||
|
||||
@@ -20,14 +20,15 @@ template <typename ElementT> struct ConstDeallocatingVectorIteratorState
|
||||
{
|
||||
}
|
||||
explicit ConstDeallocatingVectorIteratorState(const std::size_t idx,
|
||||
const std::vector<ElementT *> *input_list)
|
||||
const std::vector<ElementT *> *input_list)
|
||||
: index(idx), bucket_list(input_list)
|
||||
{
|
||||
}
|
||||
std::size_t index;
|
||||
const std::vector<ElementT *> *bucket_list;
|
||||
|
||||
ConstDeallocatingVectorIteratorState &operator=(const ConstDeallocatingVectorIteratorState &other)
|
||||
ConstDeallocatingVectorIteratorState &
|
||||
operator=(const ConstDeallocatingVectorIteratorState &other)
|
||||
{
|
||||
index = other.index;
|
||||
bucket_list = other.bucket_list;
|
||||
@@ -210,11 +211,10 @@ class DeallocatingVectorRemoveIterator
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ElementT, std::size_t ELEMENTS_PER_BLOCK>
|
||||
class DeallocatingVector;
|
||||
template <typename ElementT, std::size_t ELEMENTS_PER_BLOCK> class DeallocatingVector;
|
||||
|
||||
template<typename T, std::size_t S>
|
||||
void swap(DeallocatingVector<T, S>& lhs, DeallocatingVector<T, S>& rhs);
|
||||
template <typename T, std::size_t S>
|
||||
void swap(DeallocatingVector<T, S> &lhs, DeallocatingVector<T, S> &rhs);
|
||||
|
||||
template <typename ElementT, std::size_t ELEMENTS_PER_BLOCK = 8388608 / sizeof(ElementT)>
|
||||
class DeallocatingVector
|
||||
@@ -236,7 +236,8 @@ class DeallocatingVector
|
||||
|
||||
~DeallocatingVector() { clear(); }
|
||||
|
||||
friend void swap<>(DeallocatingVector<ElementT, ELEMENTS_PER_BLOCK>& lhs, DeallocatingVector<ElementT, ELEMENTS_PER_BLOCK>& rhs);
|
||||
friend void swap<>(DeallocatingVector<ElementT, ELEMENTS_PER_BLOCK> &lhs,
|
||||
DeallocatingVector<ElementT, ELEMENTS_PER_BLOCK> &rhs);
|
||||
|
||||
void swap(DeallocatingVector<ElementT, ELEMENTS_PER_BLOCK> &other)
|
||||
{
|
||||
@@ -367,8 +368,8 @@ class DeallocatingVector
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, std::size_t S>
|
||||
void swap(DeallocatingVector<T, S>& lhs, DeallocatingVector<T, S>& rhs)
|
||||
template <typename T, std::size_t S>
|
||||
void swap(DeallocatingVector<T, S> &lhs, DeallocatingVector<T, S> &rhs)
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
@@ -7,18 +7,32 @@
|
||||
#ifndef DEBUG_GEOMETRY
|
||||
|
||||
inline void DEBUG_GEOMETRY_START(ContractorConfig & /* config */) {}
|
||||
inline void DEBUG_GEOMETRY_EDGE(int /* new_segment_weight */ , double /* segment_length */,
|
||||
OSMNodeID /* previous_osm_node_id */, OSMNodeID /* this_osm_node_id */) {}
|
||||
inline void DEBUG_GEOMETRY_EDGE(int /* new_segment_weight */,
|
||||
double /* segment_length */,
|
||||
OSMNodeID /* previous_osm_node_id */,
|
||||
OSMNodeID /* this_osm_node_id */)
|
||||
{
|
||||
}
|
||||
inline void DEBUG_GEOMETRY_STOP() {}
|
||||
|
||||
inline void DEBUG_TURNS_START(const std::string & /* debug_turns_filename */) {}
|
||||
inline void DEBUG_TURN( const NodeID /* node */, const std::vector<QueryNode>& /* m_node_info_list */,
|
||||
const FixedPointCoordinate & /* first_coordinate */, const int /* turn_angle */,
|
||||
const int /* turn_penalty */) {}
|
||||
inline void DEBUG_UTURN( const NodeID /* node */, const std::vector<QueryNode>& /* m_node_info_list */,
|
||||
const int /* uturn_penalty */ ) {}
|
||||
inline void DEBUG_SIGNAL( const NodeID /* node */, const std::vector<QueryNode>& /* m_node_info_list */,
|
||||
const int /* signal_penalty */ ) {}
|
||||
inline void DEBUG_TURN(const NodeID /* node */,
|
||||
const std::vector<QueryNode> & /* m_node_info_list */,
|
||||
const FixedPointCoordinate & /* first_coordinate */,
|
||||
const int /* turn_angle */,
|
||||
const int /* turn_penalty */)
|
||||
{
|
||||
}
|
||||
inline void DEBUG_UTURN(const NodeID /* node */,
|
||||
const std::vector<QueryNode> & /* m_node_info_list */,
|
||||
const int /* uturn_penalty */)
|
||||
{
|
||||
}
|
||||
inline void DEBUG_SIGNAL(const NodeID /* node */,
|
||||
const std::vector<QueryNode> & /* m_node_info_list */,
|
||||
const int /* signal_penalty */)
|
||||
{
|
||||
}
|
||||
|
||||
inline void DEBUG_TURNS_STOP() {}
|
||||
|
||||
@@ -59,26 +73,27 @@ inline void DEBUG_GEOMETRY_START(const ContractorConfig &config)
|
||||
}
|
||||
}
|
||||
|
||||
inline void DEBUG_GEOMETRY_EDGE(int new_segment_weight, double segment_length, OSMNodeID previous_osm_node_id, OSMNodeID this_osm_node_id)
|
||||
inline void DEBUG_GEOMETRY_EDGE(int new_segment_weight,
|
||||
double segment_length,
|
||||
OSMNodeID previous_osm_node_id,
|
||||
OSMNodeID this_osm_node_id)
|
||||
{
|
||||
if (dg_output_debug_geometry)
|
||||
{
|
||||
if (!dg_first_debug_geometry)
|
||||
debug_geometry_file << "," << std::endl;
|
||||
debug_geometry_file
|
||||
<< "{ \"type\":\"Feature\",\"properties\":{\"original\":false, "
|
||||
"\"weight\":"
|
||||
<< new_segment_weight / 10.0 << ",\"speed\":"
|
||||
<< static_cast<int>(
|
||||
std::floor((segment_length / new_segment_weight) * 10. * 3.6))
|
||||
<< ",";
|
||||
debug_geometry_file << "{ \"type\":\"Feature\",\"properties\":{\"original\":false, "
|
||||
"\"weight\":"
|
||||
<< new_segment_weight / 10.0 << ",\"speed\":"
|
||||
<< static_cast<int>(
|
||||
std::floor((segment_length / new_segment_weight) * 10. * 3.6))
|
||||
<< ",";
|
||||
debug_geometry_file << "\"from_node\": " << previous_osm_node_id
|
||||
<< ", \"to_node\": " << this_osm_node_id << ",";
|
||||
debug_geometry_file << "\"timestamp\": \"" << dg_time_buffer << "\"},";
|
||||
debug_geometry_file
|
||||
<< "\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[!!"
|
||||
<< previous_osm_node_id << "!!],[!!" << this_osm_node_id << "!!]]}}"
|
||||
<< std::endl;
|
||||
debug_geometry_file << "\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[!!"
|
||||
<< previous_osm_node_id << "!!],[!!" << this_osm_node_id << "!!]]}}"
|
||||
<< std::endl;
|
||||
dg_first_debug_geometry = false;
|
||||
}
|
||||
}
|
||||
@@ -92,66 +107,80 @@ inline void DEBUG_GEOMETRY_STOP()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void DEBUG_TURNS_START(const std::string & debug_turns_path)
|
||||
{
|
||||
inline void DEBUG_TURNS_START(const std::string &debug_turns_path)
|
||||
{
|
||||
dg_output_turn_debug = debug_turns_path != "";
|
||||
if (dg_output_turn_debug)
|
||||
if (dg_output_turn_debug)
|
||||
{
|
||||
dg_debug_turns_file.open(debug_turns_path);
|
||||
dg_debug_turns_file << "{\"type\":\"FeatureCollection\", \"features\":[" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void DEBUG_SIGNAL(
|
||||
const NodeID node,
|
||||
const std::vector<QueryNode>& m_node_info_list,
|
||||
const int traffic_signal_penalty)
|
||||
inline void DEBUG_SIGNAL(const NodeID node,
|
||||
const std::vector<QueryNode> &m_node_info_list,
|
||||
const int traffic_signal_penalty)
|
||||
{
|
||||
if (dg_output_turn_debug)
|
||||
{
|
||||
const QueryNode &nodeinfo = m_node_info_list[node];
|
||||
if (!dg_first_turn_debug) dg_debug_turns_file << "," << std::endl;
|
||||
dg_debug_turns_file << "{ \"type\":\"Feature\",\"properties\":{\"type\":\"trafficlights\",\"cost\":" << traffic_signal_penalty/10. << "},";
|
||||
dg_debug_turns_file << " \"geometry\":{\"type\":\"Point\",\"coordinates\":[" << std::setprecision(12) << nodeinfo.lon/COORDINATE_PRECISION << "," << nodeinfo.lat/COORDINATE_PRECISION << "]}}";
|
||||
if (!dg_first_turn_debug)
|
||||
dg_debug_turns_file << "," << std::endl;
|
||||
dg_debug_turns_file
|
||||
<< "{ \"type\":\"Feature\",\"properties\":{\"type\":\"trafficlights\",\"cost\":"
|
||||
<< traffic_signal_penalty / 10. << "},";
|
||||
dg_debug_turns_file << " \"geometry\":{\"type\":\"Point\",\"coordinates\":["
|
||||
<< std::setprecision(12) << nodeinfo.lon / COORDINATE_PRECISION << ","
|
||||
<< nodeinfo.lat / COORDINATE_PRECISION << "]}}";
|
||||
dg_first_turn_debug = false;
|
||||
}
|
||||
}
|
||||
|
||||
inline void DEBUG_UTURN(
|
||||
const NodeID node,
|
||||
const std::vector<QueryNode>& m_node_info_list,
|
||||
const int traffic_signal_penalty)
|
||||
inline void DEBUG_UTURN(const NodeID node,
|
||||
const std::vector<QueryNode> &m_node_info_list,
|
||||
const int traffic_signal_penalty)
|
||||
{
|
||||
if (dg_output_turn_debug)
|
||||
{
|
||||
const QueryNode &nodeinfo = m_node_info_list[node];
|
||||
if (!dg_first_turn_debug) dg_debug_turns_file << "," << std::endl;
|
||||
dg_debug_turns_file << "{ \"type\":\"Feature\",\"properties\":{\"type\":\"trafficlights\",\"cost\":" << traffic_signal_penalty/10. << "},";
|
||||
dg_debug_turns_file << " \"geometry\":{\"type\":\"Point\",\"coordinates\":[" << std::setprecision(12) << nodeinfo.lon/COORDINATE_PRECISION << "," << nodeinfo.lat/COORDINATE_PRECISION << "]}}";
|
||||
if (!dg_first_turn_debug)
|
||||
dg_debug_turns_file << "," << std::endl;
|
||||
dg_debug_turns_file
|
||||
<< "{ \"type\":\"Feature\",\"properties\":{\"type\":\"trafficlights\",\"cost\":"
|
||||
<< traffic_signal_penalty / 10. << "},";
|
||||
dg_debug_turns_file << " \"geometry\":{\"type\":\"Point\",\"coordinates\":["
|
||||
<< std::setprecision(12) << nodeinfo.lon / COORDINATE_PRECISION << ","
|
||||
<< nodeinfo.lat / COORDINATE_PRECISION << "]}}";
|
||||
dg_first_turn_debug = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void DEBUG_TURN(
|
||||
const NodeID node,
|
||||
const std::vector<QueryNode>& m_node_info_list,
|
||||
const FixedPointCoordinate & first_coordinate,
|
||||
const int turn_angle,
|
||||
const int turn_penalty)
|
||||
inline void DEBUG_TURN(const NodeID node,
|
||||
const std::vector<QueryNode> &m_node_info_list,
|
||||
const FixedPointCoordinate &first_coordinate,
|
||||
const int turn_angle,
|
||||
const int turn_penalty)
|
||||
{
|
||||
if (turn_penalty > 0 && dg_output_turn_debug)
|
||||
if (turn_penalty > 0 && dg_output_turn_debug)
|
||||
{
|
||||
const QueryNode &v = m_node_info_list[node];
|
||||
|
||||
const float bearing_uv = coordinate_calculation::bearing(first_coordinate,v);
|
||||
float uvw_normal = bearing_uv + turn_angle/2;
|
||||
while (uvw_normal >= 360.) { uvw_normal -= 360.; }
|
||||
const float bearing_uv = coordinate_calculation::bearing(first_coordinate, v);
|
||||
float uvw_normal = bearing_uv + turn_angle / 2;
|
||||
while (uvw_normal >= 360.)
|
||||
{
|
||||
uvw_normal -= 360.;
|
||||
}
|
||||
|
||||
if (!dg_first_turn_debug) dg_debug_turns_file << "," << std::endl;
|
||||
dg_debug_turns_file << "{ \"type\":\"Feature\",\"properties\":{\"type\":\"turn\",\"cost\":" << turn_penalty/10. << ",\"turn_angle\":" << static_cast<int>(turn_angle) << ",\"normal\":" << static_cast<int>(uvw_normal) << "},";
|
||||
dg_debug_turns_file << " \"geometry\":{\"type\":\"Point\",\"coordinates\":[" << std::setprecision(12) << v.lon/COORDINATE_PRECISION << "," << v.lat/COORDINATE_PRECISION << "]}}";
|
||||
if (!dg_first_turn_debug)
|
||||
dg_debug_turns_file << "," << std::endl;
|
||||
dg_debug_turns_file << "{ \"type\":\"Feature\",\"properties\":{\"type\":\"turn\",\"cost\":"
|
||||
<< turn_penalty / 10.
|
||||
<< ",\"turn_angle\":" << static_cast<int>(turn_angle)
|
||||
<< ",\"normal\":" << static_cast<int>(uvw_normal) << "},";
|
||||
dg_debug_turns_file << " \"geometry\":{\"type\":\"Point\",\"coordinates\":["
|
||||
<< std::setprecision(12) << v.lon / COORDINATE_PRECISION << ","
|
||||
<< v.lat / COORDINATE_PRECISION << "]}}";
|
||||
dg_first_turn_debug = false;
|
||||
}
|
||||
}
|
||||
@@ -167,5 +196,4 @@ inline void DEBUG_TURNS_STOP()
|
||||
|
||||
#endif // DEBUG_GEOMETRY
|
||||
|
||||
|
||||
#endif // DEBUG_GEOMETRY_H
|
||||
|
||||
@@ -64,7 +64,8 @@ template <typename EdgeDataT> class DynamicGraph
|
||||
template <class ContainerT> DynamicGraph(const NodeIterator nodes, const ContainerT &graph)
|
||||
{
|
||||
// we need to cast here because DeallocatingVector does not have a valid const iterator
|
||||
BOOST_ASSERT(std::is_sorted(const_cast<ContainerT&>(graph).begin(), const_cast<ContainerT&>(graph).end()));
|
||||
BOOST_ASSERT(std::is_sorted(const_cast<ContainerT &>(graph).begin(),
|
||||
const_cast<ContainerT &>(graph).end()));
|
||||
|
||||
number_of_nodes = nodes;
|
||||
number_of_edges = static_cast<EdgeIterator>(graph.size());
|
||||
|
||||
@@ -25,10 +25,8 @@ class FingerPrint
|
||||
|
||||
// initialize to {6ba7b810-9dad-11d1-80b4-00c04fd430c8}
|
||||
boost::uuids::uuid named_uuid;
|
||||
|
||||
};
|
||||
|
||||
static_assert(std::is_trivial<FingerPrint>::value, "FingerPrint needs to be trivial.");
|
||||
|
||||
|
||||
#endif /* FingerPrint_H */
|
||||
|
||||
@@ -7,20 +7,20 @@
|
||||
#include <vector>
|
||||
|
||||
/// This function checks if the graph (consisting of directed edges) is undirected
|
||||
template<typename GraphT>
|
||||
bool isUndirectedGraph(const GraphT& graph)
|
||||
template <typename GraphT> bool isUndirectedGraph(const GraphT &graph)
|
||||
{
|
||||
for (auto source = 0u; source < graph.GetNumberOfNodes(); ++source)
|
||||
{
|
||||
for (auto edge = graph.BeginEdges(source); edge < graph.EndEdges(source); ++edge)
|
||||
{
|
||||
const auto& data = graph.GetEdgeData(edge);
|
||||
const auto &data = graph.GetEdgeData(edge);
|
||||
|
||||
auto target = graph.GetTarget(edge);
|
||||
BOOST_ASSERT(target != SPECIAL_NODEID);
|
||||
|
||||
bool found_reverse = false;
|
||||
for (auto rev_edge = graph.BeginEdges(target); rev_edge < graph.EndEdges(target); ++rev_edge)
|
||||
for (auto rev_edge = graph.BeginEdges(target); rev_edge < graph.EndEdges(target);
|
||||
++rev_edge)
|
||||
{
|
||||
auto rev_target = graph.GetTarget(rev_edge);
|
||||
BOOST_ASSERT(rev_target != SPECIAL_NODEID);
|
||||
@@ -44,7 +44,6 @@ bool isUndirectedGraph(const GraphT& graph)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// Since DynamicGraph assumes directed edges we have to make sure we transformed
|
||||
/// the compressed edge format into single directed edges. We do this to make sure
|
||||
/// every node also knows its incoming edges, not only its outgoing edges and use the reversed=true
|
||||
@@ -60,13 +59,14 @@ bool isUndirectedGraph(const GraphT& graph)
|
||||
/// (a <-- b gets reducted to b --> a)
|
||||
/// 2. a --> b will be transformed to a --> b and b <-- a
|
||||
/// 3. a <-> b will be transformed to a --> b and b --> a
|
||||
template<typename OutputEdgeT, typename InputEdgeT, typename FunctorT>
|
||||
std::vector<OutputEdgeT> directedEdgesFromCompressed(const std::vector<InputEdgeT>& input_edge_list, FunctorT copy_data)
|
||||
template <typename OutputEdgeT, typename InputEdgeT, typename FunctorT>
|
||||
std::vector<OutputEdgeT> directedEdgesFromCompressed(const std::vector<InputEdgeT> &input_edge_list,
|
||||
FunctorT copy_data)
|
||||
{
|
||||
std::vector<OutputEdgeT> output_edge_list;
|
||||
|
||||
OutputEdgeT edge;
|
||||
for (const auto& input_edge : input_edge_list)
|
||||
for (const auto &input_edge : input_edge_list)
|
||||
{
|
||||
// edges that are not forward get converted by flipping the end points
|
||||
BOOST_ASSERT(input_edge.forward);
|
||||
|
||||
@@ -28,10 +28,7 @@ template <typename Integer> class range
|
||||
const range &end() const noexcept { return *this; }
|
||||
Integer front() const noexcept { return iter; }
|
||||
Integer back() const noexcept { return last - 1; }
|
||||
std::size_t size() const noexcept
|
||||
{
|
||||
return static_cast<std::size_t>(last - iter);
|
||||
}
|
||||
std::size_t size() const noexcept { return static_cast<std::size_t>(last - iter); }
|
||||
|
||||
// Iterator functions
|
||||
bool operator!=(const range &) const noexcept { return iter < last; }
|
||||
|
||||
@@ -20,7 +20,7 @@ class Logger
|
||||
using MapT = std::unordered_map<std::string, osrm::json::Value>;
|
||||
|
||||
public:
|
||||
static Logger* get()
|
||||
static Logger *get()
|
||||
{
|
||||
static Logger logger;
|
||||
|
||||
@@ -40,7 +40,7 @@ class Logger
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void initialize(const std::string& name)
|
||||
void initialize(const std::string &name)
|
||||
{
|
||||
if (!map.get())
|
||||
{
|
||||
@@ -49,15 +49,10 @@ class Logger
|
||||
(*map)[name] = Object();
|
||||
}
|
||||
|
||||
void render(const std::string& name, Object& obj) const
|
||||
{
|
||||
obj.values["debug"] = map->at(name);
|
||||
}
|
||||
void render(const std::string &name, Object &obj) const { obj.values["debug"] = map->at(name); }
|
||||
|
||||
boost::thread_specific_ptr<MapT> map;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,17 +13,22 @@ struct NodeBasedEdgeData
|
||||
{
|
||||
NodeBasedEdgeData()
|
||||
: distance(INVALID_EDGE_WEIGHT), edge_id(SPECIAL_NODEID),
|
||||
name_id(std::numeric_limits<unsigned>::max()), access_restricted(false),
|
||||
reversed(false), roundabout(false), travel_mode(TRAVEL_MODE_INACCESSIBLE)
|
||||
name_id(std::numeric_limits<unsigned>::max()), access_restricted(false), reversed(false),
|
||||
roundabout(false), travel_mode(TRAVEL_MODE_INACCESSIBLE)
|
||||
{
|
||||
}
|
||||
|
||||
NodeBasedEdgeData(int distance, unsigned edge_id, unsigned name_id,
|
||||
bool access_restricted, bool reversed,
|
||||
bool roundabout, bool startpoint, TravelMode travel_mode)
|
||||
NodeBasedEdgeData(int distance,
|
||||
unsigned edge_id,
|
||||
unsigned name_id,
|
||||
bool access_restricted,
|
||||
bool reversed,
|
||||
bool roundabout,
|
||||
bool startpoint,
|
||||
TravelMode travel_mode)
|
||||
: distance(distance), edge_id(edge_id), name_id(name_id),
|
||||
access_restricted(access_restricted), reversed(reversed),
|
||||
roundabout(roundabout), startpoint(startpoint), travel_mode(travel_mode)
|
||||
access_restricted(access_restricted), reversed(reversed), roundabout(roundabout),
|
||||
startpoint(startpoint), travel_mode(travel_mode)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -49,10 +54,12 @@ using NodeBasedDynamicGraph = DynamicGraph<NodeBasedEdgeData>;
|
||||
/// Since DynamicGraph expects directed edges, we need to insert
|
||||
/// two edges for undirected edges.
|
||||
inline std::shared_ptr<NodeBasedDynamicGraph>
|
||||
NodeBasedDynamicGraphFromEdges(std::size_t number_of_nodes, const std::vector<NodeBasedEdge> &input_edge_list)
|
||||
NodeBasedDynamicGraphFromEdges(std::size_t number_of_nodes,
|
||||
const std::vector<NodeBasedEdge> &input_edge_list)
|
||||
{
|
||||
auto edges_list = directedEdgesFromCompressed<NodeBasedDynamicGraph::InputEdge>(input_edge_list,
|
||||
[](NodeBasedDynamicGraph::InputEdge& output_edge, const NodeBasedEdge& input_edge)
|
||||
auto edges_list = directedEdgesFromCompressed<NodeBasedDynamicGraph::InputEdge>(
|
||||
input_edge_list,
|
||||
[](NodeBasedDynamicGraph::InputEdge &output_edge, const NodeBasedEdge &input_edge)
|
||||
{
|
||||
output_edge.data.distance = static_cast<int>(input_edge.weight);
|
||||
BOOST_ASSERT(output_edge.data.distance > 0);
|
||||
@@ -62,8 +69,7 @@ NodeBasedDynamicGraphFromEdges(std::size_t number_of_nodes, const std::vector<No
|
||||
output_edge.data.access_restricted = input_edge.access_restricted;
|
||||
output_edge.data.travel_mode = input_edge.travel_mode;
|
||||
output_edge.data.startpoint = input_edge.startpoint;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
tbb::parallel_sort(edges_list.begin(), edges_list.end());
|
||||
|
||||
|
||||
@@ -53,8 +53,7 @@ template <unsigned BLOCK_SIZE, bool USE_SHARED_MEMORY> class RangeTable
|
||||
}
|
||||
|
||||
// construct table from length vector
|
||||
template<typename VectorT>
|
||||
explicit RangeTable(const VectorT &lengths)
|
||||
template <typename VectorT> explicit RangeTable(const VectorT &lengths)
|
||||
{
|
||||
const unsigned number_of_blocks = [&lengths]()
|
||||
{
|
||||
|
||||
@@ -60,10 +60,10 @@ template <typename EdgeDataT, bool UseSharedMemory = false> class StaticGraph
|
||||
return osrm::irange(BeginEdges(node), EndEdges(node));
|
||||
}
|
||||
|
||||
template<typename ContainerT>
|
||||
StaticGraph(const int nodes, const ContainerT &graph)
|
||||
template <typename ContainerT> StaticGraph(const int nodes, const ContainerT &graph)
|
||||
{
|
||||
BOOST_ASSERT(std::is_sorted(const_cast<ContainerT&>(graph).begin(), const_cast<ContainerT&>(graph).end()));
|
||||
BOOST_ASSERT(std::is_sorted(const_cast<ContainerT &>(graph).begin(),
|
||||
const_cast<ContainerT &>(graph).end()));
|
||||
|
||||
number_of_nodes = nodes;
|
||||
number_of_edges = static_cast<EdgeIterator>(graph.size());
|
||||
|
||||
@@ -319,7 +319,7 @@ class StaticRTree
|
||||
|
||||
// Override filter and terminator for the desired behaviour.
|
||||
std::vector<EdgeDataT> Nearest(const FixedPointCoordinate &input_coordinate,
|
||||
const std::size_t max_results)
|
||||
const std::size_t max_results)
|
||||
{
|
||||
return Nearest(input_coordinate,
|
||||
[](const EdgeDataT &)
|
||||
@@ -335,8 +335,8 @@ class StaticRTree
|
||||
// Override filter and terminator for the desired behaviour.
|
||||
template <typename FilterT, typename TerminationT>
|
||||
std::vector<EdgeDataT> Nearest(const FixedPointCoordinate &input_coordinate,
|
||||
const FilterT filter,
|
||||
const TerminationT terminate)
|
||||
const FilterT filter,
|
||||
const TerminationT terminate)
|
||||
{
|
||||
std::vector<EdgeDataT> results;
|
||||
std::pair<double, double> projected_coordinate = {
|
||||
@@ -345,7 +345,7 @@ class StaticRTree
|
||||
|
||||
// initialize queue with root element
|
||||
std::priority_queue<QueryCandidate> traversal_queue;
|
||||
traversal_queue.push(QueryCandidate {0.f, m_search_tree[0]});
|
||||
traversal_queue.push(QueryCandidate{0.f, m_search_tree[0]});
|
||||
|
||||
while (!traversal_queue.empty())
|
||||
{
|
||||
@@ -377,7 +377,6 @@ class StaticRTree
|
||||
// inspecting an actual road segment
|
||||
const auto ¤t_segment = current_query_node.node.template get<EdgeDataT>();
|
||||
|
||||
|
||||
auto use_segment = filter(current_segment);
|
||||
if (!use_segment.first && !use_segment.second)
|
||||
{
|
||||
@@ -422,7 +421,8 @@ class StaticRTree
|
||||
// distance must be non-negative
|
||||
BOOST_ASSERT(0.f <= current_perpendicular_distance);
|
||||
|
||||
traversal_queue.push(QueryCandidate {current_perpendicular_distance, std::move(current_edge)});
|
||||
traversal_queue.push(
|
||||
QueryCandidate{current_perpendicular_distance, std::move(current_edge)});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ class StaticRTree
|
||||
const auto &child_tree_node = m_search_tree[child_id];
|
||||
const auto &child_rectangle = child_tree_node.minimum_bounding_rectangle;
|
||||
const float lower_bound_to_element = child_rectangle.GetMinDist(input_coordinate);
|
||||
traversal_queue.push(QueryCandidate {lower_bound_to_element, m_search_tree[child_id]});
|
||||
traversal_queue.push(QueryCandidate{lower_bound_to_element, m_search_tree[child_id]});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ class StaticRTree
|
||||
}
|
||||
if (!leaves_stream.good())
|
||||
{
|
||||
throw osrm::exception("Could not read from leaf file.");
|
||||
throw osrm::exception("Could not read from leaf file.");
|
||||
}
|
||||
const uint64_t seek_pos = sizeof(uint64_t) + leaf_id * sizeof(LeafNode);
|
||||
leaves_stream.seekg(seek_pos);
|
||||
|
||||
Reference in New Issue
Block a user