geokernel-electron 1.1.60 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geokernel-electron",
3
- "version": "1.1.60",
3
+ "version": "1.2.0",
4
4
  "description": "Electron bindings for the GeoKernel GIS SDK.",
5
5
  "main": "src/index.js",
6
6
  "type": "commonjs",
@@ -56,7 +56,7 @@ const SIGNATURES = Object.freeze({
56
56
  "GeoKernelViewer_ArcMakeConnectedJson": ["int", ["void_p", "double_p", "int", "double_p", "int_p", "int", "out_wchar_p", "int"]],
57
57
  "GeoKernelViewer_ArcSplitOnCrossJson": ["int", ["void_p", "double_p", "int", "double_p", "int_p", "int", "out_wchar_p", "int"]],
58
58
  "GeoKernelViewer_BeginEditLayer": ["bool", ["void_p", "int"]],
59
- "GeoKernelViewer_BuildRoutingGraphForLayer": ["bool", ["void_p", "int", "double", "bool", "wchar_p", "wchar_p", "double"]],
59
+ "GeoKernelViewer_BuildRoutingGraphForLayer": ["bool", ["void_p", "int", "double", "bool", "wchar_p", "wchar_p", "wchar_p", "double"]],
60
60
  "GeoKernelViewer_CancelEditSketch": ["void", ["void_p"]],
61
61
  "GeoKernelViewer_CanEditLayer": ["bool", ["void_p", "int"]],
62
62
  "GeoKernelViewer_CanEditSelectedFeatures": ["bool", ["void_p"]],
package/src/viewer.js CHANGED
@@ -11,6 +11,7 @@ const {
11
11
  ViewerTool,
12
12
  extent,
13
13
  point,
14
+ routeSummary,
14
15
  } = require("./types");
15
16
  const {
16
17
  extentObject,
@@ -401,6 +402,57 @@ class ViewerWindow {
401
402
  this.addLayerFile(filePath, options);
402
403
  }
403
404
 
405
+ buildRoutingGraphForLayer(index, options = {}) {
406
+ return this._call(
407
+ "GeoKernelViewer_BuildRoutingGraphForLayer",
408
+ Number(index),
409
+ Number(options.snapTolerance ?? 0),
410
+ options.undirected ?? true,
411
+ options.speedFieldName ?? "SPEED",
412
+ options.nameFieldName ?? "AD",
413
+ options.oneWayFieldName ?? "ONEWAY",
414
+ Number(options.defaultSpeedKmh ?? 50),
415
+ );
416
+ }
417
+
418
+ hasRoutingGraph() {
419
+ return this._call("GeoKernelViewer_HasRoutingGraph");
420
+ }
421
+
422
+ clearRoutingGraph() {
423
+ this._call("GeoKernelViewer_ClearRoutingGraph");
424
+ }
425
+
426
+ routingGraphLayerIndex() {
427
+ return this._call("GeoKernelViewer_GetRoutingGraphLayerIndex");
428
+ }
429
+
430
+ routingGraphNodeCount() {
431
+ return this._call("GeoKernelViewer_GetRoutingGraphNodeCount");
432
+ }
433
+
434
+ routingGraphEdgeCount() {
435
+ return this._call("GeoKernelViewer_GetRoutingGraphEdgeCount");
436
+ }
437
+
438
+ addShortestRouteLayerBetweenPoints(fromWorldPoint, toWorldPoint, options = {}) {
439
+ const summary = {};
440
+ this._call(
441
+ "GeoKernelViewer_AddShortestRouteLayerBetweenPoints",
442
+ Number(fromWorldPoint.x),
443
+ Number(fromWorldPoint.y),
444
+ Number(toWorldPoint.x),
445
+ Number(toWorldPoint.y),
446
+ Number(options.metric ?? 0),
447
+ Number(options.maxSnapDistance ?? Number.POSITIVE_INFINITY),
448
+ Number(options.defaultSpeedKmh ?? 50),
449
+ options.layerName ?? "Route",
450
+ options.zoomToRoute ?? false,
451
+ summary,
452
+ );
453
+ return routeSummary(summary);
454
+ }
455
+
404
456
  addOpenStreetMapLayer(localCacheEnabled = true) {
405
457
  return this._call("GeoKernelViewer_AddOpenStreetMapLayer", Boolean(localCacheEnabled));
406
458
  }