@metoceanapi/wxtiles-leaflet 2.1.3 → 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.
- package/CHANGELOG.md +4 -0
- package/GPLv3.txt +674 -0
- package/LICENSE.txt +12 -9
- package/README.md +10 -32
- package/dist/es/controls/WxAPIControl.d.ts +4 -2
- package/dist/es/controls/WxTimeControl .d.ts +1 -1
- package/dist/es/index.d.ts +13 -17
- package/dist/es/index.js +2 -2
- package/dist/es/utils/RawCLUT.d.ts +9 -8
- package/dist/es/utils/qtree.d.ts +6 -4
- package/dist/es/utils/wxtools.d.ts +16 -5
- package/dist/es/wxAPI/WxAPI.d.ts +63 -0
- package/dist/es/wxAPI/WxAPItypes.d.ts +152 -0
- package/dist/es/wxAPI/WxDataSetManager.d.ts +69 -92
- package/dist/es/wxlayer/WxImplementation.d.ts +36 -11
- package/dist/es/wxlayer/loader.d.ts +3 -3
- package/dist/es/wxlayer/loadertools.d.ts +1 -1
- package/dist/es/wxlayer/painter.d.ts +1 -1
- package/dist/es/wxlayer/wxlayer.d.ts +48 -26
- package/dist/es/wxsource/wxsource.d.ts +3 -1
- package/dist/es/wxsource/wxsourcetypes.d.ts +2 -1
- package/dist/web/index.js +2 -2
- package/docs/docs/assets/highlight.css +4 -4
- package/docs/docs/assets/search.js +1 -1
- package/docs/docs/classes/CustomWxTilesLayer.html +1 -1
- package/docs/docs/classes/DataIntegral.html +13 -13
- package/docs/docs/classes/Loader.html +17 -17
- package/docs/docs/classes/Painter.html +11 -11
- package/docs/docs/classes/QTree.html +63 -34
- package/docs/docs/classes/RawCLUT.html +8 -8
- package/docs/docs/classes/TilesCache.html +108 -0
- package/docs/docs/classes/WxAPI.html +31 -104
- package/docs/docs/classes/WxDataSetManager.html +118 -184
- package/docs/docs/classes/WxLayer.html +78 -60
- package/docs/docs/classes/WxLayerBaseImplementation.html +52 -43
- package/docs/docs/classes/WxTileSource.html +63 -47
- package/docs/docs/enums/TileType.html +4 -4
- package/docs/docs/functions/WXLOG.html +9 -7
- package/docs/docs/functions/WxCreateLegend.html +11 -9
- package/docs/docs/functions/WxGetColorSchemes.html +9 -7
- package/docs/docs/functions/WxGetColorStyles.html +9 -7
- package/docs/docs/functions/WxTilesLogging.html +9 -7
- package/docs/docs/index.html +21 -20
- package/docs/docs/interfaces/CachedUriLoaderPromiseFunc.html +106 -0
- package/docs/docs/interfaces/ColorStylesIncomplete.html +9 -7
- package/docs/docs/interfaces/Converter.html +5 -3
- package/docs/docs/interfaces/DataPicture.html +5 -5
- package/docs/docs/interfaces/FrameworkOptions.html +5 -4
- package/docs/docs/interfaces/IntegralPare.html +3 -3
- package/docs/docs/interfaces/SLinePoint.html +3 -3
- package/docs/docs/interfaces/Tree.html +2 -2
- package/docs/docs/interfaces/WxAPIOptions.html +17 -17
- package/docs/docs/interfaces/WxAllBoundariesMeta.html +4 -4
- package/docs/docs/interfaces/WxAllDatasetsShortMetas.html +120 -0
- package/docs/docs/interfaces/WxBoundaryMeta.html +5 -5
- package/docs/docs/interfaces/WxColorSchemes.html +9 -7
- package/docs/docs/interfaces/WxColorStyleStrict.html +45 -27
- package/docs/docs/interfaces/WxColorStyleWeak.html +47 -27
- package/docs/docs/interfaces/WxColorStylesStrict.html +2 -2
- package/docs/docs/interfaces/WxColorStylesWeakMixed.html +9 -7
- package/docs/docs/interfaces/WxData.html +3 -3
- package/docs/docs/interfaces/WxDataSetManagerOptions.html +12 -12
- package/docs/docs/interfaces/WxDatasetMeta.html +18 -9
- package/docs/docs/interfaces/WxDatasetShortMeta.html +5 -5
- package/docs/docs/interfaces/WxLayerAPI.html +92 -26
- package/docs/docs/interfaces/WxLayerBaseAPI.html +21 -21
- package/docs/docs/interfaces/WxLayerOptions.html +9 -10
- package/docs/docs/interfaces/WxLegend.html +7 -7
- package/docs/docs/interfaces/WxLngLat.html +3 -3
- package/docs/docs/interfaces/WxRasterData.html +6 -6
- package/docs/docs/interfaces/WxRequestInit.html +2 -2
- package/docs/docs/interfaces/WxSourceLayerOptions.html +8 -5
- package/docs/docs/interfaces/WxTick.html +5 -5
- package/docs/docs/interfaces/WxTileInfo.html +9 -9
- package/docs/docs/interfaces/WxUnits.html +9 -7
- package/docs/docs/interfaces/WxVariableMeta.html +6 -6
- package/docs/docs/interfaces/WxVariablesMetas.html +9 -7
- package/docs/docs/interfaces/XYZ.html +4 -4
- package/docs/docs/modules.html +17 -13
- package/docs/docs/types/DataIntegrals.html +9 -7
- package/docs/docs/types/DataPictures.html +9 -7
- package/docs/docs/types/{UriLoaderPromiseFunc.html → ListenerMethod.html} +21 -23
- package/docs/docs/types/SLine.html +9 -7
- package/docs/docs/types/SubTrees.html +9 -7
- package/docs/docs/types/SubTreesN.html +9 -7
- package/docs/docs/types/TreeN.html +9 -7
- package/docs/docs/types/WxDate.html +17 -8
- package/docs/docs/types/WxEventType.html +116 -0
- package/docs/docs/types/{WxVars.html → WxInstances.html} +13 -13
- package/docs/docs/types/WxLayerVarsNames.html +113 -0
- package/docs/docs/types/WxURIs.html +9 -7
- package/docs/docs/types/WxUnitTuple.html +9 -7
- package/docs/examples/interactive.html +84 -0
- package/docs/examples/seaMaskAndAnimatedBlur.html +31 -23
- package/docs/examples/simpleDemo.html +33 -22
- package/docs/script/script.css +1 -1
- package/docs/script/script.js +13 -9
- package/docs/server.py +11 -0
- package/package.json +1 -1
- package/src_example/frwrkdeps.ts +6 -3
- package/src_example/index.ts +31 -54
- package/src_example/start.ts +39 -21
- package/watch-public.mjs +1 -7
- package/dist/es/wxAPI/wxAPI.d.ts +0 -192
- package/docs/docs/classes/FrameworkParentClass.html +0 -98
- package/docs/docs/interfaces/WxDataSetsMetasJSON.html +0 -75
- package/docs/docs/interfaces/WxTilesLibOptions.html +0 -92
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
}
|
|
@@ -1,47 +1,12 @@
|
|
|
1
|
-
import type { WxDate,
|
|
1
|
+
import type { WxDate, WxLayerVarsNames } from '../wxlayer/wxlayer';
|
|
2
2
|
import { WxTileSource } from '../wxsource/wxsource';
|
|
3
|
-
import { FrameworkOptions } from '../wxsource/wxsourcetypes';
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
variable: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Options to pass to the constructor of {@link WxDataSetManager}
|
|
10
|
-
*/
|
|
11
|
-
export interface WxDataSetManagerOptions {
|
|
12
|
-
/**
|
|
13
|
-
* @internal
|
|
14
|
-
* Dataset name
|
|
15
|
-
* */
|
|
16
|
-
datasetName: string;
|
|
17
|
-
/**
|
|
18
|
-
* @internal
|
|
19
|
-
* current instance of the dataset
|
|
20
|
-
* */
|
|
21
|
-
datasetCurrentInstance: string;
|
|
22
|
-
/**
|
|
23
|
-
* @internal
|
|
24
|
-
* Array of instanced time steps
|
|
25
|
-
* */
|
|
26
|
-
instanced?: string[];
|
|
27
|
-
/**
|
|
28
|
-
* @internal
|
|
29
|
-
* Dataset's meta data
|
|
30
|
-
* */
|
|
31
|
-
datasetCurrentMeta: WxDatasetMeta;
|
|
32
|
-
/**
|
|
33
|
-
* @internal
|
|
34
|
-
* Dataset's metas for an instanced dataset
|
|
35
|
-
* */
|
|
36
|
-
metas: Map<string, WxDatasetMeta>;
|
|
37
|
-
/**
|
|
38
|
-
* @internal
|
|
39
|
-
* The {@link WxAPI} instance to use to interact with the *WxTiles* API
|
|
40
|
-
* */
|
|
41
|
-
wxAPI: WxAPI;
|
|
42
|
-
}
|
|
3
|
+
import type { FrameworkOptions } from '../wxsource/wxsourcetypes';
|
|
4
|
+
import type { WxAPI } from './WxAPI';
|
|
5
|
+
import type { WxDatasetMeta, WxVariableMeta, WxAllBoundariesMeta, WxAllDatasetsShortMetas, WxDataSetManagerOptions, WxSourceLayerOptions } from './WxAPItypes';
|
|
43
6
|
/**
|
|
44
7
|
* Class for managing WX datasets.
|
|
8
|
+
* Do not use constructor directly.
|
|
9
|
+
* Use {@link WxAPI} to create instances of this class.
|
|
45
10
|
* @class WxDataSetManager
|
|
46
11
|
* @example
|
|
47
12
|
* ```ts
|
|
@@ -51,48 +16,57 @@ export interface WxDataSetManagerOptions {
|
|
|
51
16
|
export declare class WxDataSetManager {
|
|
52
17
|
/** dataset's name */
|
|
53
18
|
readonly datasetName: string;
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/** if not empty, returns dataset's instances to be used as time steps in the dataset */
|
|
59
|
-
private readonly instanced?;
|
|
60
|
-
/** dataset's metas for an instanced dataset */
|
|
61
|
-
private readonly metas;
|
|
62
|
-
/** a reference to the wxAPI object */
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
* a reference to the wxAPI object
|
|
22
|
+
* */
|
|
63
23
|
readonly wxAPI: WxAPI;
|
|
64
|
-
/**
|
|
24
|
+
/** @ignore Get dataset's current instance. */
|
|
25
|
+
protected _datasetCurrentInstance: string;
|
|
26
|
+
/** @ignore dataset's meta */
|
|
27
|
+
protected _datasetCurrentMeta: WxDatasetMeta;
|
|
28
|
+
/** @ignore if not empty, returns dataset's instances to be used as time steps in the dataset */
|
|
29
|
+
protected _instanced?: string[];
|
|
30
|
+
/** @ignore dataset's metas for an instanced dataset */
|
|
31
|
+
protected _metas?: Map<string, WxDatasetMeta>;
|
|
32
|
+
/** @internal Do not use this constructor directly, use {@link WxAPI} instead.*/
|
|
65
33
|
constructor({ datasetName, datasetCurrentInstance, instanced, datasetCurrentMeta, metas, wxAPI }: WxDataSetManagerOptions);
|
|
66
|
-
isInstanced(): boolean;
|
|
67
34
|
/**
|
|
68
|
-
*
|
|
69
|
-
* @
|
|
35
|
+
* Create a source layer for the dataset.
|
|
36
|
+
* @param {WxSourceLayerOptions} options - layer options
|
|
37
|
+
* @param {FrameworkOptions} frwOptions - framework options
|
|
38
|
+
* @returns {WxTileSource}
|
|
39
|
+
*/
|
|
40
|
+
createSourceLayer(options: WxSourceLayerOptions, frwOptions: FrameworkOptions): WxTileSource;
|
|
41
|
+
/**
|
|
42
|
+
* Get nearest valid time to the given time.
|
|
43
|
+
* @argument {WxDate} time - time
|
|
70
44
|
* @returns {string} - closest valid time from the dataset's time array
|
|
71
45
|
* */
|
|
72
|
-
|
|
46
|
+
getNearestValidTime(time?: WxDate): string;
|
|
73
47
|
/**
|
|
74
|
-
* Get
|
|
48
|
+
* Get all times from the dataset.
|
|
75
49
|
* @returns {string[]} - copy of dataset's time steps
|
|
76
50
|
* */
|
|
77
|
-
|
|
51
|
+
getAllTimes(): string[];
|
|
78
52
|
/**
|
|
79
|
-
* Get
|
|
53
|
+
* Get all variables from the dataset.
|
|
80
54
|
* @returns {string[]} - all dataset's variables
|
|
81
55
|
* */
|
|
82
|
-
|
|
56
|
+
getAllVariables(): string[];
|
|
83
57
|
/**
|
|
84
|
-
* Get
|
|
58
|
+
* Get the variable's meta from the dataset.
|
|
85
59
|
* @argument {string} variable - variable name
|
|
86
60
|
* @returns {WxVariableMeta | undefined} - dataset variable's meta
|
|
87
61
|
* */
|
|
88
|
-
|
|
62
|
+
getVariableCurrentMeta(variable: string): WxVariableMeta | undefined;
|
|
89
63
|
/**
|
|
90
|
-
*
|
|
64
|
+
* Get the variable meta from the instanced dataset.
|
|
91
65
|
* @argument {string} variable - variable name
|
|
92
66
|
* @argument {string} instance - instance name
|
|
93
67
|
* @returns {WxVariableMeta | undefined} - dataset variable's meta for the given instance
|
|
94
68
|
* */
|
|
95
|
-
getInstanceVariableMeta(variable: string, instance
|
|
69
|
+
getInstanceVariableMeta(variable: string, instance?: string): WxVariableMeta | undefined;
|
|
96
70
|
/**
|
|
97
71
|
* Get dataset's native maximum zoom level.
|
|
98
72
|
* @returns {number} - maximum zoom level of the dataset
|
|
@@ -108,49 +82,52 @@ export declare class WxDataSetManager {
|
|
|
108
82
|
* @param {string} instance
|
|
109
83
|
* @returns {WxDatasetMeta}
|
|
110
84
|
*/
|
|
111
|
-
getInstanceMeta(instance
|
|
85
|
+
getInstanceMeta(instance?: string): WxDatasetMeta;
|
|
112
86
|
/**
|
|
113
87
|
* Createts dataset's current URI ready for fetching tiles.
|
|
114
88
|
* @argument {string} variable - variable of the dataset
|
|
115
|
-
* @argument {
|
|
116
|
-
* @argument {'
|
|
89
|
+
* @argument {string} validTime - time step of the dataset
|
|
90
|
+
* @argument {'webp'} ext - must be WEBP
|
|
117
91
|
* @returns {string} - dataset's current URI ready for fetching tiles
|
|
118
92
|
* */
|
|
119
|
-
createURI(variable: string, validTime: string, ext?: '
|
|
93
|
+
createURI(variable: string, validTime: string, ext?: 'webp'): string;
|
|
120
94
|
/**
|
|
121
95
|
* Check if given variable is available in the dataset.
|
|
122
96
|
* @argument {string} variable - variable name
|
|
123
97
|
* @returns {boolean} - true if variable is available in the dataset
|
|
124
98
|
* */
|
|
125
|
-
|
|
99
|
+
isVariableValid(variable: string): boolean;
|
|
100
|
+
/** @internal Update dataset's meta data. */
|
|
101
|
+
update(): Promise<void>;
|
|
102
|
+
/** @internal Get dataset's current instance. @returns {boolean} - true if dataset is instanced */
|
|
103
|
+
isInstanced(): boolean;
|
|
126
104
|
/**
|
|
105
|
+
* @internal
|
|
127
106
|
* Checks if variable is a vector component.
|
|
128
107
|
* @argument {string} variable - variable name
|
|
129
|
-
* @returns {
|
|
108
|
+
* @returns {WxLayerVarsNames} - [variable] or [variable.eastward, variable.northward]
|
|
130
109
|
* */
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
110
|
+
protected _checkCombineVariableIfVector(variable: string): WxLayerVarsNames;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Class for managing all datasets metadata.
|
|
114
|
+
* @internal
|
|
115
|
+
*/
|
|
116
|
+
export declare class WxAllDatasetsManager {
|
|
117
|
+
protected readonly wxAPI: WxAPI;
|
|
118
|
+
allDatasetsShortMetas: WxAllDatasetsShortMetas;
|
|
119
|
+
ready: Promise<WxAllDatasetsShortMetas>;
|
|
120
|
+
constructor(wxAPI: WxAPI);
|
|
121
|
+
/**
|
|
122
|
+
* Update all datasets metadata
|
|
123
|
+
* @returns a promise that resolves when all datasets are loaded
|
|
136
124
|
*/
|
|
137
|
-
|
|
125
|
+
updateAll(): Promise<WxAllDatasetsShortMetas>;
|
|
138
126
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* @returns {
|
|
142
|
-
*
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
* A part of WxAPI (is not used internally)
|
|
146
|
-
* Get dataset's instance.
|
|
147
|
-
* @returns {Promise<string>} - dataset's instance
|
|
148
|
-
* */
|
|
149
|
-
protected getDatasetInstance(): Promise<string>;
|
|
150
|
-
/**
|
|
151
|
-
* A part of WxAPI (is not used internally)
|
|
152
|
-
* Get dataset's instances.
|
|
153
|
-
* @returns {Promise<string[]>} - dataset's all instances
|
|
154
|
-
* */
|
|
155
|
-
protected getDatasetInstances(): Promise<string[]>;
|
|
127
|
+
* Update one dataset metadata
|
|
128
|
+
* @param {string} datasetName - name of the dataset to update
|
|
129
|
+
* @returns {Promise<WxAllDatasetsShortMetas>} a promise that resolves when the dataset is loaded
|
|
130
|
+
* if the dataset is not found in the list of datasets, it will update all datasets
|
|
131
|
+
*/
|
|
132
|
+
updateOne(datasetName: string): Promise<WxAllDatasetsShortMetas>;
|
|
156
133
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { type WxColorStyleWeak, type XYZ, type WxColorStyleStrict } from '../utils/wxtools';
|
|
2
|
-
import type { WxRequestInit, WxDate,
|
|
2
|
+
import type { WxRequestInit, WxDate, WxLayerVarsNames, WxLngLat, WxTileInfo, WxRasterDataCache, WxLayerOptions } from './wxlayer';
|
|
3
3
|
import { WxLayer } from './wxlayer';
|
|
4
|
-
import type { WxDatasetMeta, WxVariableMeta } from '../wxAPI/
|
|
4
|
+
import type { WxDatasetMeta, WxVariableMeta } from '../wxAPI/WxAPItypes';
|
|
5
5
|
import { FrameworkParentClass, type FrameworkOptions } from '../wxsource/wxsourcetypes';
|
|
6
6
|
import type { WxDataSetManager } from '../wxAPI/WxDataSetManager';
|
|
7
|
+
import { WxRasterData } from './painter';
|
|
7
8
|
/**
|
|
8
9
|
* Mandatory Interface to be implemented by a {@link WxLayerBaseImplementation}
|
|
9
10
|
*/
|
|
10
11
|
export interface WxLayerBaseAPI {
|
|
11
12
|
wxdatasetManager: WxDataSetManager;
|
|
12
13
|
getCurrentVariableMeta(): WxVariableMeta;
|
|
13
|
-
|
|
14
|
+
getVariablesNames(): WxLayerVarsNames;
|
|
14
15
|
clearCache(): void;
|
|
15
16
|
getCurrentStyleObjectCopy(): WxColorStyleStrict;
|
|
16
17
|
getTime(): string;
|
|
@@ -23,6 +24,10 @@ export interface WxLayerBaseAPI {
|
|
|
23
24
|
setStyleByName(wxstyleName: string, reload: boolean): Promise<void>;
|
|
24
25
|
updateCurrentStyleObject(style?: WxColorStyleWeak, reload?: boolean, requestInit?: WxRequestInit): Promise<void>;
|
|
25
26
|
}
|
|
27
|
+
export type ListenerMethod = <T extends keyof WxEventType>(arg?: WxEventType[T]) => void;
|
|
28
|
+
export type WxEventType = {
|
|
29
|
+
changed: any;
|
|
30
|
+
};
|
|
26
31
|
/**
|
|
27
32
|
* Mandatory Interface to be implemented by a {@link WxTileSource} implementation
|
|
28
33
|
* These methods *Requires* framework specific implementation
|
|
@@ -32,6 +37,9 @@ export interface WxLayerAPI extends WxLayerBaseAPI {
|
|
|
32
37
|
_reloadVisible(requestInit?: WxRequestInit): Promise<void>;
|
|
33
38
|
update(): void;
|
|
34
39
|
coveringTiles(): XYZ[];
|
|
40
|
+
on<T extends keyof WxEventType>(type: T, listener: ListenerMethod): void;
|
|
41
|
+
off<T extends keyof WxEventType>(type: T, listener: ListenerMethod): void;
|
|
42
|
+
once<T extends keyof WxEventType>(type: T, listener: ListenerMethod): void;
|
|
35
43
|
}
|
|
36
44
|
/**
|
|
37
45
|
* Implementation of universal methods for the layer (for Mapbox and Leaflet)
|
|
@@ -43,22 +51,22 @@ export declare class WxLayerBaseImplementation extends FrameworkParentClass impl
|
|
|
43
51
|
* @ignore
|
|
44
52
|
* if true, the source is animating
|
|
45
53
|
* */
|
|
46
|
-
protected
|
|
54
|
+
protected _animation: boolean;
|
|
47
55
|
/**
|
|
48
56
|
* @ignore
|
|
49
57
|
* a seed for the animation
|
|
50
58
|
* */
|
|
51
|
-
protected
|
|
59
|
+
protected _animationSeed: number;
|
|
52
60
|
/**
|
|
53
61
|
* @ignore
|
|
54
62
|
* An instance of the layer
|
|
55
63
|
* */
|
|
56
|
-
protected readonly
|
|
64
|
+
protected readonly _layer: WxLayer;
|
|
57
65
|
/**
|
|
58
66
|
* @ignore
|
|
59
67
|
* used to avoid multiple animation requests
|
|
60
68
|
* */
|
|
61
|
-
protected
|
|
69
|
+
protected _redrawRequested?: Promise<void>;
|
|
62
70
|
/**
|
|
63
71
|
* @internal
|
|
64
72
|
* Do not use this constructor directly
|
|
@@ -83,14 +91,14 @@ export declare class WxLayerBaseImplementation extends FrameworkParentClass impl
|
|
|
83
91
|
getMetadata(): WxVariableMeta;
|
|
84
92
|
/**
|
|
85
93
|
* Get current variables (1 or 2) of the source/layer.
|
|
86
|
-
* @returns {
|
|
94
|
+
* @returns {WxLayerVarsNames} variables of the source.
|
|
87
95
|
*/
|
|
88
|
-
|
|
96
|
+
getVariablesNames(): WxLayerVarsNames;
|
|
89
97
|
/**
|
|
90
98
|
* Clears the cache of the source.
|
|
91
99
|
*/
|
|
92
100
|
clearCache(): void;
|
|
93
|
-
getCache():
|
|
101
|
+
getCache(): WxRasterDataCache;
|
|
94
102
|
/**
|
|
95
103
|
* Get a copy of the current style of the source.
|
|
96
104
|
* @returns {WxColorStyleStrict} A copy of the current style of the source.
|
|
@@ -101,7 +109,7 @@ export declare class WxLayerBaseImplementation extends FrameworkParentClass impl
|
|
|
101
109
|
* @returns {string} The current time of the source from array of times.
|
|
102
110
|
*/
|
|
103
111
|
getTime(): string;
|
|
104
|
-
|
|
112
|
+
getAllTimes(): string[];
|
|
105
113
|
/**
|
|
106
114
|
* Set time and render the source. If the time is not available, the closest time will be used.
|
|
107
115
|
* @param {WxDate} time - Time to set.
|
|
@@ -161,4 +169,21 @@ export declare class WxLayerBaseImplementation extends FrameworkParentClass impl
|
|
|
161
169
|
* Force reload and redraw all tiles.
|
|
162
170
|
*/
|
|
163
171
|
protected update(): void;
|
|
172
|
+
/**
|
|
173
|
+
* A boolean flag indicating whether the dataset manager needs to be updated or not.
|
|
174
|
+
*/
|
|
175
|
+
protected _needUpdateDSManager: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* @ignore
|
|
178
|
+
* @internal
|
|
179
|
+
* Helper method that loads a tile with the given coordinates and request options.
|
|
180
|
+
* It returns null during datasetManager update or in case of any other error (e.g. network error, not found, etc.)
|
|
181
|
+
* It tries to update datasetManager if e.reason === 'instance-not-found' and update the layer
|
|
182
|
+
* (MAY BE COPY-PASTED!!!)
|
|
183
|
+
*
|
|
184
|
+
* @param {XYZ} coords - The tile coordinates to be loaded.
|
|
185
|
+
* @param {WxRequestInit} requestInit - The request options.
|
|
186
|
+
* @returns {Promise<WxRasterData | null>} - A promise that resolves with the loaded tile or null.
|
|
187
|
+
*/
|
|
188
|
+
protected _loadTileHelper(coords: XYZ, requestInit?: WxRequestInit): Promise<WxRasterData | null>;
|
|
164
189
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TileType } from '../utils/qtree';
|
|
2
|
-
import { type DataIntegral, type DataIntegrals, type DataPictures,
|
|
2
|
+
import { type DataIntegral, type DataIntegrals, type DataPictures, type XYZ, CachedUriLoaderPromiseFunc } from '../utils/wxtools';
|
|
3
3
|
import { WxRequestInit, WxURIs, type WxLayer } from './wxlayer';
|
|
4
4
|
/** Point on pixel grid */
|
|
5
5
|
export interface SLinePoint {
|
|
@@ -22,9 +22,9 @@ export interface WxData {
|
|
|
22
22
|
*/
|
|
23
23
|
export declare class Loader {
|
|
24
24
|
/** refference to the Layer {@link WxLayer} in which this loader is used */
|
|
25
|
-
protected readonly
|
|
25
|
+
protected readonly _layer: WxLayer;
|
|
26
26
|
/** function to load, decode and cache data from URL */
|
|
27
|
-
protected
|
|
27
|
+
protected _loadDataFunc: CachedUriLoaderPromiseFunc<DataIntegral>;
|
|
28
28
|
/** Do not use constructor directly */
|
|
29
29
|
constructor(layer: WxLayer);
|
|
30
30
|
/**
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { RawCLUT } from '../utils/RawCLUT';
|
|
2
2
|
import type { WxColorStyleStrict, XYZ, DataPictures, WxColorStyleWeak } from '../utils/wxtools';
|
|
3
|
-
import type { WxAllBoundariesMeta, WxVariableMeta } from '../wxAPI/
|
|
3
|
+
import type { WxAllBoundariesMeta, WxVariableMeta } from '../wxAPI/WxAPItypes';
|
|
4
4
|
import type { WxDataSetManager } from '../wxAPI/WxDataSetManager';
|
|
5
5
|
import { Loader } from './loader';
|
|
6
6
|
import { Painter, type WxRasterData } from './painter';
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Type used to set a time step for the layer.
|
|
9
|
+
* Can be
|
|
10
|
+
* 1. a string in the dataset's format,
|
|
11
|
+
* 2. a number of a time step in the dataset's meta data,
|
|
12
|
+
* 3. a number of milliseconds since 1970-01-01T00:00:00Z
|
|
13
|
+
* 4. a Date object.
|
|
14
|
+
* */
|
|
8
15
|
export type WxDate = string | number | Date;
|
|
9
16
|
/** Used to make an abortable call to the layer update */
|
|
10
17
|
export interface WxRequestInit {
|
|
@@ -33,7 +40,7 @@ export interface WxTileInfo {
|
|
|
33
40
|
dataUnits: string;
|
|
34
41
|
}
|
|
35
42
|
/** Array of variable names to be used in {@link WxLayer} */
|
|
36
|
-
export type
|
|
43
|
+
export type WxLayerVarsNames = [string] | [string, string];
|
|
37
44
|
/** @internal Array of URIs to request tiles */
|
|
38
45
|
export type WxURIs = [string] | [string, string];
|
|
39
46
|
/** Lon/Lat coordinates */
|
|
@@ -44,12 +51,19 @@ export interface WxLngLat {
|
|
|
44
51
|
lat: number;
|
|
45
52
|
}
|
|
46
53
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
54
|
+
* @internal
|
|
55
|
+
* Used in {@link WxLayerBaseImplementation} cache of the renderes tiles
|
|
56
|
+
* */
|
|
57
|
+
export declare class WxRasterDataCache extends Map<string, WxRasterData> {
|
|
58
|
+
clear(): void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
* Do not use this type directly, use {@link WxSourceLayerOptions} instead
|
|
49
63
|
* */
|
|
50
64
|
export interface WxLayerOptions {
|
|
51
65
|
/** Variables of the layer */
|
|
52
|
-
variables:
|
|
66
|
+
variables: WxLayerVarsNames;
|
|
53
67
|
/** Dataset Manager */
|
|
54
68
|
wxdatasetManager: WxDataSetManager;
|
|
55
69
|
/** initial time step */
|
|
@@ -59,24 +73,17 @@ export interface WxLayerOptions {
|
|
|
59
73
|
/** initial style, applyed on top of style passed by name {@link wxstyleName} */
|
|
60
74
|
wxstyle?: WxColorStyleWeak;
|
|
61
75
|
}
|
|
62
|
-
/**
|
|
63
|
-
* @internal
|
|
64
|
-
* Used in {@link WxLayerBaseImplementation} cache of tiles
|
|
65
|
-
* */
|
|
66
|
-
export declare class TilesCache extends Map<string, WxRasterData> {
|
|
67
|
-
clear(): void;
|
|
68
|
-
}
|
|
69
76
|
/**
|
|
70
77
|
* @internal
|
|
71
78
|
* Used in {@link WxLayerBaseImplementation} to manipulate the the layer's style, data and time
|
|
72
79
|
* */
|
|
73
80
|
export declare class WxLayer {
|
|
74
81
|
/** @internal Variables to be displayed by the layer */
|
|
75
|
-
readonly variables:
|
|
82
|
+
readonly variables: WxLayerVarsNames;
|
|
76
83
|
/** @internal Data manager created this layer */
|
|
77
84
|
readonly wxdatasetManager: WxDataSetManager;
|
|
78
85
|
/** @internal Current time*/
|
|
79
|
-
protected
|
|
86
|
+
protected _time: string;
|
|
80
87
|
/** @internal Current variable's Meta data of the layer*/
|
|
81
88
|
currentVariableMeta: WxVariableMeta;
|
|
82
89
|
/** @internal current URIs to fetch tiles */
|
|
@@ -85,14 +92,14 @@ export declare class WxLayer {
|
|
|
85
92
|
style: WxColorStyleStrict;
|
|
86
93
|
/** @internal Current "Color lookup table" object */
|
|
87
94
|
CLUT: RawCLUT;
|
|
88
|
-
/** @internal
|
|
89
|
-
|
|
95
|
+
/** @internal cahce: URI->rendered data on canvases */
|
|
96
|
+
tilesRasterCache: WxRasterDataCache;
|
|
90
97
|
/** @internal current coarsing zoom level */
|
|
91
98
|
coarseLevel: number;
|
|
92
99
|
/** @internal Painter object to render tiles */
|
|
93
|
-
readonly
|
|
100
|
+
protected readonly _painter: Painter;
|
|
94
101
|
/** @internal Loader object to load and preprocess tiles */
|
|
95
|
-
protected readonly
|
|
102
|
+
protected readonly _loader: Loader;
|
|
96
103
|
constructor(wxLayerOptions: WxLayerOptions);
|
|
97
104
|
/** Check if the layer is vector and may be animated according to style */
|
|
98
105
|
get nonanimatable(): boolean;
|
|
@@ -130,22 +137,37 @@ export declare class WxLayer {
|
|
|
130
137
|
}): WxTileInfo | undefined;
|
|
131
138
|
/** @internal reassign URIs and a time step with a new given time step */
|
|
132
139
|
setURLsAndTime(time_?: WxDate): void;
|
|
133
|
-
|
|
140
|
+
getPaintedCanvas(data: WxRasterData, animation: boolean, seed: number): HTMLCanvasElement;
|
|
141
|
+
/**
|
|
142
|
+
* @internal
|
|
143
|
+
* load, cache, draw the tile. Abortable
|
|
144
|
+
* */
|
|
134
145
|
loadTile(tile: XYZ, requestInit?: WxRequestInit): Promise<WxRasterData | null>;
|
|
135
|
-
/**
|
|
146
|
+
/**
|
|
147
|
+
* @internal
|
|
148
|
+
* cache given time step for faster access when needed. Resolved when done.
|
|
136
149
|
* @param time_ time step to cache
|
|
137
150
|
* @param requestInit request options
|
|
138
|
-
* @returns {Promise<void>}
|
|
151
|
+
* @returns {Promise<void>}
|
|
152
|
+
* */
|
|
139
153
|
preloadTime(time_: WxDate, tiles: XYZ[], requestInit?: WxRequestInit): Promise<void>;
|
|
140
154
|
/**
|
|
141
|
-
* @
|
|
155
|
+
* @internal
|
|
156
|
+
* Load all tiles, draw it on canvas, save to cache and return. Resolved when done.
|
|
142
157
|
* @param tiles
|
|
143
158
|
* @param requestInit
|
|
144
159
|
* @returns {Promise<viod>} */
|
|
145
160
|
reloadTiles(tiles: XYZ[], requestInit?: WxRequestInit): Promise<void>;
|
|
146
|
-
/**
|
|
147
|
-
|
|
148
|
-
|
|
161
|
+
/**
|
|
162
|
+
* @internal
|
|
163
|
+
* @ignore
|
|
164
|
+
* */
|
|
165
|
+
protected _loadCacheDrawTile(tile: XYZ, tilesRasterCache: WxRasterDataCache, requestInit?: WxRequestInit): Promise<WxRasterData | null>;
|
|
166
|
+
/**
|
|
167
|
+
* @internal
|
|
168
|
+
* @ignore
|
|
169
|
+
* creates/calculates meta data for vector layers
|
|
170
|
+
* */
|
|
149
171
|
protected _getCurrentVariableMeta(): WxVariableMeta;
|
|
150
172
|
/** @ignore x, y - pixel on tile, data - data tile */
|
|
151
173
|
protected _getPixelInfo({ x, y }: {
|