Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ae01a1ad6a | |||
| abaa47458b | |||
| ce5afb7334 | |||
| 82dc092ca0 | |||
| 31b6e4b2c3 |
@@ -10,8 +10,6 @@
|
||||
- .osrm.datasource_index file was removed. Data is now part of .osrm.geometries.
|
||||
- .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 `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
|
||||
|
||||
@@ -36,7 +36,6 @@ 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
|
||||
|
||||
|
||||
+9
-13
@@ -32,25 +32,21 @@ We may introduce forward-compatible changes: query parameters and response prope
|
||||
|
||||
- The `master` branch is for the bleeding edge development
|
||||
- We create and maintain release branches `x.y` to control the release flow
|
||||
- We create the release branch once we create release branches once we want to release the first RC
|
||||
- RCs go in the release branch, commits needs to be cherry-picked from master
|
||||
- We create the release branch once we tagged the final version `x.y.0` version, RCs go on master
|
||||
- No minor or major version will be released without a code-equal release candidates
|
||||
- For quality assurance, release candidates need to be staged beforing tagging a final release
|
||||
- For quality assurance, release candidates will be run on the demo server for 24 hours before releaseing the version proper
|
||||
- Patch versions may be released without a release candidate
|
||||
- We may backport fixes to older versions and release them as patch versions
|
||||
|
||||
## Releasing a version
|
||||
|
||||
1. Check out the appropriate release branch `x.y`
|
||||
2. Make sure `CHANGELOG.md` is up to date.
|
||||
3. Make sure the OSRM version in `CMakeLists.txt` is up to date
|
||||
4. Make sure the `package.json` is up to date.
|
||||
5. Make sure all tests are passing (e.g. Travis CI gives you a :thumbs_up:)
|
||||
6. Use an annotated tag to mark the release: `git tag vx.y.z -a` Body of the tag description should be the changelog entries.
|
||||
7. Use `npm run build-api-docs` to generate the API documentation. Copy `build/docs/*` to `https://github.com/Project-OSRM/project-osrm.github.com` in the `docs/vN.N.N/api` directory
|
||||
8. Push tags and commits: `git push; git push --tags`
|
||||
2. Make sure all tests are passing (e.g. Travis CI gives you a :thumbs_up:)
|
||||
3. Make sure `CHANGELOG.md` is up to date.
|
||||
4. Make sure the OSRM version in `CMakeLists.txt` is up to date
|
||||
5. Use an annotated tag to mark the release: `git tag vx.y.z -a` Body of the tag description should be the changelog entries.
|
||||
6. Use `npm run build-api-docs` to generate the API documentation. Copy `build/docs/*` to `https://github.com/Project-OSRM/project-osrm.github.com` in the `docs/vN.N.N/api` directory
|
||||
6. Push tags and commits: `git push; git push --tags`
|
||||
8. Proceede with the `node-osrm` release as [outlined in the repository](https://github.com/Project-OSRM/node-osrm/blob/master/docs/releasing.md).
|
||||
9. If not a release-candidate: Write a mailing-list post to osrm-talk@openstreetmap.org to announce the release
|
||||
10. Wait until the travis build has been completed and check if the node binaries were published by doing:
|
||||
`rm -rf node_modules && npm install` locally.
|
||||
11. For final releases run `npm publish` or `npm publish --tag next` for release candidates.
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
Feature: osrm-extract with a profile containing raster source
|
||||
Scenario: osrm-extract on a valid profile
|
||||
Given the profile "rasterbot"
|
||||
And the node locations
|
||||
| node | lat | lon |
|
||||
| a | 0.1 | 0.1 |
|
||||
| b | 0.05 | 0.1 |
|
||||
And the node map
|
||||
"""
|
||||
a b
|
||||
"""
|
||||
And the ways
|
||||
| nodes |
|
||||
| ab |
|
||||
@@ -20,6 +20,4 @@ Feature: osrm-extract with a profile containing raster source
|
||||
And the data has been saved to disk
|
||||
When I run "osrm-extract {osm_file} -p {profile_file}"
|
||||
Then stdout should contain "source loader"
|
||||
Then stdout should contain "slope: 0.0899"
|
||||
Then stdout should contain "slope: -0.0899"
|
||||
And it should exit successfully
|
||||
|
||||
@@ -50,9 +50,8 @@ Feature: Raster - weights
|
||||
And I route I should get
|
||||
| from | to | route | speed |
|
||||
| a | b | ab,ab | 8 km/h |
|
||||
| b | a | ab,ab | 22 km/h |
|
||||
| a | c | ab,bc,bc | 12 km/h |
|
||||
| b | c | bc,bc | 22 km/h |
|
||||
| a | c | ad,dc,dc | 15 km/h |
|
||||
| b | c | bc,bc | 8 km/h |
|
||||
| a | d | ad,ad | 15 km/h |
|
||||
| d | c | dc,dc | 15 km/h |
|
||||
| d | e | de,de | 10 km/h |
|
||||
|
||||
@@ -62,6 +62,13 @@ struct ExtractionWay
|
||||
forward_restricted = false;
|
||||
}
|
||||
|
||||
// These accessors exists because it's not possible to take the address of a bitfield,
|
||||
// and LUA therefore cannot read/write the mode attributes directly.
|
||||
void set_forward_mode(const TravelMode m) { forward_travel_mode = m; }
|
||||
TravelMode get_forward_mode() const { return forward_travel_mode; }
|
||||
void set_backward_mode(const TravelMode m) { backward_travel_mode = m; }
|
||||
TravelMode get_backward_mode() const { return backward_travel_mode; }
|
||||
|
||||
// wrappers to allow assigning nil (nullptr) to string values
|
||||
void SetName(const char *value) { detail::maybeSetString(name, value); }
|
||||
const char *GetName() const { return name.c_str(); }
|
||||
@@ -98,14 +105,14 @@ struct ExtractionWay
|
||||
std::string destinations;
|
||||
std::string turn_lanes_forward;
|
||||
std::string turn_lanes_backward;
|
||||
guidance::RoadClassification road_classification;
|
||||
bool roundabout;
|
||||
bool circular;
|
||||
bool is_startpoint;
|
||||
bool backward_restricted;
|
||||
bool forward_restricted;
|
||||
TravelMode forward_travel_mode : 4;
|
||||
TravelMode backward_travel_mode : 4;
|
||||
bool roundabout : 1;
|
||||
bool circular : 1;
|
||||
bool is_startpoint : 1;
|
||||
bool forward_restricted : 1;
|
||||
bool backward_restricted : 1;
|
||||
guidance::RoadClassification road_classification;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ class ExtractorCallbacks
|
||||
guidance::LaneDescriptionMap lane_description_map;
|
||||
ExtractionContainers &external_memory;
|
||||
bool fallback_to_duration;
|
||||
bool force_split_edges;
|
||||
|
||||
public:
|
||||
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers,
|
||||
|
||||
@@ -87,7 +87,6 @@ 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;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,13 +112,7 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
|
||||
auto params = Nan::To<v8::Object>(args[0]).ToLocalChecked();
|
||||
|
||||
auto path = params->Get(Nan::New("path").ToLocalChecked());
|
||||
if (path.IsEmpty())
|
||||
return engine_config_ptr();
|
||||
|
||||
auto shared_memory = params->Get(Nan::New("shared_memory").ToLocalChecked());
|
||||
if (shared_memory.IsEmpty())
|
||||
return engine_config_ptr();
|
||||
|
||||
if (!path->IsUndefined())
|
||||
{
|
||||
engine_config->storage_config =
|
||||
@@ -146,9 +140,6 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
|
||||
}
|
||||
|
||||
auto algorithm = params->Get(Nan::New("algorithm").ToLocalChecked());
|
||||
if (algorithm.IsEmpty())
|
||||
return engine_config_ptr();
|
||||
|
||||
if (algorithm->IsString())
|
||||
{
|
||||
auto algorithm_str = Nan::To<v8::String>(algorithm).ToLocalChecked();
|
||||
@@ -189,8 +180,6 @@ parseCoordinateArray(const v8::Local<v8::Array> &coordinates_array)
|
||||
for (uint32_t i = 0; i < coordinates_array->Length(); ++i)
|
||||
{
|
||||
v8::Local<v8::Value> coordinate = coordinates_array->Get(i);
|
||||
if (coordinate.IsEmpty())
|
||||
return resulting_coordinates;
|
||||
|
||||
if (!coordinate->IsArray())
|
||||
{
|
||||
@@ -258,9 +247,6 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
v8::Local<v8::Object> obj = Nan::To<v8::Object>(args[0]).ToLocalChecked();
|
||||
|
||||
v8::Local<v8::Value> coordinates = obj->Get(Nan::New("coordinates").ToLocalChecked());
|
||||
if (coordinates.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (coordinates->IsUndefined())
|
||||
{
|
||||
Nan::ThrowError("Must provide a coordinates property");
|
||||
@@ -301,8 +287,6 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
if (obj->Has(Nan::New("bearings").ToLocalChecked()))
|
||||
{
|
||||
v8::Local<v8::Value> bearings = obj->Get(Nan::New("bearings").ToLocalChecked());
|
||||
if (bearings.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (!bearings->IsArray())
|
||||
{
|
||||
@@ -321,8 +305,6 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
for (uint32_t i = 0; i < bearings_array->Length(); ++i)
|
||||
{
|
||||
v8::Local<v8::Value> bearing_raw = bearings_array->Get(i);
|
||||
if (bearing_raw.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (bearing_raw->IsNull())
|
||||
{
|
||||
@@ -367,8 +349,6 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
if (obj->Has(Nan::New("hints").ToLocalChecked()))
|
||||
{
|
||||
v8::Local<v8::Value> hints = obj->Get(Nan::New("hints").ToLocalChecked());
|
||||
if (hints.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (!hints->IsArray())
|
||||
{
|
||||
@@ -387,9 +367,6 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
for (uint32_t i = 0; i < hints_array->Length(); ++i)
|
||||
{
|
||||
v8::Local<v8::Value> hint = hints_array->Get(i);
|
||||
if (hint.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (hint->IsString())
|
||||
{
|
||||
if (hint->ToString()->Length() == 0)
|
||||
@@ -416,8 +393,6 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
if (obj->Has(Nan::New("radiuses").ToLocalChecked()))
|
||||
{
|
||||
v8::Local<v8::Value> radiuses = obj->Get(Nan::New("radiuses").ToLocalChecked());
|
||||
if (radiuses.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (!radiuses->IsArray())
|
||||
{
|
||||
@@ -436,9 +411,6 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
for (uint32_t i = 0; i < radiuses_array->Length(); ++i)
|
||||
{
|
||||
v8::Local<v8::Value> radius = radiuses_array->Get(i);
|
||||
if (radius.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (radius->IsNull())
|
||||
{
|
||||
params->radiuses.emplace_back();
|
||||
@@ -458,8 +430,6 @@ inline bool argumentsToParameter(const Nan::FunctionCallbackInfo<v8::Value> &arg
|
||||
if (obj->Has(Nan::New("generate_hints").ToLocalChecked()))
|
||||
{
|
||||
v8::Local<v8::Value> generate_hints = obj->Get(Nan::New("generate_hints").ToLocalChecked());
|
||||
if (generate_hints.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (!generate_hints->IsBoolean())
|
||||
{
|
||||
@@ -479,9 +449,6 @@ inline bool parseCommonParameters(const v8::Local<v8::Object> &obj, ParamType &p
|
||||
if (obj->Has(Nan::New("steps").ToLocalChecked()))
|
||||
{
|
||||
auto steps = obj->Get(Nan::New("steps").ToLocalChecked());
|
||||
if (steps.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (steps->IsBoolean())
|
||||
{
|
||||
params->steps = steps->BooleanValue();
|
||||
@@ -496,9 +463,6 @@ inline bool parseCommonParameters(const v8::Local<v8::Object> &obj, ParamType &p
|
||||
if (obj->Has(Nan::New("annotations").ToLocalChecked()))
|
||||
{
|
||||
auto annotations = obj->Get(Nan::New("annotations").ToLocalChecked());
|
||||
if (annotations.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (annotations->IsBoolean())
|
||||
{
|
||||
params->annotations = annotations->BooleanValue();
|
||||
@@ -559,8 +523,6 @@ inline bool parseCommonParameters(const v8::Local<v8::Object> &obj, ParamType &p
|
||||
if (obj->Has(Nan::New("geometries").ToLocalChecked()))
|
||||
{
|
||||
v8::Local<v8::Value> geometries = obj->Get(Nan::New("geometries").ToLocalChecked());
|
||||
if (geometries.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (!geometries->IsString())
|
||||
{
|
||||
@@ -593,8 +555,6 @@ inline bool parseCommonParameters(const v8::Local<v8::Object> &obj, ParamType &p
|
||||
if (obj->Has(Nan::New("overview").ToLocalChecked()))
|
||||
{
|
||||
v8::Local<v8::Value> overview = obj->Get(Nan::New("overview").ToLocalChecked());
|
||||
if (overview.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (!overview->IsString())
|
||||
{
|
||||
@@ -641,13 +601,9 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
if (obj->Has(Nan::New("continue_straight").ToLocalChecked()))
|
||||
{
|
||||
auto value = obj->Get(Nan::New("continue_straight").ToLocalChecked());
|
||||
if (value.IsEmpty())
|
||||
return route_parameters_ptr();
|
||||
|
||||
if (!value->IsBoolean() && !value->IsNull())
|
||||
{
|
||||
Nan::ThrowError("'continue_straight' parama must be boolean or null");
|
||||
return route_parameters_ptr();
|
||||
}
|
||||
if (value->IsBoolean())
|
||||
{
|
||||
@@ -658,13 +614,9 @@ argumentsToRouteParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
if (obj->Has(Nan::New("alternatives").ToLocalChecked()))
|
||||
{
|
||||
auto value = obj->Get(Nan::New("alternatives").ToLocalChecked());
|
||||
if (value.IsEmpty())
|
||||
return route_parameters_ptr();
|
||||
|
||||
if (!value->IsBoolean())
|
||||
{
|
||||
Nan::ThrowError("'alternatives' parama must be boolean");
|
||||
return route_parameters_ptr();
|
||||
}
|
||||
params->alternatives = value->BooleanValue();
|
||||
}
|
||||
@@ -706,8 +658,6 @@ argumentsToTileParameters(const Nan::FunctionCallbackInfo<v8::Value> &args, bool
|
||||
v8::Local<v8::Value> x = array->Get(0);
|
||||
v8::Local<v8::Value> y = array->Get(1);
|
||||
v8::Local<v8::Value> z = array->Get(2);
|
||||
if (x.IsEmpty() || y.IsEmpty() || z.IsEmpty())
|
||||
return tile_parameters_ptr();
|
||||
|
||||
if (!x->IsUint32() && !x->IsUndefined())
|
||||
{
|
||||
@@ -748,8 +698,6 @@ argumentsToNearestParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
return nearest_parameters_ptr();
|
||||
|
||||
v8::Local<v8::Object> obj = Nan::To<v8::Object>(args[0]).ToLocalChecked();
|
||||
if (obj.IsEmpty())
|
||||
return nearest_parameters_ptr();
|
||||
|
||||
if (obj->Has(Nan::New("number").ToLocalChecked()))
|
||||
{
|
||||
@@ -787,14 +735,10 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
return table_parameters_ptr();
|
||||
|
||||
v8::Local<v8::Object> obj = Nan::To<v8::Object>(args[0]).ToLocalChecked();
|
||||
if (obj.IsEmpty())
|
||||
return table_parameters_ptr();
|
||||
|
||||
if (obj->Has(Nan::New("sources").ToLocalChecked()))
|
||||
{
|
||||
v8::Local<v8::Value> sources = obj->Get(Nan::New("sources").ToLocalChecked());
|
||||
if (sources.IsEmpty())
|
||||
return table_parameters_ptr();
|
||||
|
||||
if (!sources->IsArray())
|
||||
{
|
||||
@@ -806,9 +750,6 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
for (uint32_t i = 0; i < sources_array->Length(); ++i)
|
||||
{
|
||||
v8::Local<v8::Value> source = sources_array->Get(i);
|
||||
if (source.IsEmpty())
|
||||
return table_parameters_ptr();
|
||||
|
||||
if (source->IsUint32())
|
||||
{
|
||||
size_t source_value = static_cast<size_t>(source->NumberValue());
|
||||
@@ -832,8 +773,6 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
if (obj->Has(Nan::New("destinations").ToLocalChecked()))
|
||||
{
|
||||
v8::Local<v8::Value> destinations = obj->Get(Nan::New("destinations").ToLocalChecked());
|
||||
if (destinations.IsEmpty())
|
||||
return table_parameters_ptr();
|
||||
|
||||
if (!destinations->IsArray())
|
||||
{
|
||||
@@ -845,9 +784,6 @@ argumentsToTableParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
for (uint32_t i = 0; i < destinations_array->Length(); ++i)
|
||||
{
|
||||
v8::Local<v8::Value> destination = destinations_array->Get(i);
|
||||
if (destination.IsEmpty())
|
||||
return table_parameters_ptr();
|
||||
|
||||
if (destination->IsUint32())
|
||||
{
|
||||
size_t destination_value = static_cast<size_t>(destination->NumberValue());
|
||||
@@ -891,9 +827,6 @@ argumentsToTripParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
if (obj->Has(Nan::New("roundtrip").ToLocalChecked()))
|
||||
{
|
||||
auto roundtrip = obj->Get(Nan::New("roundtrip").ToLocalChecked());
|
||||
if (roundtrip.IsEmpty())
|
||||
return trip_parameters_ptr();
|
||||
|
||||
if (roundtrip->IsBoolean())
|
||||
{
|
||||
params->roundtrip = roundtrip->BooleanValue();
|
||||
@@ -908,8 +841,6 @@ argumentsToTripParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
if (obj->Has(Nan::New("source").ToLocalChecked()))
|
||||
{
|
||||
v8::Local<v8::Value> source = obj->Get(Nan::New("source").ToLocalChecked());
|
||||
if (source.IsEmpty())
|
||||
return trip_parameters_ptr();
|
||||
|
||||
if (!source->IsString())
|
||||
{
|
||||
@@ -937,8 +868,6 @@ argumentsToTripParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
if (obj->Has(Nan::New("destination").ToLocalChecked()))
|
||||
{
|
||||
v8::Local<v8::Value> destination = obj->Get(Nan::New("destination").ToLocalChecked());
|
||||
if (destination.IsEmpty())
|
||||
return trip_parameters_ptr();
|
||||
|
||||
if (!destination->IsString())
|
||||
{
|
||||
@@ -980,8 +909,6 @@ argumentsToMatchParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
if (obj->Has(Nan::New("timestamps").ToLocalChecked()))
|
||||
{
|
||||
v8::Local<v8::Value> timestamps = obj->Get(Nan::New("timestamps").ToLocalChecked());
|
||||
if (timestamps.IsEmpty())
|
||||
return match_parameters_ptr();
|
||||
|
||||
if (!timestamps->IsArray())
|
||||
{
|
||||
@@ -1001,9 +928,6 @@ argumentsToMatchParameter(const Nan::FunctionCallbackInfo<v8::Value> &args,
|
||||
for (uint32_t i = 0; i < timestamps_array->Length(); ++i)
|
||||
{
|
||||
v8::Local<v8::Value> timestamp = timestamps_array->Get(i);
|
||||
if (timestamp.IsEmpty())
|
||||
return match_parameters_ptr();
|
||||
|
||||
if (!timestamp->IsNumber())
|
||||
{
|
||||
Nan::ThrowError("Timestamps array items must be numbers");
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "osrm",
|
||||
"version": "5.7.0-latest.2",
|
||||
"version": "5.7.0-latest.1",
|
||||
"private": false,
|
||||
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
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)
|
||||
@@ -48,7 +46,7 @@ function segment_function (segment)
|
||||
local scaled_duration = segment.duration
|
||||
|
||||
if sourceData.datum ~= invalid and targetData.datum ~= invalid then
|
||||
local slope = (targetData.datum - sourceData.datum) / segment.distance
|
||||
local slope = math.abs(sourceData.datum - targetData.datum) / segment.distance
|
||||
scaled_weight = scaled_weight / (1.0 - (slope * 5.0))
|
||||
scaled_duration = scaled_duration / (1.0 - (slope * 5.0))
|
||||
io.write(" slope: " .. slope .. "\n")
|
||||
|
||||
@@ -388,24 +388,21 @@ void ExtractionContainers::PrepareEdges(ScriptingEnvironment &scripting_environm
|
||||
BOOST_ASSERT(edge_iterator->source_coordinate.lon !=
|
||||
util::FixedLongitude{std::numeric_limits<std::int32_t>::min()});
|
||||
|
||||
util::Coordinate source_coord(edge_iterator->source_coordinate);
|
||||
util::Coordinate target_coord{node_iterator->lon, node_iterator->lat};
|
||||
const util::Coordinate target_coord{node_iterator->lon, node_iterator->lat};
|
||||
const double distance = util::coordinate_calculation::greatCircleDistance(
|
||||
edge_iterator->source_coordinate, target_coord);
|
||||
|
||||
// flip source and target coordinates if segment is in backward direction only
|
||||
if (!edge_iterator->result.forward && edge_iterator->result.backward)
|
||||
std::swap(source_coord, target_coord);
|
||||
auto weight = edge_iterator->weight_data(distance);
|
||||
auto duration = edge_iterator->duration_data(distance);
|
||||
|
||||
const auto distance =
|
||||
util::coordinate_calculation::greatCircleDistance(source_coord, target_coord);
|
||||
const auto weight = edge_iterator->weight_data(distance);
|
||||
const auto duration = edge_iterator->duration_data(distance);
|
||||
|
||||
ExtractionSegment segment(source_coord, target_coord, distance, weight, duration);
|
||||
scripting_environment.ProcessSegment(segment);
|
||||
ExtractionSegment extracted_segment(
|
||||
edge_iterator->source_coordinate, target_coord, distance, weight, duration);
|
||||
scripting_environment.ProcessSegment(extracted_segment);
|
||||
|
||||
auto &edge = edge_iterator->result;
|
||||
edge.weight = std::max<EdgeWeight>(1, std::round(segment.weight * weight_multiplier));
|
||||
edge.duration = std::max<EdgeWeight>(1, std::round(segment.duration * 10.));
|
||||
edge.weight =
|
||||
std::max<EdgeWeight>(1, std::round(extracted_segment.weight * weight_multiplier));
|
||||
edge.duration = std::max<EdgeWeight>(1, std::round(extracted_segment.duration * 10.));
|
||||
|
||||
// assign new node id
|
||||
auto id_iter = external_to_internal_node_id_map.find(node_iterator->node_id);
|
||||
|
||||
@@ -35,9 +35,7 @@ namespace TurnLaneType = guidance::TurnLaneType;
|
||||
|
||||
ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers &extraction_containers_,
|
||||
const ProfileProperties &properties)
|
||||
: external_memory(extraction_containers_),
|
||||
fallback_to_duration(properties.fallback_to_duration),
|
||||
force_split_edges(properties.force_split_edges)
|
||||
: external_memory(extraction_containers_), fallback_to_duration(properties.fallback_to_duration)
|
||||
{
|
||||
// we reserved 0, 1, 2, 3 for the empty case
|
||||
string_map[MapKey("", "", "", "")] = 0;
|
||||
@@ -325,15 +323,14 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
|
||||
(parsed_way.backward_travel_mode != TRAVEL_MODE_INACCESSIBLE);
|
||||
|
||||
// split an edge into two edges if forwards/backwards behavior differ
|
||||
const bool split_edge =
|
||||
in_forward_direction && in_backward_direction &&
|
||||
(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));
|
||||
const bool split_edge = in_forward_direction && in_backward_direction &&
|
||||
((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));
|
||||
|
||||
if (in_forward_direction)
|
||||
{ // add (forward) segments or (forward,backward) for non-split edges in backward direction
|
||||
{
|
||||
util::for_each_pair(
|
||||
nodes.cbegin(),
|
||||
nodes.cend(),
|
||||
@@ -358,8 +355,8 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
|
||||
});
|
||||
}
|
||||
|
||||
if (in_backward_direction && (!in_forward_direction || split_edge))
|
||||
{ // add (backward) segments for split edges or not in forward direction
|
||||
if (in_backward_direction || split_edge)
|
||||
{
|
||||
util::for_each_pair(
|
||||
nodes.cbegin(),
|
||||
nodes.cend(),
|
||||
|
||||
@@ -247,9 +247,7 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
||||
"weight_name",
|
||||
sol::property(&ProfileProperties::SetWeightName, &ProfileProperties::GetWeightName),
|
||||
"max_turn_weight",
|
||||
sol::property(&ProfileProperties::GetMaxTurnWeight),
|
||||
"force_split_edges",
|
||||
&ProfileProperties::force_split_edges);
|
||||
sol::property(&ProfileProperties::GetMaxTurnWeight));
|
||||
|
||||
context.state.new_usertype<std::vector<std::string>>(
|
||||
"vector",
|
||||
@@ -332,6 +330,12 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
||||
sol::property(&ExtractionWay::GetTurnLanesForward, &ExtractionWay::SetTurnLanesForward),
|
||||
"turn_lanes_backward",
|
||||
sol::property(&ExtractionWay::GetTurnLanesBackward, &ExtractionWay::SetTurnLanesBackward),
|
||||
"roundabout",
|
||||
&ExtractionWay::roundabout,
|
||||
"circular",
|
||||
&ExtractionWay::circular,
|
||||
"is_startpoint",
|
||||
&ExtractionWay::is_startpoint,
|
||||
"duration",
|
||||
&ExtractionWay::duration,
|
||||
"weight",
|
||||
@@ -339,26 +343,13 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
||||
"road_classification",
|
||||
&ExtractionWay::road_classification,
|
||||
"forward_mode",
|
||||
sol::property([](const ExtractionWay &way) { return way.forward_travel_mode; },
|
||||
[](ExtractionWay &way, TravelMode mode) { way.forward_travel_mode = mode; }),
|
||||
sol::property(&ExtractionWay::get_forward_mode, &ExtractionWay::set_forward_mode),
|
||||
"backward_mode",
|
||||
sol::property([](const ExtractionWay &way) { return way.backward_travel_mode; },
|
||||
[](ExtractionWay &way, TravelMode mode) { way.backward_travel_mode = mode; }),
|
||||
"roundabout",
|
||||
sol::property([](const ExtractionWay &way) { return way.roundabout; },
|
||||
[](ExtractionWay &way, bool flag) { way.roundabout = flag; }),
|
||||
"circular",
|
||||
sol::property([](const ExtractionWay &way) { return way.circular; },
|
||||
[](ExtractionWay &way, bool flag) { way.circular = flag; }),
|
||||
"is_startpoint",
|
||||
sol::property([](const ExtractionWay &way) { return way.is_startpoint; },
|
||||
[](ExtractionWay &way, bool flag) { way.is_startpoint = flag; }),
|
||||
sol::property(&ExtractionWay::get_backward_mode, &ExtractionWay::set_backward_mode),
|
||||
"forward_restricted",
|
||||
sol::property([](const ExtractionWay &way) { return way.forward_restricted; },
|
||||
[](ExtractionWay &way, bool flag) { way.forward_restricted = flag; }),
|
||||
&ExtractionWay::forward_restricted,
|
||||
"backward_restricted",
|
||||
sol::property([](const ExtractionWay &way) { return way.backward_restricted; },
|
||||
[](ExtractionWay &way, bool flag) { way.backward_restricted = flag; }));
|
||||
&ExtractionWay::backward_restricted);
|
||||
|
||||
context.state.new_usertype<ExtractionSegment>("ExtractionSegment",
|
||||
"source",
|
||||
|
||||
Reference in New Issue
Block a user