autumnplot-gl 3.0.0 → 3.2.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 (44) hide show
  1. package/README.md +6 -11
  2. package/dist/110.autumnplot-gl.js +1 -1
  3. package/dist/110.autumnplot-gl.js.map +1 -1
  4. package/dist/autumnplot-gl.js +1 -1
  5. package/dist/autumnplot-gl.js.map +1 -1
  6. package/dist/marchingsquares.wasm +0 -0
  7. package/lib/Barbs.d.ts +18 -2
  8. package/lib/Barbs.js +25 -19
  9. package/lib/BillboardCollection.d.ts +9 -2
  10. package/lib/BillboardCollection.js +46 -9
  11. package/lib/Color.d.ts +56 -0
  12. package/lib/Color.js +160 -0
  13. package/lib/ColorBar.d.ts +2 -1
  14. package/lib/ColorBar.js +5 -5
  15. package/lib/Colormap.d.ts +19 -18
  16. package/lib/Colormap.js +81 -20
  17. package/lib/Contour.d.ts +25 -6
  18. package/lib/Contour.js +61 -12
  19. package/lib/ContourCreator.js +4 -40
  20. package/lib/Fill.d.ts +2 -4
  21. package/lib/Fill.js +29 -45
  22. package/lib/Grid.d.ts +1 -0
  23. package/lib/Grid.js +6 -1
  24. package/lib/Hodographs.d.ts +19 -3
  25. package/lib/Hodographs.js +23 -20
  26. package/lib/Paintball.d.ts +2 -2
  27. package/lib/Paintball.js +9 -6
  28. package/lib/PlotComponent.js +9 -4
  29. package/lib/PlotLayer.d.ts +1 -1
  30. package/lib/PlotLayer.worker.js +10 -7
  31. package/lib/PolylineCollection.d.ts +13 -6
  32. package/lib/PolylineCollection.js +76 -64
  33. package/lib/StationPlot.d.ts +34 -0
  34. package/lib/StationPlot.js +73 -0
  35. package/lib/TextCollection.d.ts +3 -2
  36. package/lib/TextCollection.js +21 -11
  37. package/lib/cpp/marchingsquares.js +558 -1261
  38. package/lib/cpp/marchingsquares.wasm +0 -0
  39. package/lib/cpp/marchingsquares_embind.d.ts +4 -45
  40. package/lib/index.d.ts +4 -2
  41. package/lib/index.js +2 -1
  42. package/lib/utils.d.ts +2 -8
  43. package/lib/utils.js +1 -83
  44. package/package.json +2 -2
Binary file
@@ -1,47 +1,6 @@
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
1
  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;
2
+ makeContoursFloat32(_0: any, _1: any, _2: any, _3: any, _4: any): any;
3
+ makeContoursFloat16(_0: any, _1: any, _2: any, _3: any, _4: any): any;
4
+ getContourLevelsFloat32(_0: any, _1: number, _2: number, _3: number): any;
5
+ getContourLevelsFloat16(_0: any, _1: number, _2: number, _3: number): any;
47
6
  }
package/lib/index.d.ts CHANGED
@@ -7,8 +7,10 @@ import Hodographs, { HodographOptions } from './Hodographs';
7
7
  import { PlotLayer, MultiPlotLayer } from './PlotLayer';
8
8
  import { WindProfile, WebGLAnyRenderingContext, TypedArray, ContourData } from "./AutumnTypes";
9
9
  import { MapLikeType } from "./Map";
10
- import { ColorMap, ColorMapOptions, Color } from './Colormap';
10
+ import { ColorMap, ColorMapOptions } from './Colormap';
11
+ import { Color } from "./Color";
11
12
  import { makeColorBar, makePaintballKey, ColorbarOrientation, ColorbarTickDirection, ColorBarOptions, PaintballKeyOptions } from "./ColorBar";
13
+ import { LineStyle } from "./PolylineCollection";
12
14
  import { RawScalarField, RawVectorField, RawProfileField, VectorRelativeTo, RawVectorFieldOptions } from "./RawField";
13
15
  import { Grid, GridType, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid } from './Grid';
14
16
  import { FieldContourOpts } from './ContourCreator';
@@ -27,4 +29,4 @@ declare const colormaps: {
27
29
  * first, you can prevent races when you contour a bunch of fields at once.
28
30
  */
29
31
  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 };
32
+ export { PlotComponent, Barbs, BarbsOptions, Contour, ContourOptions, ContourLabels, ContourLabelOptions, ContourFill, Raster, ContourFillOptions, RasterOptions, Paintball, PaintballOptions, Hodographs, HodographOptions, WindProfile, PlotLayer, MultiPlotLayer, MapLikeType, LineStyle, 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
@@ -6,6 +6,7 @@ import Paintball from "./Paintball";
6
6
  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
+ import { Color } from "./Color";
9
10
  import { makeColorBar, makePaintballKey } from "./ColorBar";
10
11
  import { RawScalarField, RawVectorField, RawProfileField } from "./RawField";
11
12
  import { Grid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid } from './Grid';
@@ -27,4 +28,4 @@ const colormaps = {
27
28
  function initAutumnPlot() {
28
29
  initMSModule();
29
30
  }
30
- export { PlotComponent, Barbs, Contour, ContourLabels, ContourFill, Raster, Paintball, Hodographs, PlotLayer, MultiPlotLayer, ColorMap, colormaps, makeColorBar, makePaintballKey, RawScalarField, RawVectorField, RawProfileField, Grid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, initAutumnPlot };
31
+ export { PlotComponent, Barbs, Contour, ContourLabels, ContourFill, Raster, Paintball, Hodographs, PlotLayer, MultiPlotLayer, ColorMap, colormaps, makeColorBar, makePaintballKey, Color, RawScalarField, RawVectorField, RawProfileField, Grid, PlateCarreeGrid, PlateCarreeRotatedGrid, LambertGrid, initAutumnPlot };
package/lib/utils.d.ts CHANGED
@@ -1,12 +1,6 @@
1
- declare const hex2rgba: (hexstr: string, out_type?: string) => [number, number, number, number];
2
- declare const rgba2hex: (rgba: [number, number, number, number], in_type?: string) => string;
3
- declare const hex2rgb: (hexstr: string, out_type?: string) => [number, number, number];
4
- declare const rgb2hex: (rgb: [number, number, number], in_type?: string) => string;
5
- declare const rgb2hsv: (rgb: [number, number, number]) => [number, number, number];
6
- declare const hsv2rgb: (hsv: [number, number, number]) => [number, number, number];
7
1
  declare function getMinZoom(jlat: number, ilon: number, thin_fac_base: number): number;
8
2
  declare function zip(...args: any[]): Generator<any[], void, unknown>;
9
- declare function getOS(): string;
3
+ declare function getOS(): string | null;
10
4
  declare class Cache<A extends unknown[], R> {
11
5
  private cached_values;
12
6
  private readonly compute_value;
@@ -15,4 +9,4 @@ declare class Cache<A extends unknown[], R> {
15
9
  getValue(...args: A): R;
16
10
  }
17
11
  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 };
12
+ export { zip, getMinZoom, getOS, Cache, normalizeOptions };
package/lib/utils.js CHANGED
@@ -1,85 +1,3 @@
1
- const hex2rgba = (hexstr, out_type) => {
2
- out_type = out_type === undefined ? 'float' : out_type;
3
- const match = hexstr.match(/#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?/i);
4
- if (match === null) {
5
- throw `Got '${hexstr}' in hex2rgba, which does not look like a hex color`;
6
- }
7
- let rgba = match.slice(1).filter(c => c !== undefined).map(c => parseInt(c, 16));
8
- if (out_type == 'float') {
9
- rgba = rgba.map(c => c / 255);
10
- }
11
- return rgba[3] === undefined ? [rgba[0], rgba[1], rgba[2], 1] : [rgba[0], rgba[1], rgba[2], rgba[3]];
12
- };
13
- const rgba2hex = (rgba, in_type) => {
14
- in_type = in_type === undefined ? 'float' : in_type;
15
- let rgba_ = rgba;
16
- if (in_type == 'float') {
17
- rgba_ = rgba_.map(c => Math.round(c * 255));
18
- }
19
- return '#' + rgba_.map(c => c.toString(16).padStart(2, '0').toUpperCase()).join('');
20
- };
21
- const hex2rgb = (hexstr, out_type) => {
22
- const [r, g, b, a] = hex2rgba(hexstr, out_type);
23
- return [r, g, b];
24
- };
25
- const rgb2hex = (rgb, in_type) => {
26
- const [r, g, b] = rgb;
27
- return rgba2hex([r, g, b, 0], in_type).slice(0, -2);
28
- };
29
- const rgb2hsv = (rgb) => {
30
- const [r, g, b] = rgb;
31
- const Cmax = Math.max(r, g, b);
32
- const Cmin = Math.min(r, g, b);
33
- const Delta = Cmax - Cmin;
34
- let H;
35
- if (Delta == 0) {
36
- H = 0;
37
- }
38
- else if (Cmax == r) {
39
- H = 60 * ((g - b) / Delta) % 6;
40
- }
41
- else if (Cmax == g) {
42
- H = 60 * ((b - r) / Delta + 2);
43
- }
44
- else if (Cmax == b) {
45
- H = 60 * ((r - g) / Delta + 4);
46
- }
47
- let S = Cmax == 0 ? 0 : Delta / Cmax;
48
- let V = Cmax;
49
- return [H, S, V];
50
- };
51
- const hsv2rgb = (hsv) => {
52
- const [H, S, V] = hsv;
53
- const C = V * S;
54
- const X = C * (1 - Math.abs(H / 60 % 2 - 1));
55
- const m = V - C;
56
- let r_prime, g_prime, b_prime;
57
- if (0 <= H && H < 60) {
58
- r_prime = C;
59
- g_prime = X, b_prime = 0;
60
- }
61
- else if (60 <= H && H < 120) {
62
- r_prime = X;
63
- g_prime = C, b_prime = 0;
64
- }
65
- else if (120 <= H && H < 180) {
66
- r_prime = 0;
67
- g_prime = C, b_prime = X;
68
- }
69
- else if (180 <= H && H < 240) {
70
- r_prime = 0;
71
- g_prime = X, b_prime = C;
72
- }
73
- else if (240 <= H && H < 300) {
74
- r_prime = X;
75
- g_prime = 0, b_prime = C;
76
- }
77
- else if (300 <= H && H < 360) {
78
- r_prime = C;
79
- g_prime = 0, b_prime = X;
80
- }
81
- return [r_prime + m, g_prime + m, b_prime + m];
82
- };
83
1
  function getMinZoom(jlat, ilon, thin_fac_base) {
84
2
  const zoom_base = 1;
85
3
  let zoom = zoom_base;
@@ -143,4 +61,4 @@ function normalizeOptions(opts, defaults) {
143
61
  }
144
62
  return ret;
145
63
  }
146
- export { hex2rgba, rgba2hex, hex2rgb, rgb2hex, rgb2hsv, hsv2rgb, zip, getMinZoom, getOS, Cache, normalizeOptions };
64
+ export { zip, getMinZoom, getOS, Cache, normalizeOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autumnplot-gl",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@petamoriken/float16": "^3.8.4",
37
- "autumn-wgl": "^1.4.0",
37
+ "autumn-wgl": "^1.4.1",
38
38
  "comlink": "^4.3.1",
39
39
  "kd-tree-javascript": "^1.0.3",
40
40
  "pbf": "^3.2.1",