geo-polygonize 0.9.0 → 0.11.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.
@@ -105,6 +105,71 @@ function addToExternrefTable0(obj) {
105
105
  return idx;
106
106
  }
107
107
 
108
+ function debugString(val) {
109
+ // primitive types
110
+ const type = typeof val;
111
+ if (type == 'number' || type == 'boolean' || val == null) {
112
+ return `${val}`;
113
+ }
114
+ if (type == 'string') {
115
+ return `"${val}"`;
116
+ }
117
+ if (type == 'symbol') {
118
+ const description = val.description;
119
+ if (description == null) {
120
+ return 'Symbol';
121
+ } else {
122
+ return `Symbol(${description})`;
123
+ }
124
+ }
125
+ if (type == 'function') {
126
+ const name = val.name;
127
+ if (typeof name == 'string' && name.length > 0) {
128
+ return `Function(${name})`;
129
+ } else {
130
+ return 'Function';
131
+ }
132
+ }
133
+ // objects
134
+ if (Array.isArray(val)) {
135
+ const length = val.length;
136
+ let debug = '[';
137
+ if (length > 0) {
138
+ debug += debugString(val[0]);
139
+ }
140
+ for(let i = 1; i < length; i++) {
141
+ debug += ', ' + debugString(val[i]);
142
+ }
143
+ debug += ']';
144
+ return debug;
145
+ }
146
+ // Test for built-in
147
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
148
+ let className;
149
+ if (builtInMatches && builtInMatches.length > 1) {
150
+ className = builtInMatches[1];
151
+ } else {
152
+ // Failed to match the standard '[object ClassName]'
153
+ return toString.call(val);
154
+ }
155
+ if (className == 'Object') {
156
+ // we're a user defined class or Object
157
+ // JSON.stringify avoids problems with cycles, and is generally much
158
+ // easier than looping through ownProperties of `val`.
159
+ try {
160
+ return 'Object(' + JSON.stringify(val) + ')';
161
+ } catch (_) {
162
+ return 'Object';
163
+ }
164
+ }
165
+ // errors
166
+ if (val instanceof Error) {
167
+ return `${val.name}: ${val.message}\n${val.stack}`;
168
+ }
169
+ // TODO we could test for more things here, like `Set`s and `Map`s.
170
+ return className;
171
+ }
172
+
108
173
  function getArrayU8FromWasm0(ptr, len) {
109
174
  ptr = ptr >>> 0;
110
175
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -438,6 +503,68 @@ function polygonize(geojson_str, node_input, snap_grid_size, extract_only_polygo
438
503
  }
439
504
  }
440
505
 
