autumnplot-gl 2.2.2 → 3.0.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.
Files changed (49) hide show
  1. package/README.md +65 -8
  2. package/dist/110.autumnplot-gl.js +2 -0
  3. package/dist/110.autumnplot-gl.js.map +1 -0
  4. package/dist/autumnplot-gl.js +3 -0
  5. package/dist/autumnplot-gl.js.LICENSE.txt +12 -0
  6. package/dist/autumnplot-gl.js.map +1 -0
  7. package/dist/marchingsquares.wasm +0 -0
  8. package/lib/AutumnTypes.d.ts +14 -13
  9. package/lib/Barbs.d.ts +8 -3
  10. package/lib/Barbs.js +14 -1
  11. package/lib/BillboardCollection.d.ts +11 -7
  12. package/lib/BillboardCollection.js +54 -31
  13. package/lib/ColorBar.js +51 -7
  14. package/lib/Colormap.d.ts +14 -3
  15. package/lib/Colormap.js +63 -12
  16. package/lib/Contour.d.ts +73 -16
  17. package/lib/Contour.js +175 -146
  18. package/lib/ContourCreator.d.ts +18 -0
  19. package/lib/ContourCreator.js +59 -0
  20. package/lib/Fill.d.ts +17 -5
  21. package/lib/Fill.js +60 -37
  22. package/lib/Grid.d.ts +167 -0
  23. package/lib/Grid.js +339 -0
  24. package/lib/Hodographs.d.ts +13 -5
  25. package/lib/Hodographs.js +52 -67
  26. package/lib/Map.d.ts +14 -3
  27. package/lib/Map.js +9 -0
  28. package/lib/Paintball.d.ts +9 -3
  29. package/lib/Paintball.js +28 -10
  30. package/lib/PlotComponent.d.ts +5 -5
  31. package/lib/PlotLayer.d.ts +12 -12
  32. package/lib/PlotLayer.js +16 -14
  33. package/lib/PlotLayer.worker.d.ts +2 -2
  34. package/lib/PlotLayer.worker.js +102 -66
  35. package/lib/PolylineCollection.d.ts +20 -9
  36. package/lib/PolylineCollection.js +158 -32
  37. package/lib/RawField.d.ts +11 -167
  38. package/lib/RawField.js +37 -383
  39. package/lib/TextCollection.d.ts +31 -0
  40. package/lib/TextCollection.js +295 -0
  41. package/lib/cpp/marchingsquares.d.ts +6 -0
  42. package/lib/cpp/marchingsquares.js +4152 -0
  43. package/lib/cpp/marchingsquares.wasm +0 -0
  44. package/lib/cpp/marchingsquares_embind.d.ts +47 -0
  45. package/lib/index.d.ts +13 -6
  46. package/lib/index.js +12 -3
  47. package/lib/utils.d.ts +5 -3
  48. package/lib/utils.js +17 -6
  49. package/package.json +14 -9
Binary file
@@ -0,0 +1,47 @@
1
+ export interface Point {
2
+ x: number;
3
+ y: number;
4
+ delete(): void;
5
+ }
6
+
7
+ export interface LineString {
8
+ point_list: PointList;
9
+ delete(): void;
10
+ }
11
+
12
+ export interface FloatList {
13
+ size(): number;
14
+ push_back(_0: number): void;
15
+ resize(_0: number, _1: number): void;
16
+ set(_0: number, _1: number): boolean;
17
+ get(_0: number): any;
18
+ delete(): void;
19
+ }
20
+
21
+ export interface LineStringList {
22
+ push_back(_0: LineString): void;
23
+ resize(_0: number, _1: LineString): void;
24
+ size(): number;
25
+ set(_0: number, _1: LineString): boolean;
26
+ get(_0: number): any;
27
+ delete(): void;
28
+ }
29
+
30
+ export interface PointList {
31
+ push_back(_0: Point): void;
32
+ resize(_0: number, _1: Point): void;
33
+ size(): number;
34
+ set(_0: number, _1: Point): boolean;
35
+ get(_0: number): any;
36
+ delete(): void;
37
+ }
38
+
39
+ export interface MainModule {
40
+ Point: {new(): Point};
41
+ LineString: {new(): LineString};
42
+ FloatList: {new(): FloatList};
43
+ LineStringList: {new(): LineStringList};
44
+ PointList: {new(): PointList};
45
+ makeContoursFloat32(_0: FloatList, _1: FloatList, _2: FloatList, _3: number): LineStringList;
46
+ getContourLevelsFloat32(_0: FloatList, _1: number, _2: number, _3: number): FloatList;
47
+ }
package/lib/index.d.ts CHANGED
@@ -1,15 +1,17 @@
1
1
  import { PlotComponent } from "./PlotComponent";
2
- import Contour, { ContourOptions } from "./Contour";
2
+ import Contour, { ContourOptions, ContourLabels, ContourLabelOptions } from "./Contour";
3
3
  import { ContourFill, Raster, ContourFillOptions, RasterOptions } from "./Fill";
4
4
  import Barbs, { BarbsOptions } from "./Barbs";
