Add read-only max_turn_weight in ProfileProperties
This commit is contained in:
parent
851fcf0758
commit
78a199e2fb
@ -13,6 +13,9 @@ properties.max_speed_for_map_matching = 180/3.6
|
||||
properties.use_turn_restrictions = true
|
||||
properties.continue_straight_at_waypoint = true
|
||||
properties.weight_name = 'test_version1'
|
||||
properties.weight_precision = 2
|
||||
|
||||
assert(properties.max_turn_weight == 327.67)
|
||||
|
||||
function node_function (node, result)
|
||||
print ('node_function ' .. node:id())
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef PROFILE_PROPERTIES_HPP
|
||||
#define PROFILE_PROPERTIES_HPP
|
||||
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/conversion/cast.hpp>
|
||||
@ -66,6 +68,11 @@ struct ProfileProperties
|
||||
|
||||
double GetWeightMultiplier() const { return std::pow(10., weight_precision); }
|
||||
|
||||
double GetMaxTurnWeight() const
|
||||
{
|
||||
return std::numeric_limits<TurnPenalty>::max() / GetWeightMultiplier();
|
||||
}
|
||||
|
||||
//! penalty to cross a traffic light in deci-seconds
|
||||
std::int32_t traffic_signal_penalty;
|
||||
//! penalty to do a uturn in deci-seconds
|
||||
|
@ -245,7 +245,9 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
||||
"weight_precision",
|
||||
&ProfileProperties::weight_precision,
|
||||
"weight_name",
|
||||
sol::property(&ProfileProperties::SetWeightName, &ProfileProperties::GetWeightName));
|
||||
sol::property(&ProfileProperties::SetWeightName, &ProfileProperties::GetWeightName),
|
||||
"max_turn_weight",
|
||||
sol::property(&ProfileProperties::GetMaxTurnWeight));
|
||||
|
||||
context.state.new_usertype<std::vector<std::string>>(
|
||||
"vector",
|
||||
|
Loading…
Reference in New Issue
Block a user