diff --git a/features/options/profiles/version1.feature b/features/options/profiles/version1.feature index 856a5cec4..a73ae66be 100644 --- a/features/options/profiles/version1.feature +++ b/features/options/profiles/version1.feature @@ -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()) diff --git a/include/extractor/profile_properties.hpp b/include/extractor/profile_properties.hpp index c560c59e9..61d3db0b2 100644 --- a/include/extractor/profile_properties.hpp +++ b/include/extractor/profile_properties.hpp @@ -1,6 +1,8 @@ #ifndef PROFILE_PROPERTIES_HPP #define PROFILE_PROPERTIES_HPP +#include "util/typedefs.hpp" + #include #include #include @@ -66,6 +68,11 @@ struct ProfileProperties double GetWeightMultiplier() const { return std::pow(10., weight_precision); } + double GetMaxTurnWeight() const + { + return std::numeric_limits::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 diff --git a/src/extractor/scripting_environment_lua.cpp b/src/extractor/scripting_environment_lua.cpp index be7151b79..5f3f780d4 100644 --- a/src/extractor/scripting_environment_lua.cpp +++ b/src/extractor/scripting_environment_lua.cpp @@ -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>( "vector",