geokernel-electron 1.2.3 → 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 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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geokernel-electron",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Electron bindings for the GeoKernel GIS SDK.",
5
5
  "main": "src/index.js",
6
6
  "type": "commonjs",
@@ -299,6 +299,8 @@ const SIGNATURES = Object.freeze({
299
299
  "GeoKernelWindow_SetCentralText": ["bool", ["void_p", "wchar_p"]],
300
300
  "GeoKernelWindow_SetCentralTextPanel": ["bool", ["void_p", "wchar_p"]],
301
301
  "GeoKernelWindow_SetCentralViewer": ["void_p", ["void_p"]],
302
+ "GeoKernelWindow_SetControlEnabled": ["bool", ["void_p", "int", "bool"]],
303
+ "GeoKernelWindow_SetControlOptionsJson": ["bool", ["void_p", "int", "wchar_p"]],
302
304
  "GeoKernelWindow_SetControlValue": ["bool", ["void_p", "int", "double", "wchar_p"]],
303
305
  "GeoKernelWindow_SetLegendItemsJson": ["bool", ["void_p", "wchar_p"]],
304
306
  "GeoKernelWindow_SetLegendTitle": ["bool", ["void_p", "wchar_p"]],
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
  }