geokernel-electron 1.2.3 → 1.2.5
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 +9 -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 +4 -0
- package/src/viewer.js +28 -0
package/README.md
CHANGED
|
@@ -47,6 +47,15 @@ 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
|
+
viewer.setCommandEnabled(10, false);
|
|
57
|
+
viewer.addTextShape(28.97, 41.01, "1", { textColor: "#FFFFFF", bold: true });
|
|
58
|
+
|
|
50
59
|
const native = createNativeLibrary();
|
|
51
60
|
console.log(native.getFunction("GeoKernelViewer_GetLayerCount"));
|
|
52
61
|
```
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/src/native-signatures.js
CHANGED
|
@@ -45,6 +45,7 @@ const SIGNATURES = Object.freeze({
|
|
|
45
45
|
"GeoKernelViewer_AddPolylineToEditLayer": ["bool", ["void_p", "int", "double_p", "int"]],
|
|
46
46
|
"GeoKernelViewer_AddPolylineToEditLayerWithAttributes": ["bool", ["void_p", "int", "double_p", "int", "wchar_p"]],
|
|
47
47
|
"GeoKernelViewer_AddShortestRouteLayerBetweenPoints": ["bool", ["void_p", "double", "double", "double", "double", "int", "double", "double", "wchar_p", "bool", "out_route_summary_p"]],
|
|
48
|
+
"GeoKernelViewer_AddTextShape": ["bool", ["void_p", "double", "double", "wchar_p", "wchar_p"]],
|
|
48
49
|
"GeoKernelViewer_AddTopFeatureToSelectionAt": ["bool", ["void_p", "double", "double", "int"]],
|
|
49
50
|
"GeoKernelViewer_AddWfsLayer": ["int", ["void_p", "wchar_p", "wchar_p", "wchar_p", "wchar_p", "wchar_p", "wchar_p", "int"]],
|
|
50
51
|
"GeoKernelViewer_AddWktShape": ["bool", ["void_p", "wchar_p"]],
|
|
@@ -299,6 +300,9 @@ const SIGNATURES = Object.freeze({
|
|
|
299
300
|
"GeoKernelWindow_SetCentralText": ["bool", ["void_p", "wchar_p"]],
|
|
300
301
|
"GeoKernelWindow_SetCentralTextPanel": ["bool", ["void_p", "wchar_p"]],
|
|
301
302
|
"GeoKernelWindow_SetCentralViewer": ["void_p", ["void_p"]],
|
|
303
|
+
"GeoKernelWindow_SetCommandEnabled": ["bool", ["void_p", "int", "bool"]],
|
|
304
|
+
"GeoKernelWindow_SetControlEnabled": ["bool", ["void_p", "int", "bool"]],
|
|
305
|
+
"GeoKernelWindow_SetControlOptionsJson": ["bool", ["void_p", "int", "wchar_p"]],
|
|
302
306
|
"GeoKernelWindow_SetControlValue": ["bool", ["void_p", "int", "double", "wchar_p"]],
|
|
303
307
|
"GeoKernelWindow_SetLegendItemsJson": ["bool", ["void_p", "wchar_p"]],
|
|
304
308
|
"GeoKernelWindow_SetLegendTitle": ["bool", ["void_p", "wchar_p"]],
|
package/src/viewer.js
CHANGED
|
@@ -229,6 +229,12 @@ class ViewerWindow {
|
|
|
229
229
|
if (!ok) throw new Error("GeoKernelWindow_AddCommandToolbar failed.");
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
setCommandEnabled(commandId, enabled) {
|
|
233
|
+
return this.library.function("GeoKernelWindow_SetCommandEnabled")(
|
|
234
|
+
this.windowHandle, Number(commandId), Boolean(enabled),
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
232
238
|
addControlPanel(configuration, onChange) {
|
|
233
239
|
const callback = koffi.register(
|
|
234
240
|
(controlId, numericValue, textValue) => onChange(controlId, numericValue, textValue ?? ""),
|
|
@@ -249,6 +255,21 @@ class ViewerWindow {
|
|
|
249
255
|
);
|
|
250
256
|
}
|
|
251
257
|
|
|
258
|
+
setControlOptions(controlId, options) {
|
|
259
|
+
if (!Array.isArray(options) || options.some((option) => typeof option !== "string")) {
|
|
260
|
+
throw new TypeError("options must be an array of strings.");
|
|
261
|
+
}
|
|
262
|
+
return this.library.function("GeoKernelWindow_SetControlOptionsJson")(
|
|
263
|
+
this.windowHandle, Number(controlId), jsonText(options),
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
setControlEnabled(controlId, enabled) {
|
|
268
|
+
return this.library.function("GeoKernelWindow_SetControlEnabled")(
|
|
269
|
+
this.windowHandle, Number(controlId), Boolean(enabled),
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
|
|
252
273
|
setStatusText(text) {
|
|
253
274
|
this.library.function("GeoKernelWindow_SetStatusText")(this.windowHandle, text ?? "");
|
|
254
275
|
}
|
|
@@ -1266,6 +1287,13 @@ class ViewerWindow {
|
|
|
1266
1287
|
return this._call("GeoKernelViewer_AddPointShape", Number(x), Number(y), jsonText(style));
|
|
1267
1288
|
}
|
|
1268
1289
|
|
|
1290
|
+
addTextShape(x, y, text, style = {}) {
|
|
1291
|
+
return this._call(
|
|
1292
|
+
"GeoKernelViewer_AddTextShape",
|
|
1293
|
+
Number(x), Number(y), String(text), jsonText(style),
|
|
1294
|
+
);
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1269
1297
|
addPointBufferShape(x, y, distance, pointsPerQuadrant = 16, style = {}) {
|
|
1270
1298
|
return this._call(
|
|
1271
1299
|
"GeoKernelViewer_AddPointBufferShape",
|