@redus/georedus-ui 0.1.1 → 0.1.2
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/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as Comlink from 'comlink';
|
|
2
|
+
import { scaleNaturalBreaks } from '@orioro/scale-util';
|
|
3
|
+
import { flatten, booleanIntersects, union, featureCollection } from '@turf/turf';
|
|
4
|
+
|
|
5
|
+
function dissolveAreasPreservingIsolated(geojson) {
|
|
6
|
+
var features = flatten(geojson).features.filter(Boolean);
|
|
7
|
+
var changed = true;
|
|
8
|
+
// Keep merging until nothing changes
|
|
9
|
+
while (changed) {
|
|
10
|
+
changed = false;
|
|
11
|
+
var merged = [];
|
|
12
|
+
var used = new Array(features.length).fill(false);
|
|
13
|
+
for (var i = 0; i < features.length; i++) {
|
|
14
|
+
if (used[i]) continue;
|
|
15
|
+
var current = features[i];
|
|
16
|
+
for (var j = i + 1; j < features.length; j++) {
|
|
17
|
+
if (used[j]) continue;
|
|
18
|
+
if (booleanIntersects(current, features[j])) {
|
|
19
|
+
var result = union(featureCollection([current, features[j]]));
|
|
20
|
+
if (result) {
|
|
21
|
+
current = result;
|
|
22
|
+
used[j] = true;
|
|
23
|
+
changed = true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
used[i] = true;
|
|
28
|
+
merged.push(current);
|
|
29
|
+
}
|
|
30
|
+
features = merged;
|
|
31
|
+
}
|
|
32
|
+
return featureCollection(features);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// A simple Comlink worker that doubles a number
|
|
36
|
+
var api = {
|
|
37
|
+
scaleNaturalBreaks: scaleNaturalBreaks,
|
|
38
|
+
dissolveAreasPreservingIsolated: dissolveAreasPreservingIsolated
|
|
39
|
+
};
|
|
40
|
+
Comlink.expose(api);
|
|
@@ -33,13 +33,12 @@ import 'maplibre-gl/dist/maplibre-gl.css';
|
|
|
33
33
|
import { useQuery, useQueries } from '@tanstack/react-query';
|
|
34
34
|
import { makeResolve, $$literal, withExpressionResolvers, expressions, ALL_EXPR, fetchExpr, resolve, resolveAsync } from '@orioro/resolve';
|
|
35
35
|
import queryString from 'query-string';
|
|
36
|
-
import {
|
|
36
|
+
import { wrap } from 'comlink';
|
|
37
37
|
import { get } from '@orioro/get';
|
|
38
38
|
import { saveAs } from 'file-saver';
|
|
39
39
|
import initGdalJs from 'gdal3.js';
|
|
40
40
|
import { validate } from '@orioro/validate';
|
|
41
41
|
import { csvParse } from 'd3-dsv';
|
|
42
|
-
import 'comlink';
|
|
43
42
|
|
|
44
43
|
function _arrayLikeToArray(r, a) {
|
|
45
44
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -2857,6 +2856,11 @@ function Legend(_a) {
|
|
|
2857
2856
|
return /*#__PURE__*/React$1.createElement(Component, _assign({}, props));
|
|
2858
2857
|
}
|
|
2859
2858
|
|
|
2859
|
+
var worker = typeof Worker !== 'undefined' && new Worker(new URL('./GeoReDUSWorker.worker.js', import.meta.url), {
|
|
2860
|
+
type: 'module'
|
|
2861
|
+
});
|
|
2862
|
+
var GeoReDUSWorker = worker ? wrap(worker) : null;
|
|
2863
|
+
|
|
2860
2864
|
// export const $workerGet: ExpressionSpec<[any, any?]> = {
|
|
2861
2865
|
// parseArgs: ([arg1, arg2], { parseNodeInput }) =>
|
|
2862
2866
|
// typeof arg2 === 'undefined'
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/GeoReDUSWorker.mjs
DELETED