@metoceanapi/wxtiles-leaflet 2.3.0-0 → 2.4.0-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +16 -3
- package/dep.dot +33 -0
- package/dep.svg +233 -0
- package/dist/es/customlayer/customlayer.d.ts +3 -0
- package/dist/es/index.d.ts +19 -13
- package/dist/es/index.js +6 -2
- package/dist/es/wxAPI/WxAPI.d.ts +3 -61
- package/dist/es/wxAPI/WxDataSetManager.d.ts +35 -123
- package/dist/es/wxsource/wxsource.d.ts +118 -51
- package/dist/es/wxsource/wxsourcetypes.d.ts +70 -10
- package/dist/web/index.js +6 -2
- package/docs/docs/assets/highlight.css +7 -0
- package/docs/docs/assets/search.js +1 -1
- package/docs/docs/classes/CustomWxTilesLayer.html +4 -1
- package/docs/docs/classes/DataIntegral.html +9 -9
- package/docs/docs/classes/QTree.html +41 -14
- package/docs/docs/classes/RawCLUT.html +9 -9
- package/docs/docs/classes/TilesCache.html +5 -5
- package/docs/docs/classes/WxAPI.html +109 -79
- package/docs/docs/classes/WxAPIControl.html +242 -0
- package/docs/docs/classes/WxDataSetManager.html +166 -118
- package/docs/docs/classes/WxInfoControl.html +172 -0
- package/docs/docs/classes/WxLegendControl.html +166 -0
- package/docs/docs/classes/WxStyleEditorControl.html +462 -0
- package/docs/docs/classes/WxTileSource.html +204 -108
- package/docs/docs/classes/WxTimeControl.html +219 -0
- package/docs/docs/enums/TileType.html +4 -4
- package/docs/docs/functions/WXLOG.html +10 -5
- package/docs/docs/functions/WxCreateLegend.html +14 -9
- package/docs/docs/functions/WxGetColorSchemes.html +10 -5
- package/docs/docs/functions/WxGetColorStyles.html +10 -5
- package/docs/docs/functions/WxTilesLogging.html +13 -5
- package/docs/docs/index.html +27 -7
- package/docs/docs/interfaces/CachedUriLoaderPromiseFunc.html +7 -5
- package/docs/docs/interfaces/ColorStylesIncomplete.html +10 -5
- package/docs/docs/interfaces/Converter.html +3 -5
- package/docs/docs/interfaces/DataPicture.html +5 -5
- package/docs/docs/interfaces/FrameworkOptions.html +12 -6
- package/docs/docs/interfaces/IntegralPare.html +3 -3
- package/docs/docs/interfaces/SLinePoint.html +4 -4
- package/docs/docs/interfaces/Tree.html +11 -7
- package/docs/docs/interfaces/WxAPIOptions.html +33 -24
- package/docs/docs/interfaces/WxAllBoundariesMeta.html +14 -9
- package/docs/docs/interfaces/WxAllDatasetsShortMetas.html +11 -6
- package/docs/docs/interfaces/WxBoundaryMeta.html +18 -10
- package/docs/docs/interfaces/WxColorSchemes.html +10 -5
- package/docs/docs/interfaces/WxColorStyleStrict.html +28 -28
- package/docs/docs/interfaces/WxColorStyleWeak.html +28 -28
- package/docs/docs/interfaces/WxColorStylesStrict.html +2 -2
- package/docs/docs/interfaces/WxColorStylesWeakMixed.html +10 -5
- package/docs/docs/interfaces/WxData.html +10 -6
- package/docs/docs/interfaces/WxDataSetManagerOptions.html +15 -15
- package/docs/docs/interfaces/WxDatasetMeta.html +20 -20
- package/docs/docs/interfaces/WxDatasetShortMeta.html +9 -8
- package/docs/docs/interfaces/WxLayerAPI.html +24 -28
- package/docs/docs/interfaces/WxLayerBaseAPI.html +18 -22
- package/docs/docs/interfaces/WxLayerOptions.html +18 -13
- package/docs/docs/interfaces/WxLegend.html +16 -15
- package/docs/docs/interfaces/WxLngLat.html +3 -3
- package/docs/docs/interfaces/WxRasterData.html +11 -8
- package/docs/docs/interfaces/WxRequestInit.html +2 -2
- package/docs/docs/interfaces/WxSourceLayerOptions.html +14 -12
- package/docs/docs/interfaces/WxTick.html +8 -7
- package/docs/docs/interfaces/WxTileInfo.html +10 -10
- package/docs/docs/interfaces/WxUnits.html +10 -5
- package/docs/docs/interfaces/WxVariableMeta.html +13 -12
- package/docs/docs/interfaces/WxVariablesMetas.html +11 -6
- package/docs/docs/interfaces/XYZ.html +4 -4
- package/docs/docs/modules.html +21 -8
- package/docs/docs/types/DataIntegrals.html +10 -5
- package/docs/docs/types/DataPictures.html +10 -5
- package/docs/docs/types/ListenerMethod.html +10 -5
- package/docs/docs/types/Loader.html +116 -0
- package/docs/docs/types/Painter.html +116 -0
- package/docs/docs/types/SLine.html +11 -6
- package/docs/docs/types/SubTrees.html +10 -5
- package/docs/docs/types/SubTreesN.html +12 -7
- package/docs/docs/types/TreeN.html +12 -7
- package/docs/docs/types/WxDate.html +10 -5
- package/docs/docs/types/WxEventType.html +10 -5
- package/docs/docs/types/WxInstances.html +13 -6
- package/docs/docs/types/WxLayer.html +116 -0
- package/docs/docs/types/WxLayerVarsNames.html +11 -6
- package/docs/docs/types/WxURIs.html +10 -5
- package/docs/docs/types/WxUnitTuple.html +10 -5
- package/docs/docs/variables/WxLayerBaseImplementation.html +116 -0
- package/docs/script/script.css +1 -1
- package/docs/script/script.js +8 -8
- package/hooks/pre-commit +29 -0
- package/package.json +9 -2
- package/src_example/frwrkdeps.ts +57 -18
- package/src_example/index.ts +2 -2
- package/src_example/start.ts +100 -46
- package/watch-public.mjs +16 -12
- package/dist/es/controls/WxAPIControl.d.ts +0 -19
- package/dist/es/controls/WxInfoControl.d.ts +0 -16
- package/dist/es/controls/WxLegendControl.d.ts +0 -14
- package/dist/es/controls/WxStyleEditorControl.d.ts +0 -52
- package/dist/es/controls/WxTimeControl .d.ts +0 -18
- package/dist/es/defaults/colorschemes.d.ts +0 -2
- package/dist/es/defaults/styles.d.ts +0 -2
- package/dist/es/defaults/uconv.d.ts +0 -2
- package/dist/es/utils/RawCLUT.d.ts +0 -57
- package/dist/es/utils/mercator.d.ts +0 -4
- package/dist/es/utils/qtree.d.ts +0 -27
- package/dist/es/utils/tests_wxtools.d.ts +0 -1
- package/dist/es/utils/wxtools.d.ts +0 -361
- package/dist/es/wxAPI/WxAPItypes.d.ts +0 -152
- package/dist/es/wxlayer/WxImplementation.d.ts +0 -189
- package/dist/es/wxlayer/loader.d.ts +0 -54
- package/dist/es/wxlayer/loadertools.d.ts +0 -50
- package/dist/es/wxlayer/painter.d.ts +0 -58
- package/dist/es/wxlayer/wxlayer.d.ts +0 -186
- package/docs/docs/classes/Loader.html +0 -165
- package/docs/docs/classes/Painter.html +0 -161
- package/docs/docs/classes/WxLayer.html +0 -419
- package/docs/docs/classes/WxLayerBaseImplementation.html +0 -427
- package/docs/examples/interactive.html +0 -84
- package/docs/examples/res/icon.png +0 -0
- package/docs/examples/res/wxtiles-logo.png +0 -0
- package/docs/examples/seaMaskAndAnimatedBlur.html +0 -76
- package/docs/examples/simpleDemo.html +0 -70
- package/docs/server.py +0 -11
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { Converter, WxColorStyleStrict } from './wxtools';
|
|
2
|
-
/** data values of the legend */
|
|
3
|
-
export interface WxTick {
|
|
4
|
-
/** the data value */
|
|
5
|
-
data: number;
|
|
6
|
-
/** compact string representation of the data value */
|
|
7
|
-
dataString: string;
|
|
8
|
-
/** the color of the data value in web format */
|
|
9
|
-
color: string;
|
|
10
|
-
/** the position of the data value on the legend in [0, legendSize] */
|
|
11
|
-
pos: number;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* @internal
|
|
15
|
-
* Class contains information about the color style and the legend
|
|
16
|
-
* Based on the idea of CLUT (Color Look Up Table) to fill tiles with colors from the style
|
|
17
|
-
*/
|
|
18
|
-
export declare class RawCLUT {
|
|
19
|
-
/** convert data value to level index */
|
|
20
|
-
levelIndex: Uint32Array;
|
|
21
|
-
/** convert data value to color index */
|
|
22
|
-
colorsI: Uint32Array;
|
|
23
|
-
/** convert data value to style value */
|
|
24
|
-
DataToStyle: Converter;
|
|
25
|
-
/** convert data value to knots. Useful for styles for vector data to get the direction of the vector */
|
|
26
|
-
DataToKnots?: Converter;
|
|
27
|
-
/** data values of the legend */
|
|
28
|
-
ticks: WxTick[];
|
|
29
|
-
/**
|
|
30
|
-
* @param {WxColorStyleStrict} style the color style
|
|
31
|
-
* @param {string} dUnits the units of the data
|
|
32
|
-
* @param {[number, number]} minmax the array of minimum and maximum data values
|
|
33
|
-
* @param {boolean} vector if true, the style is for vector data
|
|
34
|
-
* */
|
|
35
|
-
constructor(style: WxColorStyleStrict, dUnits: string, [dataMin, dataMax]: [number, number], vector: boolean);
|
|
36
|
-
}
|
|
37
|
-
/** Legend - data structure that contains information for rendering legends */
|
|
38
|
-
export interface WxLegend {
|
|
39
|
-
/** size of the legend in pixels */
|
|
40
|
-
size: number;
|
|
41
|
-
/** show color for values below min */
|
|
42
|
-
showBelowMin: boolean;
|
|
43
|
-
/** show color for values above max */
|
|
44
|
-
showAboveMax: boolean;
|
|
45
|
-
/** units of the legend */
|
|
46
|
-
units: string;
|
|
47
|
-
/** array of colors */
|
|
48
|
-
colors: Uint32Array;
|
|
49
|
-
/** array of ticks */
|
|
50
|
-
ticks: WxTick[];
|
|
51
|
-
}
|
|
52
|
-
/** Create a legend for a given color style
|
|
53
|
-
* @param legendSize - number of colors in the legend
|
|
54
|
-
* @param style - color style
|
|
55
|
-
* @returns legend
|
|
56
|
-
* */
|
|
57
|
-
export declare function WxCreateLegend(legendSize: number, style: WxColorStyleStrict): WxLegend;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function LatLonToPixels(lat: number, lon: number, zoom: number): [number, number];
|
|
2
|
-
export declare function PixelsToLatLon(px: number, py: number, zoom: number): [number, number];
|
|
3
|
-
export declare function PixelsToLonLat(px: number, py: number, zoom: number): [number, number];
|
|
4
|
-
export declare function coordToPixel(x: number, y: number): number[];
|
package/dist/es/utils/qtree.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { XYZ } from './wxtools';
|
|
2
|
-
/** Hierarchical quad-tree to encode the land/sea mask */
|
|
3
|
-
export interface Tree {
|
|
4
|
-
nodes: SubTreesN;
|
|
5
|
-
}
|
|
6
|
-
/** Tree or null */
|
|
7
|
-
export type TreeN = Tree | null;
|
|
8
|
-
/** 4 sub-trees of a quad-tree node */
|
|
9
|
-
export type SubTrees = [TreeN, TreeN, TreeN, TreeN];
|
|
10
|
-
/** SubTrees or null */
|
|
11
|
-
export type SubTreesN = SubTrees | null;
|
|
12
|
-
/** possible type of a tile */
|
|
13
|
-
export declare enum TileType {
|
|
14
|
-
Land = "land",
|
|
15
|
-
Mixed = "mixed",
|
|
16
|
-
Sea = "sea"
|
|
17
|
-
}
|
|
18
|
-
/** class QTree utilizes quad-tree structure to get the type of the tile at the given coord */
|
|
19
|
-
export declare class QTree {
|
|
20
|
-
protected _qtree: Tree;
|
|
21
|
-
protected _qtreedepth: number;
|
|
22
|
-
protected _ready: Promise<void>;
|
|
23
|
-
constructor(input: RequestInfo, requestInit?: RequestInit | undefined);
|
|
24
|
-
get ready(): Promise<void>;
|
|
25
|
-
protected _load(input: RequestInfo, requestInit?: RequestInit | undefined): Promise<void>;
|
|
26
|
-
check(coord: XYZ): TileType;
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function tests(): Promise<void>;
|
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
/** x,y,z */
|
|
2
|
-
export interface XYZ {
|
|
3
|
-
x: number;
|
|
4
|
-
y: number;
|
|
5
|
-
z: number;
|
|
6
|
-
}
|
|
7
|
-
/** type for unit converter */
|
|
8
|
-
export type WxUnitTuple = [string, number, number?];
|
|
9
|
-
/** Type of an Object with all unit convertion tupels */
|
|
10
|
-
export interface WxUnits {
|
|
11
|
-
[unit: string]: WxUnitTuple | undefined;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Type of an Object with all color schemes,
|
|
15
|
-
* each color scheme is an array of colors evenly distributed between min and max values in a {@link WxLegend} and {@link RawCLUT}*/
|
|
16
|
-
export interface WxColorSchemes {
|
|
17
|
-
[name: string]: string[] | undefined;
|
|
18
|
-
}
|
|
19
|
-
/** A [level,color] tuple */
|
|
20
|
-
export type colorMapTuple = [number, string];
|
|
21
|
-
/** Weak color style (may not have all fields of {@link WxColorStyleStrict}) */
|
|
22
|
-
export interface WxColorStyleWeak extends Partial<WxColorStyleStrict> {
|
|
23
|
-
}
|
|
24
|
-
/** interface of an object with all mixed color styles */
|
|
25
|
-
export interface WxColorStylesWeakMixed {
|
|
26
|
-
[name: string]: WxColorStyleWeak | WxColorStyleWeak[] | undefined;
|
|
27
|
-
}
|
|
28
|
-
/** interface of an object with all weak color styles */
|
|
29
|
-
export interface ColorStylesIncomplete {
|
|
30
|
-
[name: string]: WxColorStyleWeak | undefined;
|
|
31
|
-
}
|
|
32
|
-
/** Strict style interface */
|
|
33
|
-
export interface WxColorStyleStrict {
|
|
34
|
-
/** Name of the style */
|
|
35
|
-
name: string;
|
|
36
|
-
/** Name of a parent style to inherit from */
|
|
37
|
-
parent?: string;
|
|
38
|
-
/** Tile filling schema.
|
|
39
|
-
* - **'none'** means no fill, leave the tile transparent
|
|
40
|
-
* - **'solid'** means solid fill, no gradient between levels.
|
|
41
|
-
* - **'gradient'** means gradient fill.
|
|
42
|
-
* */
|
|
43
|
-
fill: 'none' | 'gradient' | 'solid';
|
|
44
|
-
/**
|
|
45
|
-
* Color of isolines.
|
|
46
|
-
* - **'none'** do not render.
|
|
47
|
-
* - **'fill'** using value of {@link fill} in each pixel.
|
|
48
|
-
* - **'inverted'** using *inverted* value of {@link fill} in each pixel.
|
|
49
|
-
* - **'#RGB'** or '**#RRGGBB**' or '**#RRGGBBAA**' - using this WEB-color.
|
|
50
|
-
* */
|
|
51
|
-
isolineColor: 'none' | 'inverted' | 'fill' | `#${string}`;
|
|
52
|
-
/** if true then render isoline text values */
|
|
53
|
-
isolineText: boolean;
|
|
54
|
-
/** Font size of isoline text values in ems */
|
|
55
|
-
isolineTextSizeEm: number;
|
|
56
|
-
/** if true then render a solid background behind isoline text values */
|
|
57
|
-
isolineTextBackground: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Representation of the wind/current field.
|
|
60
|
-
* - **'none'** do not render vectors.
|
|
61
|
-
* - **'arrows'** use arrows to represent winds/currents.
|
|
62
|
-
* - **'barbs'** use barbs.
|
|
63
|
-
* */
|
|
64
|
-
vectorType: 'none' | 'arrows' | 'barbs';
|
|
65
|
-
/**
|
|
66
|
-
* Color of vectors.
|
|
67
|
-
* - **'none'** do not render vectors.
|
|
68
|
-
* - **'fill'** using value of {@link fill} in each pixel.
|
|
69
|
-
* - **'inverted'** using *inverted* value of {@link fill} in each pixel.
|
|
70
|
-
* - **'#RGB'** or '**#RRGGBB**' or '**#RRGGBBAA**' - using this WEB-color.
|
|
71
|
-
* */
|
|
72
|
-
vectorColor: 'none' | 'inverted' | 'fill' | `#${string}`;
|
|
73
|
-
/** Factor for vectors length */
|
|
74
|
-
vectorFactor: number;
|
|
75
|
-
/**
|
|
76
|
-
* Draw streamlines:
|
|
77
|
-
* - **'none'** means no streamlines.
|
|
78
|
-
* - **'fill'** using value of {@link fill} in each pixel.
|
|
79
|
-
* - **'inverted'** using *inverted* value of {@link fill} in each pixel.
|
|
80
|
-
* - **'#RGB'** or '**#RRGGBB**' or '**#RRGGBBAA**' - using this WEB-color.
|
|
81
|
-
* */
|
|
82
|
-
streamLineColor: 'none' | 'inverted' | 'fill' | `#${string}`;
|
|
83
|
-
/** factor to scale streamlines length */
|
|
84
|
-
streamLineSpeedFactor: number;
|
|
85
|
-
/**
|
|
86
|
-
* Step to seed streamlines. Streamlines spread both ways from seed point.
|
|
87
|
-
* less value means more streamlines.
|
|
88
|
-
* */
|
|
89
|
-
streamLineGridStep?: number;
|
|
90
|
-
/** steps in each streamline */
|
|
91
|
-
streamLineSteps?: number;
|
|
92
|
-
/**
|
|
93
|
-
* - if true then render streamlines as static lines.
|
|
94
|
-
* - if false then render streamlines as animated lines.
|
|
95
|
-
* */
|
|
96
|
-
streamLineStatic: boolean;
|
|
97
|
-
/** If true then fill values below style's minimum. */
|
|
98
|
-
showBelowMin: boolean;
|
|
99
|
-
/** If true then fill values above style's maximum. */
|
|
100
|
-
showAboveMax: boolean;
|
|
101
|
-
/** Color scheme name from the default set. May be extended in {@link WxAPI}*/
|
|
102
|
-
colorScheme: string;
|
|
103
|
-
/** Used if presented instead of colorScheme */
|
|
104
|
-
colors?: string[];
|
|
105
|
-
/**
|
|
106
|
-
* Used if presented instead of levels, colors, colorScheme.
|
|
107
|
-
* Array of [level,color] tuples. Colors are WEB-colors.
|
|
108
|
-
*/
|
|
109
|
-
colorMap?: [number, string][];
|
|
110
|
-
/** Levels to build legend. Used if presented, otherwise 10 levels are calculated evenly on given data */
|
|
111
|
-
levels?: number[];
|
|
112
|
-
/** radius for the BOX filter */
|
|
113
|
-
blurRadius: number;
|
|
114
|
-
/** Additional rotation of all wind or current's vectors or directions by angle in degrees.*/
|
|
115
|
-
addDegrees: number;
|
|
116
|
-
/** Units of the style (from the default set)*/
|
|
117
|
-
units: string;
|
|
118
|
-
/**
|
|
119
|
-
* Additional extend of default {@link units}.
|
|
120
|
-
* @see {@link WxUnits}
|
|
121
|
-
* */
|
|
122
|
-
extraUnits?: WxUnits;
|
|
123
|
-
/**
|
|
124
|
-
* masking:
|
|
125
|
-
* - **'none'** - no masking.
|
|
126
|
-
* - **'sea'** - make sea transparent.
|
|
127
|
-
* - **'land'** - make land transparent.
|
|
128
|
-
* */
|
|
129
|
-
mask?: 'land' | 'sea' | 'none';
|
|
130
|
-
/** If exists then try to use WebGL to render tiles */
|
|
131
|
-
gl?: {
|
|
132
|
-
animationSpeed?: number;
|
|
133
|
-
noiseTexturePow?: number;
|
|
134
|
-
vectorFieldFactor?: number;
|
|
135
|
-
animationIntensity?: number;
|
|
136
|
-
wavesCount?: number;
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* @typedef {Object} WxColorStylesStrict
|
|
141
|
-
* @property {string} name - name of the style
|
|
142
|
-
*/
|
|
143
|
-
export interface WxColorStylesStrict {
|
|
144
|
-
base: WxColorStyleStrict;
|
|
145
|
-
[name: string]: WxColorStyleStrict | undefined;
|
|
146
|
-
}
|
|
147
|
-
/** Options for the wxtiles library */
|
|
148
|
-
export interface WxTilesLibOptions {
|
|
149
|
-
/** Additional Color styles to use for the library */
|
|
150
|
-
colorStyles?: WxColorStylesWeakMixed;
|
|
151
|
-
/** Additional color schemes to use for the library */
|
|
152
|
-
colorSchemes?: WxColorSchemes;
|
|
153
|
-
/** Additional units to use for the library */
|
|
154
|
-
units?: WxUnits;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Initialize the wxtiles library
|
|
158
|
-
* @param options - options {@link WxTilesLibOptions} to initialize the library
|
|
159
|
-
*/
|
|
160
|
-
export declare function WxTilesLibSetup({ colorStyles, units, colorSchemes }?: WxTilesLibOptions): void;
|
|
161
|
-
/**
|
|
162
|
-
* Get all {@link WxColorStylesStrict} used by the library
|
|
163
|
-
* */
|
|
164
|
-
export declare function WxGetColorStyles(): WxColorStylesStrict;
|
|
165
|
-
/**
|
|
166
|
-
* Get all {@link WxColorSchemes} used by the library
|
|
167
|
-
* */
|
|
168
|
-
export declare function WxGetColorSchemes(): WxColorSchemes;
|
|
169
|
-
/** A function type with extra properties. */
|
|
170
|
-
export interface Converter extends Function {
|
|
171
|
-
/** interface of a function - unit cinverter*/
|
|
172
|
-
(x: number): number;
|
|
173
|
-
/** true if the converter is a trivial one */
|
|
174
|
-
trivial?: boolean;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Convert a value from one unit to another
|
|
178
|
-
* @param from - the unit to convert from
|
|
179
|
-
* @param to - the unit to convert to
|
|
180
|
-
* @param customUnits - custom units to use if needed
|
|
181
|
-
* @returns a function that converts a value from one unit to another
|
|
182
|
-
* @example
|
|
183
|
-
* ```ts
|
|
184
|
-
* const convert = makeConverter('m/s', 'km/h');
|
|
185
|
-
* const speed = convert(10); // speed is now 36
|
|
186
|
-
* ```
|
|
187
|
-
* */
|
|
188
|
-
export declare function makeConverter(from: string, to: string, customUnits?: WxUnits): Converter;
|
|
189
|
-
/** Function type to load image from URL, with additional properties */
|
|
190
|
-
interface UriLoaderPromiseFunc<T> extends Function {
|
|
191
|
-
(url: string, ...props: any): Promise<T>;
|
|
192
|
-
}
|
|
193
|
-
export interface CachedUriLoaderPromiseFunc<T> extends UriLoaderPromiseFunc<T> {
|
|
194
|
-
(url: string, ...props: any): Promise<T>;
|
|
195
|
-
clearCache: () => void;
|
|
196
|
-
}
|
|
197
|
-
/** Makes a cachable function that loads image from URL, with additional properties */
|
|
198
|
-
export declare function cacheUriPromise<T>(fn: UriLoaderPromiseFunc<T>): CachedUriLoaderPromiseFunc<T>;
|
|
199
|
-
/**
|
|
200
|
-
* abortable 'loadImage'
|
|
201
|
-
* @param url - image url
|
|
202
|
-
* @param requestInit - fetch requestInit
|
|
203
|
-
* */
|
|
204
|
-
export declare function loadImage(url: string, requestInit?: RequestInit): Promise<ImageBitmap>;
|
|
205
|
-
/** integral pare for fast box blur algorithm */
|
|
206
|
-
export interface IntegralPare {
|
|
207
|
-
/** Integral image */
|
|
208
|
-
integral: Uint32Array;
|
|
209
|
-
/** Integral image of ZEROs */
|
|
210
|
-
integralNZ: Uint32Array | null;
|
|
211
|
-
}
|
|
212
|
-
/** interface of a data read from a PNG tile */
|
|
213
|
-
export interface DataPicture {
|
|
214
|
-
raw: Uint16Array;
|
|
215
|
-
dmin: number;
|
|
216
|
-
dmax: number;
|
|
217
|
-
dmul: number;
|
|
218
|
-
}
|
|
219
|
-
/** One (scalar) or three (vector components + length component) {@link DataPictures} */
|
|
220
|
-
export type DataPictures = [DataPicture] | [DataPicture, DataPicture, DataPicture];
|
|
221
|
-
/**
|
|
222
|
-
* class implements {@link DataPictures} with lazy calculation of {@link IntegralPare} for fast box blur algorithm
|
|
223
|
-
* */
|
|
224
|
-
export declare class DataIntegral implements DataPicture {
|
|
225
|
-
raw: Uint16Array;
|
|
226
|
-
dmin: number;
|
|
227
|
-
dmax: number;
|
|
228
|
-
dmul: number;
|
|
229
|
-
protected integral_?: IntegralPare;
|
|
230
|
-
radius: number;
|
|
231
|
-
constructor(raw: Uint16Array, dmin: number, dmax: number, dmul: number);
|
|
232
|
-
get integral(): IntegralPare;
|
|
233
|
-
}
|
|
234
|
-
/** One (scalar) or two (vector) {@link DataIntegral} */
|
|
235
|
-
export type DataIntegrals = [DataIntegral] | [DataIntegral, DataIntegral];
|
|
236
|
-
/**
|
|
237
|
-
* Helper function to create a 2D canvas context
|
|
238
|
-
* @param width - width of the context
|
|
239
|
-
* @param height - height of the context
|
|
240
|
-
* @param willReadFrequently - if true, the context will be read frequently (browser will optimize it)
|
|
241
|
-
* @returns canvas context
|
|
242
|
-
*/
|
|
243
|
-
export declare function create2DContext(width: number, height: number, willReadFrequently?: boolean): CanvasRenderingContext2D;
|
|
244
|
-
/**
|
|
245
|
-
* Load ImageData to from URL with RequestInit
|
|
246
|
-
* @param url - image url
|
|
247
|
-
* @param requestInit - fetch requestInit
|
|
248
|
-
* @returns Promise of ImageData
|
|
249
|
-
*/
|
|
250
|
-
export declare function loadImageData(url: string, requestInit?: RequestInit): Promise<ImageData>;
|
|
251
|
-
/**
|
|
252
|
-
* Load {@link DataIntegral} from URL with RequestInit
|
|
253
|
-
* @param url - image url
|
|
254
|
-
* @param requestInit - fetch requestInit
|
|
255
|
-
* @returns Promise of {@link DataIntegral}
|
|
256
|
-
* */
|
|
257
|
-
export declare function loadDataIntegral(url: string, requestInit?: RequestInit): Promise<DataIntegral>;
|
|
258
|
-
/**
|
|
259
|
-
* Calculaates {@link IntegralPare} from raw data Uint16Array.
|
|
260
|
-
* Used for fast box-blur algo
|
|
261
|
-
* Integarl image: https://en.wikipedia.org/wiki/Summed-area_table.
|
|
262
|
-
* @param raw - raw data
|
|
263
|
-
* @returns IntegralPare
|
|
264
|
-
* */
|
|
265
|
-
export declare function buildIntegralPare(raw: Uint16Array): IntegralPare;
|
|
266
|
-
/**
|
|
267
|
-
* BoxBlur implementation based on integral image {@link DataIntegral}.
|
|
268
|
-
* Adaptaion of using in 'tiling' mode. Uses only one boudary line for each tile.
|
|
269
|
-
* Gives decent visual results, but not as good as bluring over the whole image.
|
|
270
|
-
* Sometimes distortion of the image is noticable on the edges of the tiles.
|
|
271
|
-
* Also it doesn't change/blur corners of the tiles.
|
|
272
|
-
* @param data - {@link DataIntegral}
|
|
273
|
-
* @param radius - radius for the box-blur algorithm
|
|
274
|
-
* */
|
|
275
|
-
export declare function blurData(im: DataIntegral, radius: number): DataIntegral;
|
|
276
|
-
/**
|
|
277
|
-
* Convert Uin32 RGB color to web color
|
|
278
|
-
* @param color - Uin32 color
|
|
279
|
-
* @returns web color in format '#RRGGBB'
|
|
280
|
-
* */
|
|
281
|
-
export declare function RGBtoHEX(rgb: number): string;
|
|
282
|
-
/**
|
|
283
|
-
* Convert Uin32 RGBA color to web color
|
|
284
|
-
* @param color - Uin32 color
|
|
285
|
-
* @returns web color in format '#RRGGBBAA'
|
|
286
|
-
* */
|
|
287
|
-
export declare function RGBAtoHEX(rgba: number): string;
|
|
288
|
-
/**
|
|
289
|
-
* Convert web color to Uin32 RGB color
|
|
290
|
-
* @param color - web color in format '#RGB' or '#RRGGBB' or '#RRGGBBAA'
|
|
291
|
-
* @returns Uin32 color
|
|
292
|
-
* */
|
|
293
|
-
export declare function HEXtoRGBA(c: string): number;
|
|
294
|
-
/**
|
|
295
|
-
* json loader helper
|
|
296
|
-
* @template {any} T - type of the object to load
|
|
297
|
-
* @param url - url to json file
|
|
298
|
-
* @param requestInit - requestInit for fetch
|
|
299
|
-
* @returns json object
|
|
300
|
-
* */
|
|
301
|
-
export declare function fetchJson<T = any>(url: RequestInfo, requestInit?: RequestInit): Promise<T>;
|
|
302
|
-
/**
|
|
303
|
-
* Create element helper
|
|
304
|
-
* @param tag - tag name
|
|
305
|
-
* @param className - class name
|
|
306
|
-
* @param container - container to append element
|
|
307
|
-
* @returns created element
|
|
308
|
-
* */
|
|
309
|
-
export declare function createEl(tagName: string, className?: string, container?: HTMLElement): HTMLElement;
|
|
310
|
-
/**
|
|
311
|
-
* Color linear mixer
|
|
312
|
-
* @param color1 - color1 Uin32 RGBA
|
|
313
|
-
* @param color2 - color2 Uin32 RGBA
|
|
314
|
-
* @param k - koefficient
|
|
315
|
-
* @returns mixed color Uin32 RGBA
|
|
316
|
-
* */
|
|
317
|
-
export declare function mixColor(c1: number, c2: number, t: number): number;
|
|
318
|
-
/**
|
|
319
|
-
* Helper to create array of levels for a style
|
|
320
|
-
* @param min - min value
|
|
321
|
-
* @param max - max value
|
|
322
|
-
* @param n - number of levels
|
|
323
|
-
* @returns array of levels
|
|
324
|
-
* */
|
|
325
|
-
export declare function createLevels(min: number, max: number, n: number): number[];
|
|
326
|
-
/**
|
|
327
|
-
* Get closest existing time in array. If time is Date, strings will be converted to number to find closest time
|
|
328
|
-
* @param times - array of times
|
|
329
|
-
* @param time - time to find
|
|
330
|
-
* @returns closest time a value from array
|
|
331
|
-
* */
|
|
332
|
-
export declare function getClosestTimeString(times: string[], time: Date | string | number): string;
|
|
333
|
-
/**
|
|
334
|
-
* Logging helper
|
|
335
|
-
* */
|
|
336
|
-
export declare let WXLOG: (...args: any[]) => void;
|
|
337
|
-
/**
|
|
338
|
-
* Set logging on/off
|
|
339
|
-
* @param logging - true to turn on logging
|
|
340
|
-
* */
|
|
341
|
-
export declare function WxTilesLogging(on?: boolean | ((...args: any[]) => void)): void;
|
|
342
|
-
/**
|
|
343
|
-
* Helper to convert short form of web color from '#RGB' to '#RRGGBB'
|
|
344
|
-
* @param color - web color in format '#RGB' or '#RRGGBB' or '#RRGGBBAA'
|
|
345
|
-
* @returns web color in format '#RRGGBB'
|
|
346
|
-
* */
|
|
347
|
-
export declare function refineColor(c: string): string;
|
|
348
|
-
/**
|
|
349
|
-
* Helper to fill URI template with values
|
|
350
|
-
* @param uri - URI template
|
|
351
|
-
* @param values - {@link XYZ} values to fill template
|
|
352
|
-
* @returns URI with values filled
|
|
353
|
-
* */
|
|
354
|
-
export declare function uriXYZ(uri: string, { x, y, z }: XYZ): string;
|
|
355
|
-
/**
|
|
356
|
-
* Calculate hash of {@link XYZ}
|
|
357
|
-
* @param xyz - {@link XYZ} to calculate hash
|
|
358
|
-
* @returns string hash
|
|
359
|
-
* */
|
|
360
|
-
export declare function HashXYZ({ x, y, z }: XYZ): string;
|
|
361
|
-
export {};
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* type array of strings - available instances of a dataset */
|
|
3
|
-
import { WxTilesLibOptions } from '../utils/wxtools';
|
|
4
|
-
import { WxLayerOptions } from '../wxlayer/wxlayer';
|
|
5
|
-
import { WxAPI } from './WxAPI';
|
|
6
|
-
export type WxInstances = string[];
|
|
7
|
-
/**
|
|
8
|
-
* Short description of a dataset */
|
|
9
|
-
export interface WxDatasetShortMeta {
|
|
10
|
-
/** represents instances as timesteps for some datasets like NZ Radar */
|
|
11
|
-
instanced?: WxInstances;
|
|
12
|
-
/** last instance of a dataset */
|
|
13
|
-
instance: string;
|
|
14
|
-
/** list of variables in a dataset */
|
|
15
|
-
variables: string[];
|
|
16
|
-
}
|
|
17
|
-
/** Short description of all available datasets */
|
|
18
|
-
export interface WxAllDatasetsShortMetas {
|
|
19
|
-
/** a list of datasets with short description */
|
|
20
|
-
[name: string]: WxDatasetShortMeta | undefined;
|
|
21
|
-
}
|
|
22
|
-
/** Meta data of a variable */
|
|
23
|
-
export interface WxVariableMeta {
|
|
24
|
-
/** units used for the variable */
|
|
25
|
-
units: string;
|
|
26
|
-
/** min value */
|
|
27
|
-
min: number;
|
|
28
|
-
/** max value */
|
|
29
|
-
max: number;
|
|
30
|
-
/** standard name */
|
|
31
|
-
standard_name?: string;
|
|
32
|
-
/** if the variable is a part of vector data, this contains a proper pare */
|
|
33
|
-
vector?: [string, string];
|
|
34
|
-
}
|
|
35
|
-
/** interface of an object with variable names as keys and variable meta data as values */
|
|
36
|
-
export interface WxVariablesMetas {
|
|
37
|
-
[name: string]: WxVariableMeta | undefined;
|
|
38
|
-
}
|
|
39
|
-
/** boundaries of a dataset */
|
|
40
|
-
export interface WxBoundaryMeta {
|
|
41
|
-
west: number;
|
|
42
|
-
north: number;
|
|
43
|
-
east: number;
|
|
44
|
-
south: number;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* All possible versions of boundaries for the dataset wrapped (0 -> 360) or (180 -> -180)
|
|
48
|
-
* as well as the original boundaries from the dataset */
|
|
49
|
-
export interface WxAllBoundariesMeta {
|
|
50
|
-
boundariesnorm: WxBoundaryMeta;
|
|
51
|
-
boundaries180: WxBoundaryMeta[];
|
|
52
|
-
boundaries360: WxBoundaryMeta[];
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Meta data of a dataset */
|
|
56
|
-
export interface WxDatasetMeta {
|
|
57
|
-
/** a list of variables in a dataset */
|
|
58
|
-
variables: string[];
|
|
59
|
-
/** metadata of variables */
|
|
60
|
-
variablesMeta: WxVariablesMetas;
|
|
61
|
-
/** max zoom level */
|
|
62
|
-
maxZoom: number;
|
|
63
|
-
/** Instance */
|
|
64
|
-
instance: string;
|
|
65
|
-
/** array of available timesteps */
|
|
66
|
-
times: string[];
|
|
67
|
-
/** boundaries of a dataset */
|
|
68
|
-
boundaries: WxAllBoundariesMeta;
|
|
69
|
-
/** source of the dataset */
|
|
70
|
-
sourceID?: string;
|
|
71
|
-
/** base atmospheric model */
|
|
72
|
-
baseAtmosphericModel?: string;
|
|
73
|
-
/** model used for the dataset*/
|
|
74
|
-
model?: string;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Options to construct {@link WxAPI} object
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* const requestInit: RequestInit = {
|
|
81
|
-
* headers
|
|
82
|
-
* }; // add more options if needed such as headers, mode, credentials, etc
|
|
83
|
-
* const options = {
|
|
84
|
-
* dataServerURL:'https://tiles.metoceanapi.com/data/',
|
|
85
|
-
* requestInit: { headers: myHeaders },
|
|
86
|
-
* }
|
|
87
|
-
* const wxapi = new WxAPI(options);
|
|
88
|
-
* ```
|
|
89
|
-
* */
|
|
90
|
-
export interface WxAPIOptions extends WxTilesLibOptions {
|
|
91
|
-
/** base URL of the server*/
|
|
92
|
-
dataServerURL: string;
|
|
93
|
-
/** full masks tiles URL, Example: `https://server.com/masks/{z}/{x}/{y}.webp`
|
|
94
|
-
* @default 'auto' - will be set to `dataServerURL + 'masks/{z}/{x}/{y}.webp'`
|
|
95
|
-
* 'none' - will disable masks */
|
|
96
|
-
maskURL?: 'none' | 'auto' | string;
|
|
97
|
-
/** channel to use for masking from RGBA masks
|
|
98
|
-
* 0 - for the masks from Sarah (current), 3 - for the masks from Mapbox
|
|
99
|
-
* @default 'R' */
|
|
100
|
-
maskChannel?: 'R' | 'G' | 'B' | 'A';
|
|
101
|
-
/** maximum zoom level for mask tiles on the server
|
|
102
|
-
* @default 9 */
|
|
103
|
-
maskDepth?: number;
|
|
104
|
-
/** URL to qtree file.
|
|
105
|
-
* {@link QTree} is a hierarchical structure, that allows to quickly find tile's belonging to the sea/land.
|
|
106
|
-
* @default 'auto' - will be set to `dataServerURL + 'masks/9+1.seamask.qtree'`
|
|
107
|
-
* 'none' - will disable the use of {@link QTree} */
|
|
108
|
-
qtreeURL?: 'none' | 'auto' | string;
|
|
109
|
-
/** parameters to be passed to every fetch() aka _headers, credentials, cors, etc_ for interaction with backend data server */
|
|
110
|
-
requestInit?: RequestInit;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Options to pass to the {@link WxDataSetManager.createSourceLayer} method.
|
|
114
|
-
* */
|
|
115
|
-
export interface WxSourceLayerOptions extends Omit<WxLayerOptions, 'variables' | 'wxdatasetManager'> {
|
|
116
|
-
variable: string;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Options to pass to the constructor of {@link WxDataSetManager}
|
|
120
|
-
*/
|
|
121
|
-
export interface WxDataSetManagerOptions {
|
|
122
|
-
/**
|
|
123
|
-
* @internal
|
|
124
|
-
* Dataset name
|
|
125
|
-
* */
|
|
126
|
-
datasetName: string;
|
|
127
|
-
/**
|
|
128
|
-
* @internal
|
|
129
|
-
* current instance of the dataset
|
|
130
|
-
* */
|
|
131
|
-
datasetCurrentInstance: string;
|
|
132
|
-
/**
|
|
133
|
-
* @internal
|
|
134
|
-
* Array of instanced time steps
|
|
135
|
-
* */
|
|
136
|
-
instanced?: WxInstances;
|
|
137
|
-
/**
|
|
138
|
-
* @internal
|
|
139
|
-
* Dataset's meta data
|
|
140
|
-
* */
|
|
141
|
-
datasetCurrentMeta: WxDatasetMeta;
|
|
142
|
-
/**
|
|
143
|
-
* @internal
|
|
144
|
-
* Dataset's metas for an instanced dataset
|
|
145
|
-
* */
|
|
146
|
-
metas?: Map<string, WxDatasetMeta>;
|
|
147
|
-
/**
|
|
148
|
-
* @internal
|
|
149
|
-
* The {@link WxAPI} instance to use to interact with the *WxTiles* API
|
|
150
|
-
* */
|
|
151
|
-
wxAPI: WxAPI;
|
|
152
|
-
}
|