autumnplot-gl 4.0.0-beta → 4.1.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.
- package/README.md +13 -207
- package/dist/812.autumnplot-gl.js +2 -0
- package/dist/812.autumnplot-gl.js.map +1 -0
- package/dist/983.autumnplot-gl.js +2 -0
- package/dist/983.autumnplot-gl.js.map +1 -0
- package/dist/autumnplot-gl.js +1 -1
- package/dist/autumnplot-gl.js.map +1 -1
- package/dist/marchingsquares.wasm +0 -0
- package/lib/AutumnTypes.d.ts +38 -5
- package/lib/AutumnTypes.js +7 -1
- package/lib/Barbs.d.ts +12 -2
- package/lib/Barbs.js +9 -0
- package/lib/BillboardCollection.d.ts +2 -2
- package/lib/BillboardCollection.js +14 -14
- package/lib/Color.d.ts +1 -0
- package/lib/Color.js +1 -0
- package/lib/ColorBar.d.ts +14 -0
- package/lib/ColorBar.js +15 -8
- package/lib/Colormap.d.ts +9 -1
- package/lib/Colormap.js +24 -1
- package/lib/Contour.d.ts +26 -1
- package/lib/Contour.js +24 -2
- package/lib/ContourCreator.worker.d.ts +25 -0
- package/lib/{ContourCreator.js → ContourCreator.worker.js} +15 -14
- package/lib/Fill.d.ts +31 -11
- package/lib/Fill.js +38 -18
- package/lib/Hodographs.d.ts +19 -3
- package/lib/Hodographs.js +45 -20
- package/lib/Map.d.ts +13 -1
- package/lib/Map.js +62 -8
- package/lib/Paintball.d.ts +14 -5
- package/lib/Paintball.js +96 -46
- package/lib/PlotComponent.d.ts +9 -3
- package/lib/PlotComponent.js +36 -1
- package/lib/PlotLayer.d.ts +2 -2
- package/lib/PlotLayer.js +2 -2
- package/lib/PlotLayer.worker.js +9 -3
- package/lib/RawField.d.ts +223 -27
- package/lib/RawField.js +413 -59
- package/lib/StationPlot.d.ts +78 -11
- package/lib/StationPlot.js +113 -30
- package/lib/TextCollection.d.ts +5 -0
- package/lib/TextCollection.js +82 -9
- package/lib/WasmInterface.d.ts +7 -0
- package/lib/WasmInterface.js +11 -0
- package/lib/WorkerPool.d.ts +8 -0
- package/lib/WorkerPool.js +77 -0
- package/lib/cpp/marchingsquares.js +127 -13
- package/lib/cpp/marchingsquares.wasm +0 -0
- package/lib/cpp/marchingsquares_embind.d.ts +16 -3
- package/lib/grids/AutoZoom.d.ts +21 -0
- package/lib/grids/AutoZoom.js +63 -0
- package/lib/grids/DomainBuffer.d.ts +14 -0
- package/lib/grids/DomainBuffer.js +16 -0
- package/lib/grids/Geostationary.d.ts +35 -0
- package/lib/grids/Geostationary.js +47 -0
- package/lib/grids/Grid.d.ts +36 -0
- package/lib/grids/Grid.js +12 -0
- package/lib/grids/GridCoordinates.d.ts +10 -0
- package/lib/grids/GridCoordinates.js +64 -0
- package/lib/grids/LambertGrid.d.ts +73 -0
- package/lib/grids/LambertGrid.js +92 -0
- package/lib/grids/PlateCarreeGrid.d.ts +46 -0
- package/lib/grids/PlateCarreeGrid.js +55 -0
- package/lib/grids/PlateCarreeRotatedGrid.d.ts +53 -0
- package/lib/grids/PlateCarreeRotatedGrid.js +65 -0
- package/lib/grids/RadarSweepGrid.d.ts +46 -0
- package/lib/grids/RadarSweepGrid.js +74 -0
- package/lib/grids/StructuredGrid.d.ts +49 -0
- package/lib/grids/StructuredGrid.js +103 -0
- package/lib/grids/UnstructuredGrid.d.ts +56 -0
- package/lib/grids/UnstructuredGrid.js +102 -0
- package/lib/index.d.ts +23 -6
- package/lib/index.js +18 -8
- package/lib/utils.d.ts +11 -2
- package/lib/utils.js +63 -1
- package/package.json +4 -3
- package/dist/110.autumnplot-gl.js +0 -2
- package/dist/110.autumnplot-gl.js.map +0 -1
- package/lib/ContourCreator.d.ts +0 -22
- package/lib/Grid.d.ts +0 -263
- package/lib/Grid.js +0 -547
- package/lib/ParticleTracer.d.ts +0 -19
- package/lib/ParticleTracer.js +0 -37
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Grid, GridCoords } from "./Grid";
|
|
2
|
+
import { TypedArray } from "../AutumnTypes";
|
|
3
|
+
declare const UnstructuredGrid_base: import("./Grid").AbstractConstructor<import("./AutoZoom").AutoZoomGridIntf> & typeof Grid;
|
|
4
|
+
/**
|
|
5
|
+
* An unstructured grid defined by a list of latitudes and longitudes
|
|
6
|
+
*
|
|
7
|
+
* ## Plot Component Compatibility
|
|
8
|
+
* - :x: `Fill`
|
|
9
|
+
* - :x: `Raster`
|
|
10
|
+
* - :x: `Contour`
|
|
11
|
+
* - :x: `Paintball`
|
|
12
|
+
* - :white_check_mark: `Barbs`
|
|
13
|
+
* - :white_check_mark: `Hodographs`
|
|
14
|
+
* - :white_check_mark: `StationPlot`
|
|
15
|
+
*/
|
|
16
|
+
declare class UnstructuredGrid extends UnstructuredGrid_base {
|
|
17
|
+
readonly coords: {
|
|
18
|
+
lon: number;
|
|
19
|
+
lat: number;
|
|
20
|
+
}[];
|
|
21
|
+
private readonly zoom_cache;
|
|
22
|
+
private readonly zoom_arg;
|
|
23
|
+
/**
|
|
24
|
+
* Create an unstructured grid
|
|
25
|
+
* @param coords - The lat/lon coordinates of the grid points
|
|
26
|
+
*/
|
|
27
|
+
constructor(coords: {
|
|
28
|
+
lon: number;
|
|
29
|
+
lat: number;
|
|
30
|
+
}[], zoom?: Uint8Array);
|
|
31
|
+
/** @internal */
|
|
32
|
+
copy(): UnstructuredGrid;
|
|
33
|
+
/** @internal */
|
|
34
|
+
getEarthCoords(): {
|
|
35
|
+
lons: Float32Array;
|
|
36
|
+
lats: Float32Array;
|
|
37
|
+
};
|
|
38
|
+
/** @internal */
|
|
39
|
+
getGridCoords(): GridCoords;
|
|
40
|
+
/** @internal */
|
|
41
|
+
transform(x: number, y: number, opts?: {
|
|
42
|
+
inverse?: boolean;
|
|
43
|
+
}): [number, number];
|
|
44
|
+
/** @internal */
|
|
45
|
+
getMinVisibleZoom(thin_fac: number): Uint8Array;
|
|
46
|
+
/** @internal */
|
|
47
|
+
getThinnedGrid(thin_fac: number, map_max_zoom: number): this;
|
|
48
|
+
/** @internal */
|
|
49
|
+
thinDataArray<ArrayType extends TypedArray>(original_grid: UnstructuredGrid, ary: ArrayType): ArrayType;
|
|
50
|
+
sampleNearestGridPoint(lon: number, lat: number, ary: TypedArray): {
|
|
51
|
+
sample: number;
|
|
52
|
+
sample_lon: number;
|
|
53
|
+
sample_lat: number;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export { UnstructuredGrid };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { kdTree } from "kd-tree-javascript";
|
|
2
|
+
import { Cache, argMin, getArrayConstructor } from "../utils";
|
|
3
|
+
import { autoZoomGridMixin } from "./AutoZoom";
|
|
4
|
+
import { Grid } from "./Grid";
|
|
5
|
+
import { LngLat } from "../Map";
|
|
6
|
+
/**
|
|
7
|
+
* An unstructured grid defined by a list of latitudes and longitudes
|
|
8
|
+
*
|
|
9
|
+
* ## Plot Component Compatibility
|
|
10
|
+
* - :x: `Fill`
|
|
11
|
+
* - :x: `Raster`
|
|
12
|
+
* - :x: `Contour`
|
|
13
|
+
* - :x: `Paintball`
|
|
14
|
+
* - :white_check_mark: `Barbs`
|
|
15
|
+
* - :white_check_mark: `Hodographs`
|
|
16
|
+
* - :white_check_mark: `StationPlot`
|
|
17
|
+
*/
|
|
18
|
+
class UnstructuredGrid extends autoZoomGridMixin(Grid) {
|
|
19
|
+
/**
|
|
20
|
+
* Create an unstructured grid
|
|
21
|
+
* @param coords - The lat/lon coordinates of the grid points
|
|
22
|
+
*/
|
|
23
|
+
constructor(coords, zoom) {
|
|
24
|
+
const MAX_DIM = 4096;
|
|
25
|
+
super('unstructured', true, Math.min(coords.length, MAX_DIM), Math.floor(coords.length / MAX_DIM) + 1);
|
|
26
|
+
this.coords = coords;
|
|
27
|
+
this.zoom_arg = zoom === undefined ? null : zoom;
|
|
28
|
+
this.zoom_cache = new Cache((thin_fac) => {
|
|
29
|
+
const MAP_MAX_ZOOM = 24;
|
|
30
|
+
const offset = Math.log2(thin_fac);
|
|
31
|
+
const kd_nodes = this.coords.map(c => ({ ...new LngLat(c.lon, c.lat).toMercatorCoord(), min_zoom: MAP_MAX_ZOOM }));
|
|
32
|
+
const tree = new kdTree([...kd_nodes], (a, b) => Math.max(Math.abs(a.x - b.x), Math.abs(a.y - b.y)), ['x', 'y']);
|
|
33
|
+
const recursiveThin = (x, y, depth) => {
|
|
34
|
+
const size = Math.pow(0.5, depth + 1);
|
|
35
|
+
const nodes = tree.nearest({ x: x, y: y, min_zoom: 0 }, 2, size);
|
|
36
|
+
if (nodes.length > 0) {
|
|
37
|
+
const [node, dist] = nodes.sort((a, b) => a[1] - b[1])[0];
|
|
38
|
+
if (node.min_zoom == MAP_MAX_ZOOM) {
|
|
39
|
+
node.min_zoom = Math.max(depth - offset, 0);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (nodes.length > 1 && depth < MAP_MAX_ZOOM + offset) {
|
|
43
|
+
recursiveThin(x - size / 2, y - size / 2, depth + 1);
|
|
44
|
+
recursiveThin(x + size / 2, y - size / 2, depth + 1);
|
|
45
|
+
recursiveThin(x - size / 2, y + size / 2, depth + 1);
|
|
46
|
+
recursiveThin(x + size / 2, y + size / 2, depth + 1);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
// Start at -1 zoom depth, which should handle longitudes > 180 degrees.
|
|
50
|
+
recursiveThin(0.5, 0.5, -1);
|
|
51
|
+
return new Uint8Array(kd_nodes.map(n => n.min_zoom));
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/** @internal */
|
|
55
|
+
copy() {
|
|
56
|
+
return new UnstructuredGrid(this.coords);
|
|
57
|
+
}
|
|
58
|
+
/** @internal */
|
|
59
|
+
getEarthCoords() {
|
|
60
|
+
return { lons: new Float32Array(this.coords.map(c => c.lon)), lats: new Float32Array(this.coords.map(c => c.lat)) };
|
|
61
|
+
}
|
|
62
|
+
/** @internal */
|
|
63
|
+
getGridCoords() {
|
|
64
|
+
const { lons, lats } = this.getEarthCoords();
|
|
65
|
+
return { x: lons, y: lats };
|
|
66
|
+
}
|
|
67
|
+
/** @internal */
|
|
68
|
+
transform(x, y, opts) {
|
|
69
|
+
return [x, y];
|
|
70
|
+
}
|
|
71
|
+
/** @internal */
|
|
72
|
+
getMinVisibleZoom(thin_fac) {
|
|
73
|
+
if (this.zoom_arg !== null)
|
|
74
|
+
return this.zoom_arg;
|
|
75
|
+
return this.zoom_cache.getValue(thin_fac);
|
|
76
|
+
}
|
|
77
|
+
/** @internal */
|
|
78
|
+
getThinnedGrid(thin_fac, map_max_zoom) {
|
|
79
|
+
const min_zoom = this.getMinVisibleZoom(thin_fac);
|
|
80
|
+
return new UnstructuredGrid(this.coords.filter((ll, ill) => min_zoom[ill] <= map_max_zoom), min_zoom.filter(ll => ll <= map_max_zoom));
|
|
81
|
+
}
|
|
82
|
+
/** @internal */
|
|
83
|
+
thinDataArray(original_grid, ary) {
|
|
84
|
+
let i_new = 0;
|
|
85
|
+
const arrayType = getArrayConstructor(ary);
|
|
86
|
+
const new_data = new arrayType(this.ni * this.nj);
|
|
87
|
+
for (let i = 0; i < original_grid.coords.length; i++) {
|
|
88
|
+
if (this.coords[i_new].lat == original_grid.coords[i].lat && this.coords[i_new].lon == original_grid.coords[i].lon) {
|
|
89
|
+
new_data[i_new++] = ary[i];
|
|
90
|
+
if (i_new >= this.coords.length)
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return new_data;
|
|
95
|
+
}
|
|
96
|
+
sampleNearestGridPoint(lon, lat, ary) {
|
|
97
|
+
// TAS: This is gonna be slow. Need to think about using the kdTree here.
|
|
98
|
+
const idx = argMin(this.coords.map(c => (c.lon - lon) * (c.lon - lon) + (c.lat - lat) * (c.lat - lat)));
|
|
99
|
+
return { sample: ary[idx], sample_lon: this.coords[idx].lon, sample_lat: this.coords[idx].lat };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
export { UnstructuredGrid };
|
package/lib/index.d.ts
CHANGED
|
@@ -6,15 +6,24 @@ import Paintball, { PaintballOptions } from "./Paintball";
|
|
|
6
6
|
import Hodographs, { HodographOptions } from './Hodographs';
|
|
7
7
|
import StationPlot, { StationPlotOptions, SPPosition, SPNumberConfig, SPStringConfig, SPBarbConfig, SPSymbolConfig, SPConfig, SPDataConfig, SPSymbol } from "./StationPlot";
|
|
8
8
|
import { PlotLayer, MultiPlotLayer } from './PlotLayer';
|
|
9
|
-
import { WindProfile, WebGLAnyRenderingContext, TypedArray, ContourData } from "./AutumnTypes";
|
|
9
|
+
import { WindProfile, StormRelativeWindProfile, GroundRelativeWindProfile, WebGLAnyRenderingContext, TypedArray, ContourData } from "./AutumnTypes";
|
|
10
10
|
import { MapLikeType } from "./Map";
|
|
11
11
|
import { ColorMap, ColorMapOptions } from './Colormap';
|
|
12
12
|
import { Color } from "./Color";
|
|
13
13
|
import { makeColorBar, makePaintballKey, ColorbarOrientation, ColorbarTickDirection, ColorBarOptions, PaintballKeyOptions } from "./ColorBar";
|
|
14
14
|
import { LineStyle } from "./PolylineCollection";
|
|
15
|
-
import { RawScalarField, RawVectorField, RawProfileField, VectorRelativeTo, RawVectorFieldOptions, RawObsField, ObsRawData } from "./RawField";
|
|
16
|
-
import { Grid, GridType
|
|
17
|
-
import {
|
|
15
|
+
import { RawScalarField, ComputedScalarField, ExpressionScalarField, RawVectorField, ComputedVectorField, ExpressionVectorField, RawProfileField, VectorRelativeTo, RawVectorFieldOptions, RawObsField, ObsRawData } from "./RawField";
|
|
16
|
+
import { Grid, GridType } from "./grids/Grid";
|
|
17
|
+
import { StructuredGrid } from "./grids/StructuredGrid";
|
|
18
|
+
import { PlateCarreeGrid } from "./grids/PlateCarreeGrid";
|
|
19
|
+
import { PlateCarreeRotatedGrid } from "./grids/PlateCarreeRotatedGrid";
|
|
20
|
+
import { LambertGrid } from "./grids/LambertGrid";
|
|
21
|
+
import { RadarSweepGrid } from "./grids/RadarSweepGrid";
|
|
22
|
+
import { GeostationaryImage } from "./grids/Geostationary";
|
|
23
|
+
import { UnstructuredGrid } from "./grids/UnstructuredGrid";
|
|
24
|
+
import { AutoZoomGrid } from "./grids/AutoZoom";
|
|
25
|
+
import { FieldContourOpts } from './ContourCreator.worker';
|
|
26
|
+
/** All built-in colormaps */
|
|
18
27
|
declare const colormaps: {
|
|
19
28
|
bluered: (level_min: number, level_max: number, n_colors: number) => ColorMap;
|
|
20
29
|
redblue: (level_min: number, level_max: number, n_colors: number) => ColorMap;
|
|
@@ -24,10 +33,18 @@ declare const colormaps: {
|
|
|
24
33
|
pw_t2m: ColorMap;
|
|
25
34
|
pw_td2m: ColorMap;
|
|
26
35
|
nws_storm_clear_refl: ColorMap;
|
|
36
|
+
wv_cimss: ColorMap;
|
|
27
37
|
};
|
|
38
|
+
/** Options for initializing the autumnplot-gl library */
|
|
39
|
+
interface InitAutumnPlotOpts {
|
|
40
|
+
/** Base URL at which to find the WASM module (change with caution!) */
|
|
41
|
+
wasm_base_url?: string;
|
|
42
|
+
/** Number of worker threads to use for contouring */
|
|
43
|
+
contour_workers?: number;
|
|
44
|
+
}
|
|
28
45
|
/**
|
|
29
46
|
* Initialize the WebAssembly module in autumnplot-gl. It's not strictly necessary to call it first, but if you call it
|
|
30
47
|
* first, you can prevent races when you contour a bunch of fields at once.
|
|
31
48
|
*/
|
|
32
|
-
declare function initAutumnPlot(): void;
|
|
33
|
-
export { PlotComponent, Barbs, BarbsOptions, Contour, ContourOptions, ContourLabels, ContourLabelOptions, ContourFill, Raster, ContourFillOptions, RasterOptions, Paintball, PaintballOptions, Hodographs, HodographOptions, WindProfile, StationPlot, StationPlotOptions, SPPosition, SPNumberConfig, SPStringConfig, SPBarbConfig, SPSymbolConfig, SPConfig, SPDataConfig, SPSymbol, PlotLayer, MultiPlotLayer, MapLikeType, LineStyle, ColorMap, ColorMapOptions, colormaps, makeColorBar, makePaintballKey, Color, ColorbarOrientation, ColorbarTickDirection, ColorBarOptions, PaintballKeyOptions, RawScalarField, RawVectorField, RawProfileField, RawObsField, ObsRawData, Grid, GridType, StructuredGrid, VectorRelativeTo, RawVectorFieldOptions, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, UnstructuredGrid, WebGLAnyRenderingContext, TypedArray, ContourData, initAutumnPlot, FieldContourOpts };
|
|
49
|
+
declare function initAutumnPlot(opts?: InitAutumnPlotOpts): void;
|
|
50
|
+
export { PlotComponent, Barbs, BarbsOptions, Contour, ContourOptions, ContourLabels, ContourLabelOptions, ContourFill, Raster, ContourFillOptions, RasterOptions, Paintball, PaintballOptions, Hodographs, HodographOptions, WindProfile, StormRelativeWindProfile, GroundRelativeWindProfile, StationPlot, StationPlotOptions, SPPosition, SPNumberConfig, SPStringConfig, SPBarbConfig, SPSymbolConfig, SPConfig, SPDataConfig, SPSymbol, PlotLayer, MultiPlotLayer, MapLikeType, LineStyle, ColorMap, ColorMapOptions, colormaps, makeColorBar, makePaintballKey, Color, ColorbarOrientation, ColorbarTickDirection, ColorBarOptions, PaintballKeyOptions, RawScalarField, ComputedScalarField, ExpressionScalarField, RawVectorField, ComputedVectorField, ExpressionVectorField, RawProfileField, RawObsField, ObsRawData, Grid, GridType, StructuredGrid, VectorRelativeTo, RawVectorFieldOptions, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, UnstructuredGrid, RadarSweepGrid, GeostationaryImage, AutoZoomGrid, WebGLAnyRenderingContext, TypedArray, ContourData, initAutumnPlot, InitAutumnPlotOpts, FieldContourOpts };
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlotComponent } from "./PlotComponent";
|
|
1
|
+
import { PlotComponent, getContourWorkerPool } from "./PlotComponent";
|
|
2
2
|
import Contour, { ContourLabels } from "./Contour";
|
|
3
3
|
import { ContourFill, Raster } from "./Fill";
|
|
4
4
|
import Barbs from "./Barbs";
|
|
@@ -6,12 +6,19 @@ import Paintball from "./Paintball";
|
|
|
6
6
|
import Hodographs from './Hodographs';
|
|
7
7
|
import StationPlot from "./StationPlot";
|
|
8
8
|
import { PlotLayer, MultiPlotLayer } from './PlotLayer';
|
|
9
|
-
import { ColorMap, bluered, redblue, pw_speed500mb, pw_speed850mb, pw_cape, pw_t2m, pw_td2m, nws_storm_clear_refl } from './Colormap';
|
|
9
|
+
import { ColorMap, bluered, redblue, pw_speed500mb, pw_speed850mb, pw_cape, pw_t2m, pw_td2m, nws_storm_clear_refl, wv_cimss } from './Colormap';
|
|
10
10
|
import { Color } from "./Color";
|
|
11
11
|
import { makeColorBar, makePaintballKey } from "./ColorBar";
|
|
12
|
-
import { RawScalarField, RawVectorField, RawProfileField, RawObsField } from "./RawField";
|
|
13
|
-
import { Grid
|
|
14
|
-
import {
|
|
12
|
+
import { RawScalarField, ComputedScalarField, RawVectorField, ComputedVectorField, RawProfileField, RawObsField } from "./RawField";
|
|
13
|
+
import { Grid } from "./grids/Grid";
|
|
14
|
+
import { StructuredGrid } from "./grids/StructuredGrid";
|
|
15
|
+
import { PlateCarreeGrid } from "./grids/PlateCarreeGrid";
|
|
16
|
+
import { PlateCarreeRotatedGrid } from "./grids/PlateCarreeRotatedGrid";
|
|
17
|
+
import { LambertGrid } from "./grids/LambertGrid";
|
|
18
|
+
import { RadarSweepGrid } from "./grids/RadarSweepGrid";
|
|
19
|
+
import { GeostationaryImage } from "./grids/Geostationary";
|
|
20
|
+
import { UnstructuredGrid } from "./grids/UnstructuredGrid";
|
|
21
|
+
/** All built-in colormaps */
|
|
15
22
|
const colormaps = {
|
|
16
23
|
bluered: bluered,
|
|
17
24
|
redblue: redblue,
|
|
@@ -21,12 +28,15 @@ const colormaps = {
|
|
|
21
28
|
pw_t2m: pw_t2m,
|
|
22
29
|
pw_td2m: pw_td2m,
|
|
23
30
|
nws_storm_clear_refl: nws_storm_clear_refl,
|
|
31
|
+
wv_cimss: wv_cimss,
|
|
24
32
|
};
|
|
25
33
|
/**
|
|
26
34
|
* Initialize the WebAssembly module in autumnplot-gl. It's not strictly necessary to call it first, but if you call it
|
|
27
35
|
* first, you can prevent races when you contour a bunch of fields at once.
|
|
28
36
|
*/
|
|
29
|
-
function initAutumnPlot() {
|
|
30
|
-
|
|
37
|
+
function initAutumnPlot(opts) {
|
|
38
|
+
opts = opts === undefined ? {} : opts;
|
|
39
|
+
const contour_workers = opts.contour_workers === undefined ? 1 : opts.contour_workers;
|
|
40
|
+
getContourWorkerPool(opts.wasm_base_url, contour_workers);
|
|
31
41
|
}
|
|
32
|
-
export { PlotComponent, Barbs, Contour, ContourLabels, ContourFill, Raster, Paintball, Hodographs, StationPlot, PlotLayer, MultiPlotLayer, ColorMap, colormaps, makeColorBar, makePaintballKey, Color, RawScalarField, RawVectorField, RawProfileField, RawObsField, Grid, StructuredGrid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, UnstructuredGrid, initAutumnPlot };
|
|
42
|
+
export { PlotComponent, Barbs, Contour, ContourLabels, ContourFill, Raster, Paintball, Hodographs, StationPlot, PlotLayer, MultiPlotLayer, ColorMap, colormaps, makeColorBar, makePaintballKey, Color, RawScalarField, ComputedScalarField, RawVectorField, ComputedVectorField, RawProfileField, RawObsField, Grid, StructuredGrid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, UnstructuredGrid, RadarSweepGrid, GeostationaryImage, initAutumnPlot };
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TypedArray } from "./AutumnTypes";
|
|
1
|
+
import { TypedArray, TypedArrayStr } from "./AutumnTypes";
|
|
2
2
|
declare function getMinZoom(jlat: number, ilon: number, thin_fac_base: number): number;
|
|
3
3
|
declare function zip(...args: any[]): Generator<any[], void, unknown>;
|
|
4
4
|
declare function getOS(): string | null;
|
|
@@ -12,4 +12,13 @@ declare class Cache<A extends unknown[], R> {
|
|
|
12
12
|
declare function normalizeOptions<Type extends Record<string, any>>(opts: Type | undefined, defaults: Required<Type>): Required<Type>;
|
|
13
13
|
declare function getArrayConstructor<ArrayType extends TypedArray>(ary: ArrayType): new (...args: any[]) => ArrayType;
|
|
14
14
|
declare function mergeShaderCode(snippet: string, main: string): string;
|
|
15
|
-
|
|
15
|
+
declare function applySamplerCodeScalar(src: string, sampler_names: string[], sampler_expression: string, dtypes: TypedArrayStr[]): string;
|
|
16
|
+
declare function applySamplerCodeVector(src: string, sampler_names: {
|
|
17
|
+
u: string[];
|
|
18
|
+
v: string[];
|
|
19
|
+
}, sampler_expressions: {
|
|
20
|
+
u: string;
|
|
21
|
+
v: string;
|
|
22
|
+
}): string;
|
|
23
|
+
declare function argMin<T>(ary: T[] | TypedArray): number;
|
|
24
|
+
export { zip, getMinZoom, getOS, Cache, normalizeOptions, getArrayConstructor, mergeShaderCode, applySamplerCodeScalar, applySamplerCodeVector, argMin };
|
package/lib/utils.js
CHANGED
|
@@ -72,4 +72,66 @@ function mergeShaderCode(snippet, main) {
|
|
|
72
72
|
}
|
|
73
73
|
return snippet + "\n" + main;
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
function applySamplerCodeScalar(src, sampler_names, sampler_expression, dtypes) {
|
|
76
|
+
// TAS: find a better place for this to live.
|
|
77
|
+
const SAMPLER_DTYPES = {
|
|
78
|
+
'float16': 'sampler2D', 'float32': 'sampler2D',
|
|
79
|
+
'uint8': 'lowp usampler2D', 'uint16': 'mediump usampler2D', 'uint32': 'highp usampler2D',
|
|
80
|
+
'int16': 'mediump isampler2D', 'int32': 'highp isampler2D',
|
|
81
|
+
};
|
|
82
|
+
const SHADER_DTYPES = {
|
|
83
|
+
'float16': 'highp float', 'float32': 'highp float',
|
|
84
|
+
'uint8': 'uint', 'uint16': 'uint', 'uint32': 'uint',
|
|
85
|
+
'int16': 'int', 'int32': 'int',
|
|
86
|
+
};
|
|
87
|
+
const samplers = sampler_names.map((v, i) => `uniform ${SAMPLER_DTYPES[dtypes[i]]} ${v};`).join("\n");
|
|
88
|
+
const sampler_get = sampler_names.map((v, i) => ` ${SHADER_DTYPES[dtypes[i]]} ${v}_val = texture(${v}, tex_coord).r;`).join("\n");
|
|
89
|
+
sampler_names.forEach(v => sampler_expression = sampler_expression.replaceAll(v, `${v}_val`));
|
|
90
|
+
// TAS: This assumes that the return type of the expression is the same as the type of the inputs. May need to revisit this later.
|
|
91
|
+
const sampler_code = `
|
|
92
|
+
${samplers}
|
|
93
|
+
|
|
94
|
+
${SHADER_DTYPES[dtypes[0]]} get_field_value(lowp vec2 tex_coord) {
|
|
95
|
+
${sampler_get}
|
|
96
|
+
return ${sampler_expression};
|
|
97
|
+
}`;
|
|
98
|
+
return mergeShaderCode(sampler_code, src);
|
|
99
|
+
}
|
|
100
|
+
function applySamplerCodeVector(src, sampler_names, sampler_expressions) {
|
|
101
|
+
const samplers = sampler_names.u.map(v => `uniform sampler2D ${v};`).join("\n") + "\n" +
|
|
102
|
+
sampler_names.v.map(v => `uniform sampler2D ${v};`).join("\n");
|
|
103
|
+
const sampler_u_get = sampler_names.u.map(v => ` highp float ${v}_val = texture(${v}, tex_coord).r;`).join("\n");
|
|
104
|
+
const sampler_v_get = sampler_names.v.map(v => ` highp float ${v}_val = texture(${v}, tex_coord).r;`).join("\n");
|
|
105
|
+
let sampler_expression_u = sampler_expressions.u;
|
|
106
|
+
sampler_names.u.forEach(v => sampler_expression_u = sampler_expression_u.replaceAll(v, `${v}_val`));
|
|
107
|
+
let sampler_expression_v = sampler_expressions.v;
|
|
108
|
+
sampler_names.v.forEach(v => sampler_expression_v = sampler_expression_v.replaceAll(v, `${v}_val`));
|
|
109
|
+
const sampler_code = `
|
|
110
|
+
${samplers}
|
|
111
|
+
|
|
112
|
+
highp float get_field_value_u(lowp vec2 tex_coord) {
|
|
113
|
+
${sampler_u_get}
|
|
114
|
+
return ${sampler_expression_u};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
highp float get_field_value_v(lowp vec2 tex_coord) {
|
|
118
|
+
${sampler_v_get}
|
|
119
|
+
return ${sampler_expression_v};
|
|
120
|
+
}`;
|
|
121
|
+
return mergeShaderCode(sampler_code, src);
|
|
122
|
+
}
|
|
123
|
+
function argMin(ary) {
|
|
124
|
+
if (ary.length === 0) {
|
|
125
|
+
return -1;
|
|
126
|
+
}
|
|
127
|
+
let min = ary[0];
|
|
128
|
+
let minIndex = 0;
|
|
129
|
+
for (let i = 1; i < ary.length; i++) {
|
|
130
|
+
if (ary[i] < min) {
|
|
131
|
+
minIndex = i;
|
|
132
|
+
min = ary[i];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return minIndex;
|
|
136
|
+
}
|
|
137
|
+
export { zip, getMinZoom, getOS, Cache, normalizeOptions, getArrayConstructor, mergeShaderCode, applySamplerCodeScalar, applySamplerCodeVector, argMin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autumnplot-gl",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -27,15 +27,16 @@
|
|
|
27
27
|
"typedoc": "^0.25.13",
|
|
28
28
|
"typedoc-plugin-markdown": "^4.0.2",
|
|
29
29
|
"typescript": "^5.4.5",
|
|
30
|
-
"webpack": "
|
|
30
|
+
"webpack": "5.100",
|
|
31
31
|
"webpack-cli": "^5.0.1",
|
|
32
32
|
"webpack-dev-server": "^4.11.1",
|
|
33
33
|
"webpack-glsl-loader": "^1.0.1"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@petamoriken/float16": "^3.8.4",
|
|
37
|
-
"autumn-wgl": "^1.5.
|
|
37
|
+
"autumn-wgl": "^1.5.5",
|
|
38
38
|
"comlink": "^4.3.1",
|
|
39
|
+
"geographiclib-geodesic": "^2.2.0",
|
|
39
40
|
"kd-tree-javascript": "^1.0.3",
|
|
40
41
|
"pbf": "^3.2.1",
|
|
41
42
|
"potpack": "^2.0.0"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apgl=t():e.apgl=t()}(this,(()=>(()=>{"use strict";function e(e,t,r){for(var n=1,o=r;e%o!=0||t%o!=0;)n+=1,o/=2;return n}const t=Symbol("Comlink.proxy"),r=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),o=Symbol("Comlink.thrown"),a=e=>"object"==typeof e&&null!==e||"function"==typeof e,s=new Map([["proxy",{canHandle:e=>a(e)&&e[t],serialize(e){const{port1:t,port2:r}=new MessageChannel;return i(e,t),[r,[r]]},deserialize:e=>(e.start(),u(e,[],undefined))}],["throw",{canHandle:e=>a(e)&&o in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function i(e,r=self){r.addEventListener("message",(function n(a){if(!a||!a.data)return;const{id:s,type:f,path:u}=Object.assign({path:[]},a.data),l=(a.data.argumentList||[]).map(h);let p;try{const r=u.slice(0,-1).reduce(((e,t)=>e[t]),e),n=u.reduce(((e,t)=>e[t]),e);switch(f){case"GET":p=n;break;case"SET":r[u.slice(-1)[0]]=h(a.data.value),p=!0;break;case"APPLY":p=n.apply(r,l);break;case"CONSTRUCT":p=function(e){return Object.assign(e,{[t]:!0})}(new n(...l));break;case"ENDPOINT":{const{port1:t,port2:r}=new MessageChannel;i(e,r),p=function(e,t){return v.set(e,t),e}(t,[t])}break;case"RELEASE":p=void 0;break;default:return}}catch(e){p={value:e,[o]:0}}Promise.resolve(p).catch((e=>({value:e,[o]:0}))).then((e=>{const[t,o]=d(e);r.postMessage(Object.assign(Object.assign({},t),{id:s}),o),"RELEASE"===f&&(r.removeEventListener("message",n),c(r))}))})),r.start&&r.start()}function c(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function f(e){if(e)throw new Error("Proxy has been released and is not useable")}function u(e,t=[],o=function(){}){let a=!1;const s=new Proxy(o,{get(r,o){if(f(a),o===n)return()=>p(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{c(e),a=!0}));if("then"===o){if(0===t.length)return{then:()=>s};const r=p(e,{type:"GET",path:t.map((e=>e.toString()))}).then(h);return r.then.bind(r)}return u(e,[...t,o])},set(r,n,o){f(a);const[s,i]=d(o);return p(e,{type:"SET",path:[...t,n].map((e=>e.toString())),value:s},i).then(h)},apply(n,o,s){f(a);const i=t[t.length-1];if(i===r)return p(e,{type:"ENDPOINT"}).then(h);if("bind"===i)return u(e,t.slice(0,-1));const[c,v]=l(s);return p(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:c},v).then(h)},construct(r,n){f(a);const[o,s]=l(n);return p(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:o},s).then(h)}});return s}function l(e){const t=e.map(d);return[t.map((e=>e[0])),(r=t.map((e=>e[1])),Array.prototype.concat.apply([],r))];var r}const v=new WeakMap;function d(e){for(const[t,r]of s)if(r.canHandle(e)){const[n,o]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},o]}return[{type:"RAW",value:e},v.get(e)||[]]}function h(e){switch(e.type){case"HANDLER":return s.get(e.name).deserialize(e.value);case"RAW":return e.value}}function p(e,t,r){return new Promise((n=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(r){r.data&&r.data.id&&r.data.id===o&&(e.removeEventListener("message",t),n(r.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),r)}))}var m=function(){function e(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid LngLat object: (".concat(e,", ").concat(t,")"));if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}return e.prototype.toMercatorCoord=function(){return{x:(n=this.lng,(180+n)/360),y:(e=this.lat,t=Math.sin(e*Math.PI/180),r=(180-90/Math.PI*Math.log((1+t)/(1-t)))/360,Math.min(2,Math.max(-2,r)))};var e,t,r,n},e.fromMercatorCoord=function(t,r){return new e(function(e){return 360*e-180}(t),function(e){return 180*Math.atan(Math.sinh((180-360*e)*Math.PI/180))/Math.PI}(r))},e}(),y=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return s};return i({makeBBElements:function(t,r,n,o,a,s){for(var i=Math.log2(a),c=Math.max(i+1-s,0),f=Math.pow(2,c),u=Math.floor((n-1)/f)+1,l=Math.floor((o-1)/f)+1,v=u*l*6*2,d=new Float32Array(u*l*6*3),h=new Float32Array(v),p=0,y=0,g=0;g<o;g++)for(var x=0;x<n;x++){var w=g*n+x,b=t[w],E=r[w],M=e(g,x,a);if(!(M>s)){for(var A=new m(E,b).toMercatorCoord(),S=0;S<6;S++){var L=Math.max(0,Math.min(S-1,3));d[p+3*S+0]=A.x,d[p+3*S+1]=A.y,d[p+3*S+2]=4*M+L,h[y+2*S+0]=x/(n-1),h[y+2*S+1]=g/(o-1)}p+=18,y+=12}}return{pts:d,tex_coords:h}},makeDomainVerticesAndTexCoords:function(e,t,r,n,o,a){for(var s=new Float32Array(4*(r-1)*(n+1)).fill(0),i=new Float32Array(4*(r-1)*(n+1)).fill(0),c=new Float32Array(2*(r-1)*(n+1)).fill(0),f=0,u=0,l=0;l<r-1;l++)for(var v=0;v<n;v++){var d=l+v*r,h=new m(t[d],e[d]).toMercatorCoord(),p=new m(t[d+1],e[d+1]).toMercatorCoord(),y=l/(r-1)*(1-2*o)+o,g=(l+1)/(r-1)*(1-2*o)+o,x=v/(n-1)*(1-2*a)+a;0==v&&(s[f]=h.x,s[f+1]=h.y,f+=2,i[u]=y,i[u+1]=x,u+=2),s[f]=h.x,s[f+1]=h.y,s[f+2]=p.x,s[f+3]=p.y,f+=4,i[u]=y,i[u+1]=x,i[u+2]=g,i[u+3]=x,u+=4,v==n-1&&(s[f]=p.x,s[f+1]=p.y,f+=2,i[u]=g,i[u+1]=x,u+=2)}var w=0;for(l=0;l<r-1;l++)for(v=0;v<n-1;v++){var b=0==v?2*(w+1):2*w,E=s[b],M=s[b+1],A=s[b+2],S=s[b+3],L=s[b+4],j=s[b+5],k=s[b+6],C=s[b+7],P=.5*Math.abs(E*(S-j)+A*(j-M)+L*(M-S)+k*(j-S)+L*(S-C)+A*(C-j));0==v&&(c[w]=P,w+=1),c[w]=P,c[w+1]=P,w+=2,v==n-2&&(c[w]=P,c[w+1]=P,c[w+2]=P,w+=3)}return{vertices:s,tex_coords:i,grid_cell_size:c}},makePolyLines:function(e){if(0==e.length)return{vertices:new Float32Array([]),extrusion:new Float32Array([])};var t=Object.fromEntries(Object.entries(e[0]).map((function(e){var t=y(e,2),r=t[0],n=t[1];return[r,"number"==typeof n||"number"==typeof n[0]?1:n[0].length]})));t.extrusion=2,t.vertices+=1;var r=4*e.map((function(e){return e.vertices.length})).reduce((function(e,t){return e+t}))-2*e.length,n=Object.fromEntries(Object.entries(t).map((function(e){var t=y(e,2),n=t[0],o=t[1];return[n,r*o]}))),o={vertices:new Float32Array(n.vertices),extrusion:new Float32Array(n.extrusion)};"offsets"in e[0]&&(o.offsets=new Float32Array(n.offsets)),"data"in e[0]&&(o.data=new Float32Array(n.data)),"zoom"in e[0]&&(o.zoom=new Float32Array(n.zoom));var a=Object.fromEntries(Object.keys(n).map((function(e){return[e,0]}))),s=function(e,t,r){var n=t[0]-e[0],o=t[1]-e[1],a=Math.hypot(n,o),s=-n/a;return[o/a,r?-s:s]};return e.forEach((function(e){var t,r,n,i,c=e.vertices.map((function(e){var t=(new(m.bind.apply(m,function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([void 0],y(e),!1)))).toMercatorCoord();return[t.x,t.y]})),f=void 0!==e.offsets,u=void 0!==e.offsets?e.offsets:c,l=c[0],v=(c[1],u[0]),d=u[1],h=1e-4,p=y(s(v,d,!f),2),g=p[0],x=p[1];o.vertices[a.vertices++]=l[0],o.vertices[a.vertices++]=l[1],o.vertices[a.vertices++]=h,o.extrusion[a.extrusion++]=g,o.extrusion[a.extrusion++]=x;for(var w=1;w<c.length;w++)l=c[w],r=c[w-1],v=u[w],n=u[w-1],g=(t=y(s(n,v,!f),2))[0],x=t[1],i=h,h+=Math.hypot(c[w-1][0]-c[w][0],c[w-1][1]-c[w][1]),o.vertices[a.vertices++]=r[0],o.vertices[a.vertices++]=r[1],o.vertices[a.vertices++]=-i,o.vertices[a.vertices++]=r[0],o.vertices[a.vertices++]=r[1],o.vertices[a.vertices++]=i,o.vertices[a.vertices++]=l[0],o.vertices[a.vertices++]=l[1],o.vertices[a.vertices++]=-h,o.vertices[a.vertices++]=l[0],o.vertices[a.vertices++]=l[1],o.vertices[a.vertices++]=h,o.extrusion[a.extrusion++]=g,o.extrusion[a.extrusion++]=x,o.extrusion[a.extrusion++]=-g,o.extrusion[a.extrusion++]=-x,o.extrusion[a.extrusion++]=g,o.extrusion[a.extrusion++]=x,o.extrusion[a.extrusion++]=-g,o.extrusion[a.extrusion++]=-x;if(o.vertices[a.vertices++]=l[0],o.vertices[a.vertices++]=l[1],o.vertices[a.vertices++]=h,o.extrusion[a.extrusion++]=-g,o.extrusion[a.extrusion++]=-x,void 0!==o.offsets&&void 0!==e.offsets){var b=e.offsets,E=void 0,M=b[0];for(o.offsets[a.offsets++]=M[0],o.offsets[a.offsets++]=M[1],w=1;w<b.length;w++)M=b[w],E=b[w-1],o.offsets[a.offsets++]=E[0],o.offsets[a.offsets++]=E[1],o.offsets[a.offsets++]=E[0],o.offsets[a.offsets++]=E[1],o.offsets[a.offsets++]=M[0],o.offsets[a.offsets++]=M[1],o.offsets[a.offsets++]=M[0],o.offsets[a.offsets++]=M[1];o.offsets[a.offsets++]=M[0],o.offsets[a.offsets++]=M[1]}if(void 0!==o.data&&void 0!==e.data){var A=e.data,S=void 0,L=A[0];for(o.data[a.data++]=L,w=1;w<A.length;w++)L=A[w],S=A[w-1],o.data[a.data++]=S,o.data[a.data++]=S,o.data[a.data++]=L,o.data[a.data++]=L;o.data[a.data++]=L}if(void 0!==o.zoom&&void 0!==e.zoom)for(w=0;w<4*c.length-2;w++)o.zoom[a.zoom++]=e.zoom})),o}}),{}})()));
|
|
2
|
-
//# sourceMappingURL=110.autumnplot-gl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"110.autumnplot-gl.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAc,KAAID,IAElBD,EAAW,KAAIC,GAChB,CATD,CASGK,MAAM,I,mBCRT,SAASC,EAAWC,EAAcC,EAAcC,GAM5C,IALA,IAEIC,EAFc,EAGdC,EAAWF,EAENF,EAAOI,GAAa,GAAQH,EAAOG,GAAa,GACrDD,GAAQ,EACRC,GAAY,EAGhB,OAAOD,CACX,CCDA,MAAME,EAAcC,OAAO,iBACrBC,EAAiBD,OAAO,oBACxBE,EAAeF,OAAO,wBACtBG,EAAcH,OAAO,kBACrBI,EAAYC,GAAwB,iBAARA,GAA4B,OAARA,GAAgC,mBAARA,EAgDxEC,EAAmB,IAAIC,IAAI,CAC7B,CAAC,QA7CwB,CACzBC,UAAYH,GAAQD,EAASC,IAAQA,EAAIN,GACzCU,UAAUC,GACN,MAAM,MAAEC,EAAK,MAAEC,GAAU,IAAIC,eAE7B,OADAC,EAAOJ,EAAKC,GACL,CAACC,EAAO,CAACA,GACpB,EACAG,YAAYC,IACRA,EAAKC,QAuHFC,EAtHSF,EAsHO,GADTG,cAhF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OAAQiI,IACjCI,EAAYhL,EAAK4K,GAAMG,EAAY/K,EAAK4K,EAAM,GAE9C1B,EAAIlJ,KAAKoJ,EAAKpJ,QAAU+K,EACxB7B,EAAIlJ,KAAKoJ,EAAKpJ,QAAU+K,EACxB7B,EAAIlJ,KAAKoJ,EAAKpJ,QAAUgL,EACxB9B,EAAIlJ,KAAKoJ,EAAKpJ,QAAUgL,EAG5B9B,EAAIlJ,KAAKoJ,EAAKpJ,QAAUgL,CAC5B,CAEA,QAAiB7J,IAAb+H,EAAIvL,WAAoCwD,IAAd6I,EAAKrM,KAC/B,IAASiN,EAAM,EAAGA,EAAqB,EAAf3D,EAAMtE,OAAa,EAAGiI,IAC1C1B,EAAIvL,KAAKyL,EAAKzL,QAAUqM,EAAW,IAG/C,IAEOd,CACX,I","sources":["webpack://apgl/webpack/universalModuleDefinition","webpack://apgl/./src/utils.ts","webpack://apgl/./node_modules/comlink/dist/esm/comlink.mjs","webpack://apgl/./src/Map.ts","webpack://apgl/./src/PlotLayer.worker.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"apgl\"] = factory();\n\telse\n\t\troot[\"apgl\"] = factory();\n})(this, () => {\nreturn ","\nfunction getMinZoom(jlat: number, ilon: number, thin_fac_base: number) {\n const zoom_base = 1;\n\n let zoom = zoom_base;\n let thin_fac = thin_fac_base;\n\n while (((jlat % thin_fac) != 0) || ((ilon % thin_fac) != 0)) {\n zoom += 1;\n thin_fac /= 2;\n }\n\n return zoom;\n}\n\nfunction* zip(...args: any[]) {\n\tconst iterators = args.map(x => x[Symbol.iterator]());\n\twhile (true) {\n\t\tconst current = iterators.map(x => x.next());\n\t\tif (current.some(x => x.done)) {\n\t\t\tbreak;\n\t\t}\n\t\tyield current.map(x => x.value);\n\t}\n}\n\nfunction getOS() {\n const userAgent = window.navigator.userAgent,\n platform = window.navigator.platform,\n macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'],\n windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'],\n iosPlatforms = ['iPhone', 'iPad', 'iPod'];\n let os = null;\n\n if (macosPlatforms.indexOf(platform) !== -1 && navigator.maxTouchPoints <= 1) {\n os = 'Mac OS';\n } \n else if (iosPlatforms.indexOf(platform) !== -1 || (macosPlatforms.indexOf(platform) !== -1 && navigator.maxTouchPoints > 1)) { \n os = 'iOS';\n } \n else if (windowsPlatforms.indexOf(platform) !== -1) {\n os = 'Windows';\n } \n else if (/Android/.test(userAgent)) {\n os = 'Android';\n } \n else if (/Linux/.test(platform)) {\n os = 'Linux';\n }\n\n return os;\n}\n\nclass Cache<A extends unknown[], R> {\n private cached_values: Record<string, R>;\n private readonly compute_value: (...args: A) => R;\n private readonly make_key: (...args: A) => string;\n\n constructor(compute_value: (...args: A) => R, make_key?: (...args: A) => string) {\n this.cached_values = {};\n this.compute_value = compute_value;\n this.make_key = make_key === undefined ? (...args: A) => JSON.stringify(args) : make_key;\n }\n\n public getValue(...args: A) {\n const key = this.make_key(...args);\n\n if (!(key in this.cached_values)) {\n this.cached_values[key] = this.compute_value(...args);\n }\n\n return this.cached_values[key];\n }\n}\n\n\nfunction normalizeOptions<Type extends Record<string, any>>(opts: Type | undefined, defaults: Required<Type>) {\n const ret = {...defaults} as Required<Type>;\n\n if (opts !== undefined) {\n Object.entries(opts).forEach(([k, v]: [keyof Type, any]) => {\n ret[k] = v;\n });\n }\n\n return ret;\n}\n\nexport {zip, getMinZoom, getOS, Cache, normalizeOptions};\n","/**\r\n * Copyright 2019 Google Inc. All Rights Reserved.\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nconst proxyMarker = Symbol(\"Comlink.proxy\");\r\nconst createEndpoint = Symbol(\"Comlink.endpoint\");\r\nconst releaseProxy = Symbol(\"Comlink.releaseProxy\");\r\nconst throwMarker = Symbol(\"Comlink.thrown\");\r\nconst isObject = (val) => (typeof val === \"object\" && val !== null) || typeof val === \"function\";\r\n/**\r\n * Internal transfer handle to handle objects marked to proxy.\r\n */\r\nconst proxyTransferHandler = {\r\n canHandle: (val) => isObject(val) && val[proxyMarker],\r\n serialize(obj) {\r\n const { port1, port2 } = new MessageChannel();\r\n expose(obj, port1);\r\n return [port2, [port2]];\r\n },\r\n deserialize(port) {\r\n port.start();\r\n return wrap(port);\r\n },\r\n};\r\n/**\r\n * Internal transfer handler to handle thrown exceptions.\r\n */\r\nconst throwTransferHandler = {\r\n canHandle: (value) => isObject(value) && throwMarker in value,\r\n serialize({ value }) {\r\n let serialized;\r\n if (value instanceof Error) {\r\n serialized = {\r\n isError: true,\r\n value: {\r\n message: value.message,\r\n name: value.name,\r\n stack: value.stack,\r\n },\r\n };\r\n }\r\n else {\r\n serialized = { isError: false, value };\r\n }\r\n return [serialized, []];\r\n },\r\n deserialize(serialized) {\r\n if (serialized.isError) {\r\n throw Object.assign(new Error(serialized.value.message), serialized.value);\r\n }\r\n throw serialized.value;\r\n },\r\n};\r\n/**\r\n * Allows customizing the serialization of certain values.\r\n */\r\nconst transferHandlers = new Map([\r\n [\"proxy\", proxyTransferHandler],\r\n [\"throw\", throwTransferHandler],\r\n]);\r\nfunction expose(obj, ep = self) {\r\n ep.addEventListener(\"message\", function callback(ev) {\r\n if (!ev || !ev.data) {\r\n return;\r\n }\r\n const { id, type, path } = Object.assign({ path: [] }, ev.data);\r\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\r\n let returnValue;\r\n try {\r\n const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\r\n const rawValue = path.reduce((obj, prop) => obj[prop], obj);\r\n switch (type) {\r\n case \"GET\" /* GET */:\r\n {\r\n returnValue = rawValue;\r\n }\r\n break;\r\n case \"SET\" /* SET */:\r\n {\r\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\r\n returnValue = true;\r\n }\r\n break;\r\n case \"APPLY\" /* APPLY */:\r\n {\r\n returnValue = rawValue.apply(parent, argumentList);\r\n }\r\n break;\r\n case \"CONSTRUCT\" /* CONSTRUCT */:\r\n {\r\n const value = new rawValue(...argumentList);\r\n returnValue = proxy(value);\r\n }\r\n break;\r\n case \"ENDPOINT\" /* ENDPOINT */:\r\n {\r\n const { port1, port2 } = new MessageChannel();\r\n expose(obj, port2);\r\n returnValue = transfer(port1, [port1]);\r\n }\r\n break;\r\n case \"RELEASE\" /* RELEASE */:\r\n {\r\n returnValue = undefined;\r\n }\r\n break;\r\n default:\r\n return;\r\n }\r\n }\r\n catch (value) {\r\n returnValue = { value, [throwMarker]: 0 };\r\n }\r\n Promise.resolve(returnValue)\r\n .catch((value) => {\r\n return { value, [throwMarker]: 0 };\r\n })\r\n .then((returnValue) => {\r\n const [wireValue, transferables] = toWireValue(returnValue);\r\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\r\n if (type === \"RELEASE\" /* RELEASE */) {\r\n // detach and deactive after sending release response above.\r\n ep.removeEventListener(\"message\", callback);\r\n closeEndPoint(ep);\r\n }\r\n });\r\n });\r\n if (ep.start) {\r\n ep.start();\r\n }\r\n}\r\nfunction isMessagePort(endpoint) {\r\n return endpoint.constructor.name === \"MessagePort\";\r\n}\r\nfunction closeEndPoint(endpoint) {\r\n if (isMessagePort(endpoint))\r\n endpoint.close();\r\n}\r\nfunction wrap(ep, target) {\r\n return createProxy(ep, [], target);\r\n}\r\nfunction throwIfProxyReleased(isReleased) {\r\n if (isReleased) {\r\n throw new Error(\"Proxy has been released and is not useable\");\r\n }\r\n}\r\nfunction createProxy(ep, path = [], target = function () { }) {\r\n let isProxyReleased = false;\r\n const proxy = new Proxy(target, {\r\n get(_target, prop) {\r\n throwIfProxyReleased(isProxyReleased);\r\n if (prop === releaseProxy) {\r\n return () => {\r\n return requestResponseMessage(ep, {\r\n type: \"RELEASE\" /* RELEASE */,\r\n path: path.map((p) => p.toString()),\r\n }).then(() => {\r\n closeEndPoint(ep);\r\n isProxyReleased = true;\r\n });\r\n };\r\n }\r\n if (prop === \"then\") {\r\n if (path.length === 0) {\r\n return { then: () => proxy };\r\n }\r\n const r = requestResponseMessage(ep, {\r\n type: \"GET\" /* GET */,\r\n path: path.map((p) => p.toString()),\r\n }).then(fromWireValue);\r\n return r.then.bind(r);\r\n }\r\n return createProxy(ep, [...path, prop]);\r\n },\r\n set(_target, prop, rawValue) {\r\n throwIfProxyReleased(isProxyReleased);\r\n // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\r\n // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\r\n const [value, transferables] = toWireValue(rawValue);\r\n return requestResponseMessage(ep, {\r\n type: \"SET\" /* SET */,\r\n path: [...path, prop].map((p) => p.toString()),\r\n value,\r\n }, transferables).then(fromWireValue);\r\n },\r\n apply(_target, _thisArg, rawArgumentList) {\r\n throwIfProxyReleased(isProxyReleased);\r\n const last = path[path.length - 1];\r\n if (last === createEndpoint) {\r\n return requestResponseMessage(ep, {\r\n type: \"ENDPOINT\" /* ENDPOINT */,\r\n }).then(fromWireValue);\r\n }\r\n // We just pretend that `bind()` didn’t happen.\r\n if (last === \"bind\") {\r\n return createProxy(ep, path.slice(0, -1));\r\n }\r\n const [argumentList, transferables] = processArguments(rawArgumentList);\r\n return requestResponseMessage(ep, {\r\n type: \"APPLY\" /* APPLY */,\r\n path: path.map((p) => p.toString()),\r\n argumentList,\r\n }, transferables).then(fromWireValue);\r\n },\r\n construct(_target, rawArgumentList) {\r\n throwIfProxyReleased(isProxyReleased);\r\n const [argumentList, transferables] = processArguments(rawArgumentList);\r\n return requestResponseMessage(ep, {\r\n type: \"CONSTRUCT\" /* CONSTRUCT */,\r\n path: path.map((p) => p.toString()),\r\n argumentList,\r\n }, transferables).then(fromWireValue);\r\n },\r\n });\r\n return proxy;\r\n}\r\nfunction myFlat(arr) {\r\n return Array.prototype.concat.apply([], arr);\r\n}\r\nfunction processArguments(argumentList) {\r\n const processed = argumentList.map(toWireValue);\r\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\r\n}\r\nconst transferCache = new WeakMap();\r\nfunction transfer(obj, transfers) {\r\n transferCache.set(obj, transfers);\r\n return obj;\r\n}\r\nfunction proxy(obj) {\r\n return Object.assign(obj, { [proxyMarker]: true });\r\n}\r\nfunction windowEndpoint(w, context = self, targetOrigin = \"*\") {\r\n return {\r\n postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),\r\n addEventListener: context.addEventListener.bind(context),\r\n removeEventListener: context.removeEventListener.bind(context),\r\n };\r\n}\r\nfunction toWireValue(value) {\r\n for (const [name, handler] of transferHandlers) {\r\n if (handler.canHandle(value)) {\r\n const [serializedValue, transferables] = handler.serialize(value);\r\n return [\r\n {\r\n type: \"HANDLER\" /* HANDLER */,\r\n name,\r\n value: serializedValue,\r\n },\r\n transferables,\r\n ];\r\n }\r\n }\r\n return [\r\n {\r\n type: \"RAW\" /* RAW */,\r\n value,\r\n },\r\n transferCache.get(value) || [],\r\n ];\r\n}\r\nfunction fromWireValue(value) {\r\n switch (value.type) {\r\n case \"HANDLER\" /* HANDLER */:\r\n return transferHandlers.get(value.name).deserialize(value.value);\r\n case \"RAW\" /* RAW */:\r\n return value.value;\r\n }\r\n}\r\nfunction requestResponseMessage(ep, msg, transfers) {\r\n return new Promise((resolve) => {\r\n const id = generateUUID();\r\n ep.addEventListener(\"message\", function l(ev) {\r\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\r\n return;\r\n }\r\n ep.removeEventListener(\"message\", l);\r\n resolve(ev.data);\r\n });\r\n if (ep.start) {\r\n ep.start();\r\n }\r\n ep.postMessage(Object.assign({ id }, msg), transfers);\r\n });\r\n}\r\nfunction generateUUID() {\r\n return new Array(4)\r\n .fill(0)\r\n .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\r\n .join(\"-\");\r\n}\n\nexport { createEndpoint, expose, proxy, proxyMarker, releaseProxy, transfer, transferHandlers, windowEndpoint, wrap };\n//# sourceMappingURL=comlink.mjs.map\n","\n\n// Stub in required method and property types for the mapping library. God help me if these start to diverge between Mapbox and MapLibre.\ntype StyleSpecification = {\n glyphs?: string;\n}\n\ntype MapLikeType = {\n triggerRepaint: () => void;\n getCanvas: () => HTMLCanvasElement;\n getStyle: () => StyleSpecification;\n\n getZoom: () => number;\n getMaxZoom: () => number;\n getBearing: () => number;\n getPitch: () => number;\n};\n\ninterface LambertConformalConicParameters {\n lon_0: number,\n lat_0: number,\n lat_std: [number, number] | number;\n}\n\nfunction lambertConformalConic(params: LambertConformalConicParameters) {\n // Formulas from https://pubs.usgs.gov/pp/1395/report.pdf\n\n const compute_t = (lat: number) => {\n const sin_lat = Math.sin(lat);\n return Math.tan(Math.PI / 4 - lat / 2) * Math.pow((1 + eccen * sin_lat) / (1 - eccen * sin_lat), eccen / 2);\n };\n const compute_m = (lat: number) => {\n const sin_lat = Math.sin(lat);\n return Math.cos(lat) / Math.sqrt(1 - eccen * eccen * sin_lat * sin_lat);\n }\n\n // WGS 84 spheroid\n const semimajor = 6378137.0;\n const semiminor = 6356752.314245;\n const eccen = Math.sqrt(1 - (semiminor * semiminor) / (semimajor * semimajor));\n const radians = Math.PI / 180;\n\n let {lon_0, lat_0, lat_std} = params;\n lat_std = Array.isArray(lat_std) && lat_std[0] == lat_std[1] ? lat_std[0] : lat_std;\n\n lon_0 *= radians;\n lat_0 *= radians;\n\n let F: number, n: number;\n const t_0 = compute_t(lat_0);\n\n if (Array.isArray(lat_std)) {\n let [lat_1, lat_2] = lat_std;\n lat_1 *= radians;\n lat_2 *= radians;\n\n const t_1 = compute_t(lat_1);\n const t_2 = compute_t(lat_2);\n const m_1 = compute_m(lat_1);\n const m_2 = compute_m(lat_2);\n\n n = Math.log(m_1 / m_2) / Math.log(t_1 / t_2);\n F = m_1 / (n * Math.pow(t_1, n));\n }\n else {\n let lat_1 = lat_std;\n lat_1 *= radians;\n\n const t_1 = compute_t(lat_1);\n const m_1 = compute_m(lat_1);\n n = Math.sin(lat_1);\n F = m_1 / (n * Math.pow(t_1, n));\n }\n\n const rho_0 = semimajor * F * Math.pow(t_0, n);\n\n const compute_lcc = (lon: number, lat: number) : [number, number] => {\n lon *= radians;\n lat *= radians;\n\n const t = compute_t(lat);\n const rho = semimajor * F * Math.pow(t, n);\n const theta = n * (lon - lon_0);\n const x = rho * Math.sin(theta);\n const y = rho_0 - rho * Math.cos(theta);\n\n return [x, y];\n }\n\n const eccen2 = eccen * eccen;\n const eccen4 = eccen2 * eccen2;\n const eccen6 = eccen4 * eccen2;\n const eccen8 = eccen6 * eccen2;\n\n/*\n const A = eccen2 / 2 + 5 * eccen4 / 24 + eccen6 / 12 + 13 * eccen8 / 360;\n const B = 7 * eccen4 / 48 + 29 * eccen6 / 240 + 811 * eccen8 / 11520;\n const C = 7 * eccen6 / 120 + 81 * eccen8 / 1120;\n const D = 4279 * eccen8 / 161280;\n const Ap = A - C;\n const Bp = 2 * B - 4 * D;\n const Cp = 4 * C;\n const Dp = 8 * D;\n*/\n\n const Ap = eccen2 / 2 + 5 * eccen4 / 24 + 3 * eccen6 / 120 - 73 * eccen8 / 2016;\n const Bp = 7 * eccen4 / 24 + 29 * eccen6 / 120 + 233 * eccen8 / 6720;\n const Cp = 7 * eccen6 / 30 + 81 * eccen8 / 280;\n const Dp = 4729 * eccen8 / 20160;\n\n const compute_lcc_inverse = (x: number, y: number) : [number, number] => {\n const theta = Math.atan2(x, rho_0 - y); // These arguments are backwards from what I'd expect ...\n const lon = theta / n + lon_0;\n const rho = Math.hypot(x, rho_0 - y) * Math.sign(n);\n const t = Math.pow(rho / (semimajor * F), 1 / n);\n\n const chi = Math.PI / 2 - 2 * Math.atan(t);\n const sin_2chi = Math.sin(2 * chi);\n const cos_2chi = Math.cos(2 * chi);\n\n const lat = chi + sin_2chi * (Ap + cos_2chi * (Bp + cos_2chi * (Cp + Dp * cos_2chi)));\n\n return [lon / radians, lat / radians];\n }\n\n return (a: number, b: number, opts?: {inverse: boolean}) : [number, number] => {\n opts = opts === undefined ? {inverse: false} : opts;\n return opts.inverse ? compute_lcc_inverse(a, b) : compute_lcc(a, b);\n }\n}\n\ninterface RotateSphereParams {\n np_lon: number,\n np_lat: number,\n lon_shift: number,\n}\n\nfunction rotateSphere(params: RotateSphereParams) {\n const radians = Math.PI / 180;\n const np_lat = params.np_lat * radians;\n const np_lon = params.np_lon * radians;\n const lon_shift = params.lon_shift * radians;\n\n const sin_np_lat = Math.sin(np_lat);\n const cos_np_lat = Math.cos(np_lat);\n\n const compute_rotation = (lon: number, lat: number) : [number, number] => {\n lon *= radians;\n lat *= radians;\n\n const sin_lat = Math.sin(lat);\n const cos_lat = Math.cos(lat);\n const sin_lon_diff = Math.sin(lon - lon_shift);\n const cos_lon_diff = Math.cos(lon - lon_shift);\n\n const lat_p = Math.asin(sin_np_lat * sin_lat - cos_np_lat * cos_lat * cos_lon_diff);\n let lon_p = np_lon + Math.atan2((cos_lat * sin_lon_diff), (sin_np_lat * cos_lat * cos_lon_diff + cos_np_lat * sin_lat));\n\n if (lon_p > Math.PI) lon_p -= 2 * Math.PI;\n\n return [lon_p / radians, lat_p / radians];\n }\n\n const compute_rotation_inverse = (lon_p: number, lat_p: number) : [number, number] => {\n lon_p *= radians;\n lat_p *= radians;\n\n const sin_lat_p = Math.sin(lat_p);\n const cos_lat_p = Math.cos(lat_p);\n const sin_lon_p_diff = Math.sin(lon_p - np_lon);\n const cos_lon_p_diff = Math.cos(lon_p - np_lon);\n\n const lat = Math.asin(sin_np_lat * sin_lat_p + cos_np_lat * cos_lat_p * cos_lon_p_diff);\n let lon = lon_shift + Math.atan2((cos_lat_p * sin_lon_p_diff), (sin_np_lat * cos_lat_p * cos_lon_p_diff - cos_np_lat * sin_lat_p));\n\n if (lon_p > Math.PI) lon_p -= 2 * Math.PI;\n\n return [lon / radians, lat / radians];\n }\n\n return (a: number, b: number, opts?: {inverse: boolean}) => {\n opts = opts === undefined ? {inverse: false} : opts;\n return opts.inverse ? compute_rotation_inverse(a, b) : compute_rotation(a, b);\n }\n}\n\nfunction mercatorXfromLng(lng: number) {\n return (180 + lng) / 360;\n}\n\nfunction lngFromMercatorX(x: number) {\n return 360 * x - 180;\n}\n\nfunction mercatorYfromLat(lat: number) {\n const sin_lat = Math.sin(lat * Math.PI / 180);\n const y = (180 - (90 / Math.PI * Math.log((1 + sin_lat) / (1 - sin_lat)))) / 360;\n return Math.min(2, Math.max(-2, y));\n}\n\nfunction latFromMercatorY(y: number) {\n return Math.atan(Math.sinh((180 - y * 360) * Math.PI / 180)) * 180 / Math.PI;\n}\n\n/**\n * A `LngLat` object represents a given longitude and latitude coordinate, measured in degrees.\n * These coordinates are based on the [WGS84 (EPSG:4326) standard](https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84).\n *\n * MapLibre GL uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match the\n * [GeoJSON specification](https://tools.ietf.org/html/rfc7946).\n *\n * @param {number} lng Longitude, measured in degrees.\n * @param {number} lat Latitude, measured in degrees.\n * @example\n * var ll = new LngLat(-123.9749, 40.7736);\n * ll.lng; // = -123.9749\n */\n class LngLat {\n public lng: number;\n public lat: number;\n\n constructor(lng: number, lat: number) {\n if (isNaN(lng) || isNaN(lat)) {\n throw new Error(`Invalid LngLat object: (${lng}, ${lat})`);\n }\n this.lng = +lng;\n this.lat = +lat;\n if (this.lat > 90 || this.lat < -90) {\n throw new Error('Invalid LngLat latitude value: must be between -90 and 90');\n }\n }\n\n public toMercatorCoord() {\n return {x: mercatorXfromLng(this.lng), y: mercatorYfromLat(this.lat)};\n }\n\n public static fromMercatorCoord(x: number, y: number) {\n return new LngLat(lngFromMercatorX(x), latFromMercatorY(y));\n }\n}\n\nexport {LngLat, lambertConformalConic, rotateSphere};\nexport type {MapLikeType};","\nimport { getMinZoom } from \"./utils\";\nimport { LineData, Polyline } from \"./AutumnTypes\";\n\nimport * as Comlink from 'comlink';\nimport { LngLat } from \"./Map\";\n\nfunction makeBBElements(field_lats: Float32Array, field_lons: Float32Array, field_ni: number, field_nj: number,\n thin_fac_base: number, max_zoom: number) {\n \n const n_pts_per_poly = 6;\n const n_coords_per_pt_pts = 3;\n const n_coords_per_pt_tc = 2;\n\n const n_density_tiers = Math.log2(thin_fac_base);\n const n_inaccessible_tiers = Math.max(n_density_tiers + 1 - max_zoom, 0);\n const trim_inaccessible = Math.pow(2, n_inaccessible_tiers);\n\n const field_ni_access = Math.floor((field_ni - 1) / trim_inaccessible) + 1;\n const field_nj_access = Math.floor((field_nj - 1) / trim_inaccessible) + 1;\n\n const n_elems_pts = field_ni_access * field_nj_access * n_pts_per_poly * n_coords_per_pt_pts;\n const n_elems_tc = field_ni_access * field_nj_access * n_pts_per_poly * n_coords_per_pt_tc;\n\n let pts = new Float32Array(n_elems_pts);\n let tex_coords = new Float32Array(n_elems_tc);\n\n let istart_pts = 0;\n let istart_tc = 0;\n\n for (let ilat = 0; ilat < field_nj; ilat++) {\n for (let ilon = 0; ilon < field_ni; ilon++) {\n const idx = ilat * field_ni + ilon;\n const lat = field_lats[idx];\n const lon = field_lons[idx];\n\n const zoom = getMinZoom(ilat, ilon, thin_fac_base);\n\n if (zoom > max_zoom) continue;\n\n const pt_ll = new LngLat(lon, lat).toMercatorCoord();\n\n // These contain a degenerate triangle on either end to imitate primitive restarting\n // (see https://groups.google.com/g/webgl-dev-list/c/KLfiwj4jax0/m/cKiezrhRz8MJ?pli=1)\n for (let icrnr = 0; icrnr < n_pts_per_poly; icrnr++) {\n const actual_icrnr = Math.max(0, Math.min(icrnr - 1, 3));\n\n pts[istart_pts + icrnr * n_coords_per_pt_pts + 0] = pt_ll.x; \n pts[istart_pts + icrnr * n_coords_per_pt_pts + 1] = pt_ll.y; \n pts[istart_pts + icrnr * n_coords_per_pt_pts + 2] = zoom * 4 + actual_icrnr;\n\n tex_coords[istart_tc + icrnr * n_coords_per_pt_tc + 0] = ilon / (field_ni - 1);\n tex_coords[istart_tc + icrnr * n_coords_per_pt_tc + 1] = ilat / (field_nj - 1);\n }\n\n istart_pts += (n_pts_per_poly * n_coords_per_pt_pts);\n istart_tc += (n_pts_per_poly * n_coords_per_pt_tc);\n }\n }\n\n return {'pts': pts, 'tex_coords': tex_coords};\n}\n\nfunction makeDomainVerticesAndTexCoords(field_lats: Float32Array, field_lons: Float32Array, field_ni: number, field_nj: number, texcoord_margin_r: number, texcoord_margin_s: number) {\n const verts = new Float32Array(2 * 2 * (field_ni - 1) * (field_nj + 1)).fill(0);\n const tex_coords = new Float32Array(2 * 2 * (field_ni - 1) * (field_nj + 1)).fill(0);\n const grid_cell_size = new Float32Array(1 * 2 * (field_ni - 1) * (field_nj + 1)).fill(0);\n\n let ivert = 0\n let itexcoord = 0;\n\n for (let i = 0; i < field_ni - 1; i++) {\n for (let j = 0; j < field_nj; j++) {\n const idx = i + j * field_ni;\n\n const pt = new LngLat(field_lons[idx], field_lats[idx]).toMercatorCoord();\n const pt_ip1 = new LngLat(field_lons[idx + 1], field_lats[idx + 1]).toMercatorCoord();\n\n const r = i / (field_ni - 1) * (1 - 2 * texcoord_margin_r) + texcoord_margin_r;\n const rp1 = (i + 1) / (field_ni - 1) * (1 - 2 * texcoord_margin_r) + texcoord_margin_r;\n const s = j / (field_nj - 1) * (1 - 2 * texcoord_margin_s) + texcoord_margin_s;\n\n if (j == 0) {\n verts[ivert] = pt.x; verts[ivert + 1] = pt.y;\n ivert += 2\n\n tex_coords[itexcoord] = r; tex_coords[itexcoord + 1] = s;\n itexcoord += 2;\n }\n\n verts[ivert ] = pt.x; verts[ivert + 1] = pt.y;\n verts[ivert + 2] = pt_ip1.x; verts[ivert + 3] = pt_ip1.y;\n ivert += 4;\n\n tex_coords[itexcoord ] = r; tex_coords[itexcoord + 1] = s;\n tex_coords[itexcoord + 2] = rp1; tex_coords[itexcoord + 3] = s;\n itexcoord += 4;\n\n if (j == field_nj - 1) {\n verts[ivert] = pt_ip1.x; verts[ivert + 1] = pt_ip1.y;\n ivert += 2;\n\n tex_coords[itexcoord] = rp1; tex_coords[itexcoord + 1] = s;\n itexcoord += 2;\n }\n }\n }\n\n let igcs = 0;\n for (let i = 0; i < field_ni - 1; i++) {\n for (let j = 0; j < field_nj - 1; j++) {\n const ivert = j == 0 ? 2 * (igcs + 1) : 2 * igcs;\n const x_ll = verts[ivert], y_ll = verts[ivert + 1],\n x_lr = verts[ivert + 2], y_lr = verts[ivert + 3],\n x_ul = verts[ivert + 4], y_ul = verts[ivert + 5],\n x_ur = verts[ivert + 6], y_ur = verts[ivert + 7];\n\n const area = 0.5 * Math.abs(x_ll * (y_lr - y_ul) + x_lr * (y_ul - y_ll) + x_ul * (y_ll - y_lr) + \n x_ur * (y_ul - y_lr) + x_ul * (y_lr - y_ur) + x_lr * (y_ur - y_ul));\n\n if (j == 0) {\n grid_cell_size[igcs] = area;\n igcs += 1;\n }\n\n grid_cell_size[igcs] = area; grid_cell_size[igcs + 1] = area;\n igcs += 2;\n\n if (j == field_nj - 2) {\n grid_cell_size[igcs] = area; grid_cell_size[igcs + 1] = area; \n grid_cell_size[igcs + 2] = area;\n igcs += 3;\n }\n }\n }\n\n return {'vertices': verts, 'tex_coords': tex_coords, 'grid_cell_size': grid_cell_size};\n}\n\n/*\nfunction makePolylinesMiter(lines) {\n const n_points_per_vert = Object.fromEntries(Object.entries(lines[0]).map(([k, v]) => {\n let n_verts;\n if (v.length === undefined) {\n n_verts = 1;\n }\n else {\n n_verts = k == 'verts' ? v[0].length : v.length;\n }\n return [k, n_verts];\n }));\n n_points_per_vert['extrusion'] = 2;\n\n const n_verts = lines.map(l => l['verts'].length).reduce((a, b) => a + b);\n const ary_lens = Object.fromEntries(Object.entries(n_points_per_vert).map(([k, nppv]) => [k, (n_verts * 2 + lines.length * 2) * nppv]));\n\n let ret = Object.fromEntries(Object.entries(ary_lens).map(([k, v]) => [k, new Float32Array(v)]));\n\n let ilns = Object.fromEntries(Object.keys(ary_lens).map(k => [k, 0]));\n\n const is_cw_winding = (pt_prev, pt_this, pt_next) => {\n const winding = (pt_this[0] - pt_prev[0]) * (pt_this[1] + pt_prev[1]) \n + (pt_next[0] - pt_this[0]) * (pt_next[1] + pt_this[1]) \n + (pt_prev[0] - pt_next[0]) * (pt_prev[1] + pt_next[1]);\n\n return winding > 0;\n }\n\n const calculate_extrusion = (pt_prev, pt_this, pt_next) => {\n let line_vec_x_prev, line_vec_y_prev, line_vec_mag_prev, \n line_vec_x_next, line_vec_y_next, line_vec_mag_next;\n let ext_x, ext_y;\n\n if (pt_prev !== null) {\n line_vec_x_prev = pt_this[0] - pt_prev[0];\n line_vec_y_prev = pt_this[1] - pt_prev[1];\n line_vec_mag_prev = Math.hypot(line_vec_x_prev, line_vec_y_prev);\n line_vec_x_prev /= line_vec_mag_prev;\n line_vec_y_prev /= line_vec_mag_prev;\n }\n\n if (pt_next !== null) {\n line_vec_x_next = pt_next[0] - pt_this[0];\n line_vec_y_next = pt_next[1] - pt_this[1];\n line_vec_mag_next = Math.hypot(line_vec_x_next, line_vec_y_next);\n line_vec_x_next /= line_vec_mag_next;\n line_vec_y_next /= line_vec_mag_next;\n }\n\n if (pt_prev === null) {\n // First point in the line gets just the normal for the first segment\n ext_x = line_vec_y_next; ext_y = -line_vec_x_next;\n }\n else if (pt_this === null) {\n // Last point in the line gets just the normal for the last segment\n ext_x = line_vec_y_prev; ext_y = -line_vec_x_prev;\n }\n else {\n // Miter join: compute the extrusion vector halfway between the next and previous normal\n const dot = line_vec_x_prev * line_vec_x_next + line_vec_y_prev * line_vec_y_next;\n const ext_fac = Math.sqrt((1 - dot) / (1 + dot));\n const sign = is_cw_winding(pt_prev, pt_this, pt_this) ? -1 : 1;\n ext_x = line_vec_y_prev + sign * line_vec_x_prev * ext_fac;\n ext_y = sign * line_vec_y_prev * ext_fac - line_vec_x_prev;\n }\n\n return [ext_x, ext_y];\n }\n\n lines.forEach(line => {\n const verts = line['verts'];\n let ext_x, ext_y;\n\n let ivt = 0;\n ret['verts'][ilns['verts']] = verts[ivt][0]; ret['verts'][ilns['verts'] + 1] = verts[ivt][1];\n\n [ext_x, ext_y] = calculate_extrusion(null, verts[ivt], verts[ivt + 1]);\n ret['extrusion'][ilns['extrusion']] = ext_x; ret['extrusion'][ilns['extrusion'] + 1] = ext_y;\n\n for (ivt = 0; ivt < verts.length; ivt++) {\n const ary_ivt = ilns['verts'] + 2 * (2 * ivt + 1);\n ret['verts'][ary_ivt + 0] = verts[ivt][0]; ret['verts'][ary_ivt + 1] = verts[ivt][1];\n ret['verts'][ary_ivt + 2] = verts[ivt][0]; ret['verts'][ary_ivt + 3] = verts[ivt][1];\n\n if (ivt == 0) {\n [ext_x, ext_y] = calculate_extrusion(null, verts[ivt], verts[ivt + 1]);\n }\n else if (ivt == verts.length - 1) {\n [ext_x, ext_y] = calculate_extrusion(verts[ivt - 1], verts[ivt], null);\n }\n else {\n [ext_x, ext_y] = calculate_extrusion(verts[ivt - 1], verts[ivt], verts[ivt + 1]);\n }\n\n ret['extrusion'][ary_ivt + 0] = ext_x; ret['extrusion'][ary_ivt + 1] = ext_y;\n ret['extrusion'][ary_ivt + 2] = -ext_x; ret['extrusion'][ary_ivt + 3] = -ext_y;\n }\n\n ivt = verts.length - 1;\n ret['verts'][ilns['verts'] + 2 * (2 * ivt + 1) + 4] = verts[ivt][0]; \n ret['verts'][ilns['verts'] + 2 * (2 * ivt + 1) + 5] = verts[ivt][1];\n \n [ext_x, ext_y] = calculate_extrusion(verts[ivt - 1], verts[ivt], null);\n\n ret['extrusion'][ilns['extrusion'] + 2 * (2 * ivt + 1) + 4] = -ext_x; \n ret['extrusion'][ilns['extrusion'] + 2 * (2 * ivt + 1) + 5] = -ext_y;\n\n for (let key in ret) {\n if (key == 'verts' || key == 'extrusion') continue;\n\n for (ivt = 0; ivt < (verts.length * 2 + 2) * n_points_per_vert[key]; ivt += n_points_per_vert[key]) {\n if (line[key].length !== undefined) {\n line[key].forEach((cd, icd) => {\n ret[key][ilns[key] + ivt + icd] = cd;\n })\n }\n else {\n ret[key][ilns[key] + ivt] = line[key];\n }\n }\n }\n\n Object.keys(ilns).forEach(k => {\n ilns[k] += (verts.length * 2 + 2) * n_points_per_vert[k];\n })\n })\n\n return ret;\n}\n*/\n\nfunction makePolylines(lines: LineData[]) : Polyline {\n if (lines.length == 0) {\n return {vertices: new Float32Array([]), extrusion: new Float32Array([])};\n }\n\n const n_points_per_vert = Object.fromEntries(Object.entries(lines[0]).map(([k, v]) => {\n let n_verts: number;\n if (typeof v === 'number') {\n n_verts = 1;\n }\n else if (typeof v[0] === 'number') {\n n_verts = 1;\n }\n else {\n n_verts = v[0].length;\n }\n return [k, n_verts];\n }));\n n_points_per_vert['extrusion'] = 2;\n n_points_per_vert['vertices'] += 1;\n\n const n_verts = lines.map(l => l.vertices.length).reduce((a, b) => a + b);\n const n_out_verts = n_verts * 4 - lines.length * 2;\n const ary_lens = Object.fromEntries(Object.entries(n_points_per_vert).map(([k, nppv]) => [k, n_out_verts * nppv]));\n\n let ret: Polyline = {\n vertices: new Float32Array(ary_lens['vertices']),\n extrusion: new Float32Array(ary_lens['extrusion']),\n }\n\n if ('offsets' in lines[0]) {\n ret.offsets = new Float32Array(ary_lens['offsets']);\n }\n\n if ('data' in lines[0]) {\n ret.data = new Float32Array(ary_lens['data']);\n }\n\n if ('zoom' in lines[0]) {\n ret.zoom = new Float32Array(ary_lens['zoom']);\n }\n\n let ilns = Object.fromEntries(Object.keys(ary_lens).map(k => [k, 0]));\n\n const compute_normal_vec = (pt1: [number, number], pt2: [number, number], flip_y_coord: boolean) => {\n const line_vec_x = pt2[0] - pt1[0];\n const line_vec_y = pt2[1] - pt1[1];\n const line_vec_mag = Math.hypot(line_vec_x, line_vec_y);\n\n const ext_x = line_vec_y / line_vec_mag;\n const ext_y = -line_vec_x / line_vec_mag;\n\n return [ext_x, flip_y_coord ? -ext_y : ext_y];\n }\n\n lines.forEach(line => {\n const verts = line.vertices.map(v => {\n const v_ll = new LngLat(...v).toMercatorCoord();\n return [v_ll.x, v_ll.y] as [number, number];\n });\n\n const has_offsets = line.offsets !== undefined;\n const extrusion_verts = line.offsets !== undefined ? line.offsets : verts;\n\n let pt_prev: [number, number], pt_this = verts[0], pt_next = verts[1];\n let ept_prev: [number, number], ept_this = extrusion_verts[0], ept_next = extrusion_verts[1];\n let len_prev: number, len_this = 0.0001;\n let [ext_x, ext_y] = compute_normal_vec(ept_this, ept_next, !has_offsets);\n\n ret.vertices[ilns.vertices++] = pt_this[0]; ret.vertices[ilns.vertices++] = pt_this[1]; ret.vertices[ilns.vertices++] = len_this;\n ret.extrusion[ilns.extrusion++] = ext_x; ret.extrusion[ilns.extrusion++] = ext_y;\n\n for (let ivt = 1; ivt < verts.length; ivt++) {\n pt_this = verts[ivt]; pt_prev = verts[ivt - 1];\n ept_this = extrusion_verts[ivt]; ept_prev = extrusion_verts[ivt - 1];\n\n [ext_x, ext_y] = compute_normal_vec(ept_prev, ept_this, !has_offsets);\n len_prev = len_this; len_this += Math.hypot(verts[ivt - 1][0] - verts[ivt][0], verts[ivt - 1][1] - verts[ivt][1]);\n\n ret.vertices[ilns.vertices++] = pt_prev[0]; ret.vertices[ilns.vertices++] = pt_prev[1]; ret.vertices[ilns.vertices++] = -len_prev;\n ret.vertices[ilns.vertices++] = pt_prev[0]; ret.vertices[ilns.vertices++] = pt_prev[1]; ret.vertices[ilns.vertices++] = len_prev;\n\n ret.vertices[ilns.vertices++] = pt_this[0]; ret.vertices[ilns.vertices++] = pt_this[1]; ret.vertices[ilns.vertices++] = -len_this;\n ret.vertices[ilns.vertices++] = pt_this[0]; ret.vertices[ilns.vertices++] = pt_this[1]; ret.vertices[ilns.vertices++] = len_this;\n\n ret.extrusion[ilns.extrusion++] = ext_x; ret.extrusion[ilns.extrusion++] = ext_y;\n ret.extrusion[ilns.extrusion++] = -ext_x; ret.extrusion[ilns.extrusion++] = -ext_y;\n\n ret.extrusion[ilns.extrusion++] = ext_x; ret.extrusion[ilns.extrusion++] = ext_y;\n ret.extrusion[ilns.extrusion++] = -ext_x; ret.extrusion[ilns.extrusion++] = -ext_y;\n }\n\n ret.vertices[ilns.vertices++] = pt_this[0]; ret.vertices[ilns.vertices++] = pt_this[1]; ret.vertices[ilns.vertices++] = len_this;\n ret.extrusion[ilns.extrusion++] = -ext_x; ret.extrusion[ilns.extrusion++] = -ext_y;\n\n if (ret.offsets !== undefined && line.offsets !== undefined) {\n const offsets = line.offsets;\n let off_prev: [number, number], off_this = offsets[0];\n\n ret.offsets[ilns.offsets++] = off_this[0]; ret.offsets[ilns.offsets++] = off_this[1];\n\n for (let ivt = 1; ivt < offsets.length; ivt++) {\n off_this = offsets[ivt]; off_prev = offsets[ivt - 1];\n\n ret.offsets[ilns.offsets++] = off_prev[0]; ret.offsets[ilns.offsets++] = off_prev[1];\n ret.offsets[ilns.offsets++] = off_prev[0]; ret.offsets[ilns.offsets++] = off_prev[1];\n ret.offsets[ilns.offsets++] = off_this[0]; ret.offsets[ilns.offsets++] = off_this[1];\n ret.offsets[ilns.offsets++] = off_this[0]; ret.offsets[ilns.offsets++] = off_this[1];\n }\n\n ret.offsets[ilns.offsets++] = off_this[0]; ret.offsets[ilns.offsets++] = off_this[1];\n }\n\n if (ret.data !== undefined && line.data !== undefined) {\n const data = line.data;\n let data_prev: number, data_this = data[0];\n\n ret.data[ilns.data++] = data_this;\n \n for (let ivt = 1; ivt < data.length; ivt++) {\n data_this = data[ivt]; data_prev = data[ivt - 1];\n\n ret.data[ilns.data++] = data_prev;\n ret.data[ilns.data++] = data_prev;\n ret.data[ilns.data++] = data_this;\n ret.data[ilns.data++] = data_this;\n }\n\n ret.data[ilns.data++] = data_this;\n }\n \n if (ret.zoom !== undefined && line.zoom !== undefined) {\n for (let ivt = 0; ivt < verts.length * 4 - 2; ivt++) {\n ret.zoom[ilns.zoom++] = line['zoom'];\n }\n }\n })\n\n return ret;\n}\n\nconst ep_interface = {\n 'makeBBElements': makeBBElements, \n 'makeDomainVerticesAndTexCoords': makeDomainVerticesAndTexCoords,\n 'makePolyLines': makePolylines\n}\n\ntype PlotLayerWorker = typeof ep_interface;\n\nComlink.expose(ep_interface);\n\nexport type {PlotLayerWorker}"],"names":["root","factory","exports","module","define","amd","this","getMinZoom","jlat","ilon","thin_fac_base","zoom","thin_fac","proxyMarker","Symbol","createEndpoint","releaseProxy","throwMarker","isObject","val","transferHandlers","Map","canHandle","serialize","obj","port1","port2","MessageChannel","expose","deserialize","port","start","createProxy","target","value","serialized","Error","isError","message","name","stack","Object","assign","ep","self","addEventListener","callback","ev","data","id","type","path","argumentList","map","fromWireValue","returnValue","parent","slice","reduce","prop","rawValue","apply","proxy","transfers","transferCache","set","transfer","undefined","Promise","resolve","catch","then","wireValue","transferables","toWireValue","postMessage","removeEventListener","closeEndPoint","endpoint","constructor","isMessagePort","close","throwIfProxyReleased","isReleased","isProxyReleased","Proxy","get","_target","requestResponseMessage","p","toString","length","r","bind","_thisArg","rawArgumentList","last","processArguments","construct","processed","v","arr","Array","prototype","concat","WeakMap","handler","serializedValue","msg","fill","Math","floor","random","Number","MAX_SAFE_INTEGER","join","l","lng","lat","isNaN","toMercatorCoord","x","y","sin_lat","sin","PI","log","min","max","fromMercatorCoord","LngLat","lngFromMercatorX","atan","sinh","latFromMercatorY","field_lats","field_lons","field_ni","field_nj","max_zoom","n_density_tiers","log2","n_inaccessible_tiers","trim_inaccessible","pow","field_ni_access","field_nj_access","n_elems_tc","pts","Float32Array","tex_coords","istart_pts","istart_tc","ilat","idx","lon","pt_ll","icrnr","actual_icrnr","texcoord_margin_r","texcoord_margin_s","verts","grid_cell_size","ivert","itexcoord","i","j","pt","pt_ip1","rp1","s","igcs","x_ll","y_ll","x_lr","y_lr","x_ul","y_ul","x_ur","y_ur","area","abs","lines","vertices","extrusion","n_points_per_vert","fromEntries","entries","k","n_out_verts","a","b","ary_lens","nppv","ret","offsets","ilns","keys","compute_normal_vec","pt1","pt2","flip_y_coord","line_vec_x","line_vec_y","line_vec_mag","hypot","ext_y","forEach","line","pt_prev","ept_prev","len_prev","v_ll","has_offsets","extrusion_verts","pt_this","ept_this","ept_next","len_this","ext_x","ivt","off_prev","off_this","data_prev","data_this"],"sourceRoot":""}
|
package/lib/ContourCreator.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { MarchingSquaresModule } from './cpp/marchingsquares';
|
|
2
|
-
import './cpp/marchingsquares.wasm';
|
|
3
|
-
import { Grid } from "./Grid";
|
|
4
|
-
import { ContourData, TypedArray } from "./AutumnTypes";
|
|
5
|
-
declare function initMSModule(): Promise<MarchingSquaresModule>;
|
|
6
|
-
interface FieldContourOpts {
|
|
7
|
-
/**
|
|
8
|
-
* The interval at which to create contours. The field will be contoured at this interval from its minimum to its maximum.
|
|
9
|
-
*/
|
|
10
|
-
interval?: number;
|
|
11
|
-
/**
|
|
12
|
-
* Contour the field at these specific levels.
|
|
13
|
-
*/
|
|
14
|
-
levels?: number[];
|
|
15
|
-
/**
|
|
16
|
-
* Add triangles in the contouring, which takes longer and generates more detailed (not necessarily smoother or better) contours
|
|
17
|
-
*/
|
|
18
|
-
quad_as_tri?: boolean;
|
|
19
|
-
}
|
|
20
|
-
declare function contourCreator<ArrayType extends TypedArray>(data: ArrayType, grid: Grid, opts: FieldContourOpts): Promise<ContourData>;
|
|
21
|
-
export { contourCreator, initMSModule };
|
|
22
|
-
export type { FieldContourOpts };
|