format
This commit is contained in:
parent
91a24bf537
commit
4a4d7ac62f
@ -46,15 +46,14 @@ namespace engine
|
||||
struct PhantomNode
|
||||
{
|
||||
PhantomNode()
|
||||
: forward_segment_id{SPECIAL_SEGMENTID, false}, reverse_segment_id{SPECIAL_SEGMENTID,
|
||||
false},
|
||||
forward_weight(INVALID_EDGE_WEIGHT), reverse_weight(INVALID_EDGE_WEIGHT),
|
||||
forward_weight_offset(0), reverse_weight_offset(0),
|
||||
: forward_segment_id{SPECIAL_SEGMENTID, false},
|
||||
reverse_segment_id{SPECIAL_SEGMENTID, false}, forward_weight(INVALID_EDGE_WEIGHT),
|
||||
reverse_weight(INVALID_EDGE_WEIGHT), forward_weight_offset(0), reverse_weight_offset(0),
|
||||
forward_distance(INVALID_EDGE_DISTANCE), reverse_distance(INVALID_EDGE_DISTANCE),
|
||||
forward_distance_offset(0), reverse_distance_offset(0),
|
||||
forward_duration(MAXIMAL_EDGE_DURATION), reverse_duration(MAXIMAL_EDGE_DURATION),
|
||||
forward_duration_offset(0), reverse_duration_offset(0),
|
||||
fwd_segment_position(0), is_valid_forward_source{false}, is_valid_forward_target{false},
|
||||
forward_duration_offset(0), reverse_duration_offset(0), fwd_segment_position(0),
|
||||
is_valid_forward_source{false}, is_valid_forward_target{false},
|
||||
is_valid_reverse_source{false}, is_valid_reverse_target{false}, bearing(0)
|
||||
|
||||
{
|
||||
@ -112,9 +111,8 @@ struct PhantomNode
|
||||
|
||||
bool IsValid(const unsigned number_of_nodes) const
|
||||
{
|
||||
return location.IsValid() &&
|
||||
((forward_segment_id.id < number_of_nodes) ||
|
||||
(reverse_segment_id.id < number_of_nodes)) &&
|
||||
return location.IsValid() && ((forward_segment_id.id < number_of_nodes) ||
|
||||
(reverse_segment_id.id < number_of_nodes)) &&
|
||||
((forward_weight != INVALID_EDGE_WEIGHT) ||
|
||||
(reverse_weight != INVALID_EDGE_WEIGHT)) &&
|
||||
((forward_duration != MAXIMAL_EDGE_DURATION) ||
|
||||
|
@ -186,7 +186,7 @@ void routingStep(const DataFacade<Algorithm> &facade,
|
||||
}
|
||||
|
||||
template <bool UseDuration>
|
||||
std::tuple<EdgeWeight,EdgeDistance> getLoopWeight(const DataFacade<Algorithm> &facade, NodeID node)
|
||||
std::tuple<EdgeWeight, EdgeDistance> getLoopWeight(const DataFacade<Algorithm> &facade, NodeID node)
|
||||
{
|
||||
EdgeWeight loop_weight = UseDuration ? MAXIMAL_EDGE_DURATION : INVALID_EDGE_WEIGHT;
|
||||
EdgeDistance loop_distance = MAXIMAL_EDGE_DISTANCE;
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
#include <tbb/parallel_sort.h>
|
||||
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
namespace osrm
|
||||
@ -88,10 +88,10 @@ NodeBasedDynamicGraphFromEdges(NodeID number_of_nodes,
|
||||
output_edge.data.flags = input_edge.flags;
|
||||
output_edge.data.annotation_data = input_edge.annotation_data;
|
||||
|
||||
|
||||
BOOST_ASSERT(output_edge.data.weight >= 0);
|
||||
BOOST_ASSERT(output_edge.data.duration >= 0);
|
||||
if (output_edge.data.distance <= 0) {
|
||||
if (output_edge.data.distance <= 0)
|
||||
{
|
||||
std::cout << "output_edge.data.distance " << output_edge.data.distance << std::endl;
|
||||
}
|
||||
BOOST_ASSERT(output_edge.data.distance >= 0);
|
||||
|
@ -555,21 +555,21 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
&scripting_environment,
|
||||
weight_multiplier,
|
||||
&conditional_restriction_map](
|
||||
// what nodes will be used? In most cases this will be the id
|
||||
// stored in the edge_data. In case of duplicated nodes (e.g.
|
||||
// due to via-way restrictions), one/both of these might
|
||||
// refer to a newly added edge based node
|
||||
const auto edge_based_node_from,
|
||||
const auto edge_based_node_to,
|
||||
// the situation of the turn
|
||||
const auto node_along_road_entering,
|
||||
const auto node_based_edge_from,
|
||||
const auto intersection_node,
|
||||
const auto node_based_edge_to,
|
||||
const auto &turn_angle,
|
||||
const auto &road_legs_on_the_right,
|
||||
const auto &road_legs_on_the_left,
|
||||
const auto &edge_geometries) {
|
||||
// what nodes will be used? In most cases this will be the id
|
||||
// stored in the edge_data. In case of duplicated nodes (e.g.
|
||||
// due to via-way restrictions), one/both of these might
|
||||
// refer to a newly added edge based node
|
||||
const auto edge_based_node_from,
|
||||
const auto edge_based_node_to,
|
||||
// the situation of the turn
|
||||
const auto node_along_road_entering,
|
||||
const auto node_based_edge_from,
|
||||
const auto intersection_node,
|
||||
const auto node_based_edge_to,
|
||||
const auto &turn_angle,
|
||||
const auto &road_legs_on_the_right,
|
||||
const auto &road_legs_on_the_left,
|
||||
const auto &edge_geometries) {
|
||||
const auto node_restricted =
|
||||
isRestricted(node_along_road_entering,
|
||||
intersection_node,
|
||||
@ -890,7 +890,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
// TODO: this loop is not optimized - once we have a few
|
||||
// overrides available, we should index this for faster
|
||||
// lookups
|
||||
for (auto &override : unresolved_maneuver_overrides)
|
||||
for (auto & override : unresolved_maneuver_overrides)
|
||||
{
|
||||
for (auto &turn : override.turn_sequence)
|
||||
{
|
||||
|
@ -277,8 +277,8 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
|
||||
{
|
||||
if (edge_iterator->result.osm_source_id < node_iterator->node_id)
|
||||
{
|
||||
util::Log(logDEBUG)
|
||||
<< "Found invalid node reference " << edge_iterator->result.source;
|
||||
util::Log(logDEBUG) << "Found invalid node reference "
|
||||
<< edge_iterator->result.source;
|
||||
edge_iterator->result.source = SPECIAL_NODEID;
|
||||
++edge_iterator;
|
||||
continue;
|
||||
@ -1038,9 +1038,8 @@ void ExtractionContainers::PrepareRestrictions()
|
||||
// translate the turn from one segment onto another into a node restriction (the ways can
|
||||
// only
|
||||
// be connected at a single location)
|
||||
auto const get_node_restriction_from_OSM_ids = [&](auto const from_id,
|
||||
auto const to_id,
|
||||
const OSMNodeID via_node) {
|
||||
auto const get_node_restriction_from_OSM_ids = [&](
|
||||
auto const from_id, auto const to_id, const OSMNodeID via_node) {
|
||||
auto const from_segment_itr = referenced_ways.find(from_id);
|
||||
if (from_segment_itr->second.way_id != from_id)
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ void ExtractorCallbacks::ProcessRestriction(const InputConditionalTurnRestrictio
|
||||
// util::Log() << restriction.toString();
|
||||
}
|
||||
|
||||
void ExtractorCallbacks::ProcessManeuverOverride(const InputManeuverOverride &override)
|
||||
void ExtractorCallbacks::ProcessManeuverOverride(const InputManeuverOverride & override)
|
||||
{
|
||||
external_memory.external_maneuver_overrides_list.push_back(override);
|
||||
}
|
||||
|
@ -185,18 +185,17 @@ void GraphCompressor::Compress(
|
||||
* just
|
||||
* like a barrier.
|
||||
*/
|
||||
const auto selectAnnotation =
|
||||
[&node_data_container](const AnnotationID front_annotation,
|
||||
const AnnotationID back_annotation) {
|
||||
// A lane has tags: u - (front) - v - (back) - w
|
||||
// During contraction, we keep only one of the tags. Usually the one closer
|
||||
// to the intersection is preferred. If its empty, however, we keep the
|
||||
// non-empty one
|
||||
if (node_data_container[back_annotation].lane_description_id ==
|
||||
INVALID_LANE_DESCRIPTIONID)
|
||||
return front_annotation;
|
||||
return back_annotation;
|
||||
};
|
||||
const auto selectAnnotation = [&node_data_container](
|
||||
const AnnotationID front_annotation, const AnnotationID back_annotation) {
|
||||
// A lane has tags: u - (front) - v - (back) - w
|
||||
// During contraction, we keep only one of the tags. Usually the one closer
|
||||
// to the intersection is preferred. If its empty, however, we keep the
|
||||
// non-empty one
|
||||
if (node_data_container[back_annotation].lane_description_id ==
|
||||
INVALID_LANE_DESCRIPTIONID)
|
||||
return front_annotation;
|
||||
return back_annotation;
|
||||
};
|
||||
|
||||
graph.GetEdgeData(forward_e1).annotation_data = selectAnnotation(
|
||||
fwd_edge_data1.annotation_data, fwd_edge_data2.annotation_data);
|
||||
|
@ -81,7 +81,10 @@ return_code parseArguments(int argc,
|
||||
"time-zone-file",
|
||||
boost::program_options::value<std::string>(&contractor_config.updater_config.tz_file_path),
|
||||
"Required for conditional turn restriction parsing, provide a geojson file containing "
|
||||
"time zone boundaries")("cache-distances",boost::program_options::bool_switch(&contractor_config.cache_distances)->default_value(false),
|
||||
"time zone boundaries")(
|
||||
"cache-distances",
|
||||
boost::program_options::bool_switch(&contractor_config.cache_distances)
|
||||
->default_value(false),
|
||||
"Store distances for CH edges, avoiding the need for query-time re-calculation.");
|
||||
|
||||
// hidden options, will be allowed on command line, but will not be shown to the user
|
||||
|
@ -51,7 +51,8 @@
|
||||
// return false;
|
||||
|
||||
// auto const &first_annotation = node_data_container[graph.GetEdgeData(first).annotation_data];
|
||||
// auto const &second_annotation = node_data_container[graph.GetEdgeData(second).annotation_data];
|
||||
// auto const &second_annotation =
|
||||
// node_data_container[graph.GetEdgeData(second).annotation_data];
|
||||
|
||||
// return first_annotation.CanCombineWith(second_annotation);
|
||||
// }
|
||||
|
@ -169,7 +169,8 @@ using Graph = util::NodeBasedDynamicGraph;
|
||||
// // 0
|
||||
// // ↙ ↑ ↘
|
||||
// // 4 5 6
|
||||
// const auto unit_edge = [](const NodeID from, const NodeID to, bool allowed, bool roundabout) {
|
||||
// const auto unit_edge = [](const NodeID from, const NodeID to, bool allowed, bool roundabout)
|
||||
// {
|
||||
// return InputEdge{from,
|
||||
// to,
|
||||
// 1,
|
||||
|
@ -15,7 +15,8 @@ BOOST_AUTO_TEST_CASE(timezoner_test)
|
||||
// const char json[] =
|
||||
// "{ \"type\" : \"FeatureCollection\", \"features\": ["
|
||||
// "{ \"type\" : \"Feature\","
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : { \"type\": \"polygon\", "
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : { \"type\":
|
||||
// \"polygon\", "
|
||||
// "\"coordinates\": [[[8.28369,48.88277], [8.57757, "
|
||||
// "48.88277], [8.57757, 49.07206], [8.28369, "
|
||||
// "49.07206], [8.28369, 48.88277]]] }} ]}";
|
||||
@ -29,7 +30,8 @@ BOOST_AUTO_TEST_CASE(timezoner_test)
|
||||
// const char bad[] =
|
||||
// "\"type\" : \"FeatureCollection\", \"features\": ["
|
||||
// "{ \"type\" : \"Feature\","
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : { \"type\": \"polygon\", "
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : { \"type\":
|
||||
// \"polygon\", "
|
||||
// "\"coordinates\": [[[8.28369,48.88277], [8.57757, "
|
||||
// "48.88277], [8.57757, 49.07206], [8.28369, "
|
||||
// "49.07206], [8.28369, 48.88277]]] }} ]}";
|
||||
@ -39,7 +41,8 @@ BOOST_AUTO_TEST_CASE(timezoner_test)
|
||||
// const char missing_type[] =
|
||||
// "{ \"FeatureCollection\", \"features\": ["
|
||||
// "{ \"type\" : \"Feature\","
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : { \"type\": \"polygon\", "
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : { \"type\":
|
||||
// \"polygon\", "
|
||||
// "\"coordinates\": [[[8.28369,48.88277], [8.57757, "
|
||||
// "48.88277], [8.57757, 49.07206], [8.28369, "
|
||||
// "49.07206], [8.28369, 48.88277]]] }} ]}";
|
||||
@ -48,7 +51,8 @@ BOOST_AUTO_TEST_CASE(timezoner_test)
|
||||
// const char missing_featc[] =
|
||||
// "{ \"type\" : \"Collection\", \"features\": ["
|
||||
// "{ \"type\" : \"Feature\","
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : { \"type\": \"polygon\", "
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : { \"type\":
|
||||
// \"polygon\", "
|
||||
// "\"coordinates\": [[[8.28369,48.88277], [8.57757, "
|
||||
// "48.88277], [8.57757, 49.07206], [8.28369, "
|
||||
// "49.07206], [8.28369, 48.88277]]] }} ]}";
|
||||
|
@ -74,7 +74,8 @@ BOOST_AUTO_TEST_CASE(timezone_validation_test)
|
||||
// BOOST_CHECK_THROW(util::validateFeature(doc), util::exception);
|
||||
|
||||
// char tzid_err[] = "{ \"type\" : \"Feature\","
|
||||
// "\"properties\" : { \"TZID\" : []}, \"geometry\" : { \"type\": \"polygon\", "
|
||||
// "\"properties\" : { \"TZID\" : []}, \"geometry\" : { \"type\": \"polygon\",
|
||||
// "
|
||||
// "\"coordinates\": [[[8.28369,48.88277], [8.57757, "
|
||||
// "48.88277], [8.57757, 49.07206], [8.28369, "
|
||||
// "49.07206], [8.28369, 48.88277]]] }}";
|
||||
@ -92,7 +93,8 @@ BOOST_AUTO_TEST_CASE(timezone_validation_test)
|
||||
|
||||
// char nonobj_geom[] =
|
||||
// "{ \"type\" : \"Feature\","
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : [ \"type\", \"polygon\", "
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : [ \"type\",
|
||||
// \"polygon\", "
|
||||
// "\"coordinates\", [[[8.28369,48.88277], [8.57757, "
|
||||
// "48.88277], [8.57757, 49.07206], [8.28369, "
|
||||
// "49.07206], [8.28369, 48.88277]]] ]}";
|
||||
@ -100,7 +102,8 @@ BOOST_AUTO_TEST_CASE(timezone_validation_test)
|
||||
// BOOST_CHECK_THROW(util::validateFeature(doc), util::exception);
|
||||
|
||||
// char missing_geom_type[] = "{ \"type\" : \"Feature\","
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : { "
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" :
|
||||
// { "
|
||||
// "\"no_type\": \"polygon\", "
|
||||
// "\"coordinates\": [[[8.28369,48.88277], [8.57757, "
|
||||
// "48.88277], [8.57757, 49.07206], [8.28369, "
|
||||
@ -109,7 +112,8 @@ BOOST_AUTO_TEST_CASE(timezone_validation_test)
|
||||
// BOOST_CHECK_THROW(util::validateFeature(doc), util::exception);
|
||||
|
||||
// char nonstring_geom_type[] = "{ \"type\" : \"Feature\","
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : "
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\"
|
||||
// : "
|
||||
// "{ \"type\": [\"polygon\"], "
|
||||
// "\"coordinates\": [[[8.28369,48.88277], [8.57757, "
|
||||
// "48.88277], [8.57757, 49.07206], [8.28369, "
|
||||
@ -119,7 +123,8 @@ BOOST_AUTO_TEST_CASE(timezone_validation_test)
|
||||
|
||||
// char missing_coords[] =
|
||||
// "{ \"type\" : \"Feature\","
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : { \"type\": \"polygon\", "
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : { \"type\":
|
||||
// \"polygon\", "
|
||||
// "\"coords\": [[[8.28369,48.88277], [8.57757, "
|
||||
// "48.88277], [8.57757, 49.07206], [8.28369, "
|
||||
// "49.07206], [8.28369, 48.88277]]] }}";
|
||||
@ -128,7 +133,8 @@ BOOST_AUTO_TEST_CASE(timezone_validation_test)
|
||||
|
||||
// char missing_outerring[] =
|
||||
// "{ \"type\" : \"Feature\","
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : { \"type\": \"polygon\", "
|
||||
// "\"properties\" : { \"TZID\" : \"Europe/Berlin\"}, \"geometry\" : { \"type\":
|
||||
// \"polygon\", "
|
||||
// "\"coordinates\": [[8.28369,48.88277], [8.57757, "
|
||||
// "48.88277], [8.57757, 49.07206], [8.28369, "
|
||||
// "49.07206], [8.28369, 48.88277]] }}";
|
||||
|
Loading…
Reference in New Issue
Block a user