move split_edges to global properties

This commit is contained in:
Michael Krasnyk 2017-03-29 23:48:57 +02:00
parent 57d3f71bf9
commit 2cd4ba9a0a
8 changed files with 14 additions and 12 deletions

View File

@ -11,7 +11,7 @@
- .osrm.edge_lookup was removed. The option `--generate-edge-lookup` does nothing now.
- `osrm-contract` does not depend on the `.osrm.fileIndex` file anymore
- Profiles
- Added `split_edges` flag in extracted ways. True value guarantees that segment_function will be called for all segments, but also could double memory consumption
- Added `force_split_edges` flag to global properties. True value guarantees that segment_function will be called for all segments, but also could double memory consumption
# 5.6.3
- Changes from 5.6.0

View File

@ -36,6 +36,7 @@ use_turn_restrictions | Boolean | Are turn instructions followed?
continue_straight_at_waypoint | Boolean | Must the route continue straight on at a via point, or are U-turns allowed?
max_speed_for_map_matching | Float | Maximum vehicle speed to be assumed in matching (in m/s)
max_turn_weight | Float | Maximum turn penalty weight
force_split_edges | Boolean | True value forces a split of forward and backward edges of extracted ways and guarantees that segment_function will be called for all segments
## way_function
@ -64,7 +65,6 @@ backward_restricted | Boolean | " "
is_startpoint | Boolean | Can a journey start on this way? (e.g. ferry; if false, prevents snapping the start point to this way)
roundabout | Boolean | Is this part of a roundabout?
circular | Boolean | Is this part of a non-roundabout circular junction?
split_edges | Boolean | True value forces a split of forward and backward edges of the way and guarantees that segment_function will be called for all segments
name | String | Name of the way
ref | String | Road number
pronunciation | String | Name pronunciation

View File

@ -60,7 +60,6 @@ struct ExtractionWay
road_classification = guidance::RoadClassification();
backward_restricted = false;
forward_restricted = false;
split_edges = false;
}
// wrappers to allow assigning nil (nullptr) to string values
@ -107,7 +106,6 @@ struct ExtractionWay
bool is_startpoint : 1;
bool forward_restricted : 1;
bool backward_restricted : 1;
bool split_edges : 1;
};
}
}

View File

@ -63,6 +63,7 @@ class ExtractorCallbacks
guidance::LaneDescriptionMap lane_description_map;
ExtractionContainers &external_memory;
bool fallback_to_duration;
bool force_split_edges;
public:
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers,

View File

@ -87,6 +87,7 @@ struct ProfileProperties
//! stores the name of the weight (e.g. 'duration', 'distance', 'safety')
char weight_name[MAX_WEIGHT_NAME_LENGTH + 1];
unsigned weight_precision = 1;
bool force_split_edges = false;
};
}
}

View File

@ -1,6 +1,8 @@
api_version = 1
-- Rasterbot profile
properties.force_split_edges = true
-- Minimalist node_ and way_functions in order to test source_ and segment_functions
function node_function (node, result)
@ -19,7 +21,6 @@ function way_function (way, result)
result.forward_speed = 15
result.backward_speed = 15
result.split_edges = true
end
function source_function ()

View File

@ -35,7 +35,9 @@ namespace TurnLaneType = guidance::TurnLaneType;
ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers &extraction_containers_,
const ProfileProperties &properties)
: external_memory(extraction_containers_), fallback_to_duration(properties.fallback_to_duration)
: external_memory(extraction_containers_),
fallback_to_duration(properties.fallback_to_duration),
force_split_edges(properties.force_split_edges)
{
// we reserved 0, 1, 2, 3 for the empty case
string_map[MapKey("", "", "", "")] = 0;
@ -325,7 +327,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
// split an edge into two edges if forwards/backwards behavior differ
const bool split_edge =
in_forward_direction && in_backward_direction &&
(parsed_way.split_edges || (parsed_way.forward_rate != parsed_way.backward_rate) ||
(force_split_edges || (parsed_way.forward_rate != parsed_way.backward_rate) ||
(parsed_way.forward_speed != parsed_way.backward_speed) ||
(parsed_way.forward_travel_mode != parsed_way.backward_travel_mode) ||
(turn_lane_id_forward != turn_lane_id_backward));

View File

@ -247,7 +247,9 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
"weight_name",
sol::property(&ProfileProperties::SetWeightName, &ProfileProperties::GetWeightName),
"max_turn_weight",
sol::property(&ProfileProperties::GetMaxTurnWeight));
sol::property(&ProfileProperties::GetMaxTurnWeight),
"force_split_edges",
&ProfileProperties::force_split_edges);
context.state.new_usertype<std::vector<std::string>>(
"vector",
@ -356,10 +358,7 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
[](ExtractionWay &way, bool flag) { way.forward_restricted = flag; }),
"backward_restricted",
sol::property([](const ExtractionWay &way) { return way.backward_restricted; },
[](ExtractionWay &way, bool flag) { way.backward_restricted = flag; }),
"split_edges",
sol::property([](const ExtractionWay &way) { return way.split_edges; },
[](ExtractionWay &way, bool flag) { way.split_edges = flag; }));
[](ExtractionWay &way, bool flag) { way.backward_restricted = flag; }));
context.state.new_usertype<ExtractionSegment>("ExtractionSegment",
"source",