wip
This commit is contained in:
parent
b67529edf0
commit
1c41efe57a
@ -29,37 +29,4 @@ class Engine : public Napi::ObjectWrap<Engine>
|
|||||||
|
|
||||||
} // namespace node_osrm
|
} // namespace node_osrm
|
||||||
|
|
||||||
// namespace node_osrm
|
|
||||||
// {
|
|
||||||
|
|
||||||
// struct Engine final : public Nan::ObjectWrap
|
|
||||||
// {
|
|
||||||
// using Base = Nan::ObjectWrap;
|
|
||||||
|
|
||||||
// static NAN_MODULE_INIT(Init);
|
|
||||||
|
|
||||||
// static NAN_METHOD(New);
|
|
||||||
|
|
||||||
// static NAN_METHOD(route);
|
|
||||||
// static NAN_METHOD(nearest);
|
|
||||||
// static NAN_METHOD(table);
|
|
||||||
// static NAN_METHOD(tile);
|
|
||||||
// static NAN_METHOD(match);
|
|
||||||
// static NAN_METHOD(trip);
|
|
||||||
|
|
||||||
// Engine(osrm::EngineConfig &config);
|
|
||||||
|
|
||||||
// // Thread-safe singleton accessor
|
|
||||||
// static Nan::Persistent<v8::Function> &constructor();
|
|
||||||
|
|
||||||
// // Ref-counted OSRM alive even after shutdown until last callback is done
|
|
||||||
// std::shared_ptr<osrm::OSRM> this_;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// } // namespace node_osrm
|
|
||||||
|
|
||||||
// #pragma GCC diagnostic push
|
|
||||||
// #pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
||||||
// NAN_MODULE_WORKER_ENABLED(osrm, node_osrm::Engine::Init)
|
|
||||||
// #pragma GCC diagnostic pop
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -46,7 +46,6 @@
|
|||||||
"browserify": "^17.0.0",
|
"browserify": "^17.0.0",
|
||||||
"chalk": "^1.1.3",
|
"chalk": "^1.1.3",
|
||||||
"cheap-ruler": "^3.0.2",
|
"cheap-ruler": "^3.0.2",
|
||||||
"cmake-js": "^7.0.0",
|
|
||||||
"command-line-args": "^5.2.1",
|
"command-line-args": "^5.2.1",
|
||||||
"command-line-usage": "^5.0.4",
|
"command-line-usage": "^5.0.4",
|
||||||
"csv-stringify": "^3.0.0",
|
"csv-stringify": "^3.0.0",
|
||||||
@ -76,7 +75,7 @@
|
|||||||
"module_path": "./lib/binding/",
|
"module_path": "./lib/binding/",
|
||||||
"host": "https://github.com",
|
"host": "https://github.com",
|
||||||
"remote_path": "./Project-OSRM/osrm-backend/releases/download/v{version}/",
|
"remote_path": "./Project-OSRM/osrm-backend/releases/download/v{version}/",
|
||||||
"package_name": "{module_name}-v{version}-{node_abi}-{platform}-{arch}-{configuration}.tar.gz"
|
"package_name": "{module_name}-v{version}-{node_abi}-{napi_build_version}-{platform}-{arch}-{configuration}.tar.gz"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|||||||
@ -22,6 +22,7 @@ set_target_properties(node_osrm PROPERTIES CXX_CLANG_TIDY "")
|
|||||||
target_no_warning(node_osrm suggest-destructor-override)
|
target_no_warning(node_osrm suggest-destructor-override)
|
||||||
target_no_warning(node_osrm suggest-override)
|
target_no_warning(node_osrm suggest-override)
|
||||||
|
|
||||||
|
# https://github.com/cjntaylor/node-cmake/issues/53#issuecomment-842357457
|
||||||
execute_process(COMMAND node -p "require('node-addon-api').include" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE NODE_ADDON_API_DIR)
|
execute_process(COMMAND node -p "require('node-addon-api').include" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE NODE_ADDON_API_DIR)
|
||||||
string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
||||||
string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
||||||
@ -65,4 +66,4 @@ list(APPEND ARTIFACTS "${BINDING_DIR}/node_osrm.node")
|
|||||||
|
|
||||||
|
|
||||||
message(STATUS "node_osrm artifacts will be copied to: ${BINDING_DIR}")
|
message(STATUS "node_osrm artifacts will be copied to: ${BINDING_DIR}")
|
||||||
add_custom_target(copy_artifacts ALL DEPENDS ${ARTIFACTS})
|
add_custom_target(copy_artifacts ALL DEPENDS ${ARTIFACTS})
|
||||||
|
|||||||
@ -45,6 +45,47 @@ Napi::Object Engine::Init(Napi::Env env, Napi::Object exports)
|
|||||||
return exports;
|
return exports;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
/**
|
||||||
|
* The `OSRM` method is the main constructor for creating an OSRM instance.
|
||||||
|
* An OSRM instance requires a `.osrm.*` dataset(`.osrm.*` because it contains several files), which is prepared by the OSRM toolchain.
|
||||||
|
* You can create such a `.osrm.*` dataset by running the OSRM binaries we ship in `node_modules/osrm/lib/binding/` and default
|
||||||
|
* profiles (e.g. for setting speeds and determining road types to route on) in `node_modules/osrm/profiles/`:
|
||||||
|
*
|
||||||
|
* node_modules/osrm/lib/binding/osrm-extract data.osm.pbf -p node_modules/osrm/profiles/car.lua
|
||||||
|
* node_modules/osrm/lib/binding/osrm-contract data.osrm
|
||||||
|
*
|
||||||
|
* Consult the [osrm-backend](https://github.com/Project-OSRM/osrm-backend) documentation for further details.
|
||||||
|
*
|
||||||
|
* Once you have a complete `network.osrm.*` dataset, you can calculate routes in javascript with this object.
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* var osrm = new OSRM('network.osrm');
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {Object|String} [options={shared_memory: true}] Options for creating an OSRM object or string to the `.osrm` file.
|
||||||
|
* @param {String} [options.algorithm] The algorithm to use for routing. Can be 'CH', 'CoreCH' or 'MLD'. Default is 'CH'.
|
||||||
|
* Make sure you prepared the dataset with the correct toolchain.
|
||||||
|
* @param {Boolean} [options.shared_memory] Connects to the persistent shared memory datastore.
|
||||||
|
* This requires you to run `osrm-datastore` prior to creating an `OSRM` object.
|
||||||
|
* @param {String} [options.dataset_name] Connects to the persistent shared memory datastore defined by `--dataset_name` option when running `osrm-datastore`.
|
||||||
|
* This requires you to run `osrm-datastore --dataset_name` prior to creating an `OSRM` object.
|
||||||
|
* @param {String} [options.memory_file] **DEPRECATED**
|
||||||
|
* Old behaviour: Path to a file on disk to store the memory using mmap. Current behaviour: setting this value is the same as setting `mmap_memory: true`.
|
||||||
|
* @param {Boolean} [options.mmap_memory] Map on-disk files to virtual memory addresses (mmap), rather than loading into RAM.
|
||||||
|
* @param {String} [options.path] The path to the `.osrm` files. This is mutually exclusive with setting {options.shared_memory} to true.
|
||||||
|
* @param {Number} [options.max_locations_trip] Max. locations supported in trip query (default: unlimited).
|
||||||
|
* @param {Number} [options.max_locations_viaroute] Max. locations supported in viaroute query (default: unlimited).
|
||||||
|
* @param {Number} [options.max_locations_distance_table] Max. locations supported in distance table query (default: unlimited).
|
||||||
|
* @param {Number} [options.max_locations_map_matching] Max. locations supported in map-matching query (default: unlimited).
|
||||||
|
* @param {Number} [options.max_radius_map_matching] Max. radius size supported in map matching query (default: 5).
|
||||||
|
* @param {Number} [options.max_results_nearest] Max. results supported in nearest query (default: unlimited).
|
||||||
|
* @param {Number} [options.max_alternatives] Max. number of alternatives supported in alternative routes query (default: 3).
|
||||||
|
*
|
||||||
|
* @class OSRM
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
// clang-format on
|
||||||
Engine::Engine(const Napi::CallbackInfo &info) : Napi::ObjectWrap<Engine>(info)
|
Engine::Engine(const Napi::CallbackInfo &info) : Napi::ObjectWrap<Engine>(info)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user