506
+ /**
507
+ * @param {Uint8Array} ipc_bytes
508
+ * @param {any} options_val
509
+ * @returns {Uint8Array}
510
+ */
511
+ function polygonizeGeoArrowWithOptions(ipc_bytes, options_val) {
512
+ const ptr0 = passArray8ToWasm0(ipc_bytes, wasm.__wbindgen_malloc);
513
+ const len0 = WASM_VECTOR_LEN;
514
+ const ret = wasm.polygonizeGeoArrowWithOptions(ptr0, len0, options_val);
515
+ if (ret[3]) {
516
+ throw takeFromExternrefTable0(ret[2]);
517
+ }
518
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
519
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
520
+ return v2;
521
+ }
522
+
523
+ /**
524
+ * @param {string} geojson_str
525
+ * @param {any} options_val
526
+ * @returns {string}
527
+ */
528
+ function polygonizeWithOptions(geojson_str, options_val) {
529
+ let deferred3_0;
530
+ let deferred3_1;
531
+ try {
532
+ const ptr0 = passStringToWasm0(geojson_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
533
+ const len0 = WASM_VECTOR_LEN;
534
+ const ret = wasm.polygonizeWithOptions(ptr0, len0, options_val);
535
+ var ptr2 = ret[0];
536
+ var len2 = ret[1];
537
+ if (ret[3]) {
538
+ ptr2 = 0; len2 = 0;
539
+ throw takeFromExternrefTable0(ret[2]);
540
+ }
541
+ deferred3_0 = ptr2;
542
+ deferred3_1 = len2;
543
+ return getStringFromWasm0(ptr2, len2);
544
+ } finally {
545
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
546
+ }
547
+ }
548
+
549
+ /**
550
+ * @param {Float64Array} coords
551
+ * @param {Uint32Array} offsets
552
+ * @param {number} stride
553
+ * @param {any} options_val
554
+ * @returns {WasmPolygonResult}
555
+ */
556
+ function polygonizeWithOptionsBuffer(coords, offsets, stride, options_val) {
557
+ const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
558
+ const len0 = WASM_VECTOR_LEN;
559
+ const ptr1 = passArray32ToWasm0(offsets, wasm.__wbindgen_malloc);
560
+ const len1 = WASM_VECTOR_LEN;
561
+ const ret = wasm.polygonizeWithOptionsBuffer(ptr0, len0, ptr1, len1, stride, options_val);
562
+ if (ret[2]) {
563
+ throw takeFromExternrefTable0(ret[1]);
564
+ }
565
+ return WasmPolygonResult.__wrap(ret[0]);
566
+ }
567
+
441
568
  /**
442
569
  * @param {Float64Array} coords
443
570
  * @param {Uint32Array} offsets
@@ -557,10 +684,50 @@ async function __wbg_load(module, imports) {
557
684
  function __wbg_get_imports() {
558
685
  const imports = {};
559
686
  imports.wbg = {};
687
+ imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
688
+ const ret = Error(getStringFromWasm0(arg0, arg1));
689
+ return ret;
690
+ };
691
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
692
+ const ret = String(arg1);
693
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
694
+ const len1 = WASM_VECTOR_LEN;
695
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
696
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
697
+ };
698
+ imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
699
+ const v = arg0;
700
+ const ret = typeof(v) === 'boolean' ? v : undefined;
701
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
702
+ };
703
+ imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
704
+ const ret = debugString(arg1);
705
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
706
+ const len1 = WASM_VECTOR_LEN;
707
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
708
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
709
+ };
710
+ imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
711
+ const ret = arg0 in arg1;
712
+ return ret;
713
+ };
714
+ imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
715
+ const val = arg0;
716
+ const ret = typeof(val) === 'object' && val !== null;
717
+ return ret;
718
+ };
719
+ imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
720
+ const ret = typeof(arg0) === 'string';
721
+ return ret;
722
+ };
560
723
  imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
561
724
  const ret = arg0 === undefined;
562
725
  return ret;
563
726
  };
727
+ imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
728
+ const ret = arg0 == arg1;
729
+ return ret;
730
+ };
564
731
  imports.wbg.__wbg___wbindgen_memory_a342e963fbcabd68 = function() {
565
732
  const ret = wasm.memory;
566
733
  return ret;
@@ -569,6 +736,20 @@ function __wbg_get_imports() {
569
736
  const ret = __wbg_init.__wbindgen_wasm_module;
570
737
  return ret;
571
738
  };
739
+ imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
740
+ const obj = arg1;
741
+ const ret = typeof(obj) === 'number' ? obj : undefined;
742
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
743
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
744
+ };
745
+ imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
746
+ const obj = arg1;
747
+ const ret = typeof(obj) === 'string' ? obj : undefined;
748
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
749
+ var len1 = WASM_VECTOR_LEN;
750
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
751
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
752
+ };
572
753
  imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
573
754
  throw new Error(getStringFromWasm0(arg0, arg1));
574
755
  };
@@ -576,6 +757,10 @@ function __wbg_get_imports() {
576
757
  const ret = arg0.call(arg1);
577
758
  return ret;
578
759
  }, arguments) };
760
+ imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
761
+ const ret = Object.entries(arg0);
762
+ return ret;
763
+ };
579
764
  imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
580
765
  let deferred0_0;
581
766
  let deferred0_1;
@@ -587,6 +772,34 @@ function __wbg_get_imports() {
587
772
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
588
773
  }
589
774
  };
775
+ imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
776
+ const ret = arg0[arg1 >>> 0];
777
+ return ret;
778
+ };
779
+ imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
780
+ const ret = arg0[arg1];
781
+ return ret;
782
+ };
783
+ imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
784
+ let result;
785
+ try {
786
+ result = arg0 instanceof ArrayBuffer;
787
+ } catch (_) {
788
+ result = false;
789
+ }
790
+ const ret = result;
791
+ return ret;
792
+ };
793
+ imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
794
+ let result;
795
+ try {
796
+ result = arg0 instanceof Uint8Array;
797
+ } catch (_) {
798
+ result = false;
799
+ }
800
+ const ret = result;
801
+ return ret;
802
+ };
590
803
  imports.wbg.__wbg_instanceof_Window_b5cf7783caa68180 = function(arg0) {
591
804
  let result;
592
805
  try {
@@ -597,6 +810,18 @@ function __wbg_get_imports() {
597
810
  const ret = result;
598
811
  return ret;
599
812
  };
813
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
814
+ const ret = arg0.length;
815
+ return ret;
816
+ };
817
+ imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
818
+ const ret = arg0.length;
819
+ return ret;
820
+ };
821
+ imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
822
+ const ret = new Uint8Array(arg0);
823
+ return ret;
824
+ };
600
825
  imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
601
826
  const ret = new Error();
602
827
  return ret;
@@ -609,6 +834,9 @@ function __wbg_get_imports() {
609
834
  const ret = PolygonizerWasmError.__wrap(arg0);
610
835
  return ret;
611
836
  };
837
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
838
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
839
+ };
612
840
  imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
613
841
  const ret = arg1.stack;
614
842
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -636,6 +864,11 @@ function __wbg_get_imports() {
636
864
  const ret = typeof window === 'undefined' ? null : window;
637
865
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
638
866
  };
867
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
868
+ // Cast intrinsic for `Ref(String) -> Externref`.
869
+ const ret = getStringFromWasm0(arg0, arg1);
870
+ return ret;
871
+ };
639
872
  imports.wbg.__wbindgen_init_externref_table = function() {
640
873
  const table = wasm.__wbindgen_externrefs;
641
874
  const offset = table.grow(4);
@@ -716,10 +949,13 @@ var geo_polygonize = /*#__PURE__*/Object.freeze({
716
949
  initSync: initSync,
717
950
  initThreadPool: initThreadPool,
718
951
  polygonize: polygonize,
952
+ polygonizeGeoArrowWithOptions: polygonizeGeoArrowWithOptions,
953
+ polygonizeWithOptions: polygonizeWithOptions,
954
+ polygonizeWithOptionsBuffer: polygonizeWithOptionsBuffer,
719
955
  polygonize_buffers: polygonize_buffers,
720
956
  polygonize_geoarrow: polygonize_geoarrow,
721
957
  wbg_rayon_PoolBuilder: wbg_rayon_PoolBuilder,
722
958
  wbg_rayon_start_worker: wbg_rayon_start_worker
723
959
  });
724
960
 
725
- export { PolygonizerWasmError, WasmPolygonResult, __wbg_init as default, initSync, initThreadPool, polygonize, polygonize_buffers, polygonize_geoarrow, wbg_rayon_PoolBuilder, wbg_rayon_start_worker };
961
+ export { PolygonizerWasmError, WasmPolygonResult, __wbg_init as default, initSync, initThreadPool, polygonize, polygonizeGeoArrowWithOptions, polygonizeWithOptions, polygonizeWithOptionsBuffer, 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.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "A native Rust port of the JTS/GEOS polygonization algorithm (Wasm)",
5
5
  "type": "module",
6
6
  "scripts": {