Integrate MLD in node bindings
This commit is contained in:
committed by
Patrick Niklaus
parent
2cd4ba9a0a
commit
614398ed6c
@@ -117,6 +117,7 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
|
||||
{
|
||||
engine_config->storage_config =
|
||||
osrm::StorageConfig(*v8::String::Utf8Value(Nan::To<v8::String>(path).ToLocalChecked()));
|
||||
engine_config->use_shared_memory = false;
|
||||
}
|
||||
if (!shared_memory->IsUndefined())
|
||||
{
|
||||
@@ -138,6 +139,34 @@ inline engine_config_ptr argumentsToEngineConfig(const Nan::FunctionCallbackInfo
|
||||
return engine_config_ptr();
|
||||
}
|
||||
|
||||
auto algorithm = params->Get(Nan::New("algorithm").ToLocalChecked());
|
||||
if (algorithm->IsString())
|
||||
{
|
||||
auto algorithm_str = Nan::To<v8::String>(algorithm).ToLocalChecked();
|
||||
if (*v8::String::Utf8Value(algorithm_str) == std::string("CH"))
|
||||
{
|
||||
engine_config->algorithm = osrm::EngineConfig::Algorithm::CH;
|
||||
}
|
||||
else if (*v8::String::Utf8Value(algorithm_str) == std::string("CoreCH"))
|
||||
{
|
||||
engine_config->algorithm = osrm::EngineConfig::Algorithm::CoreCH;
|
||||
}
|
||||
else if (*v8::String::Utf8Value(algorithm_str) == std::string("MLD"))
|
||||
{
|
||||
engine_config->algorithm = osrm::EngineConfig::Algorithm::MLD;
|
||||
}
|
||||
else
|
||||
{
|
||||
Nan::ThrowError("algorithm option must be one of 'CH', 'CoreCH', or 'MLD'.");
|
||||
return engine_config_ptr();
|
||||
}
|
||||
}
|
||||
else if (!algorithm->IsUndefined())
|
||||
{
|
||||
Nan::ThrowError("algorithm option must be a string and one of 'CH', 'CoreCH', or 'MLD'.");
|
||||
return engine_config_ptr();
|
||||
}
|
||||
|
||||
return engine_config;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user