geokernel-electron 1.2.2 → 1.2.4
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.
- package/README.md +7 -0
- package/bin/linux-x64/libGeoKernel.Viewer.so +0 -0
- package/bin/win32-x64/GeoKernel.Core.dll +0 -0
- package/bin/win32-x64/GeoKernel.Formats.dll +0 -0
- package/bin/win32-x64/GeoKernel.Viewer.dll +0 -0
- package/package.json +1 -1
- package/src/native-signatures.js +6 -3
- package/src/viewer.js +50 -0
package/README.md
CHANGED
|
@@ -47,6 +47,13 @@ viewer.addEmptyVectorLayer("Drawings", ShapeType.POLYGON);
|
|
|
47
47
|
viewer.setLayerVisible(0, true);
|
|
48
48
|
viewer.zoomToLayer(0);
|
|
49
49
|
|
|
50
|
+
viewer.addControlPanel({
|
|
51
|
+
title: "Routes",
|
|
52
|
+
controls: [{ id: 1, type: "combo", label: "Route", options: [] }],
|
|
53
|
+
}, (_id, _number, text) => console.log(text));
|
|
54
|
+
viewer.setControlOptions(1, ["Route 1", "Route 2"]);
|
|
55
|
+
viewer.setControlEnabled(1, true);
|
|
56
|
+
|
|
50
57
|
const native = createNativeLibrary();
|
|
51
58
|
console.log(native.getFunction("GeoKernelViewer_GetLayerCount"));
|
|
52
59
|
```
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/src/native-signatures.js
CHANGED
|
@@ -142,6 +142,7 @@ const SIGNATURES = Object.freeze({
|
|
|
142
142
|
"GeoKernelViewer_GetRenderStepLog": ["bool", ["void_p"]],
|
|
143
143
|
"GeoKernelViewer_GetRenderStepLogPath": ["int", ["void_p", "out_wchar_p", "int"]],
|
|
144
144
|
"GeoKernelViewer_GetRoutingGraphEdgeCount": ["int", ["void_p"]],
|
|
145
|
+
"GeoKernelViewer_GetRoutingGraphJson": ["int", ["void_p", "out_wchar_p", "int"]],
|
|
145
146
|
"GeoKernelViewer_GetRoutingGraphLayerIndex": ["int", ["void_p"]],
|
|
146
147
|
"GeoKernelViewer_GetRoutingGraphNodeCount": ["int", ["void_p"]],
|
|
147
148
|
"GeoKernelViewer_GetScaleBarVisible": ["bool", ["void_p"]],
|
|
@@ -294,15 +295,17 @@ const SIGNATURES = Object.freeze({
|
|
|
294
295
|
"GeoKernelWindow_Destroy": ["void", ["void_p"]],
|
|
295
296
|
"GeoKernelWindow_GetSelectedLayerIndex": ["int", ["void_p"]],
|
|
296
297
|
"GeoKernelWindow_IsVisible": ["bool", ["void_p"]],
|
|
297
|
-
"
|
|
298
|
-
"GeoKernelWindow_SetCentralTextPanel": ["bool", ["void_p", "wchar_p"]],
|
|
298
|
+
"GeoKernelWindow_SetAttributionText": ["void", ["void_p", "wchar_p"]],
|
|
299
299
|
"GeoKernelWindow_SetCentralText": ["bool", ["void_p", "wchar_p"]],
|
|
300
|
+
"GeoKernelWindow_SetCentralTextPanel": ["bool", ["void_p", "wchar_p"]],
|
|
301
|
+
"GeoKernelWindow_SetCentralViewer": ["void_p", ["void_p"]],
|
|
302
|
+
"GeoKernelWindow_SetControlEnabled": ["bool", ["void_p", "int", "bool"]],
|
|
303
|
+
"GeoKernelWindow_SetControlOptionsJson": ["bool", ["void_p", "int", "wchar_p"]],
|
|
300
304
|
"GeoKernelWindow_SetControlValue": ["bool", ["void_p", "int", "double", "wchar_p"]],
|
|
301
305
|
"GeoKernelWindow_SetLegendItemsJson": ["bool", ["void_p", "wchar_p"]],
|
|
302
306
|
"GeoKernelWindow_SetLegendTitle": ["bool", ["void_p", "wchar_p"]],
|
|
303
307
|
"GeoKernelWindow_SetLegendWidth": ["bool", ["void_p", "int"]],
|
|
304
308
|
"GeoKernelWindow_SetStatusText": ["void", ["void_p", "wchar_p"]],
|
|
305
|
-
"GeoKernelWindow_SetAttributionText": ["void", ["void_p", "wchar_p"]],
|
|
306
309
|
"GeoKernelWindow_Show": ["void", ["void_p"]],
|
|
307
310
|
});
|
|
308
311
|
|
package/src/viewer.js
CHANGED
|
@@ -249,6 +249,21 @@ class ViewerWindow {
|
|
|
249
249
|
);
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
+
setControlOptions(controlId, options) {
|
|
253
|
+
if (!Array.isArray(options) || options.some((option) => typeof option !== "string")) {
|
|
254
|
+
throw new TypeError("options must be an array of strings.");
|
|
255
|
+
}
|
|
256
|
+
return this.library.function("GeoKernelWindow_SetControlOptionsJson")(
|
|
257
|
+
this.windowHandle, Number(controlId), jsonText(options),
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
setControlEnabled(controlId, enabled) {
|
|
262
|
+
return this.library.function("GeoKernelWindow_SetControlEnabled")(
|
|
263
|
+
this.windowHandle, Number(controlId), Boolean(enabled),
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
|
|
252
267
|
setStatusText(text) {
|
|
253
268
|
this.library.function("GeoKernelWindow_SetStatusText")(this.windowHandle, text ?? "");
|
|
254
269
|
}
|
|
@@ -435,6 +450,41 @@ class ViewerWindow {
|
|
|
435
450
|
return this._call("GeoKernelViewer_GetRoutingGraphEdgeCount");
|
|
436
451
|
}
|
|
437
452
|
|
|
453
|
+
getRoutingGraphJson() {
|
|
454
|
+
return this._readText("GeoKernelViewer_GetRoutingGraphJson");
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
getRoutingGraphSnapshot() {
|
|
458
|
+
const value = parseJson(this.getRoutingGraphJson(), null);
|
|
459
|
+
if (!value || !Array.isArray(value.nodes) || !Array.isArray(value.edges)) {
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
return {
|
|
463
|
+
nodes: value.nodes.map((node) => ({
|
|
464
|
+
id: Number(node.id),
|
|
465
|
+
x: Number(node.x),
|
|
466
|
+
y: Number(node.y),
|
|
467
|
+
})),
|
|
468
|
+
edges: value.edges.map((edge) => ({
|
|
469
|
+
id: Number(edge.id),
|
|
470
|
+
from: Number(edge.from),
|
|
471
|
+
to: Number(edge.to),
|
|
472
|
+
distance: Number(edge.distance),
|
|
473
|
+
speedKmh: Number(edge.speedKmh),
|
|
474
|
+
oneWay: Boolean(edge.oneWay),
|
|
475
|
+
geometry: Array.isArray(edge.geometry)
|
|
476
|
+
? edge.geometry.map((coordinate) => [
|
|
477
|
+
Number(coordinate[0]),
|
|
478
|
+
Number(coordinate[1]),
|
|
479
|
+
])
|
|
480
|
+
: [],
|
|
481
|
+
attributes: edge.attributes && typeof edge.attributes === "object"
|
|
482
|
+
? { ...edge.attributes }
|
|
483
|
+
: {},
|
|
484
|
+
})),
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
|
|
438
488
|
addShortestRouteLayerBetweenPoints(fromWorldPoint, toWorldPoint, options = {}) {
|
|
439
489
|
const summary = {};
|
|
440
490
|
this._call(
|