geo-polygonize 0.9.0 → 0.10.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,51 @@ function polygonize(geojson_str, node_input, snap_grid_size, extract_only_polygo
438
503
  }
439
504
  }
440
505
 
506
+ /**
507
+ * @param {string} geojson_str
508
+ * @param {any} options_val
509
+ * @returns {string}
510
+ */
511
+ function polygonizeWithOptions(geojson_str, options_val) {
512
+ let deferred3_0;
513
+ let deferred3_1;
514
+ try {
515
+ const ptr0 = passStringToWasm0(geojson_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
516
+ const len0 = WASM_VECTOR_LEN;
517
+ const ret = wasm.polygonizeWithOptions(ptr0, len0, options_val);
518
+ var ptr2 = ret[0];
519
+ var len2 = ret[1];
520
+ if (ret[3]) {
521
+ ptr2 = 0; len2 = 0;
522
+ throw takeFromExternrefTable0(ret[2]);
523
+ }
524
+ deferred3_0 = ptr2;
525
+ deferred3_1 = len2;
526
+ return getStringFromWasm0(ptr2, len2);
527
+ } finally {
528
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
529
+ }
530
+ }
531
+
532
+ /**
533
+ * @param {Float64Array} coords
534
+ * @param {Uint32Array} offsets
535
+ * @param {number} stride
536
+ * @param {any} options_val
537
+ * @returns {WasmPolygonResult}
538
+ */
539
+ function polygonizeWithOptionsBuffer(coords, offsets, stride, options_val) {
540
+ const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
541
+ const len0 = WASM_VECTOR_LEN;
542
+ const ptr1 = passArray32ToWasm0(offsets, wasm.__wbindgen_malloc);
543
+ const len1 = WASM_VECTOR_LEN;
544
+ const ret = wasm.polygonizeWithOptionsBuffer(ptr0, len0, ptr1, len1, stride, options_val);
545
+ if (ret[2]) {
546
+ throw takeFromExternrefTable0(ret[1]);
547
+ }
548
+ return WasmPolygonResult.__wrap(ret[0]);
549
+ }
550
+
441
551
  /**
442
552
  * @param {Float64Array} coords
443
553
  * @param {Uint32Array} offsets
@@ -557,10 +667,50 @@ async function __wbg_load(module, imports) {
557
667
  function __wbg_get_imports() {
558
668
  const imports = {};
559
669
  imports.wbg = {};
670
+ imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
671
+ const ret = Error(getStringFromWasm0(arg0, arg1));
672
+ return ret;
673
+ };
674
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
675
+ const ret = String(arg1);
676
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
677
+ const len1 = WASM_VECTOR_LEN;
678
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
679
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
680
+ };
681
+ imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
682
+ const v = arg0;
683
+ const ret = typeof(v) === 'boolean' ? v : undefined;
684
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
685
+ };
686
+ imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
687
+ const ret = debugString(arg1);
688
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
689
+ const len1 = WASM_VECTOR_LEN;
690
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
691
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
692
+ };
693
+ imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
694
+ const ret = arg0 in arg1;
695
+ return ret;
696
+ };
697
+ imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
698
+ const val = arg0;
699
+ const ret = typeof(val) === 'object' && val !== null;
700
+ return ret;
701
+ };
702
+ imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
703
+ const ret = typeof(arg0) === 'string';
704
+ return ret;
705
+ };
560
706
  imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
561
707
  const ret = arg0 === undefined;
562
708
  return ret;
563
709
  };
710
+ imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
711
+ const ret = arg0 == arg1;
712
+ return ret;
713
+ };
564
714
  imports.wbg.__wbg___wbindgen_memory_a342e963fbcabd68 = function() {
565
715
  const ret = wasm.memory;
566
716
  return ret;
@@ -569,6 +719,20 @@ function __wbg_get_imports() {
569
719
  const ret = __wbg_init.__wbindgen_wasm_module;
570
720
  return ret;
571
721
  };
722
+ imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
723
+ const obj = arg1;
724
+ const ret = typeof(obj) === 'number' ? obj : undefined;
725
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
726
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
727
+ };
728
+ imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
729
+ const obj = arg1;
730
+ const ret = typeof(obj) === 'string' ? obj : undefined;
731
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
732
+ var len1 = WASM_VECTOR_LEN;
733
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
734
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
735
+ };
572
736
  imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
573
737
  throw new Error(getStringFromWasm0(arg0, arg1));
574
738
  };
@@ -576,6 +740,10 @@ function __wbg_get_imports() {
576
740
  const ret = arg0.call(arg1);
577
741
  return ret;
578
742
  }, arguments) };
743
+ imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
744
+ const ret = Object.entries(arg0);
745
+ return ret;
746
+ };
579
747
  imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
580
748
  let deferred0_0;
581
749
  let deferred0_1;
@@ -587,6 +755,34 @@ function __wbg_get_imports() {
587
755
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
588
756
  }
589
757
  };
758
+ imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
759
+ const ret = arg0[arg1 >>> 0];
760
+ return ret;
761
+ };
762
+ imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
763
+ const ret = arg0[arg1];
764
+ return ret;
765
+ };
766
+ imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
767
+ let result;
768
+ try {
769
+ result = arg0 instanceof ArrayBuffer;
770
+ } catch (_) {
771
+ result = false;
772
+ }
773
+ const ret = result;
774
+ return ret;
775
+ };
776
+ imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
777
+ let result;
778
+ try {
779
+ result = arg0 instanceof Uint8Array;
780
+ } catch (_) {
781
+ result = false;
782
+ }
783
+ const ret = result;
784
+ return ret;
785
+ };
590
786
  imports.wbg.__wbg_instanceof_Window_b5cf7783caa68180 = function(arg0) {
591
787
  let result;
592
788
  try {
@@ -597,6 +793,18 @@ function __wbg_get_imports() {
597
793
  const ret = result;
598
794
  return ret;
599
795
  };
796
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
797
+ const ret = arg0.length;
798
+ return ret;
799
+ };
800
+ imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
801
+ const ret = arg0.length;
802
+ return ret;
803
+ };
804
+ imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
805
+ const ret = new Uint8Array(arg0);
806
+ return ret;
807
+ };
600
808
  imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
601
809
  const ret = new Error();
602
810
  return ret;
@@ -609,6 +817,9 @@ function __wbg_get_imports() {
609
817
  const ret = PolygonizerWasmError.__wrap(arg0);
610
818
  return ret;
611
819
  };
820
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
821
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
822
+ };
612
823
  imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
613
824
  const ret = arg1.stack;
614
825
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -636,6 +847,11 @@ function __wbg_get_imports() {
636
847
  const ret = typeof window === 'undefined' ? null : window;
637
848
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
638
849
  };
850
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
851
+ // Cast intrinsic for `Ref(String) -> Externref`.
852
+ const ret = getStringFromWasm0(arg0, arg1);
853
+ return ret;
854
+ };
639
855
  imports.wbg.__wbindgen_init_externref_table = function() {
640
856
  const table = wasm.__wbindgen_externrefs;
641
857
  const offset = table.grow(4);
@@ -716,10 +932,12 @@ var geo_polygonize = /*#__PURE__*/Object.freeze({
716
932
  initSync: initSync,
717
933
  initThreadPool: initThreadPool,
718
934
  polygonize: polygonize,
935
+ polygonizeWithOptions: polygonizeWithOptions,
936
+ polygonizeWithOptionsBuffer: polygonizeWithOptionsBuffer,
719
937
  polygonize_buffers: polygonize_buffers,
720
938
  polygonize_geoarrow: polygonize_geoarrow,
721
939
  wbg_rayon_PoolBuilder: wbg_rayon_PoolBuilder,
722
940
  wbg_rayon_start_worker: wbg_rayon_start_worker
723
941
  });
724
942
 
725
- export { PolygonizerWasmError, WasmPolygonResult, __wbg_init as default, initSync, initThreadPool, polygonize, polygonize_buffers, polygonize_geoarrow, wbg_rayon_PoolBuilder, wbg_rayon_start_worker };
943
+ export { PolygonizerWasmError, WasmPolygonResult, __wbg_init as default, initSync, initThreadPool, polygonize, 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.10.0",
4
4
  "description": "A native Rust port of the JTS/GEOS polygonization algorithm (Wasm)",
5
5
  "type": "module",
6
6
  "scripts": {