Run clang-format

This commit is contained in:
Patrick Niklaus
2016-01-08 01:31:57 +01:00
parent 6b18e4f7e9
commit 6991a38703
149 changed files with 457 additions and 498 deletions
+19 -12
View File
@@ -96,14 +96,15 @@ void ApiResponseGenerator<DataFacadeT>::DescribeRoute(const RouteParameters &con
const InternalRouteResult &raw_route,
util::json::Object &json_result)
{
if( not raw_route.is_valid() ){
return;
if (not raw_route.is_valid())
{
return;
}
const constexpr bool ALLOW_SIMPLIFICATION = true;
const constexpr bool EXTRACT_ROUTE = false;
const constexpr bool EXTRACT_ALTERNATIVE = true;
Segments segment_list(raw_route, EXTRACT_ROUTE, config.zoom_level, ALLOW_SIMPLIFICATION,
facade);
facade);
json_result.values["route_summary"] = SummarizeRoute(raw_route, segment_list);
json_result.values["via_points"] = ListViaPoints(raw_route);
json_result.values["via_indices"] = ListViaIndices(segment_list);
@@ -125,7 +126,7 @@ void ApiResponseGenerator<DataFacadeT>::DescribeRoute(const RouteParameters &con
if (raw_route.has_alternative())
{
Segments alternate_segment_list(raw_route, EXTRACT_ALTERNATIVE, config.zoom_level,
ALLOW_SIMPLIFICATION, facade);
ALLOW_SIMPLIFICATION, facade);
// Alternative Route Summaries are stored in an array to (down the line) allow multiple
// alternatives
@@ -140,7 +141,8 @@ void ApiResponseGenerator<DataFacadeT>::DescribeRoute(const RouteParameters &con
auto alternate_geometry_string =
GetGeometry(config.compression, alternate_segment_list);
util::json::Array json_alternate_geometries_array;
json_alternate_geometries_array.values.emplace_back(std::move(alternate_geometry_string));
json_alternate_geometries_array.values.emplace_back(
std::move(alternate_geometry_string));
json_result.values["alternative_geometries"] = json_alternate_geometries_array;
}
@@ -192,7 +194,8 @@ ApiResponseGenerator<DataFacadeT>::SummarizeRoute(const InternalRouteResult &raw
{
const auto start_name_id = raw_route.segment_end_coordinates.front().source_phantom.name_id;
json_route_summary.values["start_point"] = facade->get_name_for_id(start_name_id);
const auto destination_name_id = raw_route.segment_end_coordinates.back().target_phantom.name_id;
const auto destination_name_id =
raw_route.segment_end_coordinates.back().target_phantom.name_id;
json_route_summary.values["end_point"] = facade->get_name_for_id(destination_name_id);
}
json_route_summary.values["total_time"] = segment_list.GetDuration();
@@ -217,8 +220,10 @@ ApiResponseGenerator<DataFacadeT>::ListViaPoints(const InternalRouteResult &raw_
{
std::string tmp;
util::json::Array json_coordinate;
json_coordinate.values.emplace_back(nodes.target_phantom.location.lat / COORDINATE_PRECISION);
json_coordinate.values.emplace_back(nodes.target_phantom.location.lon / COORDINATE_PRECISION);
json_coordinate.values.emplace_back(nodes.target_phantom.location.lat /
COORDINATE_PRECISION);
json_coordinate.values.emplace_back(nodes.target_phantom.location.lon /
COORDINATE_PRECISION);
json_via_points_array.values.emplace_back(std::move(json_coordinate));
}
return json_via_points_array;
@@ -235,7 +240,8 @@ ApiResponseGenerator<DataFacadeT>::ListViaIndices(const Segments &segment_list)
}
template <typename DataFacadeT>
util::json::Value ApiResponseGenerator<DataFacadeT>::GetGeometry(const bool return_encoded, const Segments &segments) const
util::json::Value ApiResponseGenerator<DataFacadeT>::GetGeometry(const bool return_encoded,
const Segments &segments) const
{
if (return_encoded)
return PolylineFormatter().printEncodedString(segments.Get());
@@ -284,11 +290,12 @@ ApiResponseGenerator<DataFacadeT>::BuildHintData(const InternalRouteResult &raw_
}
template <typename DataFacadeT>
ApiResponseGenerator<DataFacadeT> MakeApiResponseGenerator(DataFacadeT *facade){
return ApiResponseGenerator<DataFacadeT>(facade);
ApiResponseGenerator<DataFacadeT> MakeApiResponseGenerator(DataFacadeT *facade)
{
return ApiResponseGenerator<DataFacadeT>(facade);
}
} // namespace engine
} // namespace osrm
#endif //ENGINE_GUIDANCE_API_RESPONSE_GENERATOR_HPP_
#endif // ENGINE_GUIDANCE_API_RESPONSE_GENERATOR_HPP_
@@ -85,10 +85,10 @@ template <class EdgeDataT> class BaseDataFacade
const int bearing = 0,
const int bearing_range = 180) = 0;
virtual std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::FixedPointCoordinate &input_coordinate,
const int bearing = 0,
const int bearing_range = 180) = 0;
virtual std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent(
const util::FixedPointCoordinate &input_coordinate,
const int bearing = 0,
const int bearing_range = 180) = 0;
virtual unsigned GetCheckSum() const = 0;
@@ -102,7 +102,6 @@ template <class EdgeDataT> class BaseDataFacade
virtual std::string GetTimestamp() const = 0;
};
}
}
}
@@ -37,7 +37,8 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
using QueryGraph = util::StaticGraph<typename super::EdgeData>;
using InputEdge = typename QueryGraph::InputEdge;
using RTreeLeaf = typename super::RTreeLeaf;
using InternalRTree = util::StaticRTree<RTreeLeaf, util::ShM<util::FixedPointCoordinate, false>::vector, false>;
using InternalRTree =
util::StaticRTree<RTreeLeaf, util::ShM<util::FixedPointCoordinate, false>::vector, false>;
using InternalGeospatialQuery = GeospatialQuery<InternalRTree>;
InternalDataFacade() {}
@@ -98,8 +99,8 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
BOOST_ASSERT_MSG(0 != node_list.size(), "node list empty");
// BOOST_ASSERT_MSG(0 != edge_list.size(), "edge list empty");
util::SimpleLogger().Write() << "loaded " << node_list.size() << " nodes and " << edge_list.size()
<< " edges";
util::SimpleLogger().Write() << "loaded " << node_list.size() << " nodes and "
<< edge_list.size() << " edges";
m_query_graph = std::unique_ptr<QueryGraph>(new QueryGraph(node_list, edge_list));
BOOST_ASSERT_MSG(0 == node_list.size(), "node list not flushed");
@@ -120,7 +121,8 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
for (unsigned i = 0; i < number_of_coordinates; ++i)
{
nodes_input_stream.read((char *)&current_node, sizeof(extractor::QueryNode));
m_coordinate_list->at(i) = util::FixedPointCoordinate(current_node.lat, current_node.lon);
m_coordinate_list->at(i) =
util::FixedPointCoordinate(current_node.lat, current_node.lon);
BOOST_ASSERT((std::abs(m_coordinate_list->at(i).lat) >> 30) == 0);
BOOST_ASSERT((std::abs(m_coordinate_list->at(i).lon) >> 30) == 0);
}
@@ -140,7 +142,8 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
extractor::OriginalEdgeData current_edge_data;
for (unsigned i = 0; i < number_of_edges; ++i)
{
edges_input_stream.read((char *)&(current_edge_data), sizeof(extractor::OriginalEdgeData));
edges_input_stream.read((char *)&(current_edge_data),
sizeof(extractor::OriginalEdgeData));
m_via_node_list[i] = current_edge_data.via_node;
m_name_ID_list[i] = current_edge_data.name_id;
m_turn_instruction_list[i] = current_edge_data.turn_instruction;
@@ -371,10 +374,10 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
bearing_range);
}
std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::FixedPointCoordinate &input_coordinate,
const int bearing = 0,
const int bearing_range = 180) override final
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent(
const util::FixedPointCoordinate &input_coordinate,
const int bearing = 0,
const int bearing_range = 180) override final
{
if (!m_static_rtree.get())
{
@@ -444,7 +447,6 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
std::string GetTimestamp() const override final { return m_timestamp; }
};
}
}
}
@@ -36,7 +36,6 @@ struct SharedBarriers
// Is there any query?
int number_of_queries;
};
}
}
}
+16 -12
View File
@@ -38,7 +38,8 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
using NameIndexBlock = typename util::RangeTable<16, true>::BlockT;
using InputEdge = typename QueryGraph::InputEdge;
using RTreeLeaf = typename super::RTreeLeaf;
using SharedRTree = util::StaticRTree<RTreeLeaf, util::ShM<util::FixedPointCoordinate, true>::vector, true>;
using SharedRTree =
util::StaticRTree<RTreeLeaf, util::ShM<util::FixedPointCoordinate, true>::vector, true>;
using SharedGeospatialQuery = GeospatialQuery<SharedRTree>;
using TimeStampedRTreePair = std::pair<unsigned, std::shared_ptr<SharedRTree>>;
using RTreeNode = typename SharedRTree::TreeNode;
@@ -125,19 +126,22 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
void LoadNodeAndEdgeInformation()
{
util::FixedPointCoordinate *coordinate_list_ptr = data_layout->GetBlockPtr<util::FixedPointCoordinate>(
shared_memory, SharedDataLayout::COORDINATE_LIST);
util::FixedPointCoordinate *coordinate_list_ptr =
data_layout->GetBlockPtr<util::FixedPointCoordinate>(shared_memory,
SharedDataLayout::COORDINATE_LIST);
m_coordinate_list = util::make_unique<util::ShM<util::FixedPointCoordinate, true>::vector>(
coordinate_list_ptr, data_layout->num_entries[SharedDataLayout::COORDINATE_LIST]);
extractor::TravelMode *travel_mode_list_ptr =
data_layout->GetBlockPtr<extractor::TravelMode>(shared_memory, SharedDataLayout::TRAVEL_MODE);
data_layout->GetBlockPtr<extractor::TravelMode>(shared_memory,
SharedDataLayout::TRAVEL_MODE);
typename util::ShM<extractor::TravelMode, true>::vector travel_mode_list(
travel_mode_list_ptr, data_layout->num_entries[SharedDataLayout::TRAVEL_MODE]);
m_travel_mode_list.swap(travel_mode_list);
extractor::TurnInstruction *turn_instruction_list_ptr = data_layout->GetBlockPtr<extractor::TurnInstruction>(
shared_memory, SharedDataLayout::TURN_INSTRUCTION);
extractor::TurnInstruction *turn_instruction_list_ptr =
data_layout->GetBlockPtr<extractor::TurnInstruction>(
shared_memory, SharedDataLayout::TURN_INSTRUCTION);
typename util::ShM<extractor::TurnInstruction, true>::vector turn_instruction_list(
turn_instruction_list_ptr,
data_layout->num_entries[SharedDataLayout::TURN_INSTRUCTION]);
@@ -258,7 +262,8 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
file_index_path = boost::filesystem::path(file_index_ptr);
if (!boost::filesystem::exists(file_index_path))
{
util::SimpleLogger().Write(logDEBUG) << "Leaf file name " << file_index_path.string();
util::SimpleLogger().Write(logDEBUG) << "Leaf file name "
<< file_index_path.string();
throw util::exception("Could not load leaf index file. "
"Is any data loaded into shared memory?");
}
@@ -397,10 +402,10 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
bearing_range);
}
std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::FixedPointCoordinate &input_coordinate,
const int bearing = 0,
const int bearing_range = 180) override final
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent(
const util::FixedPointCoordinate &input_coordinate,
const int bearing = 0,
const int bearing_range = 180) override final
{
if (!m_static_rtree.get() || CURRENT_TIMESTAMP != m_static_rtree->first)
{
@@ -452,7 +457,6 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
std::string GetTimestamp() const override final { return m_timestamp; }
};
}
}
}
+18 -19
View File
@@ -54,41 +54,41 @@ struct SharedDataLayout
void PrintInformation() const
{
util::SimpleLogger().Write(logDEBUG) << "NAME_OFFSETS "
<< ": " << GetBlockSize(NAME_OFFSETS);
<< ": " << GetBlockSize(NAME_OFFSETS);
util::SimpleLogger().Write(logDEBUG) << "NAME_BLOCKS "
<< ": " << GetBlockSize(NAME_BLOCKS);
<< ": " << GetBlockSize(NAME_BLOCKS);
util::SimpleLogger().Write(logDEBUG) << "NAME_CHAR_LIST "
<< ": " << GetBlockSize(NAME_CHAR_LIST);
<< ": " << GetBlockSize(NAME_CHAR_LIST);
util::SimpleLogger().Write(logDEBUG) << "NAME_ID_LIST "
<< ": " << GetBlockSize(NAME_ID_LIST);
<< ": " << GetBlockSize(NAME_ID_LIST);
util::SimpleLogger().Write(logDEBUG) << "VIA_NODE_LIST "
<< ": " << GetBlockSize(VIA_NODE_LIST);
<< ": " << GetBlockSize(VIA_NODE_LIST);
util::SimpleLogger().Write(logDEBUG) << "GRAPH_NODE_LIST "
<< ": " << GetBlockSize(GRAPH_NODE_LIST);
<< ": " << GetBlockSize(GRAPH_NODE_LIST);
util::SimpleLogger().Write(logDEBUG) << "GRAPH_EDGE_LIST "
<< ": " << GetBlockSize(GRAPH_EDGE_LIST);
<< ": " << GetBlockSize(GRAPH_EDGE_LIST);
util::SimpleLogger().Write(logDEBUG) << "COORDINATE_LIST "
<< ": " << GetBlockSize(COORDINATE_LIST);
<< ": " << GetBlockSize(COORDINATE_LIST);
util::SimpleLogger().Write(logDEBUG) << "TURN_INSTRUCTION "
<< ": " << GetBlockSize(TURN_INSTRUCTION);
<< ": " << GetBlockSize(TURN_INSTRUCTION);
util::SimpleLogger().Write(logDEBUG) << "TRAVEL_MODE "
<< ": " << GetBlockSize(TRAVEL_MODE);
<< ": " << GetBlockSize(TRAVEL_MODE);
util::SimpleLogger().Write(logDEBUG) << "R_SEARCH_TREE "
<< ": " << GetBlockSize(R_SEARCH_TREE);
<< ": " << GetBlockSize(R_SEARCH_TREE);
util::SimpleLogger().Write(logDEBUG) << "GEOMETRIES_INDEX "
<< ": " << GetBlockSize(GEOMETRIES_INDEX);
<< ": " << GetBlockSize(GEOMETRIES_INDEX);
util::SimpleLogger().Write(logDEBUG) << "GEOMETRIES_LIST "
<< ": " << GetBlockSize(GEOMETRIES_LIST);
<< ": " << GetBlockSize(GEOMETRIES_LIST);
util::SimpleLogger().Write(logDEBUG) << "GEOMETRIES_INDICATORS"
<< ": " << GetBlockSize(GEOMETRIES_INDICATORS);
<< ": " << GetBlockSize(GEOMETRIES_INDICATORS);
util::SimpleLogger().Write(logDEBUG) << "HSGR_CHECKSUM "
<< ": " << GetBlockSize(HSGR_CHECKSUM);
<< ": " << GetBlockSize(HSGR_CHECKSUM);
util::SimpleLogger().Write(logDEBUG) << "TIMESTAMP "
<< ": " << GetBlockSize(TIMESTAMP);
<< ": " << GetBlockSize(TIMESTAMP);
util::SimpleLogger().Write(logDEBUG) << "FILE_INDEX_PATH "
<< ": " << GetBlockSize(FILE_INDEX_PATH);
<< ": " << GetBlockSize(FILE_INDEX_PATH);
util::SimpleLogger().Write(logDEBUG) << "CORE_MARKER "
<< ": " << GetBlockSize(CORE_MARKER);
<< ": " << GetBlockSize(CORE_MARKER);
}
template <typename T> inline void SetBlockSize(BlockID bid, uint64_t entries)
@@ -171,7 +171,6 @@ struct SharedDataTimestamp
SharedDataType data;
unsigned timestamp;
};
}
}
}
-1
View File
@@ -55,7 +55,6 @@ class DouglasPeucker
void Run(RandomAccessIt begin, RandomAccessIt end, const unsigned zoom_level);
void Run(std::vector<SegmentInformation> &input_geometry, const unsigned zoom_level);
};
}
}
+12 -12
View File
@@ -77,10 +77,10 @@ template <typename RTreeT> class GeospatialQuery
// Returns the nearest phantom node. If this phantom node is not from a big component
// a second phantom node is return that is the nearest coordinate in a big component.
std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const util::FixedPointCoordinate &input_coordinate,
const int bearing = 0,
const int bearing_range = 180)
std::pair<PhantomNode, PhantomNode> NearestPhantomNodeWithAlternativeFromBigComponent(
const util::FixedPointCoordinate &input_coordinate,
const int bearing = 0,
const int bearing_range = 180)
{
bool has_small_component = false;
bool has_big_component = false;
@@ -139,9 +139,10 @@ template <typename RTreeT> class GeospatialQuery
{
util::FixedPointCoordinate point_on_segment;
double ratio;
const auto current_perpendicular_distance = util::coordinate_calculation::perpendicularDistance(
coordinates->at(data.u), coordinates->at(data.v), input_coordinate, point_on_segment,
ratio);
const auto current_perpendicular_distance =
util::coordinate_calculation::perpendicularDistance(
coordinates->at(data.u), coordinates->at(data.v), input_coordinate,
point_on_segment, ratio);
auto transformed = PhantomNodeWithDistance{PhantomNode{data, point_on_segment},
current_perpendicular_distance};
@@ -163,8 +164,8 @@ template <typename RTreeT> class GeospatialQuery
const int filter_bearing,
const int filter_bearing_range)
{
const double forward_edge_bearing =
util::coordinate_calculation::bearing(coordinates->at(segment.u), coordinates->at(segment.v));
const double forward_edge_bearing = util::coordinate_calculation::bearing(
coordinates->at(segment.u), coordinates->at(segment.v));
const double backward_edge_bearing = (forward_edge_bearing + 180) > 360
? (forward_edge_bearing - 180)
@@ -172,11 +173,11 @@ template <typename RTreeT> class GeospatialQuery
const bool forward_bearing_valid =
util::bearing::CheckInBounds(std::round(forward_edge_bearing), filter_bearing,
filter_bearing_range) &&
filter_bearing_range) &&
segment.forward_edge_based_node_id != SPECIAL_NODEID;
const bool backward_bearing_valid =
util::bearing::CheckInBounds(std::round(backward_edge_bearing), filter_bearing,
filter_bearing_range) &&
filter_bearing_range) &&
segment.reverse_edge_based_node_id != SPECIAL_NODEID;
return std::make_pair(forward_bearing_valid, backward_bearing_valid);
}
@@ -184,7 +185,6 @@ template <typename RTreeT> class GeospatialQuery
RTreeT &rtree;
const std::shared_ptr<CoordinateList> coordinates;
};
}
}
@@ -63,4 +63,4 @@ inline void CombineSimilarSegments(std::vector<SegmentInformation> &segments)
} // namespace engine
} // namespace osrm
#endif //ENGINE_GUIDANCE_PROCESSING_SEGMENT_COMPRESSION_HPP_
#endif // ENGINE_GUIDANCE_PROCESSING_SEGMENT_COMPRESSION_HPP_
+4 -3
View File
@@ -146,7 +146,8 @@ void SegmentList<DataFacadeT>::AddLeg(const std::vector<PathData> &leg_data,
const extractor::TravelMode travel_mode =
(traversed_in_reverse ? target_node.backward_travel_mode : target_node.forward_travel_mode);
segments.emplace_back(target_node.location, target_node.name_id, segment_duration, 0.f,
is_via_leg ? extractor::TurnInstruction::ReachViaLocation : extractor::TurnInstruction::NoTurn,
is_via_leg ? extractor::TurnInstruction::ReachViaLocation
: extractor::TurnInstruction::NoTurn,
true, true, travel_mode);
}
@@ -220,8 +221,8 @@ void SegmentList<DataFacadeT>::Finalize(const bool extract_alternative,
{
// move down names by one, q&d hack
segments[i - 1].name_id = segments[i].name_id;
segments[i].length = util::coordinate_calculation::greatCircleDistance(segments[i - 1].location,
segments[i].location);
segments[i].length = util::coordinate_calculation::greatCircleDistance(
segments[i - 1].location, segments[i].location);
}
float segment_length = 0.;
@@ -21,13 +21,13 @@ namespace engine
{
namespace guidance
{
template< typename DataFacadeT >
inline util::json::Array
AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT* facade)
template <typename DataFacadeT>
inline util::json::Array AnnotateRoute(const std::vector<SegmentInformation> &route_segments,
DataFacadeT *facade)
{
util::json::Array json_instruction_array;
if( route_segments.empty() )
return json_instruction_array;
if (route_segments.empty())
return json_instruction_array;
// Segment information has following format:
//["instruction id","streetname",length,position,time,"length","earth_direction",azimuth]
std::int32_t necessary_segments_running_index = 0;
@@ -42,7 +42,7 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
round_about = {std::numeric_limits<std::int32_t>::max(), 0, 0};
std::string temp_dist, temp_length, temp_duration, temp_bearing, temp_instruction;
//Generate annotations for every segment
// Generate annotations for every segment
for (const SegmentInformation &segment : route_segments)
{
util::json::Array json_instruction_row;
@@ -59,8 +59,8 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
std::string current_turn_instruction;
if (extractor::TurnInstruction::LeaveRoundAbout == current_instruction)
{
temp_instruction =
std::to_string(util::cast::enum_to_underlying(extractor::TurnInstruction::EnterRoundAbout));
temp_instruction = std::to_string(util::cast::enum_to_underlying(
extractor::TurnInstruction::EnterRoundAbout));
current_turn_instruction += temp_instruction;
current_turn_instruction += "-";
temp_instruction = std::to_string(round_about.leave_at_exit + 1);
@@ -110,9 +110,9 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
}
util::json::Array json_last_instruction_row;
temp_instruction =
std::to_string(util::cast::enum_to_underlying(extractor::TurnInstruction::ReachedYourDestination));
json_last_instruction_row.values.emplace_back( std::move(temp_instruction));
temp_instruction = std::to_string(
util::cast::enum_to_underlying(extractor::TurnInstruction::ReachedYourDestination));
json_last_instruction_row.values.emplace_back(std::move(temp_instruction));
json_last_instruction_row.values.push_back("");
json_last_instruction_row.values.push_back(0);
json_last_instruction_row.values.push_back(necessary_segments_running_index - 1);
+2 -2
View File
@@ -19,7 +19,8 @@ struct PathData
{
PathData()
: node(SPECIAL_NODEID), name_id(INVALID_EDGE_WEIGHT), segment_duration(INVALID_EDGE_WEIGHT),
turn_instruction(extractor::TurnInstruction::NoTurn), travel_mode(TRAVEL_MODE_INACCESSIBLE)
turn_instruction(extractor::TurnInstruction::NoTurn),
travel_mode(TRAVEL_MODE_INACCESSIBLE)
{
}
@@ -65,7 +66,6 @@ struct InternalRouteResult
{
}
};
}
}
@@ -94,7 +94,6 @@ class BayesClassifier
double positive_apriori_probability;
double negative_apriori_probability;
};
}
}
}
@@ -34,8 +34,7 @@ struct EmissionLogProbability
double operator()(const double distance) const
{
return -0.5 * (log_2_pi + (distance / sigma_z) * (distance / sigma_z)) -
log_sigma_z;
return -0.5 * (log_2_pi + (distance / sigma_z) * (distance / sigma_z)) - log_sigma_z;
}
};
@@ -116,8 +115,7 @@ template <class CandidateLists> struct HiddenMarkovModel
viterbi[initial_timestamp][s] =
emission_log_probability(candidates_list[initial_timestamp][s].distance);
parents[initial_timestamp][s] = std::make_pair(initial_timestamp, s);
pruned[initial_timestamp][s] =
viterbi[initial_timestamp][s] < MINIMAL_LOG_PROB;
pruned[initial_timestamp][s] = viterbi[initial_timestamp][s] < MINIMAL_LOG_PROB;
suspicious[initial_timestamp][s] = false;
breakage[initial_timestamp] =
@@ -140,7 +138,6 @@ template <class CandidateLists> struct HiddenMarkovModel
return initial_timestamp;
}
};
}
}
}
-1
View File
@@ -63,7 +63,6 @@ struct ObjectEncoder
}
}
};
}
}
+2 -2
View File
@@ -34,7 +34,8 @@ struct PhantomNode
PhantomNode();
template <class OtherT> PhantomNode(const OtherT &other, const util::FixedPointCoordinate &foot_point)
template <class OtherT>
PhantomNode(const OtherT &other, const util::FixedPointCoordinate &foot_point)
{
forward_node_id = other.forward_edge_based_node_id;
reverse_node_id = other.reverse_edge_based_node_id;
@@ -137,7 +138,6 @@ inline std::ostream &operator<<(std::ostream &out, const PhantomNode &pn)
<< "loc: " << pn.location;
return out;
}
}
}
@@ -219,7 +219,6 @@ template <class DataFacadeT> class DistanceTablePlugin final : public BasePlugin
std::string descriptor_string;
DataFacadeT *facade;
};
}
}
}
-1
View File
@@ -80,7 +80,6 @@ class HelloWorldPlugin final : public BasePlugin
private:
std::string descriptor_string;
};
}
}
}
+6 -6
View File
@@ -37,7 +37,9 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
using SubMatching = routing_algorithms::SubMatching;
using SubMatchingList = routing_algorithms::SubMatchingList;
using CandidateLists = routing_algorithms::CandidateLists;
using ClassifierT = map_matching::BayesClassifier<map_matching::LaplaceDistribution, map_matching::LaplaceDistribution, double>;
using ClassifierT = map_matching::BayesClassifier<map_matching::LaplaceDistribution,
map_matching::LaplaceDistribution,
double>;
using TraceClassification = ClassifierT::ClassificationT;
public:
@@ -203,13 +205,13 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
if (route_parameters.geometry || route_parameters.print_instructions)
{
using SegmentList = guidance::SegmentList<DataFacadeT>;
//Passing false to extract_alternative extracts the route.
// Passing false to extract_alternative extracts the route.
const constexpr bool EXTRACT_ROUTE = false;
// by passing false to segment_list, we skip the douglas peucker simplification
// and mark all segments as necessary within the generation process
const constexpr bool NO_ROUTE_SIMPLIFICATION = false;
SegmentList segment_list(raw_route, EXTRACT_ROUTE, route_parameters.zoom_level,
NO_ROUTE_SIMPLIFICATION, facade);
NO_ROUTE_SIMPLIFICATION, facade);
if (route_parameters.geometry)
{
@@ -220,8 +222,7 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
if (route_parameters.print_instructions)
{
subtrace.values["instructions"] =
guidance::AnnotateRoute<DataFacadeT>(
segment_list.Get(), facade);
guidance::AnnotateRoute<DataFacadeT>(segment_list.Get(), facade);
}
util::json::Object json_route_summary;
@@ -379,7 +380,6 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
int max_locations_map_matching;
ClassifierT classifier;
};
}
}
}
+1 -3
View File
@@ -30,8 +30,7 @@ template <class DataFacadeT> class NearestPlugin final : public BasePlugin
util::json::Object &json_result) override final
{
// check number of parameters
if (route_parameters.coordinates.empty() ||
!route_parameters.coordinates.front().IsValid())
if (route_parameters.coordinates.empty() || !route_parameters.coordinates.front().IsValid())
{
return Status::Error;
}
@@ -101,7 +100,6 @@ template <class DataFacadeT> class NearestPlugin final : public BasePlugin
DataFacadeT *facade;
std::string descriptor_string;
};
}
}
}
-1
View File
@@ -112,7 +112,6 @@ class BasePlugin
return snapped_phantoms;
}
};
}
}
}
-1
View File
@@ -36,7 +36,6 @@ template <class DataFacadeT> class TimestampPlugin final : public BasePlugin
const DataFacadeT *facade;
std::string descriptor_string;
};
}
}
}
+5 -7
View File
@@ -149,8 +149,8 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
}
// Run TarjanSCC
auto wrapper = std::make_shared<util::MatrixGraphWrapper<EdgeWeight>>(result_table.GetTable(),
number_of_locations);
auto wrapper = std::make_shared<util::MatrixGraphWrapper<EdgeWeight>>(
result_table.GetTable(), number_of_locations);
auto scc = extractor::TarjanSCC<util::MatrixGraphWrapper<EdgeWeight>>(wrapper);
scc.run();
@@ -301,13 +301,12 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
if (component_size < BF_MAX_FEASABLE)
{
scc_route =
trip::BruteForceTrip(start, end, number_of_locations, result_table);
scc_route = trip::BruteForceTrip(start, end, number_of_locations, result_table);
}
else
{
scc_route = trip::FarthestInsertionTrip(start, end, number_of_locations,
result_table);
scc_route =
trip::FarthestInsertionTrip(start, end, number_of_locations, result_table);
}
// use this output if debugging of route is needed:
@@ -366,7 +365,6 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
return Status::Ok;
}
};
}
}
}
-1
View File
@@ -166,7 +166,6 @@ template <class DataFacadeT> class ViaRoutePlugin final : public BasePlugin
return Status::Ok;
}
};
}
}
}
-1
View File
@@ -25,7 +25,6 @@ class PolylineCompressor
std::vector<util::FixedPointCoordinate> decode_string(const std::string &geometry_string) const;
};
}
}
-1
View File
@@ -19,7 +19,6 @@ struct PolylineFormatter
util::json::Array printUnencodedString(const std::vector<SegmentInformation> &polyline) const;
};
}
}
+1 -2
View File
@@ -28,7 +28,7 @@ template <class DataFacadeT, class SegmentT> struct ExtractRouteNames
const unsigned blocked_name_id) const
{
SegmentT result_segment;
result_segment.name_id = blocked_name_id; //make sure we get a valid name
result_segment.name_id = blocked_name_id; // make sure we get a valid name
result_segment.length = 0;
for (const SegmentT &segment : segment_list)
@@ -139,7 +139,6 @@ template <class DataFacadeT, class SegmentT> struct ExtractRouteNames
return route_names;
}
};
}
}
@@ -564,7 +564,8 @@ class AlternativeRouting final
const NodeID node = forward_heap.DeleteMin();
const int distance = forward_heap.GetKey(node);
// const NodeID parentnode = forward_heap.GetData(node).parent;
// util::SimpleLogger().Write() << (is_forward_directed ? "[fwd] " : "[rev] ") << "settled edge ("
// util::SimpleLogger().Write() << (is_forward_directed ? "[fwd] " : "[rev] ") << "settled
// edge ("
// << parentnode << "," << node << "), dist: " << distance;
const int scaled_distance =
@@ -588,10 +589,12 @@ class AlternativeRouting final
{
*middle_node = node;
*upper_bound_to_shortest_path_distance = new_distance;
// util::SimpleLogger().Write() << "accepted middle_node " << *middle_node << " at
// util::SimpleLogger().Write() << "accepted middle_node " << *middle_node
// << " at
// distance " << new_distance;
// } else {
// util::SimpleLogger().Write() << "discarded middle_node " << *middle_node << "
// util::SimpleLogger().Write() << "discarded middle_node " << *middle_node
// << "
// at distance " << new_distance;
}
}
@@ -846,7 +849,6 @@ class AlternativeRouting final
return (upper_bound <= t_test_path_length);
}
};
}
}
}
@@ -131,7 +131,6 @@ class DirectShortestPathRouting final
raw_route_data.unpacked_path_segments.front());
}
};
}
}
}
@@ -147,8 +147,8 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
}
else
{
trace_split = trace_split || (t - prev_unbroken_timestamps.back() >
MAX_BROKEN_STATES);
trace_split =
trace_split || (t - prev_unbroken_timestamps.back() > MAX_BROKEN_STATES);
}
if (trace_split)
@@ -194,8 +194,8 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
const auto &current_timestamps_list = candidates_list[t];
const auto &current_coordinate = trace_coordinates[t];
const auto haversine_distance =
util::coordinate_calculation::haversineDistance(prev_coordinate, current_coordinate);
const auto haversine_distance = util::coordinate_calculation::haversineDistance(
prev_coordinate, current_coordinate);
// compute d_t for this timestamp and the next one
for (const auto s : util::irange<std::size_t>(0u, prev_viterbi.size()))
@@ -246,8 +246,7 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
current_parents[s_prime] = std::make_pair(prev_unbroken_timestamp, s);
current_lengths[s_prime] = network_distance;
current_pruned[s_prime] = false;
current_suspicious[s_prime] =
d_t > SUSPICIOUS_DISTANCE_DELTA;
current_suspicious[s_prime] = d_t > SUSPICIOUS_DISTANCE_DELTA;
model.breakage[t] = false;
}
}
@@ -355,7 +354,6 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
matching_debug.add_breakage(model.breakage);
}
};
}
}
}
@@ -25,7 +25,6 @@ SearchEngineData::SearchEngineHeapPtr SearchEngineData::reverse_heap_3;
namespace routing_algorithms
{
template <class DataFacadeT, class Derived> class BasicRoutingInterface
{
private:
@@ -231,7 +230,8 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
{
BOOST_ASSERT_MSG(!ed.shortcut, "original edge flagged as shortcut");
unsigned name_index = facade->GetNameIndexFromEdgeID(ed.id);
const extractor::TurnInstruction turn_instruction = facade->GetTurnInstructionForEdgeID(ed.id);
const extractor::TurnInstruction turn_instruction =
facade->GetTurnInstructionForEdgeID(ed.id);
const extractor::TravelMode travel_mode = facade->GetTravelModeForEdgeID(ed.id);
if (!facade->EdgeIsCompressed(ed.id))
@@ -260,7 +260,8 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
for (std::size_t i = start_index; i < end_index; ++i)
{
unpacked_path.emplace_back(id_vector[i], name_index,
extractor::TurnInstruction::NoTurn, 0, travel_mode);
extractor::TurnInstruction::NoTurn, 0,
travel_mode);
}
unpacked_path.back().turn_instruction = turn_instruction;
unpacked_path.back().segment_duration = ed.distance;
@@ -304,9 +305,10 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
{
BOOST_ASSERT(i < id_vector.size());
BOOST_ASSERT(phantom_node_pair.target_phantom.forward_travel_mode > 0);
unpacked_path.emplace_back(PathData{
id_vector[i], phantom_node_pair.target_phantom.name_id, extractor::TurnInstruction::NoTurn,
0, phantom_node_pair.target_phantom.forward_travel_mode});
unpacked_path.emplace_back(
PathData{id_vector[i], phantom_node_pair.target_phantom.name_id,
extractor::TurnInstruction::NoTurn, 0,
phantom_node_pair.target_phantom.forward_travel_mode});
}
}
@@ -658,16 +660,15 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
{
current_coordinate = facade->GetCoordinateOfNode(p.node);
distance += util::coordinate_calculation::haversineDistance(previous_coordinate,
current_coordinate);
current_coordinate);
previous_coordinate = current_coordinate;
}
distance += util::coordinate_calculation::haversineDistance(previous_coordinate,
target_phantom.location);
target_phantom.location);
}
return distance;
}
};
}
}
}
@@ -521,7 +521,6 @@ class ShortestPathRouting final
}
}
};
}
}
}
-1
View File
@@ -41,7 +41,6 @@ template <class DataFacadeT> class SearchEngine
~SearchEngine() {}
};
}
}
+2 -2
View File
@@ -19,7 +19,8 @@ struct HeapData
struct SearchEngineData
{
using QueryHeap = util::BinaryHeap<NodeID, NodeID, int, HeapData, util::UnorderedMapStorage<NodeID, int>>;
using QueryHeap =
util::BinaryHeap<NodeID, NodeID, int, HeapData, util::UnorderedMapStorage<NodeID, int>>;
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
static SearchEngineHeapPtr forward_heap_1;
@@ -35,7 +36,6 @@ struct SearchEngineData
void InitializeOrClearThirdThreadLocalStorage(const unsigned number_of_nodes);
};
}
}
+2 -3
View File
@@ -49,12 +49,11 @@ struct SegmentInformation
const extractor::TravelMode travel_mode)
: location(std::move(location)), name_id(name_id), duration(duration), length(length),
pre_turn_bearing(0), post_turn_bearing(0), turn_instruction(turn_instruction),
travel_mode(travel_mode), necessary(turn_instruction != extractor::TurnInstruction::NoTurn),
is_via_location(false)
travel_mode(travel_mode),
necessary(turn_instruction != extractor::TurnInstruction::NoTurn), is_via_location(false)
{
}
};
}
}
-1
View File
@@ -77,7 +77,6 @@ std::vector<NodeID> BruteForceTrip(const NodeIDIterator start,
return route;
}
}
}
}
@@ -190,7 +190,6 @@ std::vector<NodeID> FarthestInsertionTrip(const NodeIDIterator &start,
BOOST_ASSERT_MSG(static_cast<std::size_t>(max_to) < number_of_locations, "start node");
return FindRoute(number_of_locations, component_size, start, end, dist_table, max_from, max_to);
}
}
}
}
@@ -92,7 +92,6 @@ std::vector<NodeID> NearestNeighbourTrip(const NodeIDIterator &start,
}
return route;
}
}
}
}
-1
View File
@@ -34,7 +34,6 @@ void TabuSearchTrip(const PhantomNodeArray &phantom_node_vector,
std::vector<int> &min_loc_permutation)
{
}
}
}
}