5
5
  import Paintball, { PaintballOptions } from "./Paintball";
6
6
  import Hodographs, { HodographOptions } from './Hodographs';
7
7
  import { PlotLayer, MultiPlotLayer } from './PlotLayer';
8
- import { WindProfile, WebGLAnyRenderingContext, TypedArray } from "./AutumnTypes";
9
- import { MapType } from "./Map";
10
- import { ColorMap, Color } from './Colormap';
8
+ import { WindProfile, WebGLAnyRenderingContext, TypedArray, ContourData } from "./AutumnTypes";
9
+ import { MapLikeType } from "./Map";
10
+ import { ColorMap, ColorMapOptions, Color } from './Colormap';
11
11
  import { makeColorBar, makePaintballKey, ColorbarOrientation, ColorbarTickDirection, ColorBarOptions, PaintballKeyOptions } from "./ColorBar";
12
- import { RawScalarField, RawVectorField, RawProfileField, Grid, GridType, VectorRelativeTo, RawVectorFieldOptions, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid } from "./RawField";
12
+ import { RawScalarField, RawVectorField, RawProfileField, VectorRelativeTo, RawVectorFieldOptions } from "./RawField";
13
+ import { Grid, GridType, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid } from './Grid';
14
+ import { FieldContourOpts } from './ContourCreator';
13
15
  declare const colormaps: {
14
16
  bluered: (level_min: number, level_max: number, n_colors: number) => ColorMap;
15
17
  redblue: (level_min: number, level_max: number, n_colors: number) => ColorMap;
@@ -20,4 +22,9 @@ declare const colormaps: {
20
22
  pw_td2m: ColorMap;
21
23
  nws_storm_clear_refl: ColorMap;
22
24
  };
23
- export { PlotComponent, Barbs, BarbsOptions, Contour, ContourOptions, ContourFill, Raster, ContourFillOptions, RasterOptions, Paintball, PaintballOptions, Hodographs, HodographOptions, WindProfile, PlotLayer, MultiPlotLayer, MapType, ColorMap, colormaps, makeColorBar, makePaintballKey, Color, ColorbarOrientation, ColorbarTickDirection, ColorBarOptions, PaintballKeyOptions, RawScalarField, RawVectorField, RawProfileField, Grid, GridType, VectorRelativeTo, RawVectorFieldOptions, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, WebGLAnyRenderingContext, TypedArray };
25
+ /**
26
+ * Initialize the WebAssembly module in autumnplot-gl. It's not strictly necessary to call it first, but if you call it
27
+ * first, you can prevent races when you contour a bunch of fields at once.
28
+ */
29
+ declare function initAutumnPlot(): void;
30
+ export { PlotComponent, Barbs, BarbsOptions, Contour, ContourOptions, ContourLabels, ContourLabelOptions, ContourFill, Raster, ContourFillOptions, RasterOptions, Paintball, PaintballOptions, Hodographs, HodographOptions, WindProfile, PlotLayer, MultiPlotLayer, MapLikeType, ColorMap, ColorMapOptions, colormaps, makeColorBar, makePaintballKey, Color, ColorbarOrientation, ColorbarTickDirection, ColorBarOptions, PaintballKeyOptions, RawScalarField, RawVectorField, RawProfileField, Grid, GridType, VectorRelativeTo, RawVectorFieldOptions, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, WebGLAnyRenderingContext, TypedArray, ContourData, initAutumnPlot, FieldContourOpts };
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PlotComponent } from "./PlotComponent";
2
- import Contour from "./Contour";
2
+ import Contour, { ContourLabels } from "./Contour";
3
3
  import { ContourFill, Raster } from "./Fill";
4
4
  import Barbs from "./Barbs";
5
5
  import Paintball from "./Paintball";
@@ -7,7 +7,9 @@ import Hodographs from './Hodographs';
7
7
  import { PlotLayer, MultiPlotLayer } from './PlotLayer';
8
8
  import { ColorMap, bluered, redblue, pw_speed500mb, pw_speed850mb, pw_cape, pw_t2m, pw_td2m, nws_storm_clear_refl } from './Colormap';
9
9
  import { makeColorBar, makePaintballKey } from "./ColorBar";
10
- import { RawScalarField, RawVectorField, RawProfileField, Grid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid } from "./RawField";
10
+ import { RawScalarField, RawVectorField, RawProfileField } from "./RawField";
11
+ import { Grid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid } from './Grid';
12
+ import { initMSModule } from './ContourCreator';
11
13
  const colormaps = {
12
14
  bluered: bluered,
13
15
  redblue: redblue,
@@ -18,4 +20,11 @@ const colormaps = {
18
20
  pw_td2m: pw_td2m,
19
21
  nws_storm_clear_refl: nws_storm_clear_refl,
20
22
  };
21
- export { PlotComponent, Barbs, Contour, ContourFill, Raster, Paintball, Hodographs, PlotLayer, MultiPlotLayer, ColorMap, colormaps, makeColorBar, makePaintballKey, RawScalarField, RawVectorField, RawProfileField, Grid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid };
23
+ /**
24
+ * Initialize the WebAssembly module in autumnplot-gl. It's not strictly necessary to call it first, but if you call it
25
+ * first, you can prevent races when you contour a bunch of fields at once.
26
+ */
27
+ function initAutumnPlot() {
28
+ initMSModule();
29
+ }
30
+ export { PlotComponent, Barbs, Contour, ContourLabels, ContourFill, Raster, Paintball, Hodographs, PlotLayer, MultiPlotLayer, ColorMap, colormaps, makeColorBar, makePaintballKey, RawScalarField, RawVectorField, RawProfileField, Grid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, initAutumnPlot };
package/lib/utils.d.ts CHANGED
@@ -8,9 +8,11 @@ declare function getMinZoom(jlat: number, ilon: number, thin_fac_base: number):
8
8
  declare function zip(...args: any[]): Generator<any[], void, unknown>;
9
9
  declare function getOS(): string;
10
10
  declare class Cache<A extends unknown[], R> {
11
- private cached_value;
11
+ private cached_values;
12
12
  private readonly compute_value;
13
- constructor(compute_value: (...args: A) => R);
13
+ private readonly make_key;
14
+ constructor(compute_value: (...args: A) => R, make_key?: (...args: A) => string);
14
15
  getValue(...args: A): R;
15
16
  }
16
- export { hex2rgba, rgba2hex, hex2rgb, rgb2hex, rgb2hsv, hsv2rgb, zip, getMinZoom, getOS, Cache };
17
+ declare function normalizeOptions<Type extends Record<string, any>>(opts: Type | undefined, defaults: Required<Type>): Required<Type>;
18
+ export { hex2rgba, rgba2hex, hex2rgb, rgb2hex, rgb2hsv, hsv2rgb, zip, getMinZoom, getOS, Cache, normalizeOptions };
package/lib/utils.js CHANGED
@@ -121,15 +121,26 @@ function getOS() {
121
121
  return os;
122
122
  }
123
123
  class Cache {
124
- constructor(compute_value) {
125
- this.cached_value = null;
124
+ constructor(compute_value, make_key) {
125
+ this.cached_values = {};
126
126
  this.compute_value = compute_value;
127
+ this.make_key = make_key === undefined ? (...args) => JSON.stringify(args) : make_key;
127
128
  }
128
129
  getValue(...args) {
129
- if (this.cached_value === null) {
130
- this.cached_value = this.compute_value(...args);
130
+ const key = this.make_key(...args);
131
+ if (!(key in this.cached_values)) {
132
+ this.cached_values[key] = this.compute_value(...args);
131
133
  }
132
- return this.cached_value;
134
+ return this.cached_values[key];
133
135
  }
134
136
  }
135
- export { hex2rgba, rgba2hex, hex2rgb, rgb2hex, rgb2hsv, hsv2rgb, zip, getMinZoom, getOS, Cache };
137
+ function normalizeOptions(opts, defaults) {
138
+ const ret = { ...defaults };
139
+ if (opts !== undefined) {
140
+ Object.entries(opts).forEach(([k, v]) => {
141
+ ret[k] = v;
142
+ });
143
+ }
144
+ return ret;
145
+ }
146
+ export { hex2rgba, rgba2hex, hex2rgb, rgb2hex, rgb2hsv, hsv2rgb, zip, getMinZoom, getOS, Cache, normalizeOptions };
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "autumnplot-gl",
3
- "version": "2.2.2",
3
+ "version": "3.0.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "files": [
8
- "lib/**/*"
8
+ "lib/**/*",
9
+ "dist/*"
9
10
  ],
10
11
  "scripts": {
11
12
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -18,13 +19,14 @@
18
19
  "author": "Tim Supinie",
19
20
  "license": "MIT",
20
21
  "devDependencies": {
22
+ "@types/emscripten": "^1.39.10",
23
+ "@types/kd-tree-javascript": "^1.0.3",
21
24
  "@types/luxon": "^3.2.0",
22
- "@types/mapbox-gl": "^2.7.10",
23
- "@types/maplibre-gl": "^1.14.0",
25
+ "@types/pbf": "^3.0.5",
24
26
  "ts-loader": "^9.4.2",
25
- "typedoc": "^0.23.24",
26
- "typedoc-plugin-markdown": "^3.14.0",
27
- "typescript": "^4.9.4",
27
+ "typedoc": "^0.25.13",
28
+ "typedoc-plugin-markdown": "^4.0.2",
29
+ "typescript": "^5.4.5",
28
30
  "webpack": "^5.75.0",
29
31
  "webpack-cli": "^5.0.1",
30
32
  "webpack-dev-server": "^4.11.1",
@@ -32,7 +34,10 @@
32
34
  },
33
35
  "dependencies": {
34
36
  "@petamoriken/float16": "^3.8.4",
35
- "autumn-wgl": "^1.2.0",
36
- "comlink": "^4.3.1"
37
+ "autumn-wgl": "^1.4.0",
38
+ "comlink": "^4.3.1",
39
+ "kd-tree-javascript": "^1.0.3",
40
+ "pbf": "^3.2.1",
41
+ "potpack": "^2.0.0"
37
42
  }
38
43
  }