geo-polygonize 0.8.0 → 0.9.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.
@@ -253,6 +253,10 @@ if (!('encodeInto' in cachedTextEncoder)) {
253
253
 
254
254
  let WASM_VECTOR_LEN = 0;
255
255
 
256
+ const PolygonizerWasmErrorFinalization = (typeof FinalizationRegistry === 'undefined')
257
+ ? { register: () => {}, unregister: () => {} }
258
+ : new FinalizationRegistry(ptr => wasm.__wbg_polygonizerwasmerror_free(ptr >>> 0, 1));
259
+
256
260
  const WasmPolygonResultFinalization = (typeof FinalizationRegistry === 'undefined')
257
261
  ? { register: () => {}, unregister: () => {} }
258
262
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmpolygonresult_free(ptr >>> 0, 1));
@@ -261,6 +265,71 @@ const wbg_rayon_PoolBuilderFinalization = (typeof FinalizationRegistry === 'unde
261
265
  ? { register: () => {}, unregister: () => {} }
262
266
  : new FinalizationRegistry(ptr => wasm.__wbg_wbg_rayon_poolbuilder_free(ptr >>> 0, 1));
263
267
 
268
+ class PolygonizerWasmError {
269
+ static __wrap(ptr) {
270
+ ptr = ptr >>> 0;
271
+ const obj = Object.create(PolygonizerWasmError.prototype);
272
+ obj.__wbg_ptr = ptr;
273
+ PolygonizerWasmErrorFinalization.register(obj, obj.__wbg_ptr, obj);
274
+ return obj;
275
+ }
276
+ __destroy_into_raw() {
277
+ const ptr = this.__wbg_ptr;
278
+ this.__wbg_ptr = 0;
279
+ PolygonizerWasmErrorFinalization.unregister(this);
280
+ return ptr;
281
+ }
282
+ free() {
283
+ const ptr = this.__destroy_into_raw();
284
+ wasm.__wbg_polygonizerwasmerror_free(ptr, 0);
285
+ }
286
+ /**
287
+ * @param {string} name
288
+ * @param {string} message
289
+ */
290
+ constructor(name, message) {
291
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
292
+ const len0 = WASM_VECTOR_LEN;
293
+ const ptr1 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
294
+ const len1 = WASM_VECTOR_LEN;
295
+ const ret = wasm.polygonizerwasmerror_new(ptr0, len0, ptr1, len1);
296
+ this.__wbg_ptr = ret >>> 0;
297
+ PolygonizerWasmErrorFinalization.register(this, this.__wbg_ptr, this);
298
+ return this;
299
+ }
300
+ /**
301
+ * @returns {string}
302
+ */
303
+ get name() {
304
+ let deferred1_0;
305
+ let deferred1_1;
306
+ try {
307
+ const ret = wasm.polygonizerwasmerror_name(this.__wbg_ptr);
308
+ deferred1_0 = ret[0];
309
+ deferred1_1 = ret[1];
310
+ return getStringFromWasm0(ret[0], ret[1]);
311
+ } finally {
312
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
313
+ }
314
+ }
315
+ /**
316
+ * @returns {string}
317
+ */
318
+ get message() {
319
+ let deferred1_0;
320
+ let deferred1_1;
321
+ try {
322
+ const ret = wasm.polygonizerwasmerror_message(this.__wbg_ptr);
323
+ deferred1_0 = ret[0];
324
+ deferred1_1 = ret[1];
325
+ return getStringFromWasm0(ret[0], ret[1]);
326
+ } finally {
327
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
328
+ }
329
+ }
330
+ }
331
+ if (Symbol.dispose) PolygonizerWasmError.prototype[Symbol.dispose] = PolygonizerWasmError.prototype.free;
332
+
264
333
  class WasmPolygonResult {
265
334
  static __wrap(ptr) {
266
335
  ptr = ptr >>> 0;
@@ -345,15 +414,16 @@ function initThreadPool(num_threads) {
345
414
  * @param {boolean | null} [node_input]
346
415
  * @param {number | null} [snap_grid_size]
347
416
  * @param {boolean | null} [extract_only_polygonal]
417
+ * @param {boolean | null} [report_mode]
348
418
  * @returns {string}
349
419
  */
350
- function polygonize(geojson_str, node_input, snap_grid_size, extract_only_polygonal) {
420
+ function polygonize(geojson_str, node_input, snap_grid_size, extract_only_polygonal, report_mode) {
351
421
  let deferred3_0;
352
422
  let deferred3_1;
353
423
  try {
354
424
  const ptr0 = passStringToWasm0(geojson_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
355
425
  const len0 = WASM_VECTOR_LEN;
356
- const ret = wasm.polygonize(ptr0, len0, isLikeNone(node_input) ? 0xFFFFFF : node_input ? 1 : 0, !isLikeNone(snap_grid_size), isLikeNone(snap_grid_size) ? 0 : snap_grid_size, isLikeNone(extract_only_polygonal) ? 0xFFFFFF : extract_only_polygonal ? 1 : 0);
426
+ const ret = wasm.polygonize(ptr0, len0, isLikeNone(node_input) ? 0xFFFFFF : node_input ? 1 : 0, !isLikeNone(snap_grid_size), isLikeNone(snap_grid_size) ? 0 : snap_grid_size, isLikeNone(extract_only_polygonal) ? 0xFFFFFF : extract_only_polygonal ? 1 : 0, isLikeNone(report_mode) ? 0xFFFFFF : report_mode ? 1 : 0);
357
427
  var ptr2 = ret[0];
358
428
  var len2 = ret[1];
359
429
  if (ret[3]) {
@@ -535,6 +605,10 @@ function __wbg_get_imports() {
535
605
  const ret = new Function(getStringFromWasm0(arg0, arg1));
536
606
  return ret;
537
607
  };
608
+ imports.wbg.__wbg_polygonizerwasmerror_new = function(arg0) {
609
+ const ret = PolygonizerWasmError.__wrap(arg0);
610
+ return ret;
611
+ };
538
612
  imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
539
613
  const ret = arg1.stack;
540
614
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -562,11 +636,6 @@ function __wbg_get_imports() {
562
636
  const ret = typeof window === 'undefined' ? null : window;
563
637
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
564
638
  };
565
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
566
- // Cast intrinsic for `Ref(String) -> Externref`.
567
- const ret = getStringFromWasm0(arg0, arg1);
568
- return ret;
569
- };
570
639
  imports.wbg.__wbindgen_init_externref_table = function() {
571
640
  const table = wasm.__wbindgen_externrefs;
572
641
  const offset = table.grow(4);
@@ -641,6 +710,7 @@ async function __wbg_init(module_or_path) {
641
710
 
642
711
  var geo_polygonize = /*#__PURE__*/Object.freeze({
643
712
  __proto__: null,
713
+ PolygonizerWasmError: PolygonizerWasmError,
644
714
  WasmPolygonResult: WasmPolygonResult,
645
715
  default: __wbg_init,
646
716
  initSync: initSync,
@@ -652,4 +722,4 @@ var geo_polygonize = /*#__PURE__*/Object.freeze({
652
722
  wbg_rayon_start_worker: wbg_rayon_start_worker
653
723
  });
654
724
 
655
- export { WasmPolygonResult, __wbg_init as default, initSync, initThreadPool, polygonize, polygonize_buffers, polygonize_geoarrow, wbg_rayon_PoolBuilder, wbg_rayon_start_worker };
725
+ export { PolygonizerWasmError, WasmPolygonResult, __wbg_init as default, initSync, initThreadPool, polygonize, polygonize_buffers, polygonize_geoarrow, wbg_rayon_PoolBuilder, wbg_rayon_start_worker };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geo-polygonize",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "A native Rust port of the JTS/GEOS polygonization algorithm (Wasm)",
5
5
  "type": "module",
6
6
  "scripts